@nebula-spatial/viewer 0.4.6 → 0.5.0

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,14 +1,25 @@
1
- var Ft = Object.defineProperty;
2
- var $t = (s, e, t) => e in s ? Ft(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var u = (s, e, t) => $t(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { Texture as Bt, Vector3 as S, MathUtils as D, MOUSE as z, Object3D as yt, Scene as we, Group as xt, Raycaster as wt, Vector2 as oe, WebGLRenderer as _t, Color as Ut, Euler as jt, OrthographicCamera as De, PerspectiveCamera as Ht, TOUCH as Oe, Vector4 as qt, Plane as Ct, WebGLRenderTarget as Yt, Box3 as N, PMREMGenerator as Xt, EquirectangularReflectionMapping as Wt, Quaternion as Gt, BoxHelper as Kt, Box3Helper as Zt, BoxGeometry as Jt, Mesh as Qt, MeshBasicMaterial as ei, LineSegments as ti, EdgesGeometry as ii, LineBasicMaterial as ri } from "three";
5
- import { RoomEnvironment as si } from "three/addons/environments/RoomEnvironment.js";
6
- import { MapControls as ni } from "three/addons/controls/MapControls.js";
7
- import { OrbitControls as ai } from "three/addons/controls/OrbitControls.js";
8
- import { HDRLoader as oi } from "three/addons/loaders/HDRLoader.js";
9
- import { createCadDocumentSession as li, getCadDocumentRenderResource as di, formatCadInsertId as ze } from "@nebula-spatial/cad-loader";
10
- import { CSS2DObject as ci, CSS2DRenderer as ui } from "three/addons/renderers/CSS2DRenderer.js";
11
- const hi = [
1
+ var Bt = Object.defineProperty;
2
+ var _t = (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) => _t(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Texture as Ut, Vector3 as E, MathUtils as O, MOUSE as N, Object3D as wt, Scene as we, Group as Ct, Raycaster as St, Vector2 as oe, WebGLRenderer as jt, Color as Ht, Euler as qt, OrthographicCamera as De, PerspectiveCamera as Yt, TOUCH as Oe, Vector4 as Xt, Plane as Et, WebGLRenderTarget as Wt, Box3 as V, PMREMGenerator as Gt, EquirectangularReflectionMapping as Kt, Quaternion as Zt, BoxHelper as Jt, Box3Helper as Qt, BoxGeometry as ei, Mesh as ti, MeshBasicMaterial as ii, LineSegments as ri, EdgesGeometry as si, LineBasicMaterial as ni } from "three";
5
+ import { RoomEnvironment as ai } from "three/addons/environments/RoomEnvironment.js";
6
+ import { MapControls as oi } from "three/addons/controls/MapControls.js";
7
+ import { OrbitControls as li } from "three/addons/controls/OrbitControls.js";
8
+ import { HDRLoader as di } from "three/addons/loaders/HDRLoader.js";
9
+ import { createCadDocumentSession as ci, getCadDocumentRenderResource as ui, formatCadInsertId as ze } from "@nebula-spatial/cad-loader";
10
+ import { CSS2DObject as hi, CSS2DRenderer as pi } from "three/addons/renderers/CSS2DRenderer.js";
11
+ const fi = "0.5.0", mi = "@nebula-spatial/viewer", Ne = "__NEBULA_SPATIAL_VIEWER_BANNER_PRINTED__";
12
+ function Ve() {
13
+ const s = `%c ${mi} %c v${fi} `;
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
+ }
16
+ try {
17
+ const s = globalThis;
18
+ s[Ne] || (s[Ne] = !0, Ve());
19
+ } catch {
20
+ Ve();
21
+ }
22
+ const vi = [
12
23
  "alphaMap",
13
24
  "aoMap",
14
25
  "bumpMap",
@@ -37,28 +48,28 @@ const hi = [
37
48
  function de(s, e) {
38
49
  e.has(s) || (e.add(s), s.dispose());
39
50
  }
40
- function pi(s, e, t) {
51
+ function gi(s, e, t) {
41
52
  if (e) {
42
53
  const i = s;
43
- for (const r of hi) {
54
+ for (const r of vi) {
44
55
  const n = i[r];
45
- n instanceof Bt && de(n, t);
56
+ n instanceof Ut && de(n, t);
46
57
  }
47
58
  }
48
59
  de(s, t);
49
60
  }
50
- function Ne(s, e = {}) {
61
+ function Fe(s, e = {}) {
51
62
  const t = e.disposedResources ?? /* @__PURE__ */ new WeakSet(), i = e.disposeTextures !== !1;
52
63
  s.traverse((r) => {
53
64
  const n = r;
54
65
  n.geometry && de(n.geometry, t);
55
66
  const a = Array.isArray(n.material) ? n.material : [n.material];
56
67
  for (const o of a)
57
- o && pi(o, i, t);
68
+ o && gi(o, i, t);
58
69
  n.renderTarget && de(n.renderTarget, t);
59
70
  });
60
71
  }
61
- function fi(s) {
72
+ function bi(s) {
62
73
  const {
63
74
  dxPx: e,
64
75
  dyPx: t,
@@ -72,31 +83,31 @@ function fi(s) {
72
83
  } = s;
73
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)
74
85
  return { x: 0, y: 0, z: 0 };
75
- const c = 2 * n * Math.tan(a * Math.PI / 360), p = c / r, f = c * o / i, m = Math.sin(l), v = Math.cos(l), b = -m, y = v, g = -v, x = -m, w = -e * f * d, k = t * p * d;
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;
76
87
  return {
77
- x: b * w + g * k,
78
- y: y * w + x * k,
88
+ x: m * w + g * C,
89
+ y: b * w + x * C,
79
90
  z: 0
80
91
  };
81
92
  }
82
- function mi(s, e) {
93
+ function yi(s, e) {
83
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 } : {
84
95
  x: s.x - e.x,
85
96
  y: s.y - e.y,
86
97
  z: 0
87
98
  };
88
99
  }
89
- function vi(s, e, t) {
100
+ function xi(s, e, t) {
90
101
  if (!Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.z))
91
102
  return { x: 0, y: 0, z: 0 };
92
- const i = mi(e, t);
103
+ const i = yi(e, t);
93
104
  return {
94
105
  x: s.x + i.x,
95
106
  y: s.y + i.y,
96
107
  z: s.z
97
108
  };
98
109
  }
99
- const gi = 0.35, Y = 1, bi = 1, yi = 170;
110
+ const wi = 0.35, Y = 1, Ci = 1, Si = 170;
100
111
  function Q(s, e, t) {
101
112
  return Math.max(e, Math.min(t, s));
102
113
  }
@@ -104,20 +115,20 @@ function $(s, e, t, i) {
104
115
  const r = Number.isFinite(s) ? s : e;
105
116
  return Q(r, t, i);
106
117
  }
107
- function St(s) {
108
- return Number.isFinite(s) ? Q(s, 0.1, 0.95) : gi;
118
+ function kt(s) {
119
+ return Number.isFinite(s) ? Q(s, 0.1, 0.95) : wi;
109
120
  }
110
- function xi(s, e) {
121
+ function Ei(s, e) {
111
122
  return !Number.isFinite(s) || !Number.isFinite(e) || s <= 0 || e <= 0 ? 1 : s / e;
112
123
  }
113
- function Et(s) {
114
- const e = $(s, 50, bi, yi), t = Math.tan(e * Math.PI / 360);
124
+ function Pt(s) {
125
+ const e = $(s, 50, Ci, Si), t = Math.tan(e * Math.PI / 360);
115
126
  return Math.max(t, 1e-4);
116
127
  }
117
- function wi(s) {
128
+ function ki(s) {
118
129
  return Number.isFinite(s) ? Math.max(0.2, Math.abs(Math.sin(s))) : 0.2;
119
130
  }
120
- function Ci(s) {
131
+ function Pi(s) {
121
132
  return Number.isFinite(s) ? {
122
133
  sinAbs: Math.max(1e-4, Math.abs(Math.sin(s))),
123
134
  cosAbs: Math.abs(Math.cos(s))
@@ -126,15 +137,15 @@ function Ci(s) {
126
137
  cosAbs: Math.sqrt(1 - 0.2 * 0.2)
127
138
  };
128
139
  }
129
- function kt(s, e, t) {
130
- const i = Math.max(1e-4, 2 * s * e / wi(t)), { sinAbs: r, cosAbs: n } = Ci(t), a = s * e, o = r * r - a * a * n * n;
140
+ function At(s, e, t) {
141
+ const i = Math.max(1e-4, 2 * s * e / ki(t)), { sinAbs: r, cosAbs: n } = Pi(t), a = s * e, o = r * r - a * a * n * n;
131
142
  if (!Number.isFinite(o) || o <= 1e-4)
132
143
  return i;
133
144
  const l = 2 * a * r / o;
134
145
  return !Number.isFinite(l) || l <= 1e-4 ? i : l;
135
146
  }
136
- function Si(s) {
137
- const e = St(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 = Et(s.perspectiveFovDeg), a = kt(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 Ai(s) {
148
+ const e = kt(s.ndcBand), t = s.useFixedOrientation ? s.fixedOrbitYaw : s.orbitYaw, i = s.useFixedOrientation ? s.fixedOrbitPitch : s.orbitPitch, r = Math.max($(s.orthoFrustumSize, Y, Y, Number.MAX_VALUE), Y), n = Pt(s.perspectiveFovDeg), a = At(e, n, i), o = $(s.orbitDistanceMin, 500, 1, Number.MAX_VALUE), l = Math.max(o, $(s.orbitDistanceMax, 2e5, o, Number.MAX_VALUE)), d = Q(r / a, o, l);
138
149
  return {
139
150
  orbitTarget: { x: s.orthoCenterX, y: s.orthoCenterY, z: 0 },
140
151
  orbitDistance: d,
@@ -142,25 +153,25 @@ function Si(s) {
142
153
  orbitPitch: i
143
154
  };
144
155
  }
145
- function Ei(s) {
146
- const e = xi(s.viewportWidthPx, s.viewportHeightPx), t = St(s.ndcBand), i = Et(s.perspectiveFovDeg), r = kt(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 Ii(s) {
157
+ const e = Ei(s.viewportWidthPx, s.viewportHeightPx), t = kt(s.ndcBand), i = Pt(s.perspectiveFovDeg), r = At(t, i, s.orbitPitch), n = $(s.orthoFrustumMin, 1e3, Y, Number.MAX_VALUE), a = Math.max(n, $(s.orthoFrustumMax, 1e5, n, Number.MAX_VALUE)), o = Math.max($(s.orbitDistance, n, n, Number.MAX_VALUE), Y), l = o * r, d = Number.isFinite(l) && l >= Y ? l : Q(o / Math.max(0.5, Math.min(2, e)), n, a);
147
158
  return {
148
159
  orthoCenterX: s.orbitTarget.x,
149
160
  orthoCenterY: s.orbitTarget.y,
150
161
  orthoFrustumSize: Q(d, n, a)
151
162
  };
152
163
  }
153
- function ki(s) {
164
+ function Mi(s) {
154
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(
155
166
  1e-4,
156
167
  2 * s.ndcBand * t / Math.max(0.2, i)
157
168
  ), l = Number.isFinite(a) && a > 1e-4 ? Math.max(1e-4, 2 * n * i / a) : o;
158
169
  return e / l;
159
170
  }
160
- function Pi(s, e, t, i = 40) {
171
+ function Ri(s, e, t, i = 40) {
161
172
  return e === 1 ? s * i : e === 2 ? s * t : s;
162
173
  }
163
- function Ai(s) {
174
+ function Li(s) {
164
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;
165
176
  let l = r.type;
166
177
  if (t)
@@ -179,7 +190,7 @@ function Ai(s) {
179
190
  type: l
180
191
  };
181
192
  }
182
- function Ii(s, e, t) {
193
+ function Ti(s, e, t) {
183
194
  if (!Number.isFinite(s) || s === 0) return 1;
184
195
  const i = e === "wheel" ? t.wheelZoomRate : t.trackpadZoomRate;
185
196
  if (e === "wheel") {
@@ -191,19 +202,19 @@ function Ii(s, e, t) {
191
202
  const n = 1 / t.maxScalePerFrame;
192
203
  return Math.max(n, Math.min(t.maxScalePerFrame, r));
193
204
  }
194
- const he = 500, Ve = 2e5, pe = 0.95, Fe = -Math.PI / 2, $e = D.degToRad(55), Mi = 1e3, Ri = 2e6;
205
+ const he = 500, $e = 2e5, pe = 0.95, Be = -Math.PI / 2, _e = O.degToRad(55), Di = 1e3, Oi = 2e6;
195
206
  function B(s, e, t = 1e-4) {
196
207
  return Math.abs(s - e) <= t;
197
208
  }
198
- class Li {
209
+ class zi {
199
210
  constructor() {
200
- u(this, "orbitTarget", new S(0, 0, 0));
211
+ u(this, "orbitTarget", new E(0, 0, 0));
201
212
  u(this, "orbitDistance", 14e3);
202
- u(this, "orbitYaw", Fe);
203
- u(this, "orbitPitch", $e);
213
+ u(this, "orbitYaw", Be);
214
+ u(this, "orbitPitch", _e);
204
215
  u(this, "enabled", !0);
205
216
  u(this, "orbitDistanceMin", he);
206
- u(this, "orbitDistanceMax", Ve);
217
+ u(this, "orbitDistanceMax", $e);
207
218
  u(this, "viewportSnapshotBefore3D", null);
208
219
  u(this, "orbitSnapshotOn3DEntry", null);
209
220
  u(this, "dragMode", null);
@@ -244,9 +255,9 @@ class Li {
244
255
  fit3D(e, t) {
245
256
  const i = this.runtime;
246
257
  if (!i) return;
247
- const r = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), n = e.getSize(new S()), a = e.getCenter(new S());
258
+ const r = Math.max(1, (t == null ? void 0 : t.padding) ?? 1.15), n = e.getSize(new E()), a = e.getCenter(new E());
248
259
  this.orbitTarget.set(a.x, a.y, a.z);
249
- const o = ki({
260
+ const o = Mi({
250
261
  xmin: e.min.x,
251
262
  ymin: e.min.y,
252
263
  xmax: e.max.x,
@@ -255,7 +266,7 @@ class Li {
255
266
  orbitPitchRad: this.orbitPitch,
256
267
  ndcBand: pe
257
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);
258
- this.orbitDistanceMin = h < he ? Math.max(h * 0.02, 1e-6) : he, this.orbitDistanceMax = Math.max(Ve, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
269
+ this.orbitDistanceMin = h < he ? Math.max(h * 0.02, 1e-6) : he, this.orbitDistanceMax = Math.max($e, h * 20), this.orbitDistance = this.clampDistance(h), this.syncPerspectiveCamera();
259
270
  }
260
271
  getVisibleDocumentRect() {
261
272
  const e = this.runtime;
@@ -282,7 +293,7 @@ class Li {
282
293
  };
283
294
  }
284
295
  applyOrbitSnapshot(e) {
285
- this.runtime && (this.orbitTarget.set(e.targetX, e.targetY, e.targetZ), this.orbitDistance = this.clampDistance(e.distance), this.orbitYaw = e.yaw, this.orbitPitch = D.clamp(e.pitch, D.degToRad(5), D.degToRad(85)), this.syncPerspectiveCamera({ sync2D: !1 }));
296
+ this.runtime && (this.orbitTarget.set(e.targetX, e.targetY, e.targetZ), this.orbitDistance = this.clampDistance(e.distance), this.orbitYaw = e.yaw, this.orbitPitch = O.clamp(e.pitch, O.degToRad(5), O.degToRad(85)), this.syncPerspectiveCamera({ sync2D: !1 }));
286
297
  }
287
298
  bindInput(e) {
288
299
  const t = e.renderer.domElement;
@@ -325,7 +336,7 @@ class Li {
325
336
  if (this.dragMode === "pan") {
326
337
  const i = this.screenToGround(e.clientX, e.clientY);
327
338
  if (this.groundPanAnchor && i) {
328
- const r = vi(this.orbitTarget, this.groundPanAnchor, i);
339
+ const r = xi(this.orbitTarget, this.groundPanAnchor, i);
329
340
  this.translateOrbit(r.x - this.orbitTarget.x, r.y - this.orbitTarget.y);
330
341
  } else
331
342
  this.panByScreenDelta(
@@ -345,15 +356,15 @@ class Li {
345
356
  const t = this.runtime;
346
357
  if (!t || t.viewMode !== "3d") return;
347
358
  (d = e.preventDefault) == null || d.call(e);
348
- const i = Math.max(1, t.canvasArea.clientHeight), r = Pi(e.deltaY, e.deltaMode, i);
349
- this.wheelClassifier = Ai({
359
+ const i = Math.max(1, t.canvasArea.clientHeight), r = Ri(e.deltaY, e.deltaMode, i);
360
+ this.wheelClassifier = Li({
350
361
  valuePx: r,
351
362
  ctrlKey: e.ctrlKey,
352
363
  eventTimeMs: typeof performance > "u" ? Date.now() : performance.now(),
353
364
  state: this.wheelClassifier,
354
365
  resetMs: 400
355
366
  });
356
- const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o = Ii(-a, n, {
367
+ const n = this.wheelClassifier.type ?? "trackpad", a = n === "wheel" ? Math.sign(r) * 100 : r, o = Ti(-a, n, {
357
368
  trackpadZoomRate: 1 / 700,
358
369
  wheelZoomRate: 1 / 3200,
359
370
  maxScalePerFrame: 2
@@ -365,7 +376,7 @@ class Li {
365
376
  panByScreenDelta(e, t) {
366
377
  const i = this.runtime;
367
378
  if (!i) return;
368
- const r = fi({
379
+ const r = bi({
369
380
  dxPx: e,
370
381
  dyPx: t,
371
382
  viewportWidthPx: Math.max(1, i.canvasArea.clientWidth),
@@ -379,10 +390,10 @@ class Li {
379
390
  this.translateOrbit(r.x, r.y);
380
391
  }
381
392
  rotateByScreenDelta(e, t) {
382
- const i = this.orbitYaw - e * 5e-3, r = D.clamp(
393
+ const i = this.orbitYaw - e * 5e-3, r = O.clamp(
383
394
  this.orbitPitch + t * 5e-3,
384
- D.degToRad(5),
385
- D.degToRad(85)
395
+ O.degToRad(5),
396
+ O.degToRad(85)
386
397
  );
387
398
  i === this.orbitYaw && r === this.orbitPitch || (this.orbitYaw = i, this.orbitPitch = r, this.syncPerspectiveCamera());
388
399
  }
@@ -397,7 +408,7 @@ class Li {
397
408
  var o, l;
398
409
  const t = this.runtime;
399
410
  if (!t) return;
400
- const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a = Si({
411
+ const i = t.camera2d, r = i.zoom > 0 ? i.zoom : 1, n = Math.max((i.top - i.bottom) / r, 1), a = Ai({
401
412
  orthoCenterX: ((o = t.controls2d.target) == null ? void 0 : o.x) ?? i.position.x,
402
413
  orthoCenterY: ((l = t.controls2d.target) == null ? void 0 : l.y) ?? i.position.y,
403
414
  orthoFrustumSize: n,
@@ -409,8 +420,8 @@ class Li {
409
420
  orbitDistanceMin: this.orbitDistanceMin,
410
421
  orbitDistanceMax: this.orbitDistanceMax,
411
422
  useFixedOrientation: e,
412
- fixedOrbitYaw: Fe,
413
- fixedOrbitPitch: $e,
423
+ fixedOrbitYaw: Be,
424
+ fixedOrbitPitch: _e,
414
425
  ndcBand: pe
415
426
  });
416
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;
@@ -418,7 +429,7 @@ class Li {
418
429
  sync2DFromOrbit() {
419
430
  const e = this.runtime;
420
431
  if (!e) return;
421
- 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 = Ei({
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({
422
433
  orbitTarget: { x: this.orbitTarget.x, y: this.orbitTarget.y, z: this.orbitTarget.z },
423
434
  orbitDistance: this.orbitDistance,
424
435
  orbitYaw: this.orbitYaw,
@@ -429,13 +440,13 @@ class Li {
429
440
  orthoFrustumMin: c,
430
441
  orthoFrustumMax: p,
431
442
  ndcBand: pe
432
- }), f = h.orthoFrustumSize > 0 ? h.orthoFrustumSize : o, m = o / 2;
443
+ }), f = h.orthoFrustumSize > 0 ? h.orthoFrustumSize : o, v = o / 2;
433
444
  e.setOrthographicViewport({
434
- left: -m * n,
435
- right: m * n,
436
- top: m,
437
- bottom: -m,
438
- zoom: D.clamp(o / f, l, d),
445
+ left: -v * n,
446
+ right: v * n,
447
+ top: v,
448
+ bottom: -v,
449
+ zoom: O.clamp(o / f, l, d),
439
450
  positionX: h.orthoCenterX,
440
451
  positionY: h.orthoCenterY,
441
452
  targetX: h.orthoCenterX,
@@ -445,12 +456,12 @@ class Li {
445
456
  syncPerspectiveCamera(e = {}) {
446
457
  const t = this.runtime;
447
458
  if (!t) return;
448
- const i = Math.cos(this.orbitPitch), r = new S(
459
+ const i = Math.cos(this.orbitPitch), r = new E(
449
460
  this.orbitTarget.x + this.orbitDistance * Math.cos(this.orbitYaw) * i,
450
461
  this.orbitTarget.y + this.orbitDistance * Math.sin(this.orbitYaw) * i,
451
462
  this.orbitTarget.z + this.orbitDistance * Math.sin(this.orbitPitch)
452
463
  );
453
- t.camera3d.near = Math.min(Mi, Math.max(this.orbitDistance / 100, 1e-6)), t.camera3d.far = Math.max(Ri, this.orbitDistance * 20), t.setPerspectivePose(r, this.orbitTarget), e.sync2D !== !1 && this.sync2DFromOrbit();
464
+ t.camera3d.near = Math.min(Di, Math.max(this.orbitDistance / 100, 1e-6)), t.camera3d.far = Math.max(Oi, this.orbitDistance * 20), t.setPerspectivePose(r, this.orbitTarget), e.sync2D !== !1 && this.sync2DFromOrbit();
454
465
  }
455
466
  capture2DSnapshot() {
456
467
  const e = this.runtime;
@@ -478,7 +489,7 @@ class Li {
478
489
  const t = [];
479
490
  for (const i of [-1, 1])
480
491
  for (const r of [-1, 1]) {
481
- const n = new S(i, r, -1).unproject(e.camera3d), o = new S(i, r, 1).unproject(e.camera3d).sub(n).normalize();
492
+ const n = new E(i, r, -1).unproject(e.camera3d), o = new E(i, r, 1).unproject(e.camera3d).sub(n).normalize();
482
493
  if (Math.abs(o.z) < 1e-8) continue;
483
494
  const l = (0 - n.z) / o.z;
484
495
  !Number.isFinite(l) || l < 0 || t.push({
@@ -503,7 +514,7 @@ class Li {
503
514
  };
504
515
  }
505
516
  clampDistance(e) {
506
- return D.clamp(
517
+ return O.clamp(
507
518
  Number.isFinite(e) ? e : this.orbitDistanceMin,
508
519
  this.orbitDistanceMin,
509
520
  this.orbitDistanceMax
@@ -521,42 +532,42 @@ class Li {
521
532
  }
522
533
  }
523
534
  }
524
- const Ti = new S(2.4, -2.7, 1.7), Di = new S(0, 0, 0.65), Oi = Math.PI, zi = !0, Ni = new S(1.25, -1.5, 0.85).normalize(), Vi = 1.25, Fi = 0.4, $i = 12, Bi = 1e3, _i = 20, Ui = 0.1, ji = 0.2, Pt = "left-rotate", Hi = {
525
- "left-rotate": { LEFT: z.ROTATE, MIDDLE: z.DOLLY, RIGHT: z.PAN },
526
- "left-pan": { LEFT: z.PAN, MIDDLE: z.DOLLY, RIGHT: z.ROTATE }
535
+ const Ni = new E(2.4, -2.7, 1.7), Vi = new E(0, 0, 0.65), Fi = Math.PI, $i = !0, Bi = new E(1.25, -1.5, 0.85).normalize(), _i = 1.25, Ui = 0.4, ji = 12, Hi = 1e3, qi = 20, Yi = 0.1, Xi = 0.2, It = "left-rotate", Wi = {
536
+ "left-rotate": { LEFT: N.ROTATE, MIDDLE: N.DOLLY, RIGHT: N.PAN },
537
+ "left-pan": { LEFT: N.PAN, MIDDLE: N.DOLLY, RIGHT: N.ROTATE }
527
538
  };
528
- function qi({ radius: s, fovDeg: e }) {
529
- const t = Math.max(s, 0.02), i = D.degToRad(e), r = t / Math.sin(i * 0.5) * Vi;
539
+ function Gi({ radius: s, fovDeg: e }) {
540
+ const t = Math.max(s, 0.02), i = O.degToRad(e), r = t / Math.sin(i * 0.5) * _i;
530
541
  return {
531
542
  distance: r,
532
- minDistance: Math.max(t * Fi, 0.01),
533
- maxDistance: Math.max(t * $i, 1),
543
+ minDistance: Math.max(t * Ui, 0.01),
544
+ maxDistance: Math.max(t * ji, 1),
534
545
  near: Math.max(
535
- r / Bi,
536
- Math.min(Ui, t * ji),
546
+ r / Hi,
547
+ Math.min(Yi, t * Xi),
537
548
  1e-4
538
549
  ),
539
- far: Math.max(r * _i, 10)
550
+ far: Math.max(r * qi, 10)
540
551
  };
541
552
  }
542
- function Yi(s, e, t) {
553
+ function Ki(s, e, t) {
543
554
  e.minDistance = t.minDistance, e.maxDistance = t.maxDistance, s.near = t.near, s.far = t.far, s.updateProjectionMatrix();
544
555
  }
545
- function Be(s, e, t = Pt) {
546
- s.enableDamping = zi, s.maxPolarAngle = Oi, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = { ...Hi[t] }, yt.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
556
+ function Ue(s, e, t = It) {
557
+ s.enableDamping = $i, s.maxPolarAngle = Fi, s.dampingFactor = 0.1, s.enablePan = !0, s.screenSpacePanning = !0, s.mouseButtons = { ...Wi[t] }, wt.DEFAULT_UP.set(0, 0, 1), e.up.set(0, 0, 1);
547
558
  }
548
- function Xi(s, e, t, i) {
559
+ function Zi(s, e, t, i) {
549
560
  if (t.isEmpty()) return null;
550
- 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 });
551
- return e.target.copy(n), s.position.copy(n).addScaledVector(Ni, o.distance), Yi(s, e, o), s.updateMatrixWorld(), e.update(), o;
561
+ const r = t.getSize(new E()), n = t.getCenter(new E()), a = Math.max(r.length() * 0.5, 0.02), o = Gi({ radius: a, fovDeg: i });
562
+ return e.target.copy(n), s.position.copy(n).addScaledVector(Bi, o.distance), Ki(s, e, o), s.updateMatrixWorld(), e.update(), o;
552
563
  }
553
- const Wi = 1e3, Gi = 2, Ki = -1e4, Zi = 1e4, _e = 1e3, Ji = 2e6, Qi = 1.15, er = 1, Ue = new jt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
554
- class tr {
564
+ const Ji = 1e3, Qi = 2, er = -1e4, tr = 1e4, je = 1e3, ir = 2e6, rr = 1.15, sr = 1, He = new qt(Math.PI / 2, 0, Math.PI * 0.98 * 0.8);
565
+ class nr {
555
566
  constructor(e) {
556
567
  u(this, "canvasArea");
557
568
  u(this, "canvas");
558
569
  u(this, "scene", new we());
559
- u(this, "overlayRoot", new xt());
570
+ u(this, "overlayRoot", new Ct());
560
571
  u(this, "renderer");
561
572
  u(this, "camera2d");
562
573
  u(this, "camera3d");
@@ -568,10 +579,10 @@ class tr {
568
579
  u(this, "ownedObjects", /* @__PURE__ */ new Set());
569
580
  u(this, "overlays", /* @__PURE__ */ new Map());
570
581
  u(this, "eventCleanups", []);
571
- u(this, "raycaster", new wt());
582
+ u(this, "raycaster", new St());
572
583
  u(this, "pointerNdc", new oe());
573
- u(this, "reuseVector", new S());
574
- u(this, "reuseVector2", new S());
584
+ u(this, "reuseVector", new E());
585
+ u(this, "reuseVector2", new E());
575
586
  u(this, "viewModeValue");
576
587
  u(this, "initialized", !1);
577
588
  u(this, "disposed", !1);
@@ -593,34 +604,34 @@ class tr {
593
604
  u(this, "previewImageDataBuffer", null);
594
605
  u(this, "environmentResource", null);
595
606
  u(this, "environmentLoadGeneration", 0);
596
- 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 ?? Pt, 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 ?? It, this.overlayRoot.name = "scene-runtime:overlays", this.scene.add(this.overlayRoot);
597
608
  }
598
609
  initialize() {
599
610
  if (this.disposed) throw new Error("SceneRuntime has been disposed.");
600
611
  if (this.initialized) return;
601
- const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new _t(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, d) => new ni(l, d)), r = (e == null ? void 0 : e.createOrbitControls) ?? ((l, d) => new ai(l, d));
612
+ const e = this.options.factories, t = (e == null ? void 0 : e.createRenderer) ?? ((l) => new jt(l)), i = (e == null ? void 0 : e.createMapControls) ?? ((l, d) => new oi(l, d)), r = (e == null ? void 0 : e.createOrbitControls) ?? ((l, d) => new li(l, d));
602
613
  this.renderer = t({
603
614
  canvas: this.canvas,
604
615
  antialias: this.options.antialias ?? !0,
605
616
  alpha: this.options.alpha ?? !1,
606
617
  powerPreference: this.options.powerPreference ?? "high-performance"
607
- }), this.options.clearColor !== void 0 && this.renderer.setClearColor(new Ut(this.options.clearColor));
618
+ }), this.options.clearColor !== void 0 && this.renderer.setClearColor(new Ht(this.options.clearColor));
608
619
  const n = Math.max(1, this.canvasArea.clientWidth || 1), a = Math.max(1, this.canvasArea.clientHeight || 1), o = n / a;
609
620
  if (this.renderer.setPixelRatio(this.readDevicePixelRatio()), this.renderer.setSize(n, a, !1), this.options.environment) {
610
- const l = (e == null ? void 0 : e.createEnvironment) ?? ir;
611
- this.scene.environmentIntensity = er, this.scene.environmentRotation.copy(Ue), this.scene.backgroundRotation.copy(Ue);
621
+ const l = (e == null ? void 0 : e.createEnvironment) ?? ar;
622
+ this.scene.environmentIntensity = sr, this.scene.environmentRotation.copy(He), this.scene.backgroundRotation.copy(He);
612
623
  const d = ++this.environmentLoadGeneration, c = l(this.renderer, this.options.environment);
613
- rr(c) ? c.then(
624
+ or(c) ? c.then(
614
625
  (p) => this.applyEnvironmentResource(p, d),
615
626
  (p) => {
616
627
  !this.disposed && d === this.environmentLoadGeneration && console.warn("Failed to load scene environment HDR.", p);
617
628
  }
618
629
  ) : this.applyEnvironmentResource(c, d);
619
630
  }
620
- this.camera2d = new De(-o, o, 1, -1, Ki, Zi), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new Ht(40, o, _e, Ji), 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 = {
621
- LEFT: z.PAN,
622
- MIDDLE: z.DOLLY,
623
- RIGHT: z.PAN
631
+ this.camera2d = new De(-o, o, 1, -1, er, tr), this.camera2d.position.set(0, 0, 1), this.camera2d.lookAt(0, 0, 0), this.camera3d = new Yt(40, o, je, ir), this.camera3d.up.set(0, 0, 1), this.camera3d.position.set(1e4, 0, 1e4), this.camera3d.lookAt(0, 0, 0), this.controls2d = i(this.camera2d, this.renderer.domElement), this.controls2d.enableRotate = !1, this.controls2d.screenSpacePanning = !0, this.controls2d.zoomToCursor = !0, this.controls2d.minZoom = 2e-3, this.controls2d.maxZoom = 5e4, this.controls2d.mouseButtons = {
632
+ LEFT: N.PAN,
633
+ MIDDLE: N.DOLLY,
634
+ RIGHT: N.PAN
624
635
  }, this.controls2d.touches = {
625
636
  ONE: Oe.PAN,
626
637
  TWO: Oe.DOLLY_PAN
@@ -664,10 +675,10 @@ class tr {
664
675
  var t, i;
665
676
  if (this.controls3d) {
666
677
  if (e === "viewer") {
667
- this.viewerOrbit ?? (this.viewerOrbit = new Li()), this.viewerOrbit.attach(this);
678
+ this.viewerOrbit ?? (this.viewerOrbit = new zi()), this.viewerOrbit.attach(this);
668
679
  return;
669
680
  }
670
- (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" && (Be(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Ti), this.controls3d.target.copy(Di), 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" && (Ue(this.controls3d, this.camera3d, this.previewDragPreset), this.camera3d.position.copy(Ni), this.controls3d.target.copy(Vi), this.controls3d.update());
671
682
  }
672
683
  }
673
684
  /**
@@ -676,7 +687,7 @@ class tr {
676
687
  * handed to OrbitControls.
677
688
  */
678
689
  setPreviewDragPreset(e) {
679
- this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (Be(this.controls3d, this.camera3d, e), this.requestRender()));
690
+ this.previewDragPreset !== e && (this.previewDragPreset = e, !(!this.initialized || this.navigationPolicyValue !== "preview") && (Ue(this.controls3d, this.camera3d, e), this.requestRender()));
680
691
  }
681
692
  /**
682
693
  * Drives OrbitControls once per frame. Damping mutates the camera inside
@@ -728,7 +739,7 @@ class tr {
728
739
  if (!this.mountedObjects.has(e) && e.parent !== this.scene) return !1;
729
740
  e.removeFromParent(), this.mountedObjects.delete(e);
730
741
  const i = this.ownedObjects.delete(e);
731
- return (t.dispose === !0 || t.dispose === void 0 && i) && Ne(e), this.requestRender(), !0;
742
+ return (t.dispose === !0 || t.dispose === void 0 && i) && Fe(e), this.requestRender(), !0;
732
743
  }
733
744
  setObjectVisible(e, t) {
734
745
  e.visible !== t && (e.visible = t, this.requestRender());
@@ -738,7 +749,7 @@ class tr {
738
749
  }
739
750
  removeOverlay(e, t = {}) {
740
751
  const i = this.overlays.get(e);
741
- return i ? (this.overlays.delete(e), i.object.removeFromParent(), (t.dispose === !0 || t.dispose === void 0 && i.owned) && Ne(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) && Fe(i.object), this.requestRender(), i.object) : null;
742
753
  }
743
754
  setHighlight(e, t = {}) {
744
755
  if (!e) {
@@ -761,21 +772,21 @@ class tr {
761
772
  if (!this.camera2d || !this.camera3d) return !1;
762
773
  const i = this.resolveBox3(e);
763
774
  if (!i || i.isEmpty()) return !1;
764
- const r = i.getSize(new S()), n = i.getCenter(new S());
775
+ const r = i.getSize(new E()), n = i.getCenter(new E());
765
776
  if (![r.x, r.y, r.z, n.x, n.y, n.z].every(Number.isFinite)) return !1;
766
777
  const a = Math.max(1, t.padding ?? 1.05);
767
778
  if ((t.viewMode ?? this.viewModeValue) === "2d") {
768
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;
769
- let f = l / 2, m = d / 2;
770
- f / m < h ? f = m * h : m = f / h, this.camera2d.left = -f, this.camera2d.right = f, this.camera2d.top = m, this.camera2d.bottom = -m, 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 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();
771
782
  } else if (this.navigationPolicyValue === "preview")
772
- Xi(this.camera3d, this.controls3d, i, this.camera3d.fov);
783
+ Zi(this.camera3d, this.controls3d, i, this.camera3d.fov);
773
784
  else if (this.viewerOrbit)
774
785
  this.viewerOrbit.fit3D(i, { padding: a });
775
786
  else {
776
- 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, m = this.camera3d.position.clone().sub(this.controls3d.target);
777
- m.lengthSq() <= 1e-12 && m.set(1, -1, 1), m.normalize(), this.controls3d.target.copy(l), this.camera3d.position.copy(l).addScaledVector(m, f), this.camera3d.lookAt(l), this.camera3d.near = Math.min(
778
- _e,
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
+ je,
779
790
  Math.max(f * 0.01, 1e-6)
780
791
  ), this.camera3d.updateProjectionMatrix(), this.controls3d.update();
781
792
  }
@@ -835,16 +846,16 @@ class tr {
835
846
  distance: i,
836
847
  // Match ViewOrbitNavigation's convention: yaw around +Z, pitch off the XY plane.
837
848
  yaw: Math.atan2(t.y, t.x),
838
- pitch: Math.asin(D.clamp(t.z / i, -1, 1))
849
+ pitch: Math.asin(O.clamp(t.z / i, -1, 1))
839
850
  };
840
851
  }
841
852
  applyPreviewOrbitSnapshot(e) {
842
853
  if (!this.camera3d || !this.controls3d) return !1;
843
- const t = Math.cos(e.pitch), i = new S(e.targetX, e.targetY, e.targetZ), r = D.clamp(
854
+ const t = Math.cos(e.pitch), i = new E(e.targetX, e.targetY, e.targetZ), r = O.clamp(
844
855
  e.distance,
845
856
  this.controls3d.minDistance,
846
857
  this.controls3d.maxDistance
847
- ), n = new S(
858
+ ), n = new E(
848
859
  i.x + r * Math.cos(e.yaw) * t,
849
860
  i.y + r * Math.sin(e.yaw) * t,
850
861
  i.z + r * Math.sin(e.pitch)
@@ -878,24 +889,24 @@ class tr {
878
889
  }
879
890
  renderOrthographicPreview(e, t, i) {
880
891
  var G;
881
- if (!this.renderer || this.disposed || t.parent || !sr(i)) return !1;
882
- 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, m = (i.minY + i.maxY) / 2, b = Math.max(i.maxX - i.minX, i.maxY - i.minY, 1) * Qi / 2, y = this.getOrCreatePreviewRenderTarget(l, d), g = this.getOrCreatePreviewCamera();
883
- g.left = -b, g.right = b, g.top = b, g.bottom = -b, g.position.set(f, m, 1), g.up.copy(((G = this.camera2d) == null ? void 0 : G.up) ?? new S(0, 1, 0)), g.lookAt(f, m, 0), g.updateProjectionMatrix(), g.updateMatrixWorld(!0);
884
- const x = this.getOrCreatePreviewScene(), w = this.renderer, k = w.getRenderTarget(), F = w.getClearAlpha(), C = w.autoClear, A = new qt();
892
+ if (!this.renderer || this.disposed || t.parent || !lr(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) * rr / 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 E(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(), S = w.autoClear, A = new Xt();
885
896
  w.getViewport(A);
886
897
  const L = w.getScissorTest();
887
898
  x.add(t);
888
899
  try {
889
- w.setRenderTarget(y), w.setViewport(0, 0, c, p), w.setScissorTest(!1), w.setClearAlpha(0), w.autoClear = !1, w.clear(), w.setViewport(
900
+ w.setRenderTarget(b), w.setViewport(0, 0, c, p), w.setScissorTest(!1), w.setClearAlpha(0), w.autoClear = !1, w.clear(), w.setViewport(
890
901
  Math.floor((c - h) / 2),
891
902
  Math.floor((p - h) / 2),
892
903
  h,
893
904
  h
894
905
  ), w.render(x, g);
895
906
  const K = this.getOrCreatePreviewPixelBuffer(l, d);
896
- return w.readRenderTargetPixels(y, 0, 0, l, d, K), this.blitPreviewPixelsToCanvas(e, K, l, d);
907
+ return w.readRenderTargetPixels(b, 0, 0, l, d, K), this.blitPreviewPixelsToCanvas(e, K, l, d);
897
908
  } finally {
898
- t.removeFromParent(), w.setRenderTarget(k), w.setClearAlpha(F), w.autoClear = C, w.setViewport(
909
+ t.removeFromParent(), w.setRenderTarget(C), w.setClearAlpha(D), w.autoClear = S, w.setViewport(
899
910
  A.x,
900
911
  A.y,
901
912
  A.z,
@@ -918,7 +929,7 @@ class tr {
918
929
  }
919
930
  screenToWorldOnPlane(e, t, i = 0) {
920
931
  const r = this.clientToNdc(e, t, this.pointerNdc);
921
- return !r || !this.activeCamera ? null : (this.raycaster.setFromCamera(r, this.activeCamera), this.raycaster.ray.intersectPlane(new Ct(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 Et(new E(0, 0, 1), -i), new E()));
922
933
  }
923
934
  worldToClient(e, t = new oe()) {
924
935
  var a;
@@ -960,8 +971,8 @@ class tr {
960
971
  startAnimation(e = {}) {
961
972
  if (this.disposed || this.animationLoopActive) return;
962
973
  this.animationLoopActive = !0, this.infoFrames = 0, this.infoLastTime = performance.now();
963
- const t = e.infoUpdateIntervalMs ?? Wi, i = (r = performance.now()) => {
964
- var o, l, d, c, p, h, f, m, v;
974
+ const t = e.infoUpdateIntervalMs ?? Ji, i = (r = performance.now()) => {
975
+ var o, l, d, c, p, h, f, v, y;
965
976
  if (!this.animationLoopActive || this.disposed) {
966
977
  this.animationFrameId = null;
967
978
  return;
@@ -972,18 +983,18 @@ class tr {
972
983
  let a = !1;
973
984
  if (this.renderRequested && (((c = e.shouldRender) == null ? void 0 : c.call(e, r)) ?? !0)) {
974
985
  (p = e.beforeRender) == null || p.call(e, r);
975
- const b = (h = e.renderExtension) == null ? void 0 : h.beforeRender(this.renderer, this.scene, this.activeCamera, r);
986
+ const m = (h = e.renderExtension) == null ? void 0 : h.beforeRender(this.renderer, this.scene, this.activeCamera, r);
976
987
  try {
977
988
  this.renderer.render(this.scene, this.activeCamera);
978
989
  } finally {
979
- b == null || b();
990
+ m == null || m();
980
991
  }
981
992
  this.renderRequested = !1, a = !0, (f = e.afterRender) == null || f.call(e, r);
982
993
  }
983
994
  if (this.infoFrames += 1, r - this.infoLastTime >= t) {
984
- const b = Math.max(1, r - this.infoLastTime);
985
- this.fpsCurrent = this.infoFrames * 1e3 / b, this.infoFrames = 0, this.infoLastTime = r, (m = e.onInfoUpdate) == null || m.call(e);
986
- } else a && ((v = e.onInfoUpdate) == null || v.call(e));
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);
997
+ } else a && ((y = e.onInfoUpdate) == null || y.call(e));
987
998
  };
988
999
  i();
989
1000
  }
@@ -1015,7 +1026,7 @@ class tr {
1015
1026
  }
1016
1027
  getOrCreatePreviewRenderTarget(e, t) {
1017
1028
  var i;
1018
- return this.previewRenderTarget && this.previewRenderTargetSize.width === e && this.previewRenderTargetSize.height === t ? this.previewRenderTarget : ((i = this.previewRenderTarget) == null || i.dispose(), this.previewRenderTarget = new Yt(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 Wt(e, t), this.previewRenderTargetSize = { width: e, height: t }, this.previewRenderTarget);
1019
1030
  }
1020
1031
  getOrCreatePreviewPixelBuffer(e, t) {
1021
1032
  const i = e * t * 4;
@@ -1045,13 +1056,13 @@ class tr {
1045
1056
  }
1046
1057
  readDevicePixelRatio() {
1047
1058
  const e = globalThis.devicePixelRatio;
1048
- return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, Gi);
1059
+ return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? 1 : Math.min(e, Qi);
1049
1060
  }
1050
1061
  resolveBox3(e) {
1051
- if (e instanceof N) return e.clone();
1052
- if (e instanceof yt) return new N().setFromObject(e);
1062
+ if (e instanceof V) return e.clone();
1063
+ if (e instanceof wt) return new V().setFromObject(e);
1053
1064
  const { minX: t, minY: i, maxX: r, maxY: n } = e;
1054
- return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new N(new S(t, i, 0), new S(r, n, 0));
1065
+ return ![t, i, r, n].every(Number.isFinite) || r < t || n < i ? null : new V(new E(t, i, 0), new E(r, n, 0));
1055
1066
  }
1056
1067
  isDescendantOf(e, t) {
1057
1068
  let i = e.parent;
@@ -1068,9 +1079,9 @@ class tr {
1068
1079
  });
1069
1080
  }
1070
1081
  }
1071
- function ir(s, e) {
1082
+ function ar(s, e) {
1072
1083
  if (e === "room") {
1073
- const t = new Xt(s), i = new si(), r = t.fromScene(i);
1084
+ const t = new Gt(s), i = new ai(), r = t.fromScene(i);
1074
1085
  return i.dispose(), t.dispose(), {
1075
1086
  texture: r.texture,
1076
1087
  dispose: () => r.dispose()
@@ -1078,23 +1089,23 @@ function ir(s, e) {
1078
1089
  }
1079
1090
  if (e.type !== "hdr" || e.url.trim().length === 0)
1080
1091
  throw new Error("HDR scene environment requires a non-empty URL.");
1081
- return new oi().loadAsync(e.url).then((t) => (t.mapping = Wt, {
1092
+ return new di().loadAsync(e.url).then((t) => (t.mapping = Kt, {
1082
1093
  texture: t,
1083
1094
  dispose: () => t.dispose()
1084
1095
  }));
1085
1096
  }
1086
- function rr(s) {
1097
+ function or(s) {
1087
1098
  return typeof (s == null ? void 0 : s.then) == "function";
1088
1099
  }
1089
- function sr(s) {
1100
+ function lr(s) {
1090
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;
1091
1102
  }
1092
1103
  const Ie = 1;
1093
- function nr() {
1094
- return typeof globalThis.localStorage > "u" ? ar() : {
1104
+ function dr() {
1105
+ return typeof globalThis.localStorage > "u" ? cr() : {
1095
1106
  read(s) {
1096
1107
  try {
1097
- const e = globalThis.localStorage.getItem(je(s));
1108
+ const e = globalThis.localStorage.getItem(qe(s));
1098
1109
  return e ? JSON.parse(e) : null;
1099
1110
  } catch {
1100
1111
  return null;
@@ -1102,13 +1113,13 @@ function nr() {
1102
1113
  },
1103
1114
  write(s, e) {
1104
1115
  try {
1105
- globalThis.localStorage.setItem(je(s), JSON.stringify(e));
1116
+ globalThis.localStorage.setItem(qe(s), JSON.stringify(e));
1106
1117
  } catch {
1107
1118
  }
1108
1119
  }
1109
1120
  };
1110
1121
  }
1111
- function ar() {
1122
+ function cr() {
1112
1123
  const s = /* @__PURE__ */ new Map();
1113
1124
  return {
1114
1125
  read(e) {
@@ -1119,12 +1130,12 @@ function ar() {
1119
1130
  }
1120
1131
  };
1121
1132
  }
1122
- function or(s, e) {
1133
+ function ur(s, e) {
1123
1134
  if (!s || !e) return null;
1124
1135
  const t = s.read(e);
1125
- return At(t) ? t : null;
1136
+ return Mt(t) ? t : null;
1126
1137
  }
1127
- function At(s) {
1138
+ function Mt(s) {
1128
1139
  if (!s || typeof s != "object") return !1;
1129
1140
  const e = s;
1130
1141
  if (e.schemaVersion !== Ie) return !1;
@@ -1155,10 +1166,10 @@ function At(s) {
1155
1166
  }
1156
1167
  return !1;
1157
1168
  }
1158
- function lr(s, e, t) {
1169
+ function hr(s, e, t) {
1159
1170
  !s || !e || s.write(e, t);
1160
1171
  }
1161
- function dr(s) {
1172
+ function pr(s) {
1162
1173
  return {
1163
1174
  schemaVersion: Ie,
1164
1175
  viewMode: s.viewMode,
@@ -1166,20 +1177,20 @@ function dr(s) {
1166
1177
  ...s.orbit ? { orbit: s.orbit } : {}
1167
1178
  };
1168
1179
  }
1169
- function je(s) {
1180
+ function qe(s) {
1170
1181
  return `nebula-viewer:camera:v${Ie}:${s}`;
1171
1182
  }
1172
1183
  function Z(s) {
1173
- return new N(
1174
- new S(s.minX, s.minY, s.minZ),
1175
- new S(s.maxX, s.maxY, s.maxZ)
1184
+ return new V(
1185
+ new E(s.minX, s.minY, s.minZ),
1186
+ new E(s.maxX, s.maxY, s.maxZ)
1176
1187
  );
1177
1188
  }
1178
- function It(s) {
1189
+ function Rt(s) {
1179
1190
  const [e, t, i] = s;
1180
1191
  return (e & 255) << 16 | (t & 255) << 8 | i & 255;
1181
1192
  }
1182
- class cr {
1193
+ class fr {
1183
1194
  constructor() {
1184
1195
  u(this, "rows", []);
1185
1196
  u(this, "allColor", null);
@@ -1202,7 +1213,7 @@ class cr {
1202
1213
  color: i.has(n.index) ? i.get(n.index) : this.allColor,
1203
1214
  sourceColor: n.color
1204
1215
  }));
1205
- fr(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1216
+ br(this.rows, r) || (this.rows = r, this.revision += 1, t && this.onChange());
1206
1217
  }
1207
1218
  clear(e = !0) {
1208
1219
  const t = this.rows.length > 0 || this.allColor !== null;
@@ -1259,7 +1270,7 @@ class cr {
1259
1270
  t && (this.allColor = e, this.revision += 1, this.onChange());
1260
1271
  }
1261
1272
  }
1262
- class ur {
1273
+ class mr {
1263
1274
  constructor() {
1264
1275
  u(this, "usages", []);
1265
1276
  u(this, "revision", 0);
@@ -1285,7 +1296,7 @@ class ur {
1285
1296
  canHighlight: r.canHighlight,
1286
1297
  visible: r.visible
1287
1298
  }));
1288
- mr(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1299
+ yr(this.usages, i) || (this.usages = i, this.revision += 1, t && this.onChange());
1289
1300
  }
1290
1301
  clear(e = !0) {
1291
1302
  const t = this.usages.length > 0;
@@ -1312,7 +1323,7 @@ class ur {
1312
1323
  t.length !== 0 && (this.renderNode.setInsertVisibleBatch(t), i && (this.visibilityRevision += 1, this.revision += 1, this.onChange()));
1313
1324
  }
1314
1325
  }
1315
- class hr {
1326
+ class vr {
1316
1327
  constructor() {
1317
1328
  u(this, "selection", null);
1318
1329
  u(this, "details", null);
@@ -1330,7 +1341,7 @@ class hr {
1330
1341
  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);
1331
1342
  }
1332
1343
  }
1333
- class pr {
1344
+ class gr {
1334
1345
  constructor() {
1335
1346
  u(this, "revision", 0);
1336
1347
  u(this, "filename", null);
@@ -1372,7 +1383,7 @@ class pr {
1372
1383
  this.zoomLabel = Number.isFinite(p) && (p ?? 0) > 0 ? `${Math.round(p * 100)}%` : "", this.scaleRuler = {
1373
1384
  visible: !0,
1374
1385
  worldLength: c,
1375
- lengthLabel: vr(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1386
+ lengthLabel: xr(c, ((l = e.units) == null ? void 0 : l.source) ?? "mm")
1376
1387
  }, this.orbitDistanceLabel = "";
1377
1388
  } else {
1378
1389
  const c = (d = e.host.runtime.captureCameraSnapshot()) == null ? void 0 : d.orbit;
@@ -1383,26 +1394,26 @@ class pr {
1383
1394
  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;
1384
1395
  }
1385
1396
  }
1386
- function fr(s, e) {
1397
+ function br(s, e) {
1387
1398
  return s.length === e.length && s.every((t, i) => {
1388
1399
  const r = e[i];
1389
1400
  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];
1390
1401
  });
1391
1402
  }
1392
- function mr(s, e) {
1403
+ function yr(s, e) {
1393
1404
  return s.length === e.length && s.every((t, i) => {
1394
1405
  const r = e[i];
1395
1406
  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;
1396
1407
  });
1397
1408
  }
1398
- function vr(s, e) {
1409
+ function xr(s, e) {
1399
1410
  if (e === "mm") {
1400
1411
  if (s >= 1e6) return `${(s / 1e6).toFixed(2)} km`;
1401
1412
  if (s >= 1e3) return `${(s / 1e3).toFixed(2)} m`;
1402
1413
  }
1403
1414
  return `${s.toFixed(2)}${e ? ` ${e}` : ""}`;
1404
1415
  }
1405
- function He(s) {
1416
+ function Ye(s) {
1406
1417
  return {
1407
1418
  documentKey: s.documentKey,
1408
1419
  filename: s.filename,
@@ -1414,13 +1425,13 @@ function He(s) {
1414
1425
  units: s.units ?? { source: "mm" }
1415
1426
  };
1416
1427
  }
1417
- const gr = 160, qe = 5e3;
1418
- class br {
1428
+ const wr = 160, Xe = 5e3;
1429
+ class Cr {
1419
1430
  constructor(e) {
1420
- u(this, "layers", new cr());
1421
- u(this, "blocks", new ur());
1422
- u(this, "inspector", new hr());
1423
- u(this, "hud", new pr());
1431
+ u(this, "layers", new fr());
1432
+ u(this, "blocks", new mr());
1433
+ u(this, "inspector", new vr());
1434
+ u(this, "hud", new gr());
1424
1435
  u(this, "document", null);
1425
1436
  u(this, "loadTiming", null);
1426
1437
  u(this, "capabilities", {
@@ -1454,10 +1465,10 @@ class br {
1454
1465
  this.assertActive(), this.closeInternal();
1455
1466
  const i = ++this.openEpoch;
1456
1467
  this.cameraSettled = !1, this.initialDemandSettled = !1, this.initialCameraRestored = !1, this.cameraChangedDuringInitialLoad = !1, this.loadTiming = null;
1457
- const r = t.documentKey ?? Sr(e);
1468
+ const r = t.documentKey ?? Ar(e);
1458
1469
  let n;
1459
1470
  try {
1460
- n = li(e, {
1471
+ n = ci(e, {
1461
1472
  documentKey: r ?? void 0,
1462
1473
  filename: t.filename,
1463
1474
  loadAnnotations: t.loadAnnotations,
@@ -1477,7 +1488,7 @@ class br {
1477
1488
  throw this.emit("error", { ...J(p, !0, e), error: p }), p;
1478
1489
  }
1479
1490
  this.session = n, this.loadTiming = n.loadTiming, this.statusMessage = "加载中…";
1480
- const a = di(n);
1491
+ const a = ui(n);
1481
1492
  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(
1482
1493
  a.onChange(() => {
1483
1494
  this.host.requestRender(), this.host.emitContentChange();
@@ -1546,7 +1557,7 @@ class br {
1546
1557
  name: "AbortError",
1547
1558
  code: "E_SUPERSEDED"
1548
1559
  });
1549
- return this.layers.sync(n, !1), this.blocks.sync(n, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(r), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Z(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = He({
1560
+ return this.layers.sync(n, !1), this.blocks.sync(n, !1), this.syncHud(t.filename ?? o.filename ?? null), this.initialCameraRestored = this.tryRestoreCamera(r), !this.initialCameraRestored && o.bounds && this.host.fitBox3(Z(o.bounds)), this.cameraSettled = !0, this.syncDisplayContext(), this.document = Ye({
1550
1561
  documentKey: r,
1551
1562
  filename: t.filename ?? o.filename ?? null,
1552
1563
  phase: n.phase === "interactive" && !this.initialDemandSettled ? "initial-loading" : n.phase,
@@ -1625,11 +1636,11 @@ class br {
1625
1636
  return this.layers.getVisibilityRevision() + this.blocks.getVisibilityRevision();
1626
1637
  }
1627
1638
  setInsertSelection(e, t) {
1628
- yr(this.inspector.selection, e) && wr(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1639
+ Sr(this.inspector.selection, e) && kr(this.inspector.details, t) && !this.inspector.textSelection || (this.inspector.setSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1629
1640
  }
1630
1641
  /** @internal Used by the viewer's managed interaction pipeline. */
1631
1642
  setTextSelectionInternal(e, t) {
1632
- xr(this.inspector.textSelection, e) && Cr(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1643
+ Er(this.inspector.textSelection, e) && Pr(this.inspector.textDetails, t) && !this.inspector.selection || (this.inspector.setTextSelection(e, t), this.emit("inspector-change", { inspector: this.inspector }));
1633
1644
  }
1634
1645
  getAuthoritativeBoundsBox() {
1635
1646
  if (!this.session) return null;
@@ -1703,7 +1714,7 @@ class br {
1703
1714
  hud: e(this.hud),
1704
1715
  loadTiming: e(this.loadTiming)
1705
1716
  };
1706
- return Mt(t);
1717
+ return Lt(t);
1707
1718
  }
1708
1719
  fitDocument() {
1709
1720
  this.assertActive();
@@ -1717,8 +1728,8 @@ class br {
1717
1728
  if (!e) return !1;
1718
1729
  let { minX: t, minY: i, maxX: r, maxY: n } = e;
1719
1730
  const a = r - t, o = n - i, l = Math.max(a, o);
1720
- if (a > 0 && o > 0 && l < qe) {
1721
- const c = (t + r) / 2, p = (i + n) / 2, h = qe / 2;
1731
+ if (a > 0 && o > 0 && l < Xe) {
1732
+ const c = (t + r) / 2, p = (i + n) / 2, h = Xe / 2;
1722
1733
  t = c - h, i = p - h, r = c + h, n = p + h;
1723
1734
  }
1724
1735
  return this.host.fitBox3(Z({
@@ -1748,7 +1759,7 @@ class br {
1748
1759
  const e = this.host.runtime.captureCameraSnapshot();
1749
1760
  e && this.host.persistCameraSnapshot(
1750
1761
  this.document.documentKey,
1751
- dr(e)
1762
+ pr(e)
1752
1763
  );
1753
1764
  }
1754
1765
  syncDisplayContext() {
@@ -1794,7 +1805,7 @@ class br {
1794
1805
  }
1795
1806
  this.viewportDemandTimer === null && (this.viewportDemandTimer = globalThis.setTimeout(() => {
1796
1807
  this.viewportDemandTimer = null, !(this.disposed || !this.session) && this.host.interaction === "active" && this.flushViewportDemand();
1797
- }, Math.max(0, this.host.viewportDemandCoalesceMs ?? gr)));
1808
+ }, Math.max(0, this.host.viewportDemandCoalesceMs ?? wr)));
1798
1809
  }
1799
1810
  clearViewportDemandTimer() {
1800
1811
  this.viewportDemandTimer !== null && (globalThis.clearTimeout(this.viewportDemandTimer), this.viewportDemandTimer = null);
@@ -1813,7 +1824,7 @@ class br {
1813
1824
  });
1814
1825
  }
1815
1826
  publishDocumentPhase(e) {
1816
- this.document && (this.document = He({
1827
+ this.document && (this.document = Ye({
1817
1828
  documentKey: this.document.documentKey,
1818
1829
  filename: this.document.filename,
1819
1830
  phase: e,
@@ -1831,19 +1842,19 @@ class br {
1831
1842
  if (this.disposed) throw new Error("Viewer has been disposed.");
1832
1843
  }
1833
1844
  }
1834
- function yr(s, e) {
1845
+ function Sr(s, e) {
1835
1846
  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);
1836
1847
  }
1837
- function xr(s, e) {
1848
+ function Er(s, e) {
1838
1849
  return s === e || !!(s && e && s.documentKey === e.documentKey && s.id.textId === e.id.textId);
1839
1850
  }
1840
- function wr(s, e) {
1851
+ function kr(s, e) {
1841
1852
  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);
1842
1853
  }
1843
- function Cr(s, e) {
1854
+ function Pr(s, e) {
1844
1855
  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);
1845
1856
  }
1846
- function Sr(s) {
1857
+ function Ar(s) {
1847
1858
  let e = null;
1848
1859
  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;
1849
1860
  let t = 2166136261;
@@ -1851,19 +1862,19 @@ function Sr(s) {
1851
1862
  t ^= e.charCodeAt(i), t = Math.imul(t, 16777619);
1852
1863
  return `reference:src-${(t >>> 0).toString(16)}`;
1853
1864
  }
1854
- function Mt(s) {
1865
+ function Lt(s) {
1855
1866
  if (!s || typeof s != "object") return s;
1856
1867
  Object.freeze(s);
1857
1868
  for (const e of Object.values(s))
1858
- e && typeof e == "object" && !Object.isFrozen(e) && Mt(e);
1869
+ e && typeof e == "object" && !Object.isFrozen(e) && Lt(e);
1859
1870
  return s;
1860
1871
  }
1861
1872
  function J(s, e, t) {
1862
1873
  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";
1863
1874
  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 };
1864
1875
  }
1865
- const Ye = 1;
1866
- class Er {
1876
+ const We = 1;
1877
+ class Ir {
1867
1878
  constructor(e) {
1868
1879
  u(this, "startX", 0);
1869
1880
  u(this, "startY", 0);
@@ -1908,13 +1919,13 @@ class Er {
1908
1919
  this.release(), this.resetMotion(), this.startX = 0, this.startY = 0, this.lastX = 0, this.lastY = 0;
1909
1920
  }
1910
1921
  isTrackingPrimaryPointer(e) {
1911
- return this.primaryPointerDown || (e & Ye) === Ye;
1922
+ return this.primaryPointerDown || (e & We) === We;
1912
1923
  }
1913
1924
  }
1914
1925
  function Ce(s, e) {
1915
1926
  return `${s}:${e}`;
1916
1927
  }
1917
- class kr {
1928
+ class Mr {
1918
1929
  constructor() {
1919
1930
  u(this, "expandedLayers", /* @__PURE__ */ new Set());
1920
1931
  u(this, "expandedBlocks", /* @__PURE__ */ new Set());
@@ -1967,7 +1978,7 @@ function I(s) {
1967
1978
  "'": "&#39;"
1968
1979
  })[e] ?? e);
1969
1980
  }
1970
- const Pr = {
1981
+ const Rr = {
1971
1982
  "panel.layers": "图层",
1972
1983
  "panel.properties": "属性",
1973
1984
  "panel.layers.aria": "图层面板",
@@ -2046,7 +2057,7 @@ const Pr = {
2046
2057
  "status.parsing": "解析中…",
2047
2058
  "status.incrementalLoading": "增量渲染中…",
2048
2059
  "unit.mm": "mm"
2049
- }, Ar = {
2060
+ }, Lr = {
2050
2061
  "panel.layers": "Layers",
2051
2062
  "panel.properties": "Properties",
2052
2063
  "panel.layers.aria": "Layers panel",
@@ -2126,29 +2137,29 @@ const Pr = {
2126
2137
  "status.incrementalLoading": "Rendering incrementally…",
2127
2138
  "unit.mm": "mm"
2128
2139
  };
2129
- function Ir(s, e) {
2140
+ function Tr(s, e) {
2130
2141
  return e ? s.replace(/\{([a-zA-Z0-9_]+)\}/g, (t, i) => {
2131
2142
  const r = e[i];
2132
2143
  return r === void 0 ? t : String(r);
2133
2144
  }) : s;
2134
2145
  }
2135
- function Mr(s) {
2146
+ function Dr(s) {
2136
2147
  try {
2137
2148
  return new Intl.NumberFormat(s, { maximumFractionDigits: 4, useGrouping: !1 });
2138
2149
  } catch {
2139
2150
  return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 4, useGrouping: !1 });
2140
2151
  }
2141
2152
  }
2142
- function Rr(s) {
2153
+ function Or(s) {
2143
2154
  try {
2144
2155
  return new Intl.NumberFormat(s, { maximumFractionDigits: 0 });
2145
2156
  } catch {
2146
2157
  return new Intl.NumberFormat("zh-CN", { maximumFractionDigits: 0 });
2147
2158
  }
2148
2159
  }
2149
- function Rt(s) {
2160
+ function Tt(s) {
2150
2161
  var a;
2151
- const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Ar : Pr, i = Mr(e), r = Rr(e), n = {
2162
+ const e = ((a = s.locale) == null ? void 0 : a.trim()) || "zh-CN", t = e.toLowerCase().startsWith("en") ? Lr : Rr, i = Dr(e), r = Or(e), n = {
2152
2163
  locale: e,
2153
2164
  t(o, l) {
2154
2165
  var p;
@@ -2160,7 +2171,7 @@ function Rt(s) {
2160
2171
  d = void 0;
2161
2172
  }
2162
2173
  const c = d ?? ((p = s.messages) == null ? void 0 : p[o]) ?? t[o] ?? o;
2163
- return Ir(c, l);
2174
+ return Tr(c, l);
2164
2175
  },
2165
2176
  formatNumber(o) {
2166
2177
  return o == null || !Number.isFinite(o) ? "—" : i.format(o);
@@ -2189,17 +2200,17 @@ function Rt(s) {
2189
2200
  };
2190
2201
  return n;
2191
2202
  }
2192
- const Lr = {
2203
+ const zr = {
2193
2204
  "加载中…": "status.loading",
2194
2205
  "解析中…": "status.parsing",
2195
2206
  "增量渲染中…": "status.incrementalLoading"
2196
2207
  };
2197
- function Tr(s, e) {
2198
- const t = s.trim(), i = Lr[t];
2208
+ function Nr(s, e) {
2209
+ const t = s.trim(), i = zr[t];
2199
2210
  return i ? e.t(i) : t;
2200
2211
  }
2201
- const Me = Rt({});
2202
- function Dr(s) {
2212
+ const Me = Tt({});
2213
+ function Vr(s) {
2203
2214
  const e = /* @__PURE__ */ new Map();
2204
2215
  for (const i of s.usages) {
2205
2216
  const r = e.get(i.layerIndex) ?? /* @__PURE__ */ new Map(), n = Ce(i.layerIndex, i.variantId);
@@ -2224,7 +2235,7 @@ function Dr(s) {
2224
2235
  t.set(i, [...r.values()]);
2225
2236
  return t;
2226
2237
  }
2227
- function Or(s, e) {
2238
+ function Fr(s, e) {
2228
2239
  return s ? e.toLowerCase().includes(s) : !0;
2229
2240
  }
2230
2241
  function ce(s, e, t) {
@@ -2233,17 +2244,17 @@ function ce(s, e, t) {
2233
2244
  function le(s, e, t) {
2234
2245
  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");
2235
2246
  }
2236
- function zr(s) {
2247
+ function $r(s) {
2237
2248
  let e = 0;
2238
2249
  for (const t of s) t.visible && (e += 1);
2239
2250
  return e <= 0 ? "none" : e >= s.length ? "all" : "mixed";
2240
2251
  }
2241
- function Lt(s, e, t, i) {
2252
+ function Dt(s, e, t, i) {
2242
2253
  if (!s) return !1;
2243
2254
  const r = s.id;
2244
2255
  return r.layerIndex !== e || r.variantId !== t ? !1 : i === void 0 ? !0 : r.instanceId === i;
2245
2256
  }
2246
- function Xe(s) {
2257
+ function Ge(s) {
2247
2258
  const e = s.querySelector(".vui-lrow-insert.active") ?? s.querySelector(".vui-lrow-block.active");
2248
2259
  if (!e) return !1;
2249
2260
  const t = s.getBoundingClientRect(), i = e.getBoundingClientRect();
@@ -2251,7 +2262,7 @@ function Xe(s) {
2251
2262
  const r = i.top - t.top, n = s.scrollTop + r - (t.height - i.height) / 2;
2252
2263
  return s.scrollTop = Math.max(0, n), !0;
2253
2264
  }
2254
- function Tt(s, e, t = 0) {
2265
+ function Ot(s, e, t = 0) {
2255
2266
  const i = () => {
2256
2267
  const r = s.getBoundingClientRect(), n = e.getBoundingClientRect();
2257
2268
  if (r.height <= 0) return;
@@ -2270,7 +2281,7 @@ function Tt(s, e, t = 0) {
2270
2281
  };
2271
2282
  i(), typeof requestAnimationFrame == "function" && requestAnimationFrame(i);
2272
2283
  }
2273
- function Nr(s, e) {
2284
+ function Br(s, e) {
2274
2285
  const t = e.trim().toLowerCase();
2275
2286
  s.querySelectorAll(".vui-lrow-wrap").forEach((i) => {
2276
2287
  var o, l;
@@ -2280,7 +2291,7 @@ function Nr(s, e) {
2280
2291
  i.style.display = a ? "" : "none";
2281
2292
  });
2282
2293
  }
2283
- function Vr(s, e) {
2294
+ function _r(s, e) {
2284
2295
  if (s.querySelectorAll(".vui-lrow-block.active, .vui-lrow-insert.active").forEach((o) => {
2285
2296
  o.classList.remove("active");
2286
2297
  }), !e) return;
@@ -2293,36 +2304,36 @@ function Vr(s, e) {
2293
2304
  );
2294
2305
  a && a.classList.add("active");
2295
2306
  }
2296
- function Fr(s, e, t, i = Me) {
2307
+ function Ur(s, e, t, i = Me) {
2297
2308
  var l;
2298
2309
  const r = new Map(e.map((d) => [d.index, d]));
2299
2310
  s.querySelectorAll(".vui-lrow[data-layer-index]:not(.vui-lrow-all)").forEach((d) => {
2300
2311
  const c = r.get(Number(d.dataset.layerIndex));
2301
2312
  if (!c) return;
2302
2313
  const p = d.querySelector(".vui-lrow-eye");
2303
- p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), Dt(d, Re(c));
2314
+ p && (p.textContent = c.visible ? "●" : "○", p.title = c.visible ? i.t("layer.hide") : i.t("layer.show")), d.classList.toggle("off", !c.visible), zt(d, Re(c));
2304
2315
  });
2305
2316
  const n = s.querySelector(".vui-lrow-all"), a = t === null ? "#c8c8c8" : X(t);
2306
2317
  (l = n == null ? void 0 : n.querySelector(".vui-lrow-clr")) == null || l.style.setProperty("background", a);
2307
2318
  const o = n == null ? void 0 : n.querySelector('input[type="color"]');
2308
2319
  o && o.value !== a && (o.value = a);
2309
2320
  }
2310
- function $r(s, e, t) {
2311
- var m;
2321
+ function jr(s, e, t) {
2322
+ var v;
2312
2323
  const i = t.text ?? Me;
2313
2324
  e.resetForScope(t.scopeKey);
2314
- const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = Dr(t.blocks);
2325
+ const r = e.filterText.trim().toLowerCase(), n = t.layers.rows, a = Vr(t.blocks);
2315
2326
  if (s.list.replaceChildren(), s.count.textContent = String(n.length), n.length === 0) {
2316
- s.list.appendChild(_r(i.t("layer.empty")));
2327
+ s.list.appendChild(qr(i.t("layer.empty")));
2317
2328
  return;
2318
2329
  }
2319
2330
  const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
2320
- for (const v of n) {
2321
- o.add(v.index);
2322
- for (const b of a.get(v.index) ?? []) l.add(b.key);
2331
+ for (const y of n) {
2332
+ o.add(y.index);
2333
+ for (const m of a.get(y.index) ?? []) l.add(m.key);
2323
2334
  }
2324
2335
  e.prune(o, l);
2325
- const d = (m = t.selection) == null ? void 0 : m.id, c = d ? `${d.layerIndex}:${d.variantId}:${d.instanceId}` : null;
2336
+ const d = (v = t.selection) == null ? void 0 : v.id, c = d ? `${d.layerIndex}:${d.variantId}:${d.instanceId}` : null;
2326
2337
  d && c && e.needsSelectionReveal(c) ? e.ensureSelectionVisible(c, d.layerIndex, d.variantId) : d || e.clearSelectionReveal();
2327
2338
  const p = document.createElement("div");
2328
2339
  p.className = "vui-lrow vui-lrow-all", p.innerHTML = `
@@ -2335,38 +2346,38 @@ function $r(s, e, t) {
2335
2346
  </span>`;
2336
2347
  const h = p.querySelector('input[type="color"]');
2337
2348
  h && h.addEventListener("input", () => {
2338
- var y, g, x;
2339
- const v = Number.parseInt(h.value.slice(1), 16), b = Number.isFinite(v) ? v : null;
2340
- (y = t.beginLayerColorPreview) == null || y.call(t, h);
2349
+ var b, g, x;
2350
+ const y = Number.parseInt(h.value.slice(1), 16), m = Number.isFinite(y) ? y : null;
2351
+ (b = t.beginLayerColorPreview) == null || b.call(t, h);
2341
2352
  try {
2342
- if (t.setAllLayerColor) t.setAllLayerColor(b);
2343
- else for (const k of n) t.setLayerColor(k.index, b);
2344
- const w = b === null ? "#c8c8c8" : X(b);
2345
- (g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", w), We(s.list, n, b);
2353
+ if (t.setAllLayerColor) t.setAllLayerColor(m);
2354
+ else for (const C of n) t.setLayerColor(C.index, m);
2355
+ const w = m === null ? "#c8c8c8" : X(m);
2356
+ (g = h.closest(".vui-lrow-clr")) == null || g.style.setProperty("background", w), Ke(s.list, n, m);
2346
2357
  } finally {
2347
2358
  (x = t.endLayerColorPreview) == null || x.call(t, h);
2348
2359
  }
2349
- }), h == null || h.addEventListener("click", (v) => v.stopPropagation());
2360
+ }), h == null || h.addEventListener("click", (y) => y.stopPropagation());
2350
2361
  const f = p.querySelector(".vui-lrow-clr");
2351
- f && f.addEventListener("contextmenu", (v) => {
2352
- var b;
2353
- if (v.preventDefault(), v.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
2354
- else for (const y of n) t.setLayerColor(y.index, null);
2355
- (b = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || b.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), We(s.list, n, null);
2362
+ f && f.addEventListener("contextmenu", (y) => {
2363
+ var m;
2364
+ if (y.preventDefault(), y.stopPropagation(), t.setAllLayerColor) t.setAllLayerColor(null);
2365
+ else for (const b of n) t.setLayerColor(b.index, null);
2366
+ (m = h == null ? void 0 : h.closest(".vui-lrow-clr")) == null || m.style.setProperty("background", "#c8c8c8"), h && (h.value = "#c8c8c8"), Ke(s.list, n, null);
2356
2367
  }), s.list.appendChild(p);
2357
- for (const v of n)
2358
- Or(r, v.name) && s.list.appendChild(Br(v, e, t, a.get(v.index) ?? [], i));
2359
- c && e.needsSelectionReveal(c) && (Xe(s.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
2360
- e.needsSelectionReveal(c) && Xe(s.list) && e.markSelectionRevealed(c);
2368
+ for (const y of n)
2369
+ Fr(r, y.name) && s.list.appendChild(Hr(y, e, t, a.get(y.index) ?? [], i));
2370
+ c && e.needsSelectionReveal(c) && (Ge(s.list) && e.markSelectionRevealed(c), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
2371
+ e.needsSelectionReveal(c) && Ge(s.list) && e.markSelectionRevealed(c);
2361
2372
  }));
2362
2373
  }
2363
2374
  function X(s) {
2364
2375
  return `#${s.toString(16).padStart(6, "0")}`;
2365
2376
  }
2366
2377
  function Re(s) {
2367
- return s.color !== null ? X(s.color) : X(It(s.sourceColor));
2378
+ return s.color !== null ? X(s.color) : X(Rt(s.sourceColor));
2368
2379
  }
2369
- function Dt(s, e) {
2380
+ function zt(s, e) {
2370
2381
  var r;
2371
2382
  (r = s.querySelector(".vui-lrow-dot")) == null || r.style.setProperty("background", e);
2372
2383
  const t = s.querySelector(".vui-lrow-clr");
@@ -2374,21 +2385,21 @@ function Dt(s, e) {
2374
2385
  const i = s.querySelector('input[type="color"]');
2375
2386
  i && i.value !== e && (i.value = e);
2376
2387
  }
2377
- function We(s, e, t) {
2388
+ function Ke(s, e, t) {
2378
2389
  const i = new Map(e.map((r) => [r.index, r]));
2379
2390
  s.querySelectorAll(".vui-lrow[data-layer-index]").forEach((r) => {
2380
2391
  const n = i.get(Number(r.dataset.layerIndex));
2381
- n && Dt(r, t === null ? Re(n) : X(t));
2392
+ n && zt(r, t === null ? Re(n) : X(t));
2382
2393
  });
2383
2394
  }
2384
- function Br(s, e, t, i, r) {
2395
+ function Hr(s, e, t, i, r) {
2385
2396
  const n = i.length > 0, a = e.expandedLayers.has(s.index), o = Re(s), l = document.createElement("div");
2386
2397
  l.className = "vui-lrow-wrap";
2387
2398
  const d = document.createElement("div");
2388
2399
  d.className = `vui-lrow${s.visible ? "" : " off"}`, d.dataset.layerIndex = String(s.index);
2389
2400
  const c = document.createElement("button");
2390
- c.type = "button", c.className = "vui-lrow-eye", c.textContent = s.visible ? "●" : "○", c.title = s.visible ? r.t("layer.hide") : r.t("layer.show"), c.addEventListener("click", (y) => {
2391
- y.stopPropagation();
2401
+ c.type = "button", c.className = "vui-lrow-eye", c.textContent = s.visible ? "●" : "○", c.title = s.visible ? r.t("layer.hide") : r.t("layer.show"), c.addEventListener("click", (b) => {
2402
+ b.stopPropagation();
2392
2403
  const g = !s.visible;
2393
2404
  c.textContent = g ? "●" : "○", c.title = g ? r.t("layer.hide") : r.t("layer.show"), d.classList.toggle("off", !g), t.toggleLayer(s.index);
2394
2405
  });
@@ -2396,8 +2407,8 @@ function Br(s, e, t, i, r) {
2396
2407
  p.className = "vui-lrow-dot", p.style.background = o;
2397
2408
  const h = document.createElement("button");
2398
2409
  h.type = "button", h.className = `vui-lrow-toggle${n ? "" : " placeholder"}`, h.textContent = a ? "▼" : "▶", h.disabled = !n;
2399
- const f = (y) => {
2400
- if (y.stopPropagation(), !n) return;
2410
+ const f = (b) => {
2411
+ if (b.stopPropagation(), !n) return;
2401
2412
  e.toggleLayerExpanded(s.index);
2402
2413
  const g = e.expandedLayers.has(s.index);
2403
2414
  h.textContent = g ? "▼" : "▶";
@@ -2408,94 +2419,94 @@ function Br(s, e, t, i, r) {
2408
2419
  else {
2409
2420
  x = document.createElement("div"), x.className = "vui-lrow-blocks open";
2410
2421
  for (const w of i)
2411
- x.appendChild(Ge(w, e, t, r));
2422
+ x.appendChild(Ze(w, e, t, r));
2412
2423
  l.appendChild(x);
2413
2424
  }
2414
2425
  else {
2415
2426
  x == null || x.classList.remove("open");
2416
2427
  const w = l.closest(".vui-section-list") ?? l.parentElement;
2417
- w && Tt(w, d, 0);
2428
+ w && Ot(w, d, 0);
2418
2429
  }
2419
2430
  };
2420
2431
  h.addEventListener("click", f);
2421
- const m = document.createElement("span");
2422
- m.className = "vui-lrow-name", m.textContent = s.name || r.t("layer.unnamed"), m.title = s.name;
2423
2432
  const v = document.createElement("span");
2424
- v.className = "vui-lrow-clr", v.style.background = o, v.title = r.t("layer.colorOverride");
2425
- const b = document.createElement("input");
2426
- if (b.type = "color", b.value = o, b.addEventListener("input", () => {
2433
+ v.className = "vui-lrow-name", v.textContent = s.name || r.t("layer.unnamed"), v.title = s.name;
2434
+ const y = document.createElement("span");
2435
+ y.className = "vui-lrow-clr", y.style.background = o, y.title = r.t("layer.colorOverride");
2436
+ const m = document.createElement("input");
2437
+ if (m.type = "color", m.value = o, m.addEventListener("input", () => {
2427
2438
  var g, x;
2428
- const y = Number.parseInt(b.value.slice(1), 16);
2429
- (g = t.beginLayerColorPreview) == null || g.call(t, b);
2439
+ const b = Number.parseInt(m.value.slice(1), 16);
2440
+ (g = t.beginLayerColorPreview) == null || g.call(t, m);
2430
2441
  try {
2431
- t.setLayerColor(s.index, Number.isFinite(y) ? y : null), p.style.background = b.value, v.style.background = b.value;
2442
+ t.setLayerColor(s.index, Number.isFinite(b) ? b : null), p.style.background = m.value, y.style.background = m.value;
2432
2443
  } finally {
2433
- (x = t.endLayerColorPreview) == null || x.call(t, b);
2444
+ (x = t.endLayerColorPreview) == null || x.call(t, m);
2434
2445
  }
2435
- }), b.addEventListener("click", (y) => y.stopPropagation()), v.addEventListener("contextmenu", (y) => {
2436
- y.preventDefault(), y.stopPropagation(), t.setLayerColor(s.index, null);
2437
- const g = X(It(s.sourceColor));
2438
- b.value = g, p.style.background = g, v.style.background = g;
2439
- }), v.appendChild(b), d.append(c, p, h, m, v), d.addEventListener("click", (y) => {
2440
- const g = y.target;
2446
+ }), m.addEventListener("click", (b) => b.stopPropagation()), y.addEventListener("contextmenu", (b) => {
2447
+ b.preventDefault(), b.stopPropagation(), t.setLayerColor(s.index, null);
2448
+ const g = X(Rt(s.sourceColor));
2449
+ m.value = g, p.style.background = g, y.style.background = g;
2450
+ }), y.appendChild(m), d.append(c, p, h, v, y), d.addEventListener("click", (b) => {
2451
+ const g = b.target;
2441
2452
  if (g instanceof HTMLInputElement && g.type === "color" || g.closest(".vui-lrow-clr") || g.closest(".vui-lrow-toggle") || g.closest(".vui-lrow-eye")) return;
2442
2453
  const x = !s.visible;
2443
2454
  c.textContent = x ? "●" : "○", c.title = x ? r.t("layer.hide") : r.t("layer.show"), d.classList.toggle("off", !x), t.toggleLayer(s.index);
2444
2455
  }), l.appendChild(d), n && a) {
2445
- const y = document.createElement("div");
2446
- y.className = "vui-lrow-blocks open";
2456
+ const b = document.createElement("div");
2457
+ b.className = "vui-lrow-blocks open";
2447
2458
  for (const g of i)
2448
- y.appendChild(Ge(g, e, t, r));
2449
- l.appendChild(y);
2459
+ b.appendChild(Ze(g, e, t, r));
2460
+ l.appendChild(b);
2450
2461
  }
2451
2462
  return l;
2452
2463
  }
2453
- function Ge(s, e, t, i) {
2464
+ function Ze(s, e, t, i) {
2454
2465
  const r = document.createElement("div");
2455
2466
  r.className = "vui-lrow-block-wrap";
2456
- const n = e.expandedBlocks.has(s.key), a = zr(s.inserts), o = Lt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2467
+ const n = e.expandedBlocks.has(s.key), a = $r(s.inserts), o = Dt(t.selection, s.layerIndex, s.variantId), l = document.createElement("div");
2457
2468
  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"));
2458
2469
  const d = document.createElement("button");
2459
- d.type = "button", d.className = "vui-lrow-block-visibility", le(d, a, i), d.addEventListener("click", (m) => {
2460
- if (m.stopPropagation(), a === "none") {
2461
- const b = e.blockVisibilitySnapshots.get(s.key), y = [];
2470
+ d.type = "button", d.className = "vui-lrow-block-visibility", le(d, a, i), d.addEventListener("click", (v) => {
2471
+ if (v.stopPropagation(), a === "none") {
2472
+ const m = e.blockVisibilitySnapshots.get(s.key), b = [];
2462
2473
  for (const g of s.inserts) {
2463
- const x = (b == null ? void 0 : b.get(g.instanceId)) ?? !0;
2464
- g.visible !== x && y.push({ insertId: g.insertId, visible: x });
2474
+ const x = (m == null ? void 0 : m.get(g.instanceId)) ?? !0;
2475
+ g.visible !== x && b.push({ insertId: g.insertId, visible: x });
2465
2476
  }
2466
2477
  if (le(d, "all", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((g) => {
2467
2478
  ce(g, !0, i);
2468
- }), t.batchToggleInserts && y.length > 0)
2469
- t.batchToggleInserts(y);
2479
+ }), t.batchToggleInserts && b.length > 0)
2480
+ t.batchToggleInserts(b);
2470
2481
  else
2471
- for (const g of y) t.toggleInsert(g.insertId, g.visible);
2482
+ for (const g of b) t.toggleInsert(g.insertId, g.visible);
2472
2483
  return;
2473
2484
  }
2474
2485
  e.blockVisibilitySnapshots.set(
2475
2486
  s.key,
2476
- new Map(s.inserts.map((b) => [b.instanceId, b.visible]))
2487
+ new Map(s.inserts.map((m) => [m.instanceId, m.visible]))
2477
2488
  );
2478
- const v = s.inserts.filter((b) => b.visible).map((b) => ({ insertId: b.insertId, visible: !1 }));
2479
- if (le(d, "none", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((b) => {
2480
- ce(b, !1, i);
2481
- }), t.batchToggleInserts && v.length > 0)
2482
- t.batchToggleInserts(v);
2489
+ const y = s.inserts.filter((m) => m.visible).map((m) => ({ insertId: m.insertId, visible: !1 }));
2490
+ if (le(d, "none", i), r.querySelectorAll(".vui-lrow-insert-visibility").forEach((m) => {
2491
+ ce(m, !1, i);
2492
+ }), t.batchToggleInserts && y.length > 0)
2493
+ t.batchToggleInserts(y);
2483
2494
  else
2484
- for (const b of v) t.toggleInsert(b.insertId, !1);
2495
+ for (const m of y) t.toggleInsert(m.insertId, !1);
2485
2496
  });
2486
2497
  const c = document.createElement("button");
2487
2498
  c.type = "button", c.className = "vui-lrow-block-toggle", c.textContent = n ? "▼" : "▶";
2488
- const p = (m) => {
2489
- m.stopPropagation(), e.toggleBlockExpanded(s.layerIndex, s.variantId);
2490
- const v = e.expandedBlocks.has(s.key);
2491
- c.textContent = v ? "▼" : "▶";
2492
- let b = r.querySelector(":scope > .vui-lrow-inserts");
2493
- if (v)
2494
- b ? b.classList.add("open") : (b = Ke(s, e, t, d, i), r.appendChild(b));
2499
+ const p = (v) => {
2500
+ v.stopPropagation(), e.toggleBlockExpanded(s.layerIndex, s.variantId);
2501
+ const y = e.expandedBlocks.has(s.key);
2502
+ c.textContent = y ? "▼" : "▶";
2503
+ let m = r.querySelector(":scope > .vui-lrow-inserts");
2504
+ if (y)
2505
+ m ? m.classList.add("open") : (m = Je(s, e, t, d, i), r.appendChild(m));
2495
2506
  else {
2496
- b == null || b.classList.remove("open");
2497
- const y = r.closest(".vui-section-list") ?? r.parentElement;
2498
- y && Tt(y, l, 24);
2507
+ m == null || m.classList.remove("open");
2508
+ const b = r.closest(".vui-section-list") ?? r.parentElement;
2509
+ b && Ot(b, l, 24);
2499
2510
  }
2500
2511
  };
2501
2512
  c.addEventListener("click", p);
@@ -2504,16 +2515,16 @@ function Ge(s, e, t, i) {
2504
2515
  const f = document.createElement("span");
2505
2516
  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", () => {
2506
2517
  if (!s.canHighlight) return;
2507
- const m = s.inserts[0], v = `${s.layerIndex}:${s.variantId}:${m.instanceId}`;
2508
- e.markSelectionRevealed(v), t.selectInsert(m.insertId);
2509
- }), r.appendChild(l), n && r.appendChild(Ke(s, e, t, d, i)), r;
2518
+ const v = s.inserts[0], y = `${s.layerIndex}:${s.variantId}:${v.instanceId}`;
2519
+ e.markSelectionRevealed(y), t.selectInsert(v.insertId);
2520
+ }), r.appendChild(l), n && r.appendChild(Je(s, e, t, d, i)), r;
2510
2521
  }
2511
- function Ke(s, e, t, i, r) {
2522
+ function Je(s, e, t, i, r) {
2512
2523
  const n = document.createElement("div");
2513
2524
  n.className = "vui-lrow-inserts open";
2514
2525
  for (const a of s.inserts) {
2515
2526
  const o = document.createElement("div");
2516
- o.className = `vui-lrow-insert${Lt(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"));
2527
+ 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"));
2517
2528
  const l = document.createElement("button");
2518
2529
  l.type = "button", l.className = "vui-lrow-insert-visibility", ce(l, a.visible, r), l.addEventListener("click", (c) => {
2519
2530
  c.stopPropagation();
@@ -2521,11 +2532,11 @@ function Ke(s, e, t, i, r) {
2521
2532
  ce(l, p, r);
2522
2533
  const h = n.querySelectorAll(".vui-lrow-insert-visibility");
2523
2534
  let f = 0;
2524
- h.forEach((v) => {
2525
- v.dataset.visible === "1" && f++;
2535
+ h.forEach((y) => {
2536
+ y.dataset.visible === "1" && f++;
2526
2537
  });
2527
- const m = f === 0 ? "none" : f === h.length ? "all" : "mixed";
2528
- le(i, m, r), t.toggleInsert(a.insertId, p);
2538
+ const v = f === 0 ? "none" : f === h.length ? "all" : "mixed";
2539
+ le(i, v, r), t.toggleInsert(a.insertId, p);
2529
2540
  });
2530
2541
  const d = document.createElement("span");
2531
2542
  d.className = "vui-lrow-insert-label", d.textContent = a.label, d.title = a.label, o.append(l, d), o.addEventListener("click", () => {
@@ -2536,45 +2547,45 @@ function Ke(s, e, t, i, r) {
2536
2547
  }
2537
2548
  return n;
2538
2549
  }
2539
- function _r(s) {
2550
+ function qr(s) {
2540
2551
  const e = document.createElement("div");
2541
2552
  return e.className = "vui-empty-note", e.textContent = s, e;
2542
2553
  }
2543
- function Ur(s, e) {
2554
+ function Yr(s, e) {
2544
2555
  const t = () => {
2545
2556
  e(s.value);
2546
2557
  };
2547
2558
  return s.addEventListener("input", t), () => s.removeEventListener("input", t);
2548
2559
  }
2549
- function Ze(s, e, t = Me, i = "mm") {
2560
+ function Qe(s, e, t = Me, i = "mm") {
2550
2561
  if (s.body.replaceChildren(), e.textSelection && e.textDetails) {
2551
- H(s, !1), Hr(s.body, e.textDetails, t, i), Je(s.body);
2562
+ H(s, !1), Wr(s.body, e.textDetails, t, i), et(s.body);
2552
2563
  return;
2553
2564
  }
2554
2565
  if (!e.selection || !e.details) {
2555
- H(s, !1), s.body.appendChild(qr(t.t("property.empty")));
2566
+ H(s, !1), s.body.appendChild(Gr(t.t("property.empty")));
2556
2567
  return;
2557
2568
  }
2558
- jr(s.body, e.details, t, i), Je(s.body);
2569
+ Xr(s.body, e.details, t, i), et(s.body);
2559
2570
  }
2560
2571
  function H(s, e) {
2561
2572
  if (!s.previewWrap || !s.previewCanvas || (s.previewWrap.hidden = !e, e)) return;
2562
2573
  const t = s.previewCanvas.getContext("2d");
2563
2574
  t == null || t.clearRect(0, 0, s.previewCanvas.width, s.previewCanvas.height);
2564
2575
  }
2565
- function jr(s, e, t, i) {
2566
- Ot(s, t.t("property.insert"), e.blockName), Se(s, t.t("property.basic"), (r) => {
2576
+ function Xr(s, e, t, i) {
2577
+ Nt(s, t.t("property.insert"), e.blockName), Se(s, t.t("property.basic"), (r) => {
2567
2578
  M(r, t.t("property.block"), e.blockName), M(r, t.t("property.layer"), e.layerName), M(r, t.t("property.instance"), `#${e.id.instanceId}`), M(r, t.t("property.currentShape"), t.t("property.normalShape"));
2568
2579
  }), Se(s, t.t("property.transform"), (r) => {
2569
2580
  M(r, "X", t.formatUnit(e.tx, i)), M(r, "Y", t.formatUnit(e.ty, i)), M(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°")), M(r, "Sx", t.formatNumber(e.scaleX)), M(r, "Sy", t.formatNumber(e.scaleY));
2570
2581
  });
2571
2582
  }
2572
- function Hr(s, e, t, i) {
2573
- Ot(s, t.t("property.text"), e.content), Se(s, t.t("property.basic"), (r) => {
2583
+ function Wr(s, e, t, i) {
2584
+ Nt(s, t.t("property.text"), e.content), Se(s, t.t("property.basic"), (r) => {
2574
2585
  M(r, t.t("property.layer"), e.layerName), M(r, t.t("property.content"), e.content), M(r, t.t("property.height"), t.formatUnit(e.height, i)), M(r, "X", t.formatUnit(e.x, i)), M(r, "Y", t.formatUnit(e.y, i)), M(r, t.t("property.rotation"), t.formatUnit(e.rotation, "°"));
2575
2586
  });
2576
2587
  }
2577
- function Ot(s, e, t) {
2588
+ function Nt(s, e, t) {
2578
2589
  const i = document.createElement("div");
2579
2590
  i.className = "vui-pp-section vui-pp-title-row", i.innerHTML = `<strong>${I(e)}</strong><span>·</span><span>${I(t)}</span>`, s.appendChild(i);
2580
2591
  }
@@ -2588,11 +2599,11 @@ function M(s, e, t) {
2588
2599
  const i = document.createElement("div");
2589
2600
  i.className = "vui-pp-row", i.innerHTML = `<span class="label">${I(e)}</span><span class="value" title="${I(t)}">${I(t)}</span>`, s.appendChild(i);
2590
2601
  }
2591
- function qr(s) {
2602
+ function Gr(s) {
2592
2603
  const e = document.createElement("div");
2593
2604
  return e.className = "vui-empty-note", e.textContent = s, e;
2594
2605
  }
2595
- function Je(s) {
2606
+ function et(s) {
2596
2607
  if (s.querySelector('input:not([type="color"])'))
2597
2608
  throw new Error("Property panel must not contain editable inputs");
2598
2609
  if (s.querySelector('[contenteditable=""], [contenteditable="true"]'))
@@ -2600,17 +2611,17 @@ function Je(s) {
2600
2611
  if (s.querySelector("textarea"))
2601
2612
  throw new Error("Property panel must not contain textarea elements");
2602
2613
  }
2603
- const Yr = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), Xr = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2614
+ const Kr = typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(globalThis) : (s) => globalThis.setTimeout(() => s(performance.now()), 16), Zr = typeof cancelAnimationFrame == "function" ? cancelAnimationFrame.bind(globalThis) : (s) => {
2604
2615
  globalThis.clearTimeout(s);
2605
2616
  };
2606
- class Wr {
2617
+ class Jr {
2607
2618
  constructor(e) {
2608
2619
  u(this, "onFlush");
2609
2620
  u(this, "requestFrame");
2610
2621
  u(this, "cancelFrame");
2611
2622
  u(this, "pending", /* @__PURE__ */ new Map());
2612
2623
  u(this, "scheduledHandle", null);
2613
- this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? Yr, this.cancelFrame = e.cancelFrame ?? Xr;
2624
+ this.onFlush = e.onFlush, this.requestFrame = e.requestFrame ?? Kr, this.cancelFrame = e.cancelFrame ?? Zr;
2614
2625
  }
2615
2626
  enqueue(e, t) {
2616
2627
  this.pending.set(e, t), this.scheduledHandle === null && (this.scheduledHandle = this.requestFrame(() => {
@@ -2634,7 +2645,7 @@ class Wr {
2634
2645
  this.pending.clear(), this.scheduledHandle !== null && (this.cancelFrame(this.scheduledHandle), this.scheduledHandle = null);
2635
2646
  }
2636
2647
  }
2637
- const Gr = `
2648
+ const Qr = `
2638
2649
  :host {
2639
2650
  display: block;
2640
2651
  width: 100%;
@@ -3504,7 +3515,7 @@ button, input { font: inherit; }
3504
3515
  .vui-infobar-content { max-width: calc(100vw - 48px); }
3505
3516
  .vui-infobar-tools .vui-info-text { max-width: min(180px, 45vw); }
3506
3517
  }
3507
- `, Kr = {
3518
+ `, es = {
3508
3519
  dark: `
3509
3520
  :host, .vui-root[data-theme="dark"] {
3510
3521
  --vui-bg: #0A0B0F;
@@ -3625,13 +3636,13 @@ function fe(s = "dark", e = {}) {
3625
3636
  hudBackground: "--vui-hud-bg"
3626
3637
  }, i = Object.entries(e).filter(([, r]) => typeof r == "string" && r.trim().length > 0).map(([r, n]) => `${t[r]}: ${n};`).join(`
3627
3638
  `);
3628
- return `${Kr[s]}${i ? `
3639
+ return `${es[s]}${i ? `
3629
3640
  :host, .vui-root[data-theme="${s}"] {
3630
3641
  ${i}
3631
3642
  }
3632
- ` : ""}${Gr}`;
3643
+ ` : ""}${Qr}`;
3633
3644
  }
3634
- const Zr = {
3645
+ const ts = {
3635
3646
  layerPanel: !0,
3636
3647
  propertyPanel: !0,
3637
3648
  hud: !0,
@@ -3641,8 +3652,8 @@ const Zr = {
3641
3652
  infobarLineMode: !0,
3642
3653
  infobarPhase: !0,
3643
3654
  infobarDebug: !0
3644
- }, Qe = "property-panel:open", et = "layer-panel:open", tt = 300, it = 180, Jr = 2;
3645
- let Qr = 0;
3655
+ }, tt = "property-panel:open", it = "layer-panel:open", rt = 300, st = 180, is = 2;
3656
+ let rs = 0;
3646
3657
  function _(s, ...e) {
3647
3658
  const t = document.createElement("div");
3648
3659
  t.className = "vui-debug-row";
@@ -3651,7 +3662,7 @@ function _(s, ...e) {
3651
3662
  const r = document.createElement("div");
3652
3663
  return r.className = "vui-debug-value", r.append(...e), t.append(i, r), t;
3653
3664
  }
3654
- function rt(s, e, t) {
3665
+ function nt(s, e, t) {
3655
3666
  const i = document.createElement("div");
3656
3667
  i.className = "vui-debug-spread";
3657
3668
  const r = document.createElement("b");
@@ -3663,11 +3674,11 @@ function rt(s, e, t) {
3663
3674
  }
3664
3675
  return i;
3665
3676
  }
3666
- function st(s) {
3677
+ function at(s) {
3667
3678
  const e = document.createElement("div");
3668
3679
  return e.className = "vui-debug-spread-list", e.append(...s), e;
3669
3680
  }
3670
- function es(s, e) {
3681
+ function ss(s, e) {
3671
3682
  switch (s) {
3672
3683
  case "created":
3673
3684
  return e.t("status.created");
@@ -3685,7 +3696,7 @@ function es(s, e) {
3685
3696
  return "";
3686
3697
  }
3687
3698
  }
3688
- function nt(s) {
3699
+ function ot(s) {
3689
3700
  return (typeof s.composedPath == "function" ? s.composedPath() : [s.target]).some((t) => {
3690
3701
  var a, o;
3691
3702
  if (!t || typeof t != "object") return !1;
@@ -3695,11 +3706,11 @@ function nt(s) {
3695
3706
  return n === "" || n === "true" || n === "plaintext-only";
3696
3707
  });
3697
3708
  }
3698
- class ts {
3709
+ class ns {
3699
3710
  constructor(e, t) {
3700
3711
  u(this, "parts");
3701
3712
  u(this, "text");
3702
- u(this, "layerPanelState", new kr());
3713
+ u(this, "layerPanelState", new Mr());
3703
3714
  u(this, "shadow", null);
3704
3715
  u(this, "layerPanelRefs", null);
3705
3716
  u(this, "propertyPanelRefs", null);
@@ -3731,32 +3742,32 @@ class ts {
3731
3742
  u(this, "activeLayerColorPreview", null);
3732
3743
  u(this, "renderedLayerRows", null);
3733
3744
  u(this, "handleKeyDown", (e) => {
3734
- if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || nt(e)) return;
3745
+ if (this.disposed || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || ot(e)) return;
3735
3746
  const t = this.getFitShortcut();
3736
3747
  t && e.key.toLowerCase() === t.toLowerCase() && this.host.fitSelectionOrDocument();
3737
3748
  });
3738
3749
  u(this, "handleKeyboardTargetPointerDown", (e) => {
3739
3750
  var t, i;
3740
- this.disposed || nt(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
3751
+ this.disposed || ot(e) || (i = (t = this.keyboardTarget) == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
3741
3752
  });
3742
3753
  u(this, "unsubscribers", []);
3743
3754
  u(this, "filterCleanup", null);
3744
3755
  u(this, "disposed", !1);
3745
3756
  u(this, "persistenceNamespace");
3746
- u(this, "insertToggleScheduler", new Wr({
3757
+ u(this, "insertToggleScheduler", new Jr({
3747
3758
  onFlush: (e) => {
3748
3759
  this.host.cad.blocks.batchToggleInserts(e);
3749
3760
  }
3750
3761
  }));
3751
3762
  u(this, "refresh", () => {
3752
- this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (Ze(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
3763
+ this.disposed || !this.active || (this.syncToolbarState(), this.renderLayerPanel(), this.propertyPanelRefs && this.parts.propertyPanel && (Qe(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview()), this.syncHud());
3753
3764
  });
3754
3765
  u(this, "syncHud", () => {
3755
3766
  var e;
3756
3767
  if (!(this.disposed || !this.active)) {
3757
3768
  if (this.infobarRefs && this.parts.hud) {
3758
3769
  const t = this.host.cad.hud;
3759
- 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 ? es(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
3770
+ this.infobarRefs.file.textContent = t.filename ?? "", this.infobarRefs.file.title = t.filename ?? "", this.infobarRefs.file.hidden = !t.filename, this.infobarRefs.zoom.textContent = t.zoomLabel ? this.text.t("toolbar.zoom", { value: t.zoomLabel }) : "", this.infobarRefs.zoom.hidden = !t.zoomLabel, this.infobarRefs.vertices.textContent = t.viewportVertexCount > 0 ? this.text.t("toolbar.vertices", { value: this.text.formatInteger(t.viewportVertexCount) }) : "", this.infobarRefs.vertices.hidden = t.viewportVertexCount <= 0, this.infobarRefs.drawCalls.textContent = t.drawCalls > 0 ? this.text.t("toolbar.drawCalls", { value: this.text.formatInteger(t.drawCalls) }) : "", this.infobarRefs.drawCalls.hidden = t.drawCalls <= 0, this.infobarRefs.lineMode.textContent = this.parts.infobarLineMode && t.lineRenderMode ? this.text.t("toolbar.lineMode", { value: t.lineRenderMode.toUpperCase() }) : "", this.infobarRefs.lineMode.hidden = !this.infobarRefs.lineMode.textContent, this.infobarRefs.phase.textContent = this.parts.infobarPhase ? ss(t.phase, this.text) : "", this.infobarRefs.phase.hidden = !this.infobarRefs.phase.textContent;
3760
3771
  const i = Math.round(t.fps);
3761
3772
  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);
3762
3773
  const r = t.blockVariantCount > 0 || t.splitBlockLayerGroupCount > 0 || t.entityCount > 0;
@@ -3767,7 +3778,7 @@ class ts {
3767
3778
  blocks: this.text.formatInteger(t.blockVariantCount),
3768
3779
  split: this.text.formatInteger(t.splitBlockLayerGroupCount)
3769
3780
  });
3770
- const n = t.renderDebugBreakdown.map((d) => rt(
3781
+ const n = t.renderDebugBreakdown.map((d) => nt(
3771
3782
  d.label,
3772
3783
  this.text.t("toolbar.debug.breakdown", {
3773
3784
  renderables: this.text.formatInteger(d.renderables),
@@ -3779,8 +3790,8 @@ class ts {
3779
3790
  calls: this.text.formatInteger(t.drawCalls)
3780
3791
  })
3781
3792
  ];
3782
- n.length > 0 && a.push(st(n));
3783
- const o = t.splitBlockLayerDetails.map((d) => rt(
3793
+ n.length > 0 && a.push(at(n));
3794
+ const o = t.splitBlockLayerDetails.map((d) => nt(
3784
3795
  `${d.blockName} #${d.variantId}`,
3785
3796
  this.text.t("toolbar.debug.spreadMeta", {
3786
3797
  layers: this.text.formatInteger(d.layerCount),
@@ -3797,7 +3808,7 @@ class ts {
3797
3808
  const l = [this.text.t("toolbar.debug.splitLayerCount", {
3798
3809
  count: this.text.formatInteger(t.splitBlockLayerGroupCount)
3799
3810
  })];
3800
- o.length > 0 && l.push(st(o)), this.infobarRefs.debugBody.replaceChildren(
3811
+ o.length > 0 && l.push(at(o)), this.infobarRefs.debugBody.replaceChildren(
3801
3812
  _("" + this.text.t("toolbar.debug.submitted"), this.text.formatInteger(t.submittedVertexRefs)),
3802
3813
  ...t.lineRenderMode ? [_(this.text.t("toolbar.debug.lineMode"), t.lineRenderMode.toUpperCase())] : [],
3803
3814
  _(this.text.t("toolbar.debug.layers"), this.text.t("toolbar.debug.layerCount", {
@@ -3817,7 +3828,7 @@ class ts {
3817
3828
  const t = this.host.cad.hud, i = t.fileCount > 0 ? this.text.t("toolbar.layerSummary", {
3818
3829
  visible: this.text.formatInteger(t.visibleLayerCount),
3819
3830
  total: this.text.formatInteger(t.totalLayerCount)
3820
- }) : "", r = Tr(t.statusMessage, this.text);
3831
+ }) : "", r = Nr(t.statusMessage, this.text);
3821
3832
  this.toolbarInfoText.textContent = i && r ? `${i} | ${r}` : i || r;
3822
3833
  }
3823
3834
  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(
@@ -3828,7 +3839,7 @@ class ts {
3828
3839
  }
3829
3840
  });
3830
3841
  var i, r, n, a;
3831
- this.host = e, this.options = t, this.parts = { ...Zr, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = Rt({ ...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-${++Qr}`;
3842
+ this.host = e, this.options = t, this.parts = { ...ts, ...(i = t.cad) == null ? void 0 : i.parts }, this.themeValue = t.theme ?? "dark", this.text = Tt({ ...t, unitFormatter: (r = t.cad) == null ? void 0 : r.unitFormatter }), this.persistenceNamespace = ((a = (n = t.cad) == null ? void 0 : n.persistenceKey) == null ? void 0 : a.trim()) || t.root.id.trim() || `instance-${++rs}`;
3832
3843
  }
3833
3844
  mount() {
3834
3845
  var o, l;
@@ -3927,9 +3938,9 @@ class ts {
3927
3938
  d.type = "button", d.className = "vui-btn", d.textContent = this.text.t("layer.hideAll"), d.addEventListener("click", () => this.host.cad.layers.hideAll());
3928
3939
  const c = document.createElement("button");
3929
3940
  c.type = "button", c.className = "vui-btn", c.textContent = this.text.t("layer.collapse"), c.title = this.text.t("layer.collapseTitle"), c.addEventListener("click", () => {
3930
- var b;
3931
- const m = (b = this.host.cad.inspector.selection) == null ? void 0 : b.id, v = m ? `${m.layerIndex}:${m.variantId}:${m.instanceId}` : null;
3932
- this.layerPanelState.collapseAll(v), this.refresh();
3941
+ var m;
3942
+ const v = (m = this.host.cad.inspector.selection) == null ? void 0 : m.id, y = v ? `${v.layerIndex}:${v.variantId}:${v.instanceId}` : null;
3943
+ this.layerPanelState.collapseAll(y), this.refresh();
3933
3944
  }), o.append(l, d, c);
3934
3945
  const p = document.createElement("div");
3935
3946
  p.className = "vui-section-list", i.append(r, n, o, p), t.appendChild(i), this.layerPanelRefs = {
@@ -3964,12 +3975,12 @@ class ts {
3964
3975
  const a = document.createElement("span");
3965
3976
  if (a.className = "vui-info-text", this.toolbarInfoText = a, n.appendChild(a), this.parts.fit) {
3966
3977
  this.btnFit = document.createElement("button"), this.btnFit.type = "button", this.btnFit.className = "vui-btn";
3967
- const b = this.getFitShortcut();
3968
- this.btnFit.innerHTML = b ? `${I(this.text.t("toolbar.fit"))} <span class="vui-kbd">${I(b.toUpperCase())}</span>` : I(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
3978
+ const m = this.getFitShortcut();
3979
+ this.btnFit.innerHTML = m ? `${I(this.text.t("toolbar.fit"))} <span class="vui-kbd">${I(m.toUpperCase())}</span>` : I(this.text.t("toolbar.fit")), this.btnFit.addEventListener("click", () => this.host.fitSelectionOrDocument()), n.appendChild(this.btnFit);
3969
3980
  }
3970
3981
  if (this.parts.viewMode) {
3971
- const b = document.createElement("div");
3972
- b.className = "vui-view-toggle", b.setAttribute("role", "group"), b.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")), b.append(this.btnView2d, this.btnView3d), n.appendChild(b);
3982
+ const m = document.createElement("div");
3983
+ 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);
3973
3984
  }
3974
3985
  const o = document.createElement("span");
3975
3986
  o.className = "vui-seg";
@@ -3985,10 +3996,10 @@ class ts {
3985
3996
  h.className = "vui-fps";
3986
3997
  const f = document.createElement("details");
3987
3998
  f.className = "vui-debug-card";
3988
- const m = document.createElement("summary");
3989
- m.className = "vui-debug-summary", m.textContent = this.text.t("toolbar.details");
3990
- const v = document.createElement("div");
3991
- return v.className = "vui-debug-body", f.append(m, v), i.append(r, n, o, l, d, c, p, h, f), e.append(t, i), this.infobarRefs = {
3999
+ const v = document.createElement("summary");
4000
+ v.className = "vui-debug-summary", v.textContent = this.text.t("toolbar.details");
4001
+ const y = document.createElement("div");
4002
+ 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 = {
3992
4003
  infobar: e,
3993
4004
  file: r,
3994
4005
  tools: n,
@@ -3999,8 +4010,8 @@ class ts {
3999
4010
  phase: p,
4000
4011
  fps: h,
4001
4012
  debugCard: f,
4002
- debugSummary: m,
4003
- debugBody: v
4013
+ debugSummary: v,
4014
+ debugBody: y
4004
4015
  }, this.infobar = e, this.infobarToggle = t, e;
4005
4016
  }
4006
4017
  buildPropertyPanel() {
@@ -4022,8 +4033,8 @@ class ts {
4022
4033
  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;
4023
4034
  }
4024
4035
  bindEvents() {
4025
- this.layerPanelRefs && (this.filterCleanup = Ur(this.layerPanelRefs.filterInput, (e) => {
4026
- this.layerPanelState.filterText = e, this.layerPanelRefs && Nr(this.layerPanelRefs.list, e);
4036
+ this.layerPanelRefs && (this.filterCleanup = Yr(this.layerPanelRefs.filterInput, (e) => {
4037
+ this.layerPanelState.filterText = e, this.layerPanelRefs && Br(this.layerPanelRefs.list, e);
4027
4038
  })), this.unsubscribers.push(
4028
4039
  this.host.cad.on("document-change", () => this.refresh()),
4029
4040
  this.host.cad.on("layer-change", () => this.syncLayerChange()),
@@ -4031,9 +4042,9 @@ class ts {
4031
4042
  this.host.cad.on("inspector-change", () => {
4032
4043
  if (this.layerPanelRefs && this.parts.layerPanel) {
4033
4044
  const e = this.host.cad.inspector.selection, t = e == null ? void 0 : e.id, i = t ? `${t.layerIndex}:${t.variantId}:${t.instanceId}` : null;
4034
- i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : Vr(this.layerPanelRefs.list, e);
4045
+ i && this.layerPanelState.needsSelectionReveal(i) ? this.renderLayerPanel() : _r(this.layerPanelRefs.list, e);
4035
4046
  }
4036
- this.propertyPanelRefs && this.parts.propertyPanel && (Ze(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4047
+ this.propertyPanelRefs && this.parts.propertyPanel && (Qe(this.propertyPanelRefs, this.host.cad.inspector, this.text, this.getCadUnit()), this.syncPropertyPanelSelectionState(), this.syncPropertyPanelPreview());
4037
4048
  }),
4038
4049
  this.host.cad.on("hud-change", () => this.syncHud()),
4039
4050
  this.host.on("view-mode-change", () => {
@@ -4092,7 +4103,7 @@ class ts {
4092
4103
  return !!(e && e.isConnected && ((t = this.layerPanelRefs) != null && t.list.contains(e)));
4093
4104
  }
4094
4105
  renderLayerPanel() {
4095
- !this.layerPanelRefs || !this.parts.layerPanel || ($r(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4106
+ !this.layerPanelRefs || !this.parts.layerPanel || (jr(this.layerPanelRefs, this.layerPanelState, this.createLayerPanelActions()), this.renderedLayerRows = this.host.cad.layers.rows);
4096
4107
  }
4097
4108
  syncLayerChange() {
4098
4109
  if (!this.isLayerColorPreviewActive()) {
@@ -4100,7 +4111,7 @@ class ts {
4100
4111
  this.refresh();
4101
4112
  return;
4102
4113
  }
4103
- Fr(
4114
+ Ur(
4104
4115
  this.layerPanelRefs.list,
4105
4116
  this.host.cad.layers.rows,
4106
4117
  this.host.cad.layers.allColor,
@@ -4122,7 +4133,7 @@ class ts {
4122
4133
  var e;
4123
4134
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !1;
4124
4135
  try {
4125
- return this.readState(Qe) === "1";
4136
+ return this.readState(tt) === "1";
4126
4137
  } catch {
4127
4138
  return !1;
4128
4139
  }
@@ -4131,7 +4142,7 @@ class ts {
4131
4142
  var e;
4132
4143
  if (((e = this.options.cad) == null ? void 0 : e.persistence) === !1) return !0;
4133
4144
  try {
4134
- return this.readState(et) !== "0";
4145
+ return this.readState(it) !== "0";
4135
4146
  } catch {
4136
4147
  return !0;
4137
4148
  }
@@ -4144,7 +4155,7 @@ class ts {
4144
4155
  panel: this.text.t("panel.layers")
4145
4156
  })), !!t && (this.emitUiLayoutChange(), ((n = this.options.cad) == null ? void 0 : n.persistence) !== !1)))
4146
4157
  try {
4147
- this.writeState(et, e ? "1" : "0");
4158
+ this.writeState(it, e ? "1" : "0");
4148
4159
  } catch {
4149
4160
  }
4150
4161
  }
@@ -4160,7 +4171,7 @@ class ts {
4160
4171
  panel: this.text.t("panel.properties")
4161
4172
  })), (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)))
4162
4173
  try {
4163
- this.writeState(Qe, e ? "1" : "0");
4174
+ this.writeState(tt, e ? "1" : "0");
4164
4175
  } catch {
4165
4176
  }
4166
4177
  }
@@ -4258,7 +4269,7 @@ class ts {
4258
4269
  return (t = this.propertyPanelShell) != null && t.classList.contains("closed") ? !0 : !this.isPropertyPreviewLayoutReady(e);
4259
4270
  }
4260
4271
  isPropertyPreviewLayoutReady(e) {
4261
- return e.clientWidth >= it && e.clientHeight >= it;
4272
+ return e.clientWidth >= st && e.clientHeight >= st;
4262
4273
  }
4263
4274
  waitForPropertyPreviewLayout(e) {
4264
4275
  if (this.isPropertyPreviewLayoutReady(e)) return Promise.resolve();
@@ -4268,37 +4279,37 @@ class ts {
4268
4279
  const l = [], d = [];
4269
4280
  let c = 0;
4270
4281
  const p = () => {
4271
- for (const y of l) window.clearTimeout(y);
4272
- for (const y of d) y();
4273
- window.clearTimeout(b), c !== 0 && cancelAnimationFrame(c), this.propertyPreviewLayoutWaitAbort = null;
4282
+ for (const b of l) window.clearTimeout(b);
4283
+ for (const b of d) b();
4284
+ window.clearTimeout(m), c !== 0 && cancelAnimationFrame(c), this.propertyPreviewLayoutWaitAbort = null;
4274
4285
  }, h = () => {
4275
4286
  n || (n = !0, p(), r());
4276
4287
  }, f = () => {
4277
- const y = e.clientWidth;
4288
+ const b = e.clientWidth;
4278
4289
  if (!this.isPropertyPreviewLayoutReady(e)) {
4279
4290
  a = 0, o = -1;
4280
4291
  return;
4281
4292
  }
4282
- if (y === o) {
4283
- a += 1, a >= Jr && h();
4293
+ if (b === o) {
4294
+ a += 1, a >= is && h();
4284
4295
  return;
4285
4296
  }
4286
- o = y, a = 0;
4287
- }, m = (y) => {
4288
- if (!is(y)) return;
4297
+ o = b, a = 0;
4298
+ }, v = (b) => {
4299
+ if (!as(b)) return;
4289
4300
  let g = !1;
4290
- const x = (k) => {
4291
- k.target !== y || k.propertyName !== "width" || w();
4301
+ const x = (C) => {
4302
+ C.target !== b || C.propertyName !== "width" || w();
4292
4303
  }, w = () => {
4293
- g || (g = !0, y.removeEventListener("transitionend", x), requestAnimationFrame(f));
4304
+ g || (g = !0, b.removeEventListener("transitionend", x), requestAnimationFrame(f));
4294
4305
  };
4295
- y.addEventListener("transitionend", x), l.push(window.setTimeout(w, tt)), d.push(() => {
4296
- g || (g = !0, y.removeEventListener("transitionend", x));
4306
+ b.addEventListener("transitionend", x), l.push(window.setTimeout(w, rt)), d.push(() => {
4307
+ g || (g = !0, b.removeEventListener("transitionend", x));
4297
4308
  });
4298
- }, v = () => {
4299
- f(), n || (c = requestAnimationFrame(v));
4300
- }, b = window.setTimeout(h, tt);
4301
- m(i), m(t), c = requestAnimationFrame(v), this.propertyPreviewLayoutWaitAbort = () => {
4309
+ }, y = () => {
4310
+ f(), n || (c = requestAnimationFrame(y));
4311
+ }, m = window.setTimeout(h, rt);
4312
+ v(i), v(t), c = requestAnimationFrame(y), this.propertyPreviewLayoutWaitAbort = () => {
4302
4313
  n = !0, p();
4303
4314
  };
4304
4315
  });
@@ -4315,7 +4326,7 @@ class ts {
4315
4326
  this.propertyPreviewRenderHandle !== null && (cancelAnimationFrame(this.propertyPreviewRenderHandle), this.propertyPreviewRenderHandle = null), (e = this.propertyPreviewLayoutWaitAbort) == null || e.call(this), this.propertyPreviewLayoutWaitAbort = null;
4316
4327
  }
4317
4328
  }
4318
- function is(s) {
4329
+ function as(s) {
4319
4330
  const e = getComputedStyle(s), t = e.transitionDuration.split(",").map((r) => r.trim()), i = e.transitionProperty.split(",").map((r) => r.trim());
4320
4331
  for (let r = 0; r < i.length; r += 1) {
4321
4332
  const n = i[r] ?? i[0] ?? "all";
@@ -4324,8 +4335,8 @@ function is(s) {
4324
4335
  }
4325
4336
  return !1;
4326
4337
  }
4327
- const rs = ["left", "right", "top", "bottom"], te = 0.5, ss = /* @__PURE__ */ new Set(["cad", "scene"]);
4328
- class ns {
4338
+ const os = ["left", "right", "top", "bottom"], te = 0.5, ls = /* @__PURE__ */ new Set(["cad", "scene"]);
4339
+ class ds {
4329
4340
  constructor(e) {
4330
4341
  u(this, "zoneContainers", /* @__PURE__ */ new Map());
4331
4342
  u(this, "mounts", /* @__PURE__ */ new Set());
@@ -4335,7 +4346,7 @@ class ns {
4335
4346
  u(this, "flags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4336
4347
  u(this, "lastInsets", Object.freeze({ top: 0, right: 0, bottom: 0, left: 0 }));
4337
4348
  u(this, "lastFlags", { layerPanelOpen: !1, propertyPanelOpen: !1 });
4338
- u(this, "activeGroups", ss);
4349
+ u(this, "activeGroups", ls);
4339
4350
  u(this, "warnedUnstableReference", !1);
4340
4351
  u(this, "disposed", !1);
4341
4352
  u(this, "frameHandle", null);
@@ -4345,7 +4356,7 @@ class ns {
4345
4356
  const t = this.canMeasure();
4346
4357
  this.resizeObserver = t && typeof ResizeObserver == "function" ? new ResizeObserver(() => this.schedule()) : null, t && typeof globalThis.window < "u" && globalThis.window.addEventListener("resize", this.handleWindowResize);
4347
4358
  const i = this.host.reference(), r = this.host.target();
4348
- i && O(i) && ((n = this.resizeObserver) == null || n.observe(i)), r && r !== i && O(r) && ((a = this.resizeObserver) == null || a.observe(r));
4359
+ i && z(i) && ((n = this.resizeObserver) == null || n.observe(i)), r && r !== i && z(r) && ((a = this.resizeObserver) == null || a.observe(r));
4349
4360
  }
4350
4361
  mountBuiltin(e, t) {
4351
4362
  return this.mountNode(e, t.zone, !0, t.group);
@@ -4382,7 +4393,7 @@ class ns {
4382
4393
  }
4383
4394
  canMeasure() {
4384
4395
  const e = this.host.reference();
4385
- return !!(e && O(e) && typeof e.getBoundingClientRect == "function");
4396
+ return !!(e && z(e) && typeof e.getBoundingClientRect == "function");
4386
4397
  }
4387
4398
  dispose() {
4388
4399
  var e;
@@ -4399,10 +4410,10 @@ class ns {
4399
4410
  const n = me(t, i, r), a = this.ensureZoneContainer(t, i, r);
4400
4411
  a.append(e);
4401
4412
  const o = { node: e, zone: t, builtin: i, group: r, container: a, key: n };
4402
- return this.mounts.add(o), O(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
4413
+ return this.mounts.add(o), z(e) && ((l = this.resizeObserver) == null || l.observe(e)), this.schedule(), {
4403
4414
  dispose: () => {
4404
4415
  var d, c;
4405
- this.mounts.delete(o) && (O(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());
4416
+ 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());
4406
4417
  }
4407
4418
  };
4408
4419
  }
@@ -4426,7 +4437,7 @@ class ns {
4426
4437
  installZoneStyles(e, t) {
4427
4438
  if (!e || typeof e.querySelector != "function" || typeof e.prepend != "function" || e.querySelector(`style[data-viewer-layout="${t}"]`)) return;
4428
4439
  const i = document.createElement("style");
4429
- i.dataset.viewerLayout = t, i.textContent = ls, e.append(i), this.installedStyles.push(i), O(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
4440
+ i.dataset.viewerLayout = t, i.textContent = hs, e.append(i), this.installedStyles.push(i), z(e) && (e.dataset.viewerLayoutHost = "", typeof getComputedStyle == "function" && getComputedStyle(e).position === "static" && (e.style.position = "relative"));
4430
4441
  }
4431
4442
  schedule() {
4432
4443
  if (!(this.disposed || this.frameHandle !== null)) {
@@ -4443,7 +4454,7 @@ class ns {
4443
4454
  if (this.disposed) return;
4444
4455
  const e = this.host.reference(), t = this.host.target();
4445
4456
  if (!e || typeof e.getBoundingClientRect != "function") return;
4446
- const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !os(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
4457
+ const i = e.getBoundingClientRect(), r = this.computeInsets(i), n = !us(r, this.lastInsets), a = this.flags.layerPanelOpen !== this.lastFlags.layerPanelOpen || this.flags.propertyPanelOpen !== this.lastFlags.propertyPanelOpen;
4447
4458
  !n && !a || (this.lastInsets = r, this.lastFlags = { ...this.flags }, n && this.assertStableReference(e, t) && this.applyInsets(t, r), this.host.onChange(r, this.lastFlags));
4448
4459
  }
4449
4460
  applyInsets(e, t) {
@@ -4462,9 +4473,9 @@ class ns {
4462
4473
  }
4463
4474
  for (const i of this.zoneContainers.values()) {
4464
4475
  const r = i.dataset.viewerZone;
4465
- if (!(!r || !rs.includes(r) || !this.isZoneVisible(i)))
4476
+ if (!(!r || !os.includes(r) || !this.isZoneVisible(i)))
4466
4477
  for (const n of Array.from(i.children)) {
4467
- if (!as(n)) continue;
4478
+ if (!cs(n)) continue;
4468
4479
  const a = n.getBoundingClientRect();
4469
4480
  this.accumulateInset(
4470
4481
  t,
@@ -4494,17 +4505,17 @@ class ns {
4494
4505
  return !t || this.activeGroups.has(t);
4495
4506
  }
4496
4507
  assertStableReference(e, t) {
4497
- return !t || t === e || !O(e) || !O(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);
4508
+ 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);
4498
4509
  }
4499
4510
  }
4500
4511
  function me(s, e, t) {
4501
4512
  return `${e ? "builtin" : "plugin"}:${t ?? ""}:${s}`;
4502
4513
  }
4503
- function O(s) {
4514
+ function z(s) {
4504
4515
  return !!(s && typeof s == "object" && s.nodeType === 1);
4505
4516
  }
4506
- function as(s) {
4507
- if (!O(s) || s.hidden) return !1;
4517
+ function cs(s) {
4518
+ if (!z(s) || s.hidden) return !1;
4508
4519
  const e = typeof getComputedStyle == "function" ? getComputedStyle(s) : null;
4509
4520
  return !(e && (e.display === "none" || e.visibility === "hidden"));
4510
4521
  }
@@ -4513,10 +4524,10 @@ function ie(s, e) {
4513
4524
  const t = e > 0 ? Math.min(s, e) : s;
4514
4525
  return Math.max(0, Math.round(t * 2) / 2);
4515
4526
  }
4516
- function os(s, e) {
4527
+ function us(s, e) {
4517
4528
  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;
4518
4529
  }
4519
- const ls = `
4530
+ const hs = `
4520
4531
  [data-viewer-zone] { position: absolute; pointer-events: none; z-index: 1; }
4521
4532
  [data-viewer-zone] > * { pointer-events: auto; }
4522
4533
  [data-viewer-zone="left"] { left: 0; top: 0; bottom: 0; }
@@ -4525,7 +4536,7 @@ const ls = `
4525
4536
  [data-viewer-zone="bottom"] { left: 0; right: 0; bottom: 0; }
4526
4537
  [data-viewer-zone="overlay"] { inset: 0; }
4527
4538
  [data-viewer-zone][data-viewer-zone-active="false"] { display: none; }
4528
- `, ds = {
4539
+ `, ps = {
4529
4540
  play: '<path d="m8 5 11 7-11 7Z"/>',
4530
4541
  pause: '<path d="M8 5v14M16 5v14"/>',
4531
4542
  reset: '<path d="M3 10a9 9 0 1 1 2.5 8M3 4v6h6"/>',
@@ -4539,10 +4550,10 @@ const ls = `
4539
4550
  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"/>',
4540
4551
  moon: '<path d="M20.5 13A9 9 0 0 1 11 3.5 9 9 0 1 0 20.5 13Z"/>'
4541
4552
  };
4542
- function zt(s) {
4543
- 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">${ds[s]}</svg>`;
4553
+ function Vt(s) {
4554
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${ps[s]}</svg>`;
4544
4555
  }
4545
- const cs = {
4556
+ const fs = {
4546
4557
  filename: !0,
4547
4558
  playback: !0,
4548
4559
  reset: !0,
@@ -4552,75 +4563,75 @@ const cs = {
4552
4563
  collision: !0,
4553
4564
  theme: !0
4554
4565
  };
4555
- function us(s, e) {
4556
- const t = { ...cs, ...e.parts }, i = document.createElement("nav");
4566
+ function ms(s, e) {
4567
+ const t = { ...fs, ...e.parts }, i = document.createElement("nav");
4557
4568
  i.className = "vpu-toolbar", i.dataset.theme = e.theme ?? "dark", i.setAttribute("aria-label", e.label);
4558
4569
  const r = document.createElement("span");
4559
4570
  r.className = "vpu-filename", r.hidden = !0;
4560
4571
  const n = document.createElement("div");
4561
4572
  n.className = "vpu-actions", i.append(r, n);
4562
4573
  const a = /* @__PURE__ */ new Map();
4563
- let o = null, l = null, d = e.theme ?? "dark", c = null;
4564
- const p = (v, b, y, g, x) => {
4565
- const w = document.createElement("button");
4566
- return w.type = "button", w.className = "vpu-btn", w.dataset.viewerControl = b, w.dataset.viewerControlId = v, w.innerHTML = zt(g), w.title = y, w.setAttribute("aria-label", y), w.addEventListener("click", x), a.set(v, { button: w, icon: g }), n.append(w), w;
4567
- }, h = (v, b) => v ? b === "filename" ? t.filename : b === "playback" ? t.playback && v.canPlay : b === "reset" ? t.reset && v.canReset : b === "fit" ? t.fit : b === "upAxis" ? t.upAxis && v.canReorientUpAxis === !0 : b === "ground" ? t.ground && v.canToggleGround === !0 : b === "collision" ? t.collision && v.canToggleCollision === !0 : t.theme : !1, f = (v) => {
4568
- var y, g, x;
4569
- c = v, n.replaceChildren(), a.clear(), o = null, l = null;
4570
- const b = (v == null ? void 0 : v.capabilities) ?? null;
4571
- if (r.hidden = !(t.filename && (v != null && v.filename)), r.textContent = (v == null ? void 0 : v.filename) ?? "", r.title = (v == null ? void 0 : v.filename) ?? "", v && h(b, "playback")) {
4572
- const w = "playback";
4573
- l = w;
4574
- const k = p(w, "playback", "运行仿真", "play", () => {
4574
+ let o = null, l = null, d = { play: "运行仿真", pause: "暂停仿真", reset: "重置仿真" }, c = e.theme ?? "dark", p = null;
4575
+ const h = (m, b, g, x, w) => {
4576
+ const C = document.createElement("button");
4577
+ return C.type = "button", C.className = "vpu-btn", C.dataset.viewerControl = b, C.dataset.viewerControlId = m, C.innerHTML = Vt(x), C.title = g, C.setAttribute("aria-label", g), C.addEventListener("click", w), a.set(m, { button: C, icon: x }), n.append(C), C;
4578
+ }, f = (m, b) => m ? b === "filename" ? t.filename : b === "playback" ? t.playback && m.canPlay : b === "reset" ? t.reset && m.canReset : b === "fit" ? t.fit : b === "upAxis" ? t.upAxis && m.canReorientUpAxis === !0 : b === "ground" ? t.ground && m.canToggleGround === !0 : b === "collision" ? t.collision && m.canToggleCollision === !0 : t.theme : !1, v = (m) => {
4579
+ var g, x, w;
4580
+ p = m, n.replaceChildren(), a.clear(), o = null, l = null;
4581
+ const b = (m == null ? void 0 : m.capabilities) ?? null;
4582
+ 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")) {
4583
+ const C = "playback";
4584
+ l = C;
4585
+ const D = h(C, "playback", d.play, "play", () => {
4575
4586
  s.asset.$readControl().playing ? s.commands.pause() : s.commands.play();
4576
4587
  });
4577
- k.className = "vpu-btn vpu-btn-primary";
4588
+ D.className = "vpu-btn vpu-btn-primary";
4578
4589
  }
4579
- if ((v == null ? void 0 : v.kind) === "simulation" && v.phase === "ready" && t.playback && !(b != null && b.canPlay) && (((y = v.physics) == null ? void 0 : y.status) === "unavailable" || !v.physics && ((g = v.warning) == null ? void 0 : g.stage) === "physics-fallback")) {
4580
- const w = ((x = v.physics) == null ? void 0 : x.status) === "unavailable" ? v.physics.issue.message : v.warning.message, k = p("playback", "playback", w, "play", () => {
4590
+ 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")) {
4591
+ const C = ((w = m.physics) == null ? void 0 : w.status) === "unavailable" ? m.physics.issue.message : m.warning.message, D = h("playback", "playback", C, "play", () => {
4581
4592
  });
4582
- k.setAttribute("aria-disabled", "true"), k.className = "vpu-btn vpu-btn-primary";
4593
+ D.setAttribute("aria-disabled", "true"), D.className = "vpu-btn vpu-btn-primary";
4583
4594
  }
4584
- if (v && h(b, "reset") && p("reset", "reset", "重置仿真", "reset", () => {
4595
+ if (m && f(b, "reset") && h("reset", "reset", d.reset, "reset", () => {
4585
4596
  s.commands.reset();
4586
- }), v && h(b, "fit") && p("fit", "fit", "视角适应", "fit", () => {
4597
+ }), m && f(b, "fit") && h("fit", "fit", "视角适应", "fit", () => {
4587
4598
  s.commands.fitView();
4588
- }), v && h(b, "upAxis") && (o = "切换上轴", p("upAxis", "upAxis", o, "upAxisZ", () => {
4589
- const w = s.asset.$readControl().upAxis ?? "z";
4590
- s.commands.setUpAxis(w === "z" ? "y" : "z");
4591
- })), v && h(b, "ground") && p("ground", "ground", "显示地面", "ground", () => {
4592
- const w = s.asset.$readControl().groundVisible;
4593
- s.commands.setGroundVisible(!w);
4594
- }), v && h(b, "collision") && p("collision", "collision", "显示碰撞代理", "collision", () => {
4595
- const w = s.asset.$readControl().collisionVisible;
4596
- s.commands.setCollisionVisible(!w);
4597
- }), v && h(b, "theme")) {
4598
- const w = d === "dark";
4599
- p(
4599
+ }), m && f(b, "upAxis") && (o = "切换上轴", h("upAxis", "upAxis", o, "upAxisZ", () => {
4600
+ const C = s.asset.$readControl().upAxis ?? "z";
4601
+ s.commands.setUpAxis(C === "z" ? "y" : "z");
4602
+ })), m && f(b, "ground") && h("ground", "ground", "显示地面", "ground", () => {
4603
+ const C = s.asset.$readControl().groundVisible;
4604
+ s.commands.setGroundVisible(!C);
4605
+ }), m && f(b, "collision") && h("collision", "collision", "显示碰撞代理", "collision", () => {
4606
+ const C = s.asset.$readControl().collisionVisible;
4607
+ s.commands.setCollisionVisible(!C);
4608
+ }), m && f(b, "theme")) {
4609
+ const C = c === "dark";
4610
+ h(
4600
4611
  "theme",
4601
4612
  "theme",
4602
- w ? "切换浅色主题" : "切换深色主题",
4603
- w ? "sun" : "moon",
4604
- () => s.commands.setTheme(d === "dark" ? "light" : "dark")
4613
+ C ? "切换浅色主题" : "切换深色主题",
4614
+ C ? "sun" : "moon",
4615
+ () => s.commands.setTheme(c === "dark" ? "light" : "dark")
4605
4616
  );
4606
4617
  }
4607
- i.hidden = n.childElementCount === 0 && r.hidden, m(s.asset.$readControl());
4608
- }, m = (v) => {
4618
+ i.hidden = n.childElementCount === 0 && r.hidden, y(s.asset.$readControl());
4619
+ }, y = (m) => {
4609
4620
  const b = l ? a.get(l) : void 0;
4610
- b && (re(b.button, v.playing ? "暂停仿真" : "运行仿真", v.playing ? "pause" : "play", v.playing), b.icon = v.playing ? "pause" : "play");
4611
- const y = a.get("ground");
4612
- y && re(y.button, v.groundVisible ? "隐藏地面" : "显示地面", "ground", v.groundVisible);
4613
- const g = a.get("collision");
4614
- g && re(g.button, v.collisionVisible ? "隐藏碰撞代理" : "显示碰撞代理", "collision", v.collisionVisible);
4615
- const x = a.get("upAxis");
4616
- x && re(x.button, ps(v.upAxis), hs(v.upAxis), v.upAxis === "y");
4621
+ b && (re(b.button, m.playing ? d.pause : d.play, m.playing ? "pause" : "play", m.playing), b.icon = m.playing ? "pause" : "play");
4622
+ const g = a.get("ground");
4623
+ g && re(g.button, m.groundVisible ? "隐藏地面" : "显示地面", "ground", m.groundVisible);
4624
+ const x = a.get("collision");
4625
+ x && re(x.button, m.collisionVisible ? "隐藏碰撞代理" : "显示碰撞代理", "collision", m.collisionVisible);
4626
+ const w = a.get("upAxis");
4627
+ w && re(w.button, gs(m.upAxis), vs(m.upAxis), m.upAxis === "y");
4617
4628
  };
4618
4629
  return {
4619
4630
  element: i,
4620
- update: (v) => f(v),
4621
- pressedChanged: () => m(s.asset.$readControl()),
4622
- themeChanged: (v) => {
4623
- d = v, i.dataset.theme = v, f(c);
4631
+ update: (m) => v(m),
4632
+ pressedChanged: () => y(s.asset.$readControl()),
4633
+ themeChanged: (m) => {
4634
+ c = m, i.dataset.theme = m, v(p);
4624
4635
  },
4625
4636
  dispose: () => {
4626
4637
  i.remove();
@@ -4628,15 +4639,15 @@ function us(s, e) {
4628
4639
  };
4629
4640
  }
4630
4641
  function re(s, e, t, i) {
4631
- s.innerHTML = zt(t), s.title = e, s.setAttribute("aria-label", e), s.setAttribute("aria-pressed", String(i)), s.classList.toggle("is-active", i);
4642
+ s.innerHTML = Vt(t), s.title = e, s.setAttribute("aria-label", e), s.setAttribute("aria-pressed", String(i)), s.classList.toggle("is-active", i);
4632
4643
  }
4633
- function hs(s) {
4644
+ function vs(s) {
4634
4645
  return s === "y" ? "upAxisY" : "upAxisZ";
4635
4646
  }
4636
- function ps(s) {
4647
+ function gs(s) {
4637
4648
  return s === "y" ? "当前 Y-UP,点击切换为 Z-UP" : "当前 Z-UP,点击切换为 Y-UP";
4638
4649
  }
4639
- class fs {
4650
+ class bs {
4640
4651
  constructor(e = "dark", t) {
4641
4652
  u(this, "root");
4642
4653
  u(this, "title");
@@ -4722,7 +4733,7 @@ class fs {
4722
4733
  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);
4723
4734
  }
4724
4735
  }
4725
- const ms = `
4736
+ const ys = `
4726
4737
  .vpu-root {
4727
4738
  position: absolute;
4728
4739
  inset: 0;
@@ -4888,27 +4899,27 @@ const ms = `
4888
4899
  @media (prefers-reduced-motion: reduce) {
4889
4900
  .vpu-status-spinner { animation: none; }
4890
4901
  }
4891
- `, at = "scene";
4892
- function vs(s, e) {
4902
+ `, lt = "scene";
4903
+ function xs(s, e) {
4893
4904
  let t = null, i = null, r = null, n = null, a = null, o = null;
4894
4905
  return {
4895
4906
  id: "nebula.ui.scene",
4896
4907
  activate(l) {
4897
4908
  var c, p;
4898
- o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = ms, (c = s.shadowRoot()) == null || c.append(o), t = us(l, {
4909
+ o = document.createElement("style"), o.dataset.viewerSceneUi = "", o.textContent = ys, (c = s.shadowRoot()) == null || c.append(o), t = ms(l, {
4899
4910
  label: e.label("simulation"),
4900
4911
  parts: (p = e.scene) == null ? void 0 : p.parts,
4901
4912
  theme: s.theme()
4902
- }), i = new fs(s.theme(), () => {
4913
+ }), i = new bs(s.theme(), () => {
4903
4914
  var h;
4904
4915
  return ((h = s.getVisualDiagnostics) == null ? void 0 : h.call(s)) ?? null;
4905
- }), r = s.mountBuiltin(t.element, { zone: "overlay", group: at }), n = s.mountBuiltin(i.element, { zone: "overlay", group: at }), a = s.onThemeChange((h) => {
4916
+ }), r = s.mountBuiltin(t.element, { zone: "overlay", group: lt }), n = s.mountBuiltin(i.element, { zone: "overlay", group: lt }), a = s.onThemeChange((h) => {
4906
4917
  t == null || t.themeChanged(h), i == null || i.themeChanged(h);
4907
4918
  });
4908
4919
  const d = () => {
4909
- var m, v, b;
4920
+ var v, y, m;
4910
4921
  const h = l.asset.$read();
4911
- if (((b = (v = (m = l.asset).$inspection) == null ? void 0 : v.call(m)) == null ? void 0 : b.kind) === "urdf") {
4922
+ if (((m = (y = (v = l.asset).$inspection) == null ? void 0 : y.call(v)) == null ? void 0 : m.kind) === "urdf") {
4912
4923
  t && (t.element.hidden = !0), i == null || i.update(null);
4913
4924
  return;
4914
4925
  }
@@ -4927,9 +4938,9 @@ function vs(s, e) {
4927
4938
  }
4928
4939
  };
4929
4940
  }
4930
- class gs {
4941
+ class ws {
4931
4942
  constructor(e, t, i, r) {
4932
- u(this, "renderer", new ui());
4943
+ u(this, "renderer", new pi());
4933
4944
  u(this, "scene", new we());
4934
4945
  u(this, "labels", []);
4935
4946
  u(this, "frame", null);
@@ -4940,7 +4951,7 @@ class gs {
4940
4951
  if (n.kind !== "link" || n.visualCount === 0) continue;
4941
4952
  const a = e.ownerDocument.createElement("div");
4942
4953
  a.className = "vurdf-name-label", a.textContent = n.name;
4943
- const o = new ci(a);
4954
+ const o = new hi(a);
4944
4955
  this.scene.add(o), this.labels.push({ id: n.id.slice(5), object: o });
4945
4956
  }
4946
4957
  }
@@ -4975,14 +4986,14 @@ class gs {
4975
4986
  this.setVisible(!1), this.disposed = !0, this.scene.clear(), this.labels.length = 0;
4976
4987
  }
4977
4988
  }
4978
- function bs(s) {
4979
- 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"];
4989
+ function Cs(s) {
4990
+ const e = s.clone().invert(), t = [new E(1, 0, 0), new E(0, 1, 0), new E(0, 0, 1)], i = ["#f3656a", "#36c978", "#4789f5"];
4980
4991
  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 }) => {
4981
4992
  const l = 50 + n.x * 32, d = 50 - n.y * 32, c = i[a];
4982
4993
  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>` : ""}`;
4983
4994
  }).join("")}</svg>`;
4984
4995
  }
4985
- const ys = {
4996
+ const Ss = {
4986
4997
  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"/>',
4987
4998
  zoomIn: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6m-3-3v6"/>',
4988
4999
  zoomOut: '<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5M7 10h6"/>',
@@ -5011,12 +5022,12 @@ const ys = {
5011
5022
  moon: '<path d="M20 15.2A8 8 0 0 1 8.8 4 8.5 8.5 0 1 0 20 15.2Z"/>'
5012
5023
  };
5013
5024
  function R(s) {
5014
- return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${ys[s]}</svg>`;
5025
+ return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Ss[s]}</svg>`;
5015
5026
  }
5016
5027
  function P(s) {
5017
5028
  return s.mode === "kinematic" || s.mode === "dynamics-paused" || s.mode === "dynamics-unavailable";
5018
5029
  }
5019
- function E(s) {
5030
+ function k(s) {
5020
5031
  return String(s ?? "").replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
5021
5032
  }
5022
5033
  function ee(s, e = 1 / 0) {
@@ -5024,61 +5035,61 @@ function ee(s, e = 1 / 0) {
5024
5035
  const t = s.controlLimits;
5025
5036
  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 };
5026
5037
  }
5027
- function xs(s, e, t, i) {
5038
+ function Es(s, e, t, i) {
5028
5039
  const r = s.ownerDocument, n = r.defaultView;
5029
5040
  let a = !1, o = 0, l = null, d = null, c = "";
5030
- const p = (C) => C.composedPath().some((A) => A instanceof n.HTMLElement && (A.matches("input,textarea,select") || A.isContentEditable)), h = () => {
5041
+ const p = (S) => S.composedPath().some((A) => A instanceof n.HTMLElement && (A.matches("input,textarea,select") || A.isContentEditable)), h = () => {
5031
5042
  d && (d = null, s.style.cursor = c, s.removeAttribute("data-joint-adjusting"));
5032
- }, f = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), m = (C) => {
5043
+ }, f = () => ["kinematic", "dynamics-paused", "dynamics-unavailable"].includes(e.getSnapshot().mode), v = (S) => {
5033
5044
  var Le;
5034
- if (C.code === "Escape") {
5045
+ if (S.code === "Escape") {
5035
5046
  h();
5036
5047
  return;
5037
5048
  }
5038
- if (C.code !== "KeyR" || C.repeat || C.ctrlKey || C.altKey || C.metaKey || p(C) || !a && r.activeElement !== s || !f()) return;
5049
+ if (S.code !== "KeyR" || S.repeat || S.ctrlKey || S.altKey || S.metaKey || p(S) || !a && r.activeElement !== s || !f()) return;
5039
5050
  const A = e.getSnapshot(), L = A.nodes.find((Te) => Te.id === A.selectedEntityId && Te.kind === "joint");
5040
5051
  if (!(L != null && L.movable) || L.mimic) return;
5041
5052
  t();
5042
- const G = (Le = e.jointWorldFrame) == null ? void 0 : Le.call(e, L.name), K = i == null ? void 0 : i(), Vt = G && K && l !== null ? ws(K, G, s.getBoundingClientRect(), l, o, L.jointType === "prismatic") : 1;
5043
- d = { id: L.id, name: L.name, value: A.jointValues[L.name] ?? 0, sensitivity: L.jointType === "prismatic" ? 1e-3 : 5e-3, ...ee(L), direction: Vt }, c = s.style.cursor, s.style.cursor = "ew-resize", s.setAttribute("data-joint-adjusting", "true"), C.preventDefault();
5044
- }, v = (C) => {
5045
- C.code === "KeyR" && h();
5046
- }, b = (C) => {
5047
- const A = l === null ? 0 : C.clientX - l;
5048
- if (l = C.clientX, o = C.clientY, !(!d || C.pointerType === "touch")) {
5049
- if (!f() || e.getSnapshot().selectedEntityId !== d.id || C.buttons !== 0) {
5053
+ const G = (Le = e.jointWorldFrame) == null ? void 0 : Le.call(e, L.name), K = i == null ? void 0 : i(), $t = G && K && l !== null ? ks(K, G, s.getBoundingClientRect(), l, o, L.jointType === "prismatic") : 1;
5054
+ d = { id: L.id, name: L.name, value: A.jointValues[L.name] ?? 0, sensitivity: L.jointType === "prismatic" ? 1e-3 : 5e-3, ...ee(L), direction: $t }, c = s.style.cursor, s.style.cursor = "ew-resize", s.setAttribute("data-joint-adjusting", "true"), S.preventDefault();
5055
+ }, y = (S) => {
5056
+ S.code === "KeyR" && h();
5057
+ }, m = (S) => {
5058
+ const A = l === null ? 0 : S.clientX - l;
5059
+ if (l = S.clientX, o = S.clientY, !(!d || S.pointerType === "touch")) {
5060
+ if (!f() || e.getSnapshot().selectedEntityId !== d.id || S.buttons !== 0) {
5050
5061
  h();
5051
5062
  return;
5052
5063
  }
5053
- A && (d.value = Math.max(d.lower, Math.min(d.upper, d.value + A * d.direction * d.sensitivity)), e.setJointValue(d.name, d.value), C.preventDefault(), C.stopImmediatePropagation());
5064
+ A && (d.value = Math.max(d.lower, Math.min(d.upper, d.value + A * d.direction * d.sensitivity)), e.setJointValue(d.name, d.value), S.preventDefault(), S.stopImmediatePropagation());
5054
5065
  }
5055
- }, y = (C) => {
5056
- a = !0, l = C.clientX, o = C.clientY;
5066
+ }, b = (S) => {
5067
+ a = !0, l = S.clientX, o = S.clientY;
5057
5068
  }, g = () => {
5058
5069
  a = !1, l = null, h();
5059
- }, x = (C) => {
5060
- d && (C.preventDefault(), C.stopImmediatePropagation());
5061
- }, w = (C) => {
5062
- C.composedPath()[0] !== s && h();
5063
- }, k = () => {
5070
+ }, x = (S) => {
5071
+ d && (S.preventDefault(), S.stopImmediatePropagation());
5072
+ }, w = (S) => {
5073
+ S.composedPath()[0] !== s && h();
5074
+ }, C = () => {
5064
5075
  r.hidden && h();
5065
- }, F = e.subscribe((C) => {
5066
- d && (!f() || C.selectedEntityId !== d.id) && h();
5076
+ }, D = e.subscribe((S) => {
5077
+ d && (!f() || S.selectedEntityId !== d.id) && h();
5067
5078
  });
5068
- return s.addEventListener("pointerenter", y), s.addEventListener("pointerleave", g), s.addEventListener("pointermove", b, !0), s.addEventListener("pointerdown", x, !0), r.addEventListener("keydown", m), r.addEventListener("keyup", v), r.addEventListener("focusin", w), r.addEventListener("visibilitychange", k), n.addEventListener("blur", g), () => {
5069
- h(), F(), s.removeEventListener("pointerenter", y), s.removeEventListener("pointerleave", g), s.removeEventListener("pointermove", b, !0), s.removeEventListener("pointerdown", x, !0), r.removeEventListener("keydown", m), r.removeEventListener("keyup", v), r.removeEventListener("focusin", w), r.removeEventListener("visibilitychange", k), n.removeEventListener("blur", g);
5079
+ 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), () => {
5080
+ 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);
5070
5081
  };
5071
5082
  }
5072
- function ws(s, e, t, i, r, n) {
5083
+ function ks(s, e, t, i, r, n) {
5073
5084
  if (t.width <= 0 || t.height <= 0 || e.axis.lengthSq() < 1e-12) return 1;
5074
5085
  s.updateMatrixWorld(!0);
5075
- 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);
5086
+ const a = e.axis.clone().normalize(), o = s.getWorldDirection(new E()), l = new E(1, 0, 0).transformDirection(s.matrixWorld), d = new E(0, 1, 0).transformDirection(s.matrixWorld);
5076
5087
  let c = a.clone();
5077
5088
  if (!n) {
5078
- const f = new wt();
5089
+ const f = new St();
5079
5090
  f.setFromCamera(new oe((i - t.left) / t.width * 2 - 1, 1 - (r - t.top) / t.height * 2), s);
5080
- const m = f.ray.intersectPlane(new Ct().setFromNormalAndCoplanarPoint(o, e.position), new S()), v = m ? m.sub(e.position) : new S();
5081
- c = a.clone().cross(v), Math.abs(c.dot(l)) <= Math.max(v.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())));
5091
+ const v = f.ray.intersectPlane(new Et().setFromNormalAndCoplanarPoint(o, e.position), new E()), y = v ? v.sub(e.position) : new E();
5092
+ 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())));
5082
5093
  }
5083
5094
  const p = c.dot(l);
5084
5095
  if (Math.abs(p) > 0.05 * Math.max(c.length(), 1e-9)) return p >= 0 ? 1 : -1;
@@ -5088,7 +5099,7 @@ function ws(s, e, t, i, r, n) {
5088
5099
  function W(s, e, t) {
5089
5100
  return s.jointType === "prismatic" ? `${e.toFixed(3)} m` : t === "rad" ? `${e.toFixed(3)} rad` : `${(e * 180 / Math.PI).toFixed(1)}°`;
5090
5101
  }
5091
- function Cs(s, e) {
5102
+ function Ps(s, e) {
5092
5103
  return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
5093
5104
  }
5094
5105
  function ue(s, e) {
@@ -5102,21 +5113,21 @@ function ue(s, e) {
5102
5113
  return s;
5103
5114
  }
5104
5115
  function Ee(s, e, t, i = !1) {
5105
- const { lower: r, upper: n } = ee(s, Math.PI), a = e.jointValues[s.name] ?? 0, o = Cs(s, t);
5106
- return `<div class="vurdf-slider-card ${e.selectedEntityId === s.id ? "is-selected" : ""}" data-joint-card="${E(s.id)}" tabindex="0" role="group" aria-label="${E(s.name)},点击选中关节">
5107
- <div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${E(s.id)}">${E(s.name)}</button><output data-joint-readout="${E(s.name)}">${W(s, a, t)}</output></div>
5108
- <small>${i ? "联动控制 · " : ""}${E(s.parentLink)} → ${E(s.childLink)}</small>
5109
- <input type="range" aria-label="${E(s.name)}${i ? " 联动控制" : " 位置"}" data-control-joint="${E(s.name)}" data-display-factor="${o}" min="${r * o}" max="${n * o}" step="any" value="${a * o}" ${!P(e) || s.mimic ? "disabled" : ""}>
5110
- ${s.mimic ? `<small>跟随 ${E(s.mimic.joint)} × ${s.mimic.multiplier} + ${W(s, s.mimic.offset, t)}</small>` : ""}
5116
+ const { lower: r, upper: n } = ee(s, Math.PI), a = e.jointValues[s.name] ?? 0, o = Ps(s, t);
5117
+ return `<div class="vurdf-slider-card ${e.selectedEntityId === s.id ? "is-selected" : ""}" data-joint-card="${k(s.id)}" tabindex="0" role="group" aria-label="${k(s.name)},点击选中关节">
5118
+ <div class="vurdf-slider-heading"><button class="vurdf-text-btn" data-entity="${k(s.id)}">${k(s.name)}</button><output data-joint-readout="${k(s.name)}">${W(s, a, t)}</output></div>
5119
+ <small>${i ? "联动控制 · " : ""}${k(s.parentLink)} → ${k(s.childLink)}</small>
5120
+ <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" : ""}>
5121
+ ${s.mimic ? `<small>跟随 ${k(s.mimic.joint)} × ${s.mimic.multiplier} + ${W(s, s.mimic.offset, t)}</small>` : ""}
5111
5122
  </div>`;
5112
5123
  }
5113
- function ot(s, e, t) {
5124
+ function dt(s, e, t) {
5114
5125
  const i = e.nodes.filter((o) => o.kind === "joint"), r = s.kind === "joint" ? s : i.find((o) => o.childLink === s.name);
5115
5126
  if (!r) return "";
5116
5127
  const n = ue(r, i), a = i.filter((o) => o.mimic && ue(o, i).name === n.name);
5117
- return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Ee(n, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => E(o.name)).join(" · ")}</p></section>` : "";
5128
+ return a.length ? `<section class="vurdf-section"><div class="vurdf-section-head"><strong>联动约束 · ${a.length + 1} 个关节</strong></div>${Ee(n, e, t, !0)}<p class="vurdf-control-hint">${a.map((o) => k(o.name)).join(" · ")}</p></section>` : "";
5118
5129
  }
5119
- function Ss(s, e, t) {
5130
+ function As(s, e, t) {
5120
5131
  const i = s.nodes.filter((c) => c.kind === "joint"), r = /* @__PURE__ */ new Map();
5121
5132
  for (const c of i) r.set(c.parentLink, [...r.get(c.parentLink) ?? [], c]);
5122
5133
  const n = new Set(i.map((c) => c.childLink)), a = /* @__PURE__ */ new Set(), o = [], l = (c) => {
@@ -5127,7 +5138,7 @@ function Ss(s, e, t) {
5127
5138
  const f = r.get(h.childLink) ?? [];
5128
5139
  if (f.length !== 1) {
5129
5140
  p.length && o.push(p);
5130
- for (const m of f) l(m);
5141
+ for (const v of f) l(v);
5131
5142
  return;
5132
5143
  }
5133
5144
  h = f[0];
@@ -5139,13 +5150,13 @@ function Ss(s, e, t) {
5139
5150
  const d = e.trim().toLowerCase();
5140
5151
  return o.filter((c) => c.some((p) => `${p.name} ${p.parentLink} ${p.childLink}`.toLowerCase().includes(d))).map((c) => {
5141
5152
  const p = [...new Set(c.map((h) => ue(h, i)))].filter((h) => i.some((f) => f.mimic && ue(f, i).name === h.name));
5142
- return `<section class="vurdf-joint-group"><h3>${E(c[0].parentLink)} → ${E(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => Ee(h, s, t, !0)).join("")}${c.map((h) => Ee(h, s, t, p.includes(h))).join("")}</section>`;
5153
+ return `<section class="vurdf-joint-group"><h3>${k(c[0].parentLink)} → ${k(c[c.length - 1].childLink)}</h3>${p.filter((h) => !c.includes(h)).map((h) => Ee(h, s, t, !0)).join("")}${c.map((h) => Ee(h, s, t, p.includes(h))).join("")}</section>`;
5143
5154
  }).join("") || '<div class="vurdf-empty">没有符合筛选条件的可动关节。</div>';
5144
5155
  }
5145
- function Es(s) {
5156
+ function Is(s) {
5146
5157
  return `<button class="vurdf-tool" data-angle-unit aria-label="切换弧度和角度" title="切换所有关节的显示单位" aria-pressed="${s === "deg"}">${R("angleUnit")}<span>${s === "rad" ? "rad" : "°"}</span></button>`;
5147
5158
  }
5148
- class ks {
5159
+ class Ms {
5149
5160
  constructor(e, t, i) {
5150
5161
  u(this, "element", document.createElement("aside"));
5151
5162
  u(this, "root", document.createElement("div"));
@@ -5174,9 +5185,9 @@ class ks {
5174
5185
  const t = new Set(e.issues.map((d) => d.entityId)), i = this.root.querySelector(".vurdf-tree"), r = { top: (i == null ? void 0 : i.scrollTop) ?? 0, left: (i == null ? void 0 : i.scrollLeft) ?? 0 }, n = this.root.getRootNode().activeElement, a = n && (i != null && i.contains(n)) ? n.dataset.entity : void 0;
5175
5186
  this.root.innerHTML = `
5176
5187
  <div class="vurdf-head"><div><strong>URDF模型结构</strong><span>${e.nodes.filter((d) => d.kind === "link").length} Links · ${e.nodes.filter((d) => d.kind === "joint").length} Joints</span></div><button class="vurdf-diagram-open" data-open-diagram title="打开结构图" aria-label="打开结构图">${R("structure")}</button></div>
5177
- <label class="vurdf-search">${R("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${E(this.query)}"></label>
5188
+ <label class="vurdf-search">${R("search")}<input aria-label="搜索模型结构" placeholder="搜索 Link 或 Joint" value="${k(this.query)}"></label>
5178
5189
  <div class="vurdf-filters">${ve("all", "全部", this.filter)}${ve("movable", "可动关节", this.filter)}${ve("errors", `错误 ${e.issues.length}`, this.filter)}</div>
5179
- <div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? Ss(e, this.query, this.angleUnit) : Ps(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
5190
+ <div class="vurdf-tree" role="${this.filter === "movable" ? "region" : "tree"}">${this.filter === "movable" ? As(e, this.query, this.angleUnit) : Rs(e, t, this.filter, this.query, this.collapsed, this.angleUnit)}</div>
5180
5191
  `, this.bind(e), this.setDiagramOpen(this.diagramOpen);
5181
5192
  const o = this.root.querySelector(".vurdf-tree");
5182
5193
  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 })));
@@ -5262,33 +5273,33 @@ class ks {
5262
5273
  });
5263
5274
  }
5264
5275
  }
5265
- function Ps(s, e, t, i, r, n) {
5276
+ function Rs(s, e, t, i, r, n) {
5266
5277
  const a = new Map(s.nodes.map((p) => [p.id, p])), o = i.trim().toLowerCase(), l = o.length > 0 || t !== "all", d = (p) => {
5267
5278
  const h = !o || p.name.toLowerCase().includes(o), f = t === "all" || t === "movable" && p.kind === "joint" && p.movable || t === "errors" && e.has(p.id);
5268
5279
  return h && f;
5269
5280
  }, c = (p, h, f = /* @__PURE__ */ new Set()) => {
5270
5281
  if (f.has(p)) return { html: "", matched: !1 };
5271
- const m = a.get(p);
5272
- if (!m) return { html: "", matched: !1 };
5273
- const v = new Set(f).add(p), b = m.childIds.map((C) => c(C, h + 1, v));
5274
- if (!(d(m) || b.some((C) => C.matched))) return { html: "", matched: !1 };
5275
- const g = b.some((C) => C.matched), x = !l && r.has(m.id), w = m.kind === "joint" ? m.jointType : m.kind, k = m.kind === "joint" && m.movable ? `${W(m, s.jointValues[m.name] ?? 0, n)}` : "", F = `<div class="vurdf-tree-item" style="--depth:${h}" role="treeitem" aria-expanded="${g ? String(!x) : "false"}">
5276
- <button class="vurdf-tree-toggle ${g ? "" : "is-placeholder"} ${x ? "" : "is-open"}" data-tree-toggle="${E(m.id)}" ${g ? "" : "disabled"} aria-label="${x ? "展开" : "折叠"} ${E(m.name)}">${R("chevron")}</button>
5277
- <button class="vurdf-row ${s.selectedEntityId === m.id ? "is-selected" : ""} ${e.has(m.id) ? "has-error" : ""}" data-entity="${E(m.id)}">
5278
- ${R(m.kind === "robot" ? "robot" : m.kind === "joint" ? "joint" : "link")}
5279
- <span class="vurdf-node-copy"><b title="${E(m.name)}">${E(m.name)}</b><small>${E(w)}</small></span>
5280
- ${e.has(m.id) ? '<span class="vurdf-node-error">!</span>' : `<span class="vurdf-node-value" ${m.kind === "joint" ? `data-joint-readout="${E(m.name)}"` : ""}>${k}</span>`}
5282
+ const v = a.get(p);
5283
+ if (!v) return { html: "", matched: !1 };
5284
+ const y = new Set(f).add(p), m = v.childIds.map((S) => c(S, h + 1, y));
5285
+ if (!(d(v) || m.some((S) => S.matched))) return { html: "", matched: !1 };
5286
+ const g = m.some((S) => S.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"}">
5287
+ <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)}">${R("chevron")}</button>
5288
+ <button class="vurdf-row ${s.selectedEntityId === v.id ? "is-selected" : ""} ${e.has(v.id) ? "has-error" : ""}" data-entity="${k(v.id)}">
5289
+ ${R(v.kind === "robot" ? "robot" : v.kind === "joint" ? "joint" : "link")}
5290
+ <span class="vurdf-node-copy"><b title="${k(v.name)}">${k(v.name)}</b><small>${k(w)}</small></span>
5291
+ ${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>`}
5281
5292
  </button>
5282
5293
  </div>`;
5283
- return { html: `<div class="vurdf-branch ${x ? "is-collapsed" : ""}">${F}<div class="vurdf-children" ${x ? "inert" : ""}><div>${b.map((C) => C.html).join("")}</div></div></div>`, matched: !0 };
5294
+ return { html: `<div class="vurdf-branch ${x ? "is-collapsed" : ""}">${D}<div class="vurdf-children" ${x ? "inert" : ""}><div>${m.map((S) => S.html).join("")}</div></div></div>`, matched: !0 };
5284
5295
  };
5285
5296
  return c(s.rootEntityId, 0).html || '<div class="vurdf-empty">没有符合筛选条件的节点。</div>';
5286
5297
  }
5287
5298
  function ve(s, e, t) {
5288
5299
  return `<button class="vurdf-chip ${s === t ? "is-active" : ""}" data-filter="${s}">${e}</button>`;
5289
5300
  }
5290
- const As = 1800;
5291
- class Is {
5301
+ const Ls = 1800;
5302
+ class Ts {
5292
5303
  constructor(e) {
5293
5304
  u(this, "element", document.createElement("aside"));
5294
5305
  u(this, "root", document.createElement("div"));
@@ -5326,9 +5337,9 @@ class Is {
5326
5337
  a.open ? this.expandedInertia.add(o) : this.expandedInertia.delete(o);
5327
5338
  }), this.root.innerHTML = `
5328
5339
  <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>
5329
- <section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? Ms(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : Ts()}</section>
5330
- <section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Rs(e, t) : ""}</section>
5331
- <section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${Ls(e)}</section>
5340
+ <section class="vurdf-pane ${this.tab === "properties" ? "is-active" : ""}" data-pane="properties">${t ? Ds(t, e, ((i = this.sweep) == null ? void 0 : i.jointName) === t.name, this.angleUnit, this.expandedInertia) : Ns()}</section>
5341
+ <section class="vurdf-pane ${this.tab === "source" ? "is-active" : ""}" data-pane="source">${this.tab === "source" ? Os(e, t) : ""}</section>
5342
+ <section class="vurdf-pane ${this.tab === "issues" ? "is-active" : ""}" data-pane="issues">${zs(e)}</section>
5332
5343
  `, 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" }));
5333
5344
  }
5334
5345
  dispose() {
@@ -5342,10 +5353,10 @@ class Is {
5342
5353
  const f = () => {
5343
5354
  P(this.inspection.getSnapshot()) && this.inspection.select(h.dataset.jointCard);
5344
5355
  };
5345
- h.addEventListener("click", (m) => {
5346
- m.target.closest("input,button,select,textarea,a") || f();
5347
- }), h.addEventListener("keydown", (m) => {
5348
- m.target !== h || !["Enter", " "].includes(m.key) || (m.preventDefault(), f());
5356
+ h.addEventListener("click", (v) => {
5357
+ v.target.closest("input,button,select,textarea,a") || f();
5358
+ }), h.addEventListener("keydown", (v) => {
5359
+ v.target !== h || !["Enter", " "].includes(v.key) || (v.preventDefault(), f());
5349
5360
  });
5350
5361
  }), this.bindListSliders(e), this.root.querySelectorAll("[data-inertia-details]").forEach((h) => h.addEventListener("toggle", () => {
5351
5362
  if (!h.isConnected) return;
@@ -5354,9 +5365,9 @@ class Is {
5354
5365
  })), this.root.querySelectorAll("[data-copy-number]").forEach((h) => h.addEventListener("click", async () => {
5355
5366
  var f;
5356
5367
  try {
5357
- const m = (f = this.root.ownerDocument.defaultView) == null ? void 0 : f.navigator.clipboard;
5358
- if (!m) throw new Error("Clipboard unavailable");
5359
- await m.writeText(h.dataset.copyNumber), h.title = "已复制完整数值";
5368
+ const v = (f = this.root.ownerDocument.defaultView) == null ? void 0 : f.navigator.clipboard;
5369
+ if (!v) throw new Error("Clipboard unavailable");
5370
+ await v.writeText(h.dataset.copyNumber), h.title = "已复制完整数值";
5360
5371
  } catch {
5361
5372
  h.title = `${h.dataset.copyNumber} · 无法访问剪贴板,请从 XML 复制`;
5362
5373
  }
@@ -5385,13 +5396,13 @@ class Is {
5385
5396
  const f = Number(h.target.value) / i;
5386
5397
  this.syncJointInputs(f), r(f);
5387
5398
  }), 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) => {
5388
- const m = h.target.valueAsNumber / i;
5389
- if (!Number.isFinite(m)) {
5399
+ const v = h.target.valueAsNumber / i;
5400
+ if (!Number.isFinite(v)) {
5390
5401
  this.syncJointInputs(this.inspection.getSnapshot().jointValues[t.name] ?? 0);
5391
5402
  return;
5392
5403
  }
5393
- const { lower: v, upper: b } = ee(t);
5394
- r(Math.max(v, Math.min(b, m)));
5404
+ const { lower: y, upper: m } = ee(t);
5405
+ r(Math.max(y, Math.min(m, v)));
5395
5406
  }), 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", () => {
5396
5407
  P(this.inspection.getSnapshot()) && (this.stopSweep(!1), this.inspection.resetJoint(t.name));
5397
5408
  }), (p = this.root.querySelector("[data-sweep-joint]")) == null || p.addEventListener("click", () => {
@@ -5438,7 +5449,7 @@ class Is {
5438
5449
  const { lower: i, upper: r } = ee(e, Math.PI), n = () => {
5439
5450
  const a = this.sweep;
5440
5451
  if (!a || a.jointName !== e.name || this.disposed || !P(this.inspection.getSnapshot())) return;
5441
- const o = Math.min(1, (Date.now() - a.startedAt) / As), l = o < 0.5 ? o * 2 : (1 - o) * 2;
5452
+ const o = Math.min(1, (Date.now() - a.startedAt) / Ls), l = o < 0.5 ? o * 2 : (1 - o) * 2;
5442
5453
  if (this.inspection.setJointValue(e.name, i + (r - i) * l), o >= 1) {
5443
5454
  const d = a.initial;
5444
5455
  this.sweep = null, this.inspection.setJointValue(e.name, d);
@@ -5453,35 +5464,35 @@ class Is {
5453
5464
  t && (t.timer !== null && clearTimeout(t.timer), this.sweep = null, e && !this.disposed && this.inspection.setJointValue(t.jointName, t.initial));
5454
5465
  }
5455
5466
  }
5456
- function Ms(s, e, t, i, r) {
5467
+ function Ds(s, e, t, i, r) {
5457
5468
  var n, a;
5458
5469
  if (s.kind === "joint") {
5459
- const o = e.nodes.find((v) => v.kind === "link" && v.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>`, m = 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="${E(s.name)}">${W(s, l, i)}</output><div class="vurdf-follower-source"><span>主控关节</span><button class="vurdf-text-btn" data-entity="joint:${E(s.mimic.joint)}">${E(s.mimic.joint)}</button></div></section>` : s.movable ? `<fieldset class="vurdf-section vurdf-joint-controls" ${P(e) ? "" : "disabled"}>
5470
+ 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"}>
5460
5471
  <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>
5461
5472
  <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>
5462
5473
  <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>
5463
5474
  ${P(e) ? "" : '<p class="vurdf-control-hint">仿真运行期间只读,暂停后可选中部件并调整关节。</p>'}
5464
5475
  </fieldset>` : '<div class="vurdf-section"><div class="vurdf-empty">固定关节不可调节。</div></div>';
5465
- return `<div class="vurdf-entity"><label>${E(s.jointType.toUpperCase())} JOINT</label><h2>${E(s.name)}</h2><p>${E(s.parentLink)} → ${E(s.childLink)}</p></div>${m}${ot(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 ? dt(o, !0, r.has(o.id)) : ""}`;
5476
+ return `<div class="vurdf-entity"><label>${k(s.jointType.toUpperCase())} JOINT</label><h2>${k(s.name)}</h2><p>${k(s.parentLink)} → ${k(s.childLink)}</p></div>${v}${dt(s, e, i)}<div class="vurdf-section"><div class="vurdf-section-head"><strong>变换与轴</strong><span>m / rad</span></div><dl class="vurdf-data"><dt>关节原点 XYZ</dt><dd>${s.originPosition.map(be).join(" ")}</dd><dt>关节原点 RPY</dt><dd>${s.originRotationRpy.map(be).join(" ")}</dd><dt>Axis xyz</dt><dd>${s.axis.map(be).join(" ")}</dd><dt>Lower</dt><dd>${((n = s.limits) == null ? void 0 : n.lower) ?? "—"}</dd><dt>Upper</dt><dd>${((a = s.limits) == null ? void 0 : a.upper) ?? "—"}</dd><dt>Effort</dt><dd>${s.effort ?? "—"}</dd><dt>Velocity</dt><dd>${s.velocity ?? "—"}</dd></dl></div>${o ? ut(o, !0, r.has(o.id)) : ""}`;
5466
5477
  }
5467
- return s.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${E(s.name)}</h2><p>${s.visualCount} Visual · ${s.collisionCount} Collision</p></div>${ot(s, e, i)}${dt(s, !1, r.has(s.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${E(s.name)}</h2><p>${s.rootLinkIds.length} root link</p></div>`;
5478
+ return s.kind === "link" ? `<div class="vurdf-entity"><label>LINK</label><h2>${k(s.name)}</h2><p>${s.visualCount} Visual · ${s.collisionCount} Collision</p></div>${dt(s, e, i)}${ut(s, !1, r.has(s.id))}` : `<div class="vurdf-entity"><label>ROBOT</label><h2>${k(s.name)}</h2><p>${s.rootLinkIds.length} root link</p></div>`;
5468
5479
  }
5469
5480
  function ke(s) {
5470
5481
  if (s === void 0) return "<span>—</span>";
5471
5482
  const e = String(s), t = Number.isFinite(s) ? String(Number(s.toPrecision(6))) : e;
5472
5483
  return `<button type="button" class="vurdf-source-number" data-copy-number="${e}" title="${e} · 点击复制完整数值" aria-label="复制完整数值 ${e}">${t}</button>`;
5473
5484
  }
5474
- function lt(s, e, t, i) {
5485
+ function ct(s, e, t, i) {
5475
5486
  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>`;
5476
5487
  }
5477
- function dt(s, e, t) {
5488
+ function ut(s, e, t) {
5478
5489
  return `<section class="vurdf-section" data-link-inertial>
5479
- <div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${E(s.name)}</strong></div>
5490
+ <div class="vurdf-section-head vurdf-component-title"><strong>${e ? "子部件" : "部件属性"} · ${k(s.name)}</strong></div>
5480
5491
  <dl class="vurdf-data"><dt>质量 (kg)</dt><dd>${ke(s.mass)}</dd></dl>
5481
5492
  <div class="vurdf-inertial-frame">惯性原点 · 相对于 Link</div>
5482
- ${lt("质心位置", ["X", "Y", "Z"], s.centerOfMass, "m")}
5483
- ${lt("惯性坐标系旋转", ["R", "P", "Y"], s.inertialRotationRpy, "rad")}
5484
- <details class="vurdf-inertia-details" data-inertia-details="${E(s.id)}" ${t ? "open" : ""}>
5493
+ ${ct("质心位置", ["X", "Y", "Z"], s.centerOfMass, "m")}
5494
+ ${ct("惯性坐标系旋转", ["R", "P", "Y"], s.inertialRotationRpy, "rad")}
5495
+ <details class="vurdf-inertia-details" data-inertia-details="${k(s.id)}" ${t ? "open" : ""}>
5485
5496
  <summary>${R("chevron")}<strong>惯性张量</strong><span>kg·m²</span></summary>
5486
5497
  <div class="vurdf-inertial-frame">关于质心 · 惯性坐标系</div>
5487
5498
  <dl class="vurdf-data">${["Ixx", "Iyy", "Izz", "Ixy", "Ixz", "Iyz"].map((i, r) => {
@@ -5491,30 +5502,30 @@ function dt(s, e, t) {
5491
5502
  </details>
5492
5503
  </section>`;
5493
5504
  }
5494
- function Rs(s, e) {
5505
+ function Os(s, e) {
5495
5506
  var n, a;
5496
5507
  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;
5497
- 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>${Ds(o)}</span>`).join("")}</code></pre>`;
5508
+ return `<pre class="vurdf-source"><code>${t.map((o, l) => `<span class="line ${e && l + 1 >= i && l + 1 <= r ? "is-selected" : ""}"><span class="ln">${l + 1}</span>${Vs(o)}</span>`).join("")}</code></pre>`;
5498
5509
  }
5499
- function Ls(s) {
5500
- return s.issues.length ? s.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${E(e.entityId)}">${R("error")}<span><b>${E(e.title)}</b><small>${E(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
5510
+ function zs(s) {
5511
+ return s.issues.length ? s.issues.map((e) => `<button class="vurdf-issue" data-issue-entity="${k(e.entityId)}">${R("error")}<span><b>${k(e.title)}</b><small>${k(e.message)}</small></span></button>`).join("") : '<div class="vurdf-empty">所有严格结构与数学检查通过。</div>';
5501
5512
  }
5502
5513
  function ge(s, e, t) {
5503
5514
  return `<button class="vurdf-tab ${s === t ? "is-active" : ""}" data-tab="${s}">${e}</button>`;
5504
5515
  }
5505
- function Ts() {
5516
+ function Ns() {
5506
5517
  return '<div class="vurdf-empty vurdf-no-selection">点击模型或结构树选择部件;点击场景空白处可取消选择。</div>';
5507
5518
  }
5508
5519
  function be(s) {
5509
5520
  return s.toFixed(3);
5510
5521
  }
5511
- function Ds(s) {
5512
- return E(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>');
5522
+ function Vs(s) {
5523
+ 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>');
5513
5524
  }
5514
5525
  function Pe(s, e) {
5515
5526
  return s.jointType !== "prismatic" && e === "deg" ? 180 / Math.PI : 1;
5516
5527
  }
5517
- function Os(s) {
5528
+ function Fs(s) {
5518
5529
  const e = new Map(s.nodes.map((o) => [o.id, o])), t = /* @__PURE__ */ new Set(), i = [], r = [];
5519
5530
  let n = 0;
5520
5531
  const a = (o, l) => {
@@ -5533,7 +5544,7 @@ function Os(s) {
5533
5544
  for (const o of s.nodes) t.has(o.id) || a(o.id, 0);
5534
5545
  return { nodes: i, edges: r, width: Math.max(200, n * 210), height: Math.max(90, ...i.map((o) => o.y + 45)) };
5535
5546
  }
5536
- class zs {
5547
+ class $s {
5537
5548
  constructor(e, t, i = () => {
5538
5549
  }) {
5539
5550
  u(this, "element", document.createElement("section"));
@@ -5586,9 +5597,9 @@ class zs {
5586
5597
  }), o.addEventListener("pointermove", (d) => {
5587
5598
  const c = this.windowResize;
5588
5599
  if (!c || c.id !== d.pointerId) return;
5589
- const p = this.element.parentElement, h = d.clientX - c.x, f = d.clientY - c.y, m = 420, v = 320;
5590
- let b = c.left, y = c.top, g = c.width, x = c.height;
5591
- (c.corner === "tr" || c.corner === "br") && (g = Math.max(m, c.width + h)), (c.corner === "tl" || c.corner === "bl") && (g = Math.max(m, c.width - h), b = c.left + c.width - g), c.corner === "tr" && (x = Math.max(v, c.height - f), y = c.top + c.height - x), (c.corner === "br" || c.corner === "bl") && (x = Math.max(v, c.height + f)), c.corner === "tl" && (x = Math.max(v, c.height - f), y = c.top + c.height - x), b = Math.max(0, Math.min(b, Math.max(0, p.clientWidth - g))), y = Math.max(0, Math.min(y, Math.max(0, p.clientHeight - x))), g = Math.min(g, p.clientWidth - b), x = Math.min(x, p.clientHeight - y), this.element.style.left = `${b}px`, this.element.style.top = `${y}px`, this.element.style.width = `${Math.max(m, g)}px`, this.element.style.height = `${Math.max(v, x)}px`;
5600
+ const p = this.element.parentElement, h = d.clientX - c.x, f = d.clientY - c.y, v = 420, y = 320;
5601
+ let m = c.left, b = c.top, g = c.width, x = c.height;
5602
+ (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`;
5592
5603
  });
5593
5604
  const l = () => {
5594
5605
  this.windowResize = null;
@@ -5636,7 +5647,7 @@ class zs {
5636
5647
  if (this.snapshot = e, !this.opened) return;
5637
5648
  if (this.modelNodes !== e.nodes) {
5638
5649
  this.modelNodes = e.nodes;
5639
- const i = Os(e);
5650
+ const i = Fs(e);
5640
5651
  this.bounds = i;
5641
5652
  const r = new Map(i.nodes.map((n) => [n.node.id, n]));
5642
5653
  this.graph.innerHTML = i.edges.map((n) => {
@@ -5683,7 +5694,7 @@ class zs {
5683
5694
  this.graph.setAttribute("transform", `translate(${this.x} ${this.y}) scale(${this.scale})`);
5684
5695
  }
5685
5696
  }
5686
- class Ns {
5697
+ class Bs {
5687
5698
  constructor(e, t, i, r, n) {
5688
5699
  u(this, "namesVisible", !1);
5689
5700
  u(this, "element", document.createElement("div"));
@@ -5699,13 +5710,13 @@ class Ns {
5699
5710
  ${se("centerOfMass", "质心", e.overlays.centerOfMass, "centerOfMass")}
5700
5711
  ${se("inertia", "惯量", e.overlays.inertia === !0, "inertia")}
5701
5712
  <button class="vurdf-tool ${this.namesVisible ? "is-active" : ""}" data-name-labels aria-pressed="${this.namesVisible}" title="显示/隐藏部件名称">${R("names")}名称</button>
5702
- ${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? Es(i) : ""}
5713
+ ${e.nodes.some((a) => a.kind === "joint" && a.movable && a.jointType !== "prismatic") ? Is(i) : ""}
5703
5714
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
5704
- ${ne("ground", ct(this.ctx) ? "隐藏地面" : "显示地面", ct(this.ctx), "ground")}
5715
+ ${ne("ground", ht(this.ctx) ? "隐藏地面" : "显示地面", ht(this.ctx), "ground")}
5705
5716
  ${ne("fit", "适应视图", !1, "fit")}
5706
5717
  ${ne("theme", this.theme === "dark" ? "浅色主题" : "深色主题", !1, this.theme === "dark" ? "sun" : "moon")}
5707
5718
  <span class="vurdf-tool-divider" aria-hidden="true"></span>
5708
- ${Vs(e, r, n)}
5719
+ ${_s(e, r, n)}
5709
5720
  ${ne("reset", "重置", !1, "reset")}
5710
5721
  `, this.bind(e);
5711
5722
  }
@@ -5739,50 +5750,50 @@ function ne(s, e, t, i) {
5739
5750
  const r = s === "ground" ? ` aria-pressed="${t}"` : "";
5740
5751
  return `<button class="vurdf-tool ${t ? "is-active" : ""}" data-scene-tool="${s}"${r} title="${e}" aria-label="${e}">${R(i)}${s === "reset" ? e : ""}</button>`;
5741
5752
  }
5742
- function Vs(s, e, t) {
5753
+ function _s(s, e, t) {
5743
5754
  const i = s.mode === "dynamics-running", r = i ? "暂停仿真" : s.mode === "dynamics-initializing" ? "启动中" : "启动仿真";
5744
- return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${E(t)}">${R(i ? "pause" : "play")}${r}</button>`;
5755
+ return `<button class="vurdf-tool vurdf-dynamics ${i ? "is-active" : ""}" data-mode="dynamics" ${e ? "disabled" : ""} title="${k(t)}">${R(i ? "pause" : "play")}${r}</button>`;
5745
5756
  }
5746
- function ct(s) {
5757
+ function ht(s) {
5747
5758
  return s.asset.$readControl().groundVisible;
5748
5759
  }
5749
- class Fs {
5760
+ class Us {
5750
5761
  constructor() {
5751
5762
  u(this, "element", document.createElement("footer"));
5752
5763
  this.element.className = "vurdf-status";
5753
5764
  }
5754
5765
  update(e) {
5755
5766
  const t = e.nodes.find((i) => i.id === e.selectedEntityId) ?? null;
5756
- this.element.innerHTML = `<span>模型已就绪</span><span title="${E(e.sourcePath)}">${E(e.sourcePath)}</span><span>选择:${t ? E(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>${$s(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
5767
+ this.element.innerHTML = `<span>模型已就绪</span><span title="${k(e.sourcePath)}">${k(e.sourcePath)}</span><span>选择:${t ? k(t.name) : "无"}</span>${(t == null ? void 0 : t.kind) === "joint" && t.movable && P(e) ? '<span class="vurdf-gesture-hint" title="选中可动关节,将鼠标移入场景,按住 R 左右移动调节,松开 R 结束。运行仿真时不可用。">按住 R + 鼠标左右移动</span>' : ""}<span class="spacer"></span><span>Z-Up</span><span>m / kg / s</span><span>${js(e.mode)}</span><span class="${e.issues.length ? "vurdf-status-error" : "vurdf-status-ok"}">${e.issues.length ? `${e.issues.length} 个错误` : "严格检查通过"}</span>`;
5757
5768
  }
5758
5769
  dispose() {
5759
5770
  this.element.remove();
5760
5771
  }
5761
5772
  }
5762
- function $s(s) {
5773
+ function js(s) {
5763
5774
  return s === "kinematic" ? "运动学预览" : s === "dynamics-running" ? "动力学仿真运行中" : s === "dynamics-paused" ? "动力学仿真已暂停" : s === "dynamics-initializing" ? "正在初始化动力学" : "动力学不可用";
5764
5775
  }
5765
- class Bs {
5776
+ class Hs {
5766
5777
  constructor(e, t, i, r, n, a, o) {
5767
5778
  u(this, "diagram");
5768
5779
  u(this, "structure");
5769
5780
  u(this, "inspector");
5770
5781
  u(this, "toolbar");
5771
- u(this, "statusbar", new Fs());
5782
+ u(this, "statusbar", new Us());
5772
5783
  u(this, "gizmo", document.createElement("div"));
5773
5784
  u(this, "disposed", !1);
5774
5785
  u(this, "angleUnit", "rad");
5775
5786
  u(this, "nameLabels", null);
5776
5787
  u(this, "pointerCleanup", null);
5777
5788
  u(this, "resizeCleanup", null);
5778
- this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new ks(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new Is(t), this.toolbar = new Ns(t, i, r, (l) => {
5789
+ this.root = e, this.inspection = t, this.theme = r, this.cameraQuaternion = n, this.structure = new Ms(t, () => this.diagram.open(), (l) => this.inspector.stopSweep(l)), this.inspector = new Ts(t), this.toolbar = new Bs(t, i, r, (l) => {
5779
5790
  var d;
5780
5791
  return (d = this.nameLabels) == null ? void 0 : d.setVisible(l);
5781
5792
  }, () => {
5782
5793
  this.angleUnit = this.angleUnit === "rad" ? "deg" : "rad", this.render(this.inspection.getSnapshot());
5783
- }), this.diagram = new zs((l) => this.selectFromScene(l), () => {
5794
+ }), this.diagram = new $s((l) => this.selectFromScene(l), () => {
5784
5795
  this.structure.setDiagramOpen(!1), this.structure.focusDiagramButton();
5785
- }, () => 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 gs(e, a, o, t)), a && (this.pointerCleanup = xs(a, t, () => this.inspector.stopSweep(!1), o));
5796
+ }, () => this.structure.setDiagramOpen(!0)), this.gizmo.className = "vurdf-gizmo", this.gizmo.setAttribute("aria-label", "坐标轴方向"), this.root.append(this.structure.element, this.gizmo, this.toolbar.element, this.inspector.element, this.statusbar.element, this.diagram.element), this.bindSidebar("left"), this.bindSidebar("right"), a && o && (this.nameLabels = new ws(e, a, o, t)), a && (this.pointerCleanup = Es(a, t, () => this.inspector.stopSweep(!1), o));
5786
5797
  }
5787
5798
  render(e) {
5788
5799
  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());
@@ -5792,7 +5803,7 @@ class Bs {
5792
5803
  }
5793
5804
  updateGizmo() {
5794
5805
  var e;
5795
- this.gizmo.innerHTML = bs(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new Gt());
5806
+ this.gizmo.innerHTML = Cs(((e = this.cameraQuaternion) == null ? void 0 : e.call(this)) ?? new Zt());
5796
5807
  }
5797
5808
  setTheme(e) {
5798
5809
  this.theme !== e && (this.theme = e, this.render(this.inspection.getSnapshot()));
@@ -5820,17 +5831,17 @@ class Bs {
5820
5831
  o.addEventListener("keydown", (d) => {
5821
5832
  d.key !== "ArrowLeft" && d.key !== "ArrowRight" || (d.preventDefault(), l(t.getBoundingClientRect().width + (d.key === "ArrowRight" ? 16 : -16) * (e === "left" ? 1 : -1)));
5822
5833
  }), o.addEventListener("pointerdown", (d) => {
5823
- var m;
5834
+ var v;
5824
5835
  if (d.button !== 0) return;
5825
- d.preventDefault(), this.root.classList.add("is-resizing"), (m = o.setPointerCapture) == null || m.call(o, d.pointerId);
5826
- const c = d.clientX, p = t.getBoundingClientRect().width, h = (v) => l(p + (e === "left" ? 1 : -1) * (v.clientX - c)), f = () => {
5836
+ d.preventDefault(), this.root.classList.add("is-resizing"), (v = o.setPointerCapture) == null || v.call(o, d.pointerId);
5837
+ const c = d.clientX, p = t.getBoundingClientRect().width, h = (y) => l(p + (e === "left" ? 1 : -1) * (y.clientX - c)), f = () => {
5827
5838
  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");
5828
5839
  };
5829
5840
  this.resizeCleanup = f, o.addEventListener("pointermove", h), o.addEventListener("pointerup", f), o.addEventListener("pointercancel", f), o.addEventListener("lostpointercapture", f);
5830
5841
  });
5831
5842
  }
5832
5843
  }
5833
- const _s = `
5844
+ const qs = `
5834
5845
  .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}
5835
5846
  .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}
5836
5847
  .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)}
@@ -5955,17 +5966,17 @@ const _s = `
5955
5966
 
5956
5967
  .vurdf-diagram button:focus-visible{outline:2px solid var(--vurdf-accent)}
5957
5968
  @media(max-width:600px){.vurdf-diagram{width:calc(100% - 16px);height:calc(100% - 60px)}}
5958
- `, Us = "urdf";
5959
- function js(s) {
5969
+ `, Ys = "urdf";
5970
+ function Xs(s) {
5960
5971
  let e = null, t = null, i = null, r = null, n = null, a = null;
5961
5972
  const o = [];
5962
5973
  return {
5963
5974
  id: "nebula.ui.urdf",
5964
5975
  activate(l) {
5965
5976
  var p;
5966
- t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = _s, (p = s.shadowRoot()) == null || p.append(t);
5977
+ t = document.createElement("style"), t.dataset.viewerUrdfUi = "", t.textContent = qs, (p = s.shadowRoot()) == null || p.append(t);
5967
5978
  const d = document.createElement("div");
5968
- d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group: Us });
5979
+ d.className = "vurdf-shell", d.hidden = !0, e = s.mountBuiltin(d, { zone: "overlay", group: Ys });
5969
5980
  const c = () => {
5970
5981
  var f;
5971
5982
  const h = l.asset.$inspection();
@@ -5977,7 +5988,7 @@ function js(s) {
5977
5988
  d.hidden = !0;
5978
5989
  return;
5979
5990
  }
5980
- d.hidden = !1, i = new Bs(d, h, l, s.theme(), s.cameraQuaternion, (f = s.interactionCanvas) == null ? void 0 : f.call(s), s.interactionCamera), r = h.subscribe((m) => i == null ? void 0 : i.render(m)), i.render(h.getSnapshot());
5991
+ d.hidden = !1, i = new Hs(d, h, l, s.theme(), s.cameraQuaternion, (f = s.interactionCanvas) == null ? void 0 : f.call(s), s.interactionCamera), r = h.subscribe((v) => i == null ? void 0 : i.render(v)), i.render(h.getSnapshot());
5981
5992
  };
5982
5993
  n = s.onThemeChange((h) => i == null ? void 0 : i.setTheme(h)), o.push(
5983
5994
  l.events.on("asset-change", c),
@@ -5987,13 +5998,13 @@ function js(s) {
5987
5998
  return i == null ? void 0 : i.render((h = l.asset.$inspection()) == null ? void 0 : h.getSnapshot());
5988
5999
  }),
5989
6000
  l.events.on("pick", (h) => {
5990
- var m;
6001
+ var v;
5991
6002
  const f = l.asset.$inspection();
5992
- (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(ut(f, ((m = h.result) == null ? void 0 : m.object) ?? null)));
6003
+ (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(pt(f, ((v = h.result) == null ? void 0 : v.object) ?? null)));
5993
6004
  }),
5994
6005
  l.events.on("selection-change", (h) => {
5995
6006
  const f = l.asset.$inspection();
5996
- (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(ut(f, h.object)));
6007
+ (f == null ? void 0 : f.kind) === "urdf" && P(f.getSnapshot()) && (i == null || i.selectFromScene(pt(f, h.object)));
5997
6008
  })
5998
6009
  ), c();
5999
6010
  },
@@ -6003,7 +6014,7 @@ function js(s) {
6003
6014
  }
6004
6015
  };
6005
6016
  }
6006
- function Hs(s) {
6017
+ function Ws(s) {
6007
6018
  let e = s;
6008
6019
  for (; e; ) {
6009
6020
  if (typeof e.userData.urdfEntityId == "string") return e.userData.urdfEntityId;
@@ -6011,12 +6022,12 @@ function Hs(s) {
6011
6022
  }
6012
6023
  return null;
6013
6024
  }
6014
- function ut(s, e) {
6025
+ function pt(s, e) {
6015
6026
  var n;
6016
- const t = Hs(e), i = s.getSnapshot(), r = i.nodes.find((a) => a.id === t && a.kind === "link");
6027
+ const t = Ws(e), i = s.getSnapshot(), r = i.nodes.find((a) => a.id === t && a.kind === "link");
6017
6028
  return r ? ((n = i.nodes.find((a) => a.kind === "joint" && a.childLink === r.name)) == null ? void 0 : n.id) ?? t : t;
6018
6029
  }
6019
- class qs {
6030
+ class Gs {
6020
6031
  constructor(e, t, i, r, n, a, o, l = null, d = () => null) {
6021
6032
  u(this, "pluginsById", /* @__PURE__ */ new Map());
6022
6033
  u(this, "contributions", []);
@@ -6224,7 +6235,7 @@ class qs {
6224
6235
  n.dataset.viewerContribution = "toolbar", n.dataset.viewerContributionId = t.id;
6225
6236
  for (const a of t.items) {
6226
6237
  const o = document.createElement("button");
6227
- o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", Ys(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);
6238
+ o.type = "button", a.icon ? (o.insertAdjacentHTML("afterbegin", Ks(a.icon)), o.title = a.title ?? a.label, o.setAttribute("aria-label", a.title ?? a.label)) : (o.textContent = a.label, a.title && (o.title = a.title)), o.disabled = a.disabled === !0, a.pressed !== void 0 && (o.setAttribute("aria-pressed", String(a.pressed)), o.classList.toggle("is-active", a.pressed)), o.addEventListener("click", a.onClick), n.append(o);
6228
6239
  }
6229
6240
  this.hostElement.append(n), e.cleanup = () => n.remove();
6230
6241
  return;
@@ -6283,12 +6294,12 @@ class qs {
6283
6294
  if (this.disposed) throw new Error("Viewer plugin manager has been disposed.");
6284
6295
  }
6285
6296
  }
6286
- function Ys(s) {
6297
+ function Ks(s) {
6287
6298
  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>`;
6288
6299
  }
6289
- function Xs(s, e, t) {
6300
+ function Zs(s, e, t) {
6290
6301
  var p;
6291
- const i = Ks(s), r = Gs([t, e.signal, i]), n = ((p = e.filename) == null ? void 0 : p.trim()) || Js(s), a = Ae(s) ? en(s.files, s.entry, n) : n, o = Nt(s), l = e.baseUrl ?? Qs(o), d = /* @__PURE__ */ new Set(), c = Ae(s) ? new Map(s.files.map((h) => [V(h.path), h])) : null;
6302
+ const i = en(s), r = Qs([t, e.signal, i]), n = ((p = e.filename) == null ? void 0 : p.trim()) || rn(s), a = Ae(s) ? nn(s.files, s.entry, n) : n, o = Ft(s), l = e.baseUrl ?? sn(o), d = /* @__PURE__ */ new Set(), c = Ae(s) ? new Map(s.files.map((h) => [F(h.path), h])) : null;
6292
6303
  return Object.freeze({
6293
6304
  original: s,
6294
6305
  entryPath: a,
@@ -6298,23 +6309,23 @@ function Xs(s, e, t) {
6298
6309
  baseUrl: l,
6299
6310
  hasResourceResolver: !!e.resourceResolver,
6300
6311
  async resolve(h) {
6301
- ht(r);
6302
- const f = V(h), m = Zs(s);
6303
- if (m && (!f || f === V(a ?? ""))) {
6304
- const y = URL.createObjectURL(m);
6305
- return d.add(y), y;
6312
+ ft(r);
6313
+ const f = F(h), v = tn(s);
6314
+ if (v && (!f || f === F(a ?? ""))) {
6315
+ const b = URL.createObjectURL(v);
6316
+ return d.add(b), b;
6306
6317
  }
6307
- const v = (c == null ? void 0 : c.get(f)) ?? tn(c, a, f);
6308
- if (v) {
6309
- const y = URL.createObjectURL(v.file);
6310
- return d.add(y), y;
6318
+ const y = (c == null ? void 0 : c.get(f)) ?? an(c, a, f);
6319
+ if (y) {
6320
+ const b = URL.createObjectURL(y.file);
6321
+ return d.add(b), b;
6311
6322
  }
6312
- const b = await rn(e.resourceResolver, h, r);
6313
- if (ht(r), b instanceof Blob) {
6314
- const y = URL.createObjectURL(b);
6315
- return d.add(y), y;
6323
+ const m = await on(e.resourceResolver, h, r);
6324
+ if (ft(r), m instanceof Blob) {
6325
+ const b = URL.createObjectURL(m);
6326
+ return d.add(b), b;
6316
6327
  }
6317
- return b instanceof URL ? b.href : typeof b == "string" ? b : l ? new URL(h, l).href : h;
6328
+ return m instanceof URL ? m.href : typeof m == "string" ? m : l ? new URL(h, l).href : h;
6318
6329
  },
6319
6330
  release() {
6320
6331
  for (const h of d) URL.revokeObjectURL(h);
@@ -6322,7 +6333,7 @@ function Xs(s, e, t) {
6322
6333
  }
6323
6334
  });
6324
6335
  }
6325
- function Ws(s) {
6336
+ function Js(s) {
6326
6337
  var r;
6327
6338
  const e = s.entryPath ?? s.url;
6328
6339
  if (!e) return null;
@@ -6339,7 +6350,7 @@ function Ws(s) {
6339
6350
  const i = /\.([a-z0-9]+)$/i.exec(t);
6340
6351
  return ((r = i == null ? void 0 : i[1]) == null ? void 0 : r.toLowerCase()) ?? null;
6341
6352
  }
6342
- function Gs(s) {
6353
+ function Qs(s) {
6343
6354
  const e = s.filter((r) => !!r);
6344
6355
  if (e.length === 0) return new AbortController().signal;
6345
6356
  if (e.length === 1) return e[0];
@@ -6354,22 +6365,22 @@ function Gs(s) {
6354
6365
  }
6355
6366
  return t.signal;
6356
6367
  }
6357
- function ht(s) {
6368
+ function ft(s) {
6358
6369
  if (s.aborted)
6359
6370
  throw typeof s.throwIfAborted == "function" && s.throwIfAborted(), new DOMException("The operation was aborted.", "AbortError");
6360
6371
  }
6361
- function Ks(s) {
6372
+ function en(s) {
6362
6373
  return typeof s == "object" && s !== null && "signal" in s ? s.signal : void 0;
6363
6374
  }
6364
- function Nt(s) {
6375
+ function Ft(s) {
6365
6376
  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;
6366
6377
  }
6367
- function Zs(s) {
6378
+ function tn(s) {
6368
6379
  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;
6369
6380
  }
6370
- function Js(s) {
6381
+ function rn(s) {
6371
6382
  var t;
6372
- const e = Nt(s);
6383
+ const e = Ft(s);
6373
6384
  if (e)
6374
6385
  try {
6375
6386
  return decodeURIComponent(new URL(e, "https://viewer.invalid/").pathname.split("/").pop() || "") || null;
@@ -6378,7 +6389,7 @@ function Js(s) {
6378
6389
  }
6379
6390
  return Ae(s) ? s.entry ?? null : typeof File < "u" && s instanceof File && s.name || null;
6380
6391
  }
6381
- function Qs(s) {
6392
+ function sn(s) {
6382
6393
  var e;
6383
6394
  if (!s) return null;
6384
6395
  try {
@@ -6390,38 +6401,38 @@ function Qs(s) {
6390
6401
  function Ae(s) {
6391
6402
  return typeof s == "object" && s !== null && "kind" in s && s.kind === "files";
6392
6403
  }
6393
- function en(s, e, t) {
6404
+ function nn(s, e, t) {
6394
6405
  if (e) {
6395
- const i = V(e);
6396
- if (!s.some((r) => V(r.path) === i))
6397
- throw pt(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
6406
+ const i = F(e);
6407
+ if (!s.some((r) => F(r.path) === i))
6408
+ throw mt(`Asset package entry not found: ${e}`, "E_ASSET_ENTRY_NOT_FOUND");
6398
6409
  return i;
6399
6410
  }
6400
6411
  if (t) {
6401
- const i = V(t);
6402
- if (s.filter((n) => V(n.path) === i).length === 1) return i;
6412
+ const i = F(t);
6413
+ if (s.filter((n) => F(n.path) === i).length === 1) return i;
6403
6414
  }
6404
- if (s.length === 1) return V(s[0].path);
6405
- throw pt("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
6415
+ if (s.length === 1) return F(s[0].path);
6416
+ throw mt("Asset package has multiple files; specify an entry.", "E_ASSET_AMBIGUOUS_ENTRY");
6406
6417
  }
6407
- function tn(s, e, t) {
6418
+ function an(s, e, t) {
6408
6419
  if (!s || !e) return;
6409
6420
  const i = e.lastIndexOf("/"), r = i < 0 ? "" : e.slice(0, i + 1);
6410
- return s.get(V(`${r}${t}`));
6421
+ return s.get(F(`${r}${t}`));
6411
6422
  }
6412
- function V(s) {
6423
+ function F(s) {
6413
6424
  const e = [];
6414
6425
  for (const t of s.replaceAll("\\", "/").split("/"))
6415
6426
  !t || t === "." || (t === ".." ? e.pop() : e.push(t));
6416
6427
  return e.join("/");
6417
6428
  }
6418
- async function rn(s, e, t) {
6429
+ async function on(s, e, t) {
6419
6430
  return s ? s.resolve(e, { signal: t }) : null;
6420
6431
  }
6421
- function pt(s, e) {
6432
+ function mt(s, e) {
6422
6433
  return Object.assign(new Error(s), { code: e });
6423
6434
  }
6424
- const ft = Object.freeze({
6435
+ const vt = Object.freeze({
6425
6436
  canPlay: !1,
6426
6437
  canPause: !1,
6427
6438
  canReset: !1,
@@ -6431,8 +6442,8 @@ const ft = Object.freeze({
6431
6442
  }), q = Object.freeze({
6432
6443
  light: 15265002,
6433
6444
  dark: 593167
6434
- }), sn = 0.05;
6435
- class nn {
6445
+ }), ln = 0.05;
6446
+ class dn {
6436
6447
  constructor(e) {
6437
6448
  u(this, "epoch", 0);
6438
6449
  u(this, "active", null);
@@ -6563,7 +6574,7 @@ class nn {
6563
6574
  var r;
6564
6575
  const t = this.active;
6565
6576
  if (!t || !this.current(t) || t.snapshot.phase !== "ready" || !t.dynamic || !t.playing || !((r = t.session) != null && r.update)) return !1;
6566
- const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, sn));
6577
+ const i = t.resetFrameClock ? 0 : Math.max(0, Math.min(Number.isNaN(e) ? 0 : e, ln));
6567
6578
  t.resetFrameClock = !1;
6568
6579
  try {
6569
6580
  return !!(t.session.update(i) && this.current(t) && t.snapshot.phase === "ready" && t.playing);
@@ -6578,7 +6589,7 @@ class nn {
6578
6589
  var i, r;
6579
6590
  try {
6580
6591
  if (!this.current(e)) return;
6581
- e.source = Xs(t, e.options, e.abort.signal);
6592
+ e.source = Zs(t, e.options, e.abort.signal);
6582
6593
  const n = e.source.signal, a = () => {
6583
6594
  this.stop(e, "E_ABORTED");
6584
6595
  };
@@ -6586,7 +6597,7 @@ class nn {
6586
6597
  a();
6587
6598
  return;
6588
6599
  }
6589
- const o = this.detect(e), l = mt(o) ? await o : o;
6600
+ const o = this.detect(e), l = gt(o) ? await o : o;
6590
6601
  if (!this.current(e) || (e.loader = l.loader, !this.current(e))) return;
6591
6602
  if (!this.host.loaders().includes(l.loader))
6592
6603
  throw T("Asset loader was removed.", "E_ABORTED");
@@ -6610,22 +6621,22 @@ class nn {
6610
6621
  requestRender: () => {
6611
6622
  this.current(e) && this.host.requestRender();
6612
6623
  },
6613
- fit: (m, v) => this.current(e) ? this.host.fit(m, v) : !1,
6614
- reportError: (m, v) => this.report(e, m, v),
6624
+ fit: (v, y) => this.current(e) ? this.host.fit(v, y) : !1,
6625
+ reportError: (v, y) => this.report(e, v, y),
6615
6626
  reportSessionState: () => {
6616
- var v;
6627
+ var y;
6617
6628
  if (!this.current(e) || e.snapshot.phase !== "ready" || !e.session) return;
6618
- const m = e.session;
6619
- m.isPlaying && (e.playing = m.isPlaying()), ((v = m.physics) == null ? void 0 : v.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
6620
- capabilities: m.capabilities ?? ft,
6621
- physics: m.physics ?? null,
6622
- warning: m.warning ?? null
6629
+ const v = e.session;
6630
+ v.isPlaying && (e.playing = v.isPlaying()), ((y = v.physics) == null ? void 0 : y.status) === "unavailable" && (e.playing = !1, e.resetFrameClock = !1, this.endGrabOf(e)), this.transition(e, {
6631
+ capabilities: v.capabilities ?? vt,
6632
+ physics: v.physics ?? null,
6633
+ warning: v.warning ?? null
6623
6634
  }), this.publishControl(e), this.host.requestRender();
6624
6635
  },
6625
- reportProgress: (m, v) => {
6626
- this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: m, message: v });
6636
+ reportProgress: (v, y) => {
6637
+ this.current(e) && e.snapshot.phase === "loading" && this.transition(e, { stage: v, message: y });
6627
6638
  }
6628
- }, h = l.loader.createSession(e.source, p), f = mt(h) ? await h : h;
6639
+ }, h = l.loader.createSession(e.source, p), f = gt(h) ? await h : h;
6629
6640
  if (e.session && e.session !== f) {
6630
6641
  f.beginDispose(), await f.dispose();
6631
6642
  return;
@@ -6634,20 +6645,20 @@ class nn {
6634
6645
  this.beginDispose(e);
6635
6646
  return;
6636
6647
  }
6637
- if (await Promise.race([f.opened, new Promise((m) => {
6638
- n.aborted ? m() : n.addEventListener("abort", () => m(), { once: !0 });
6648
+ if (await Promise.race([f.opened, new Promise((v) => {
6649
+ n.aborted ? v() : n.addEventListener("abort", () => v(), { once: !0 });
6639
6650
  })]), !this.current(e) || e.snapshot.phase === "failed") return;
6640
6651
  if (f.root) {
6641
6652
  if (e.mounted = f.root, this.host.mount(f.root), !this.current(e)) return;
6642
6653
  if (((i = f.presentation ?? l.loader.presentation) == null ? void 0 : i.fitPolicy) === "fit-on-ready") {
6643
- const m = ((r = f.getFitBounds) == null ? void 0 : r.call(f)) ?? f.fitTarget ?? f.root;
6644
- if (!this.host.fit(m, { padding: 1.15 })) throw T("Asset has no displayable geometry.", "E_ASSET_EMPTY");
6654
+ const v = ((r = f.getFitBounds) == null ? void 0 : r.call(f)) ?? f.fitTarget ?? f.root;
6655
+ if (!this.host.fit(v, { padding: 1.15 })) throw T("Asset has no displayable geometry.", "E_ASSET_EMPTY");
6645
6656
  }
6646
6657
  }
6647
6658
  if (!this.current(e)) return;
6648
6659
  e.dynamic = typeof f.update == "function", e.playing = e.dynamic && f.autoPlay !== !1, e.resetFrameClock = e.playing, this.transition(e, {
6649
6660
  phase: "ready",
6650
- capabilities: f.capabilities ?? ft,
6661
+ capabilities: f.capabilities ?? vt,
6651
6662
  warning: f.warning ?? null,
6652
6663
  physics: f.physics ?? null
6653
6664
  }), this.current(e) && e.snapshot.phase === "ready" && e.ready.resolve();
@@ -6658,7 +6669,7 @@ class nn {
6658
6669
  }
6659
6670
  }
6660
6671
  detect(e) {
6661
- const t = e.source, i = this.host.loaders(), r = e.options.format, n = Ws(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
6672
+ const t = e.source, i = this.host.loaders(), r = e.options.format, n = Js(t), a = r && r !== "auto" ? r : n && ["dxb", "dxb3"].includes(n) ? "cad" : n;
6662
6673
  if (a) {
6663
6674
  const o = i.find((l) => l.formats.includes(a));
6664
6675
  if (o) return { loader: o, format: a };
@@ -6673,7 +6684,7 @@ class nn {
6673
6684
  const a = t[n], o = await ((r = a.match) == null ? void 0 : r.call(a, e.source));
6674
6685
  if (o && o.format !== "auto" && a.formats.includes(o.format)) return { loader: a, format: o.format };
6675
6686
  }
6676
- throw T("Unable to determine asset format; specify format explicitly.", "E_ASSET_UNKNOWN_FORMAT");
6687
+ throw T("Unable to determine asset format automatically; provide a supported filename or specify format explicitly.", "E_ASSET_UNKNOWN_FORMAT");
6677
6688
  }
6678
6689
  stop(e, t) {
6679
6690
  var i;
@@ -6958,10 +6969,10 @@ function ye() {
6958
6969
  function T(s, e) {
6959
6970
  return Object.assign(new Error(s), { code: e, ...e === "E_ABORTED" || e === "E_SUPERSEDED" ? { name: "AbortError" } : {} });
6960
6971
  }
6961
- function mt(s) {
6972
+ function gt(s) {
6962
6973
  return !!(s && typeof s.then == "function");
6963
6974
  }
6964
- const an = {
6975
+ const cn = {
6965
6976
  id: "nebula-asset-model",
6966
6977
  activate(s) {
6967
6978
  s.contribute({
@@ -6979,13 +6990,13 @@ const an = {
6979
6990
  clearColor: q.dark
6980
6991
  },
6981
6992
  async createSession(e, t) {
6982
- const { createModelSession: i } = await import("./session-DN0DckL_.js");
6993
+ const { createModelSession: i } = await import("./session-di9BueA_.js");
6983
6994
  return i(e, t);
6984
6995
  }
6985
6996
  });
6986
6997
  }
6987
6998
  };
6988
- function on(s, e, t) {
6999
+ function un(s, e, t) {
6989
7000
  let i = !1, r = !1;
6990
7001
  const n = {
6991
7002
  ...t.options.cad,
@@ -7014,7 +7025,7 @@ function on(s, e, t) {
7014
7025
  }
7015
7026
  };
7016
7027
  }
7017
- function ln(s) {
7028
+ function hn(s) {
7018
7029
  return {
7019
7030
  id: "nebula-asset-cad",
7020
7031
  activate(e) {
@@ -7029,24 +7040,24 @@ function ln(s) {
7029
7040
  uiProfile: "cad",
7030
7041
  fitPolicy: "restore-then-fit"
7031
7042
  },
7032
- createSession: (t, i) => on(s, t, i)
7043
+ createSession: (t, i) => un(s, t, i)
7033
7044
  });
7034
7045
  }
7035
7046
  };
7036
7047
  }
7037
- function dn(s) {
7048
+ function pn(s) {
7038
7049
  const e = s.replace(/^\uFEFF/, "").replace(/^\s*(?:<\?[\s\S]*?\?>\s*)?/, "").replace(/^(?:<!--[\s\S]*?-->\s*)*/, "");
7039
7050
  return /^<\s*mujoco(?:\s|>)/i.test(e) ? "mjcf" : /^<\s*robot(?:\s|>)/i.test(e) ? "urdf" : null;
7040
7051
  }
7041
- async function cn(s) {
7052
+ async function fn(s) {
7042
7053
  const e = s.entryPath ?? s.filename ?? s.url ?? "";
7043
7054
  if (!e.toLowerCase().split(/[?#]/, 1)[0].endsWith(".xml")) return null;
7044
7055
  const t = await s.resolve(e), i = await fetch(t, { signal: s.signal });
7045
7056
  if (!i.ok) return null;
7046
- const r = dn(await i.text());
7057
+ const r = pn(await i.text());
7047
7058
  return r ? { format: r } : null;
7048
7059
  }
7049
- const un = {
7060
+ const mn = {
7050
7061
  id: "nebula-asset-simulation",
7051
7062
  activate(s) {
7052
7063
  s.contribute({
@@ -7054,7 +7065,7 @@ const un = {
7054
7065
  id: "nebula.simulation-loader",
7055
7066
  assetKind: "simulation",
7056
7067
  formats: ["urdf", "xacro", "mjcf", "usd", "usda", "usdc", "usdz"],
7057
- match: cn,
7068
+ match: fn,
7058
7069
  presentation: {
7059
7070
  preferredViewMode: "3d",
7060
7071
  interactionMode: "simulation",
@@ -7063,12 +7074,12 @@ const un = {
7063
7074
  clearColor: q.dark
7064
7075
  },
7065
7076
  async createSession(e, t) {
7066
- const { createSimulationSession: i } = await import("./session-BaKbYHiJ.js").then((r) => r.f);
7077
+ const { createSimulationSession: i } = await import("./session-DHPMjyl3.js").then((r) => r.f);
7067
7078
  return i(e, t);
7068
7079
  }
7069
7080
  });
7070
7081
  }
7071
- }, ae = "viewer:highlight", U = "viewer:cad-selection", j = "viewer:cad-hover", vt = {
7082
+ }, ae = "viewer:highlight", U = "viewer:cad-selection", j = "viewer:cad-hover", bt = {
7072
7083
  dark: {
7073
7084
  hover: { color: 3528703, fillOpacity: 0, edgeOpacity: 0.85 },
7074
7085
  selected: { color: 5999871, fillOpacity: 0.24, edgeOpacity: 1 }
@@ -7077,8 +7088,8 @@ const un = {
7077
7088
  hover: { color: 24524, fillOpacity: 0, edgeOpacity: 0.95 },
7078
7089
  selected: { color: 24524, fillOpacity: 0.2, edgeOpacity: 1 }
7079
7090
  }
7080
- }, hn = 6, pn = 12, fn = 160, mn = 160, vn = 50, gt = 592655;
7081
- class gn {
7091
+ }, vn = 6, gn = 12, bn = 160, yn = 160, xn = 50, yt = 592655;
7092
+ class wn {
7082
7093
  constructor(e, t) {
7083
7094
  u(this, "cad");
7084
7095
  u(this, "mountedObjects", /* @__PURE__ */ new Set());
@@ -7094,9 +7105,9 @@ class gn {
7094
7105
  u(this, "interactionRenderLastTs", null);
7095
7106
  u(this, "cadHoveredInsert", null);
7096
7107
  u(this, "cadPointerPosition", null);
7097
- u(this, "pointerDragTracker", new Er({
7098
- distancePx: hn,
7099
- pathPx: pn
7108
+ u(this, "pointerDragTracker", new Ir({
7109
+ distancePx: vn,
7110
+ pathPx: gn
7100
7111
  }));
7101
7112
  u(this, "cadCapability");
7102
7113
  u(this, "cadHost");
@@ -7221,17 +7232,17 @@ class gn {
7221
7232
  u(this, "handlePointerLeave", (e) => {
7222
7233
  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));
7223
7234
  });
7224
- var i, r, n, a, o, l, d, c, p, h, f, m, v, b, y;
7225
- this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? nr(), 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 br(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (g, x = {}) => {
7235
+ var i, r, n, a, o, l, d, c, p, h, f, v, y, m, b;
7236
+ this.options = e, this.runtime = t, this.cameraStateStore = e.cameraStateStore === !1 ? void 0 : e.cameraStateStore ?? dr(), this.interactionMode = e.cadInteraction ?? "managed", e.previewDragPreset && this.runtime.setPreviewDragPreset(e.previewDragPreset), this.uiTheme = ((i = e.ui) == null ? void 0 : i.theme) ?? "dark", this.cadHost = this.createCadHost(), this.cadCapability = new Cr(this.cadHost), this.cad = this.cadCapability, this.cadCapability.open = async (g, x = {}) => {
7226
7237
  this.assertActive();
7227
- const { filename: w, signal: k, ...F } = x;
7228
- await this.assetController.open(g, { format: "cad", filename: w, signal: k, cad: F }, !0).ready;
7238
+ const { filename: w, signal: C, ...D } = x;
7239
+ await this.assetController.open(g, { format: "cad", filename: w, signal: C, cad: D }, !0).ready;
7229
7240
  const A = this.cadCapability.document;
7230
7241
  if (!A) throw Object.assign(new Error("CAD open superseded"), { code: "E_SUPERSEDED", name: "AbortError" });
7231
7242
  return A;
7232
7243
  }, this.cadCapability.close = () => {
7233
7244
  this.assertActive(), this.assetController.closeKind("cad");
7234
- }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = xe(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new qs(
7245
+ }, this.initialCameraSnapshot = t.captureCameraSnapshot(), this.lastCameraFingerprint = xe(this.initialCameraSnapshot), this.layoutEngine = this.createLayoutEngine(), this.pluginManager = new Gs(
7235
7246
  () => this.cadCapability.getSnapshot(),
7236
7247
  () => ({
7237
7248
  viewMode: this.runtime.viewMode,
@@ -7265,7 +7276,7 @@ class gn {
7265
7276
  e.viewport,
7266
7277
  this.layoutEngine,
7267
7278
  () => this.assetController.getActiveInspection()
7268
- ), this.assetController = new nn({
7279
+ ), this.assetController = new dn({
7269
7280
  loaders: () => this.pluginManager.getAssetLoaders(),
7270
7281
  mount: (g) => this.mountAssetObject(g),
7271
7282
  detach: (g) => this.unmountAssetObject(g),
@@ -7278,14 +7289,14 @@ class gn {
7278
7289
  cleanupError: (g) => {
7279
7290
  this.options.onCleanupError ? this.options.onCleanupError(g) : console.error("[viewer] asset cleanup failed", g);
7280
7291
  }
7281
- }), this.pluginManager.registerBuiltin(ln(this.cadCapability)), this.pluginManager.registerBuiltin(an), this.pluginManager.registerBuiltin(un), this.pluginManager.onAssetLoaderRemoved((g) => this.assetController.removeLoader(g)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
7292
+ }), this.pluginManager.registerBuiltin(hn(this.cadCapability)), this.pluginManager.registerBuiltin(cn), this.pluginManager.registerBuiltin(mn), this.pluginManager.onAssetLoaderRemoved((g) => this.assetController.removeLoader(g)), this.cadInspectorUnsubscribe = this.cad.on("inspector-change", () => {
7282
7293
  this.interactionMode === "managed" && (this.syncCadSelectionOverlay(), this.syncCadHoverOverlay()), this.dispatchCadSelectionChange();
7283
7294
  }), this.cadDocumentUnsubscribe = this.cad.on("document-change", () => {
7284
7295
  this.setCadHoveredInsert(null), this.interactionMode === "managed" && this.syncCadSelectionOverlay();
7285
7296
  }), this.assetChangeUnsubscribe = this.on("asset-change", (g) => {
7286
7297
  const x = g.snapshot.phase;
7287
7298
  (x === "closing" || x === "failed" || x === "closed") && this.endAssetGrab();
7288
- }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(vs(
7299
+ }), e.ui && e.ui.preset !== "none" && (e.ui.preset !== "cad-readonly" && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(xs(
7289
7300
  {
7290
7301
  mountBuiltin: (g, x) => this.layoutEngine.mountBuiltin(g, x),
7291
7302
  shadowRoot: () => this.builtinUiShadow(),
@@ -7297,7 +7308,7 @@ class gn {
7297
7308
  label: (g) => g === "simulation" ? "仿真控制" : "模型控制",
7298
7309
  scene: e.ui.scene
7299
7310
  }
7300
- )), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(js({
7311
+ )), e.ui.urdf !== !1 && this.interactionMode === "managed" && this.pluginManager.registerBuiltin(Xs({
7301
7312
  interactionCanvas: () => this.options.canvas,
7302
7313
  interactionCamera: () => this.runtime.getActiveCamera(),
7303
7314
  cameraQuaternion: () => this.runtime.getActiveCamera().quaternion.clone(),
@@ -7308,13 +7319,13 @@ class gn {
7308
7319
  })), this.interactionMode === "managed" && this.pluginManager.register({
7309
7320
  id: "nebula.ui.cad",
7310
7321
  activate: () => {
7311
- this.ui = new ts(this.createUiHost(), e.ui), this.ui.mount();
7322
+ this.ui = new ns(this.createUiHost(), e.ui), this.ui.mount();
7312
7323
  },
7313
7324
  deactivate: () => {
7314
7325
  var g;
7315
7326
  (g = this.ui) == null || g.dispose(), this.ui = null;
7316
7327
  }
7317
- })), (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), (v = (m = this.options.canvas).addEventListener) == null || v.call(m, "lostpointercapture", this.handleLostPointerCapture), (y = (b = this.options.canvas).addEventListener) == null || y.call(b, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && Cn(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({
7328
+ })), (n = (r = this.options.canvas).addEventListener) == null || n.call(r, "pointerdown", this.handlePointerDown), (o = (a = this.options.canvas).addEventListener) == null || o.call(a, "pointermove", this.handlePointerMove), (d = (l = this.options.canvas).addEventListener) == null || d.call(l, "pointerup", this.handlePointerUp), (p = (c = this.options.canvas).addEventListener) == null || p.call(c, "pointercancel", this.handlePointerCancel), (f = (h = this.options.canvas).addEventListener) == null || f.call(h, "pointerleave", this.handlePointerLeave), (y = (v = this.options.canvas).addEventListener) == null || y.call(v, "lostpointercapture", this.handleLostPointerCapture), (b = (m = this.options.canvas).addEventListener) == null || b.call(m, "wheel", this.handleWheel, { passive: !0 }), typeof globalThis.window < "u" && globalThis.window.addEventListener("blur", this.handleWindowBlur), typeof ResizeObserver == "function" && Pn(this.options.viewport) ? (this.viewportResizeObserver = new ResizeObserver(() => this.handleViewportResize()), this.viewportResizeObserver.observe(this.options.viewport)) : (this.viewportResizeObserver = null, typeof globalThis.window < "u" && (this.usingWindowResizeFallback = !0, globalThis.window.addEventListener("resize", this.handleViewportResize))), this.runtime.startAnimation({
7318
7329
  renderExtension: { beforeRender: (g, x, w) => this.assetController.beforeRender(g, x, w) },
7319
7330
  onFrame: (g, x) => {
7320
7331
  this.assetController.update(x) && this.runtime.requestRender();
@@ -7412,7 +7423,7 @@ class gn {
7412
7423
  this.assertActive(), e !== this.runtime.viewMode && (t ? this.runtime.setViewMode(e, t) : this.runtime.setViewMode(e), this.emit("view-mode-change", { viewMode: e }), this.pendingCameraReason = "view-mode", this.cadCapability.onCameraChanged("view-mode"), this.refreshCadPointerHover());
7413
7424
  }
7414
7425
  fitView(e, t) {
7415
- this.assertActive(), e && !(e instanceof N) && this.assertMounted(e);
7426
+ this.assertActive(), e && !(e instanceof V) && this.assertMounted(e);
7416
7427
  const i = e ?? this.assetController.getActiveFitBounds() ?? this.pluginManager.findFitPolicy() ?? this.resolveMixedBounds();
7417
7428
  if (!i) return !1;
7418
7429
  const r = this.runtime.fitView(i, t);
@@ -7446,7 +7457,7 @@ class gn {
7446
7457
  setHighlight(e, t = {}) {
7447
7458
  if (this.assertActive(), e && this.assertMounted(e), !(this.highlightedObjectValue === null && e === null)) {
7448
7459
  if (this.runtime.removeOverlay(ae), this.highlightedObjectValue = e, e) {
7449
- const i = new Kt(e, t.color ?? 6000111);
7460
+ const i = new Jt(e, t.color ?? 6000111);
7450
7461
  i.name = ae, this.runtime.mountOverlay(ae, i, { owned: !0 });
7451
7462
  }
7452
7463
  this.emit("highlight-change", { object: e });
@@ -7473,14 +7484,14 @@ class gn {
7473
7484
  this.assertActive(), this.pluginManager.use(e, t);
7474
7485
  }
7475
7486
  dispose() {
7476
- var e, t, i, r, n, a, o, l, d, c, p, h, f, m, v;
7487
+ var e, t, i, r, n, a, o, l, d, c, p, h, f, v, y;
7477
7488
  if (!this.disposed) {
7478
- 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), (m = (f = this.options.canvas).removeEventListener) == null || m.call(f, "wheel", this.handleWheel), typeof globalThis.window < "u" && (globalThis.window.removeEventListener("blur", this.handleWindowBlur), this.usingWindowResizeFallback && globalThis.window.removeEventListener("resize", this.handleViewportResize)), (v = this.viewportResizeObserver) == null || v.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;
7479
- for (const b of this.mountedObjects)
7480
- this.runtime.removeObject(b, { dispose: !1 });
7489
+ 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;
7490
+ for (const m of this.mountedObjects)
7491
+ this.runtime.removeObject(m, { dispose: !1 });
7481
7492
  this.mountedObjects.clear();
7482
- for (const b of this.mountedAssetObjects)
7483
- this.runtime.removeObject(b, { dispose: !1 });
7493
+ for (const m of this.mountedAssetObjects)
7494
+ this.runtime.removeObject(m, { dispose: !1 });
7484
7495
  this.mountedAssetObjects.clear(), this.cadCapability.dispose(), this.layoutEngine.dispose(), this.listeners.clear(), this.runtime.dispose();
7485
7496
  }
7486
7497
  }
@@ -7500,7 +7511,7 @@ class gn {
7500
7511
  createLayoutEngine() {
7501
7512
  var r;
7502
7513
  const e = this, t = this.options, i = (r = t.ui) == null ? void 0 : r.insetTarget;
7503
- return new ns({
7514
+ return new ds({
7504
7515
  reference: () => {
7505
7516
  var n;
7506
7517
  return ((n = t.ui) == null ? void 0 : n.root) ?? t.viewport;
@@ -7544,7 +7555,7 @@ class gn {
7544
7555
  */
7545
7556
  resetAssetPresentation() {
7546
7557
  var e;
7547
- this.runtime.setClearColor(this.options.clearColor ?? gt), 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();
7558
+ this.runtime.setClearColor(this.options.clearColor ?? yt), this.runtime.setNavigationPolicy("viewer"), this.interactionMode = this.options.cadInteraction ?? "managed", (e = this.ui) == null || e.setActive(!1), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay(), this.runtime.requestRender();
7548
7559
  }
7549
7560
  createCadHost() {
7550
7561
  const e = this;
@@ -7565,7 +7576,7 @@ class gn {
7565
7576
  return e.cadCapability.getVisibilityRevision();
7566
7577
  },
7567
7578
  get viewportDemandCoalesceMs() {
7568
- return e.options.viewportDemandCoalesceMs ?? mn;
7579
+ return e.options.viewportDemandCoalesceMs ?? yn;
7569
7580
  },
7570
7581
  mountCadObject(t) {
7571
7582
  e.unmountCadObject(), e.runtime.addObject(t, { owned: !0 }), e.cadRenderRoot = t;
@@ -7604,10 +7615,10 @@ class gn {
7604
7615
  return ((n = e.runtime.screenToWorldOnPlane(t, i, r)) == null ? void 0 : n.clone()) ?? null;
7605
7616
  },
7606
7617
  readCameraSnapshot(t) {
7607
- return or(e.cameraStateStore, t);
7618
+ return ur(e.cameraStateStore, t);
7608
7619
  },
7609
7620
  persistCameraSnapshot(t, i) {
7610
- lr(e.cameraStateStore, t, i);
7621
+ hr(e.cameraStateStore, t, i);
7611
7622
  },
7612
7623
  getViewportSize() {
7613
7624
  return {
@@ -7628,12 +7639,12 @@ class gn {
7628
7639
  e.details.bbox.minY,
7629
7640
  e.details.bbox.maxX,
7630
7641
  e.details.bbox.maxY
7631
- ].every(Number.isFinite) ? e.details.bbox : null, i = t ? new N(
7632
- new S(t.minX, t.minY, -0.01),
7633
- new S(t.maxX, t.maxY, 0.01)
7634
- ) : e.textDetails ? new N(
7635
- new S(e.textDetails.x, e.textDetails.y, -0.01),
7636
- new S(
7642
+ ].every(Number.isFinite) ? e.details.bbox : null, i = t ? new V(
7643
+ new E(t.minX, t.minY, -0.01),
7644
+ new E(t.maxX, t.maxY, 0.01)
7645
+ ) : e.textDetails ? new V(
7646
+ new E(e.textDetails.x, e.textDetails.y, -0.01),
7647
+ new E(
7637
7648
  e.textDetails.x + e.textDetails.content.length * e.textDetails.height * 0.6,
7638
7649
  e.textDetails.y + e.textDetails.height,
7639
7650
  0.01
@@ -7642,7 +7653,7 @@ class gn {
7642
7653
  if (!i || i.isEmpty()) return;
7643
7654
  const r = !!((o = e.details) != null && o.bbox);
7644
7655
  if (((d = (l = this.options.cadInteractionStyle) == null ? void 0 : l.selected) == null ? void 0 : d.enabled) === !1) return;
7645
- const n = r ? this.createCadInteractionOverlay(i, "selected") : new Zt(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? vt.dark.selected.color);
7656
+ const n = r ? this.createCadInteractionOverlay(i, "selected") : new Qt(i, ((p = (c = this.options.cadInteractionStyle) == null ? void 0 : c.selected) == null ? void 0 : p.color) ?? bt.dark.selected.color);
7646
7657
  n.name = U, this.runtime.mountOverlay(U, n, { owned: !0 });
7647
7658
  }
7648
7659
  dispatchCadSelectionChange() {
@@ -7661,17 +7672,17 @@ class gn {
7661
7672
  }
7662
7673
  createCadInteractionOverlay(e, t) {
7663
7674
  var h, f;
7664
- const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", r = vt[i][t], n = (f = this.options.cadInteractionStyle) == null ? void 0 : f[t], a = {
7675
+ const i = ((h = this.options.ui) == null ? void 0 : h.theme) === "light" ? "light" : "dark", r = bt[i][t], n = (f = this.options.cadInteractionStyle) == null ? void 0 : f[t], a = {
7665
7676
  color: (n == null ? void 0 : n.color) ?? r.color,
7666
7677
  fillOpacity: (n == null ? void 0 : n.fillOpacity) ?? r.fillOpacity,
7667
7678
  edgeOpacity: (n == null ? void 0 : n.edgeOpacity) ?? r.edgeOpacity
7668
- }, o = new xt();
7679
+ }, o = new Ct();
7669
7680
  o.name = t === "hover" ? "cad-insert-hover" : "cad-insert-selected", o.renderOrder = t === "hover" ? 1300 : 1310;
7670
- const l = e.getSize(new S()), d = e.getCenter(new S()), c = new Jt(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
7681
+ const l = e.getSize(new E()), d = e.getCenter(new E()), c = new ei(Math.max(l.x, 1e-6), Math.max(l.y, 1e-6), Math.max(l.z, 1e-3));
7671
7682
  if (a.fillOpacity > 0) {
7672
- const m = new Qt(
7683
+ const v = new ti(
7673
7684
  c.clone(),
7674
- new ei({
7685
+ new ii({
7675
7686
  color: a.color,
7676
7687
  transparent: !0,
7677
7688
  opacity: a.fillOpacity,
@@ -7679,11 +7690,11 @@ class gn {
7679
7690
  depthWrite: !1
7680
7691
  })
7681
7692
  );
7682
- m.name = `${o.name}:fill`, m.position.copy(d), m.renderOrder = 1305, o.add(m);
7693
+ v.name = `${o.name}:fill`, v.position.copy(d), v.renderOrder = 1305, o.add(v);
7683
7694
  }
7684
- const p = new ti(
7685
- new ii(c),
7686
- new ri({
7695
+ const p = new ri(
7696
+ new si(c),
7697
+ new ni({
7687
7698
  color: a.color,
7688
7699
  transparent: !0,
7689
7700
  opacity: a.edgeOpacity,
@@ -7695,9 +7706,9 @@ class gn {
7695
7706
  }
7696
7707
  cadInsertDetailsToBox(e) {
7697
7708
  const t = e == null ? void 0 : e.bbox;
7698
- return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new N(
7699
- new S(t.minX, t.minY, -0.01),
7700
- new S(t.maxX, t.maxY, 0.01)
7709
+ return !t || ![t.minX, t.minY, t.maxX, t.maxY].every(Number.isFinite) ? null : new V(
7710
+ new E(t.minX, t.minY, -0.01),
7711
+ new E(t.maxX, t.maxY, 0.01)
7701
7712
  );
7702
7713
  }
7703
7714
  isSameCadInsertSelection(e, t) {
@@ -7785,14 +7796,14 @@ class gn {
7785
7796
  this.resetAssetPresentation();
7786
7797
  return;
7787
7798
  }
7788
- this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? gt), this.runtime.setNavigationPolicy(
7799
+ this.runtime.setClearColor(e.clearColor ?? this.options.clearColor ?? yt), this.runtime.setNavigationPolicy(
7789
7800
  e.interactionMode === "object" || e.interactionMode === "simulation" ? "preview" : "viewer"
7790
- ), 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(yn(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();
7801
+ ), e.preferredViewMode && e.preferredViewMode !== this.runtime.viewMode && this.setViewMode(e.preferredViewMode, { preserveOrbit: !0 }), this.interactionMode = e.interactionMode === "cad-managed" ? this.options.cadInteraction ?? "managed" : e.interactionMode === "object" || e.interactionMode === "simulation" ? "disabled" : this.options.cadInteraction ?? "managed", this.layoutEngine.setActiveGroups(Sn(e.uiProfile)), (t = this.ui) == null || t.setActive(e.uiProfile === "cad"), this.interactionMode !== "managed" ? (this.setCadHoveredInsert(null), this.runtime.removeOverlay(U), this.runtime.removeOverlay(j), this.cadCapability.clearSelection()) : this.syncCadSelectionOverlay();
7791
7802
  }
7792
7803
  resolveMixedBounds() {
7793
7804
  const e = this.assetController.getActiveFitBounds();
7794
7805
  if (e) return e;
7795
- const t = new N();
7806
+ const t = new V();
7796
7807
  let i = !1;
7797
7808
  for (const n of [...this.mountedObjects, ...this.mountedAssetObjects])
7798
7809
  n.visible && (t.expandByObject(n), i = !0);
@@ -7803,7 +7814,7 @@ class gn {
7803
7814
  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());
7804
7815
  }
7805
7816
  applyCameraSnapshot(e, t) {
7806
- if (!At(e)) return !1;
7817
+ if (!Mt(e)) return !1;
7807
7818
  const i = this.runtime.viewMode;
7808
7819
  return this.runtime.applyCameraSnapshot(e) ? (this.runtime.viewMode !== i && this.emit("view-mode-change", { viewMode: this.runtime.viewMode }), this.pendingCameraReason = t, this.cadCapability.onCameraChanged(t), this.refreshCadPointerHover(), !0) : !1;
7809
7820
  }
@@ -7825,7 +7836,7 @@ class gn {
7825
7836
  shouldRenderCurrentFrame(e) {
7826
7837
  if (this.assetController.isActivePreview || this.assetController.isActiveDynamicPlaying || this.interaction !== "active" || this.interactionRenderLastTs === null) return !0;
7827
7838
  const t = e - this.interactionRenderLastTs;
7828
- return t < 0 || t >= vn;
7839
+ return t < 0 || t >= xn;
7829
7840
  }
7830
7841
  markInteractionActive() {
7831
7842
  this.clearInteractionIdleTimer(), this.setInteraction("active");
@@ -7833,7 +7844,7 @@ class gn {
7833
7844
  scheduleInteractionIdle() {
7834
7845
  this.clearInteractionIdleTimer(), this.interactionIdleTimer = globalThis.setTimeout(() => {
7835
7846
  this.interactionIdleTimer = null, this.setInteraction("idle"), this.refreshCadPointerHover();
7836
- }, fn);
7847
+ }, bn);
7837
7848
  }
7838
7849
  clearInteractionIdleTimer() {
7839
7850
  this.interactionIdleTimer !== null && (globalThis.clearTimeout(this.interactionIdleTimer), this.interactionIdleTimer = null);
@@ -7908,8 +7919,8 @@ class gn {
7908
7919
  for (const i of this.listeners.get(e) ?? []) i(t);
7909
7920
  }
7910
7921
  }
7911
- function Ln(s) {
7912
- const e = new tr({
7922
+ function zn(s) {
7923
+ const e = new nr({
7913
7924
  canvasArea: s.viewport,
7914
7925
  canvas: s.canvas,
7915
7926
  clearColor: s.clearColor,
@@ -7920,22 +7931,23 @@ function Ln(s) {
7920
7931
  environment: s.environment ?? "room",
7921
7932
  navigationPolicy: "viewer"
7922
7933
  });
7923
- return bn(s, e);
7934
+ return Cn(s, e);
7924
7935
  }
7925
- function bn(s, e) {
7926
- return e.initialize(), new gn(s, e);
7936
+ function Cn(s, e) {
7937
+ return e.initialize(), new wn(s, e);
7927
7938
  }
7928
- function yn(s) {
7929
- return s === "cad" ? xn : s === "model" ? bt : s === "simulation" ? /* @__PURE__ */ new Set([...bt, "urdf"]) : wn;
7939
+ function Sn(s) {
7940
+ return s === "cad" ? En : s === "model" ? xt : s === "simulation" ? /* @__PURE__ */ new Set([...xt, "urdf"]) : kn;
7930
7941
  }
7931
- const xn = /* @__PURE__ */ new Set(["cad"]), bt = /* @__PURE__ */ new Set(["scene"]), wn = /* @__PURE__ */ new Set();
7942
+ const En = /* @__PURE__ */ new Set(["cad"]), xt = /* @__PURE__ */ new Set(["scene"]), kn = /* @__PURE__ */ new Set();
7932
7943
  function xe(s) {
7933
7944
  return s ? JSON.stringify(s) : null;
7934
7945
  }
7935
- function Cn(s) {
7946
+ function Pn(s) {
7936
7947
  return !!(s && typeof s == "object" && s.nodeType === 1);
7937
7948
  }
7938
7949
  export {
7939
7950
  q as V,
7940
- Ln as c
7951
+ zn as c,
7952
+ fi as v
7941
7953
  };