@nebula-spatial/viewer 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,46 +1,62 @@
1
1
  import { Group as ot, Mesh as at, Vector3 as _, Quaternion as j, Matrix4 as X, Box3 as ht } from "three";
2
- import { USDLoader as It } from "@openusd-wasm/three-loader";
3
- import { PXR as $t } from "@openusd-wasm/pxr";
4
- import { c as Rt, a as xt, b as At, d as Nt, S as Mt } from "./session-DNMxzxd5.js";
5
- import { d as _t } from "./stage-CFr9ZkwQ.js";
6
- async function ee(t, e, n) {
7
- var w;
8
- Bt();
9
- const s = n.hasLocalFiles(), d = t.entryPath ?? t.filename ?? "asset.usd", S = s ? d : await zt(t, d), l = s ? n.getBlob(d) : await Gt(t), r = d.split("/").pop() || "asset.usd", i = d.split("/").slice(0, -1).join("/"), y = e.options.openUsdBaseUrl ? { baseURL: e.options.openUsdBaseUrl } : void 0, p = t.hasResourceResolver && !s ? await new $t().load(y) : void 0;
10
- p && await Ht(p, t, l, r, n);
11
- const g = new It({
2
+ import { USDLoader as Rt } from "@openusd-wasm/three-loader";
3
+ import { PXR as It } from "@openusd-wasm/pxr";
4
+ import { c as $t, a as xt, b as At, d as Nt, S as Mt } from "./session-B-qVl3Yy.js";
5
+ import { d as _t } from "./stage-D-Q_zul6.js";
6
+ function Ot(t) {
7
+ if (!t) return;
8
+ if (typeof window > "u") return { baseURL: t };
9
+ const e = new URL(t, document.baseURI).href, n = new URL("openusd_pxr_wasm.js", e.endsWith("/") ? e : `${e}/`);
10
+ if (n.origin === window.location.origin) return { baseURL: e };
11
+ const i = new Blob([`import ${JSON.stringify(n.href)};
12
+ `], { type: "text/javascript" });
13
+ return {
14
+ baseURL: e,
15
+ // pxr 0.0.13 sets mainScriptUrlOrBlob itself; its public preRun hook runs
16
+ // before OpenUSD initializes and lazily spawns its pthread workers.
17
+ preRun: [(d) => {
18
+ d.mainScriptUrlOrBlob = i;
19
+ }]
20
+ };
21
+ }
22
+ async function ne(t, e, n) {
23
+ var D;
24
+ zt();
25
+ const i = n.hasLocalFiles(), d = t.entryPath ?? t.filename ?? "asset.usd", S = i ? d : await Gt(t, d), l = i ? n.getBlob(d) : await qt(t), r = d.split("/").pop() || "asset.usd", s = d.split("/").slice(0, -1).join("/"), y = Ot(e.options.openUsdBaseUrl), p = t.hasResourceResolver && !i ? await new It().load(y) : void 0;
26
+ p && await Xt(p, t, l, r, n);
27
+ const g = new Rt({
12
28
  convertZUp: !1,
13
29
  loadLights: !1,
14
30
  preserveStage: !0,
15
31
  ...p ? { pxr: p } : y ? { pxrOptions: y } : {}
16
32
  });
17
- let c = null, I = null, u = null, D = null;
33
+ let c = null, R = null, u = null, b = null;
18
34
  try {
19
35
  if (c = await g.parseAsync(l, {
20
36
  sourcePath: S,
21
37
  fileName: r,
22
- files: s || t.hasResourceResolver ? n.asSourceRecord(i) : void 0,
38
+ files: i || t.hasResourceResolver ? n.asSourceRecord(s) : void 0,
23
39
  // A local package is the complete browser-visible file set. Resolving it
24
40
  // through fetch would both hide missing uploads and accept SPA fallback
25
41
  // responses as binary USD layers.
26
- autoResolveAssets: !s && !t.hasResourceResolver,
42
+ autoResolveAssets: !i && !t.hasResourceResolver,
27
43
  // USD layer references are authoritative; disable directory guessing because SPA fallback pages may be returned as HTTP 200.
28
44
  assetSearchRoots: [],
29
- textureResolver: s || t.hasResourceResolver ? (a) => {
30
- for (const $ of [a.resolvedPath, a.path, a.url])
31
- if ($) {
32
- const L = n.objectUrlIfPresent($, i);
45
+ textureResolver: i || t.hasResourceResolver ? (a) => {
46
+ for (const I of [a.resolvedPath, a.path, a.url])
47
+ if (I) {
48
+ const L = n.objectUrlIfPresent(I, s);
33
49
  if (L) return L;
34
50
  }
35
51
  return null;
36
52
  } : void 0,
37
53
  preserveStage: !0
38
54
  }), e.signal.aborted) throw Ut();
39
- const b = Yt(c);
40
- c.scene.scale.multiplyScalar(b.metersPerUnit), c.data.stage.upAxis.toUpperCase() === "Y" && c.scene.quaternion.setFromAxisAngle(new _(1, 0, 0), Math.PI / 2), c.scene.updateMatrixWorld(!0);
55
+ const w = Yt(c);
56
+ c.scene.scale.multiplyScalar(w.metersPerUnit), c.data.stage.upAxis.toUpperCase() === "Y" && c.scene.quaternion.setFromAxisAngle(new _(1, 0, 0), Math.PI / 2), c.scene.updateMatrixWorld(!0);
41
57
  const A = c.data.physics.rigidBodies.filter((a) => a.enabled), M = c.data.joints.filter((a) => a.enabled), O = At();
42
58
  A.some((a) => a.startsAsleep === !0) && O.droppedFeatures.push({ code: "E_USD_STARTS_ASLEEP", message: "USD startsAsleep 无法在 MuJoCo 初始化阶段保证完全等价,已按正常初始状态加载。", source: "usd-physics" });
43
- const R = Nt({
59
+ const $ = Nt({
44
60
  id: S,
45
61
  name: S.split("/").pop() ?? S,
46
62
  source: { format: "usd", uri: S },
@@ -50,50 +66,50 @@ async function ee(t, e, n) {
50
66
  type: a.jointType,
51
67
  parent: a.body0,
52
68
  child: a.body1,
53
- origin: { position: a.localPos1.map(($) => $ * b.metersPerUnit), rotationRpy: [0, 0, 0] },
69
+ origin: { position: a.localPos1.map((I) => I * w.metersPerUnit), rotationRpy: [0, 0, 0] },
54
70
  axis: gt(a.axis).applyQuaternion(H(a.localRot1 ?? [1, 0, 0, 0])).toArray(),
55
71
  ...Number.isFinite(a.lowerLimit) && Number.isFinite(a.upperLimit) ? { limits: {
56
- lower: a.lowerLimit * (a.jointType === "revolute" ? Math.PI / 180 : b.metersPerUnit),
57
- upper: a.upperLimit * (a.jointType === "revolute" ? Math.PI / 180 : b.metersPerUnit)
72
+ lower: a.lowerLimit * (a.jointType === "revolute" ? Math.PI / 180 : w.metersPerUnit),
73
+ upper: a.upperLimit * (a.jointType === "revolute" ? Math.PI / 180 : w.metersPerUnit)
58
74
  } } : {}
59
75
  }] : []),
60
76
  diagnostics: O,
61
77
  extension: { rigidBodyCount: A.length, jointCount: M.length }
62
78
  });
63
79
  if (A.length === 0) {
64
- const a = yt(c), $ = c.scene, L = c;
65
- return u = { root: $, sync() {
80
+ const a = yt(c), I = c.scene, L = c;
81
+ return u = { root: I, sync() {
66
82
  }, dispose() {
67
83
  L.dispose();
68
- } }, c = null, st(R, u, !1, () => {
84
+ } }, c = null, it($, u, !1, () => {
69
85
  }, void 0, void 0, a);
70
86
  }
71
87
  let P;
72
88
  try {
73
- P = Ct(c, A.map((a) => a.path), b), (w = P.massOverrides) != null && w.length && O.approximations.push({ code: "USD_INFERRED_INERTIA", message: "保留显式总质量;惯量按碰撞几何的密度分布推导并同比缩放,重叠体积会重复计入。", source: "usd-physics" });
89
+ P = Ft(c, A.map((a) => a.path), w), (D = P.massOverrides) != null && D.length && O.approximations.push({ code: "USD_INFERRED_INERTIA", message: "保留显式总质量;惯量按碰撞几何的密度分布推导并同比缩放,重叠体积会重复计入。", source: "usd-physics" });
74
90
  } catch (a) {
75
- if (!vt(a)) throw a;
76
- const $ = Tt(a);
77
- O.droppedFeatures.push($);
91
+ if (!Tt(a)) throw a;
92
+ const I = Lt(a);
93
+ O.droppedFeatures.push(I);
78
94
  const L = yt(c), G = c.scene, f = c;
79
95
  return u = { root: G, sync() {
80
96
  }, dispose() {
81
97
  f.dispose();
82
- } }, c = null, st(R, u, !1, () => {
83
- }, void 0, $, L);
98
+ } }, c = null, it($, u, !1, () => {
99
+ }, void 0, I, L);
84
100
  }
85
- const x = D = Lt(c, A.map((a) => a.path)), { MujocoRuntime: K } = await import("./mujoco-runtime-s85kwjo7.js");
86
- if (I = new K(), await I.initialize(P, e.options.mujocoBaseUrl), e.signal.aborted) throw Ut();
87
- u = new Mt(I, x), D = null;
88
- const o = c, E = I, N = u;
89
- return c = null, I = null, u = null, st(R, N, !0, () => {
101
+ const x = b = Ct(c, A.map((a) => a.path)), { MujocoRuntime: K } = await import("./mujoco-runtime-s85kwjo7.js");
102
+ if (R = new K(), await R.initialize(P, e.options.mujocoBaseUrl), e.signal.aborted) throw Ut();
103
+ u = new Mt(R, x), b = null;
104
+ const o = c, E = R, N = u;
105
+ return c = null, R = null, u = null, it($, N, !0, () => {
90
106
  E.dispose(), o.dispose();
91
107
  }, E);
92
- } catch (b) {
93
- throw D && _t(D.root), u == null || u.dispose(), I == null || I.dispose(), c == null || c.dispose(), b;
108
+ } catch (w) {
109
+ throw b && _t(b.root), u == null || u.dispose(), R == null || R.dispose(), c == null || c.dispose(), w;
94
110
  }
95
111
  }
96
- function st(t, e, n, s, d, S, l) {
112
+ function it(t, e, n, i, d, S, l) {
97
113
  let r = !1;
98
114
  return {
99
115
  asset: t,
@@ -102,20 +118,20 @@ function st(t, e, n, s, d, S, l) {
102
118
  runtime: d,
103
119
  fallback: S,
104
120
  collision: l,
105
- step(i) {
121
+ step(s) {
106
122
  if (!d) return !1;
107
- const y = d.step(i);
123
+ const y = d.step(s);
108
124
  return y && e.sync(), y;
109
125
  },
110
126
  reset() {
111
127
  d == null || d.reset(), e.sync();
112
128
  },
113
129
  dispose() {
114
- r || (r = !0, l == null || l.dispose(), e.dispose(), s());
130
+ r || (r = !0, l == null || l.dispose(), e.dispose(), i());
115
131
  }
116
132
  };
117
133
  }
118
- const Ot = /* @__PURE__ */ new Set([
134
+ const vt = /* @__PURE__ */ new Set([
119
135
  "E_USD_PHYSICS_UNSUPPORTED",
120
136
  "E_USD_UNBAKED_BODY_SCALE",
121
137
  "E_USD_INVALID_JOINT_REFERENCE",
@@ -133,11 +149,11 @@ const Ot = /* @__PURE__ */ new Set([
133
149
  "E_USD_CONSTRAINED_INITIAL_VELOCITY",
134
150
  "E_USD_UNSUPPORTED_APPROXIMATION"
135
151
  ]);
136
- function vt(t) {
152
+ function Tt(t) {
137
153
  const e = Et(t);
138
- return e !== null && Ot.has(e);
154
+ return e !== null && vt.has(e);
139
155
  }
140
- function Tt(t) {
156
+ function Lt(t) {
141
157
  const e = Et(t) ?? "E_USD_PHYSICS_UNSUPPORTED", n = t instanceof Error ? t.message : String(t);
142
158
  return {
143
159
  code: e,
@@ -150,16 +166,16 @@ function Et(t) {
150
166
  const e = t.code;
151
167
  return typeof e == "string" ? e : null;
152
168
  }
153
- function Lt(t, e) {
169
+ function Ct(t, e) {
154
170
  t.scene.updateMatrixWorld(!0);
155
171
  const n = new ot();
156
172
  n.name = "USD simulation";
157
- const s = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
173
+ const i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
158
174
  for (const l of e) {
159
175
  const r = t.index.objectsByPath.get(l);
160
176
  if (!r) throw h(`USD rigid body node is missing: ${l}`, "E_USD_PHYSICS_UNSUPPORTED");
161
- const i = new ot();
162
- i.name = l, n.add(i), s.set(l, i);
177
+ const s = new ot();
178
+ s.name = l, n.add(s), i.set(l, s);
163
179
  const y = new _(), p = new j();
164
180
  r.matrixWorld.decompose(y, p, new _()), d.set(l, new X().compose(y, p, new _(1, 1, 1)));
165
181
  }
@@ -167,33 +183,33 @@ function Lt(t, e) {
167
183
  t.scene.traverse((l) => {
168
184
  var p;
169
185
  if (!(l instanceof at)) return;
170
- let r = l, i, y = !0;
186
+ let r = l, s, y = !0;
171
187
  for (; r; ) {
172
188
  y && (y = r.visible);
173
189
  const g = (p = r.userData.usd) == null ? void 0 : p.path;
174
- !i && g && s.has(g) && (i = g), r = r.parent;
190
+ !s && g && i.has(g) && (s = g), r = r.parent;
175
191
  }
176
- y && S.push([l, i]);
192
+ y && S.push([l, s]);
177
193
  });
178
194
  for (const [l, r] of S) {
179
- const i = l.clone(!1);
180
- i.geometry = l.geometry.clone(), i.material = Array.isArray(l.material) ? l.material.map((y) => y.clone()) : l.material.clone(), i.matrix.copy(r ? d.get(r) : new X()).invert().multiply(l.matrixWorld), i.matrix.decompose(i.position, i.quaternion, i.scale), (r ? s.get(r) : n).add(i);
195
+ const s = l.clone(!1);
196
+ s.geometry = l.geometry.clone(), s.material = Array.isArray(l.material) ? l.material.map((y) => y.clone()) : l.material.clone(), s.matrix.copy(r ? d.get(r) : new X()).invert().multiply(l.matrixWorld), s.matrix.decompose(s.position, s.quaternion, s.scale), (r ? i.get(r) : n).add(s);
181
197
  }
182
- return { root: n, bindings: s, expectedLinkCount: s.size };
198
+ return { root: n, bindings: i, expectedLinkCount: i.size };
183
199
  }
184
200
  function yt(t) {
185
201
  t.scene.updateMatrixWorld(!0);
186
202
  const e = new ot();
187
203
  e.name = "USD authored collisions";
188
- const n = Rt(), s = /* @__PURE__ */ new Set();
204
+ const n = $t(), i = /* @__PURE__ */ new Set();
189
205
  for (const S of t.data.physics.colliders) {
190
206
  if (!S.enabled) continue;
191
207
  const l = t.index.objectsByPath.get(S.path);
192
208
  l && l.traverse((r) => {
193
- if (!(r instanceof at) || s.has(r)) return;
194
- s.add(r);
195
- const i = xt(r.geometry, n);
196
- i.name = `Collision:${S.path}`, i.matrixAutoUpdate = !1, i.matrix.copy(r.matrixWorld), i.renderOrder = 9, i.userData.usdColliderPath = S.path, e.add(i);
209
+ if (!(r instanceof at) || i.has(r)) return;
210
+ i.add(r);
211
+ const s = xt(r.geometry, n);
212
+ s.name = `Collision:${S.path}`, s.matrixAutoUpdate = !1, s.matrix.copy(r.matrixWorld), s.renderOrder = 9, s.userData.usdColliderPath = S.path, e.add(s);
197
213
  });
198
214
  }
199
215
  if (e.children.length === 0) {
@@ -211,20 +227,20 @@ function yt(t) {
211
227
  }
212
228
  };
213
229
  }
214
- function Ct(t, e, n) {
230
+ function Ft(t, e, n) {
215
231
  t.scene.updateMatrixWorld(!0);
216
- const s = [], d = [], S = [], l = [], r = [], i = [], y = [], { metersPerUnit: p, kilogramsPerUnit: g } = n, c = new Map(e.map((o) => {
232
+ const i = [], d = [], S = [], l = [], r = [], s = [], y = [], { metersPerUnit: p, kilogramsPerUnit: g } = n, c = new Map(e.map((o) => {
217
233
  const E = t.index.rigidBodiesByPath.get(o);
218
234
  if (!E) throw h(`USD rigid body metadata is missing: ${o}`, "E_USD_PHYSICS_UNSUPPORTED");
219
235
  return [o, E];
220
- })), I = /* @__PURE__ */ new Map();
236
+ })), R = /* @__PURE__ */ new Map();
221
237
  for (const o of c.keys()) {
222
238
  const E = t.index.objectsByPath.get(o);
223
239
  if (!E) throw h(`USD rigid body node is missing: ${o}`, "E_USD_PHYSICS_UNSUPPORTED");
224
- const N = new _(), a = new j(), $ = new _();
225
- if (E.matrixWorld.decompose(N, a, $), $.clone().divideScalar(p).toArray().some((G) => Math.abs(Math.abs(G) - 1) > 1e-5))
240
+ const N = new _(), a = new j(), I = new _();
241
+ if (E.matrixWorld.decompose(N, a, I), I.clone().divideScalar(p).toArray().some((G) => Math.abs(Math.abs(G) - 1) > 1e-5))
226
242
  throw h(`USD rigid body has unbaked scale: ${o}`, "E_USD_UNBAKED_BODY_SCALE");
227
- I.set(o, new X().compose(N, a, new _(1, 1, 1)));
243
+ R.set(o, new X().compose(N, a, new _(1, 1, 1)));
228
244
  }
229
245
  const u = /* @__PURE__ */ new Map();
230
246
  for (const o of t.data.joints.filter((E) => E.enabled)) {
@@ -235,13 +251,13 @@ function Ct(t, e, n) {
235
251
  if (u.has(o.body1)) throw h(`USD rigid body has multiple parent joints: ${o.body1}`, "E_USD_MULTIPLE_PARENTS");
236
252
  u.set(o.body1, o), o.body0 && o.collisionEnabled !== !0 && S.push(`<exclude body1="${V(o.body0)}" body2="${V(o.body1)}"/>`);
237
253
  }
238
- let D = 0;
239
- const w = /* @__PURE__ */ new Set(), b = (o, E = new X()) => {
254
+ let b = 0;
255
+ const D = /* @__PURE__ */ new Set(), w = (o, E = new X()) => {
240
256
  var ct, lt, ut, dt, pt;
241
- if (w.has(o)) throw h(`USD joint graph contains a cycle at ${o}`, "E_USD_JOINT_CYCLE");
242
- w.add(o);
243
- const N = c.get(o), a = I.get(o), $ = E.clone().invert().multiply(a), L = new _(), G = new j();
244
- $.decompose(L, G, new _());
257
+ if (D.has(o)) throw h(`USD joint graph contains a cycle at ${o}`, "E_USD_JOINT_CYCLE");
258
+ D.add(o);
259
+ const N = c.get(o), a = R.get(o), I = E.clone().invert().multiply(a), L = new _(), G = new j();
260
+ I.decompose(L, G, new _());
245
261
  const f = u.get(o), z = [`<body name="${V(o)}" pos="${T(L.toArray())}" quat="${k(G)}">`];
246
262
  if (!f && !N.kinematicEnabled && z.push("<freejoint/>"), f && [...N.velocity ?? [], ...N.angularVelocity ?? []].some((U) => U !== 0))
247
263
  throw h(`Constrained USD initial velocity cannot be projected reliably: ${o}`, "E_USD_CONSTRAINED_INITIAL_VELOCITY");
@@ -251,21 +267,21 @@ function Ct(t, e, n) {
251
267
  }
252
268
  if (f && f.jointType !== "fixed") {
253
269
  const U = f.jointType === "revolute" ? "hinge" : "slide", v = gt(f.axis).applyQuaternion(H(f.localRot1 ?? [1, 0, 0, 0])), C = U === "hinge" ? Math.PI / 180 : p, tt = new j().setFromRotationMatrix(E), W = new j().setFromRotationMatrix(a), q = tt.clone().multiply(H(f.localRot0 ?? [1, 0, 0, 0])).invert().multiply(W).multiply(H(f.localRot1 ?? [1, 0, 0, 0]));
254
- let Y = 0;
270
+ let B = 0;
255
271
  if (U === "hinge") {
256
- const B = f.axis === "Y" ? q.y : f.axis === "Z" ? q.z : q.x;
257
- Y = 2 * Math.atan2(B, q.w), Y = Math.atan2(Math.sin(Y), Math.cos(Y));
272
+ const Y = f.axis === "Y" ? q.y : f.axis === "Z" ? q.z : q.x;
273
+ B = 2 * Math.atan2(Y, q.w), B = Math.atan2(Math.sin(B), Math.cos(B));
258
274
  } else {
259
- const B = new _(...f.localPos0).multiplyScalar(p).applyMatrix4(E);
260
- Y = new _(...f.localPos1).multiplyScalar(p).applyMatrix4(a).sub(B).dot(v.clone().applyQuaternion(W));
275
+ const Y = new _(...f.localPos0).multiplyScalar(p).applyMatrix4(E);
276
+ B = new _(...f.localPos1).multiplyScalar(p).applyMatrix4(a).sub(Y).dot(v.clone().applyQuaternion(W));
261
277
  }
262
- const ft = Number.isFinite(f.lowerLimit) && Number.isFinite(f.upperLimit) && Math.abs(f.lowerLimit) < 1e20 && Math.abs(f.upperLimit) < 1e20, wt = ft && f.lowerLimit < f.upperLimit, Q = g * (U === "slide" ? p : p * p), et = Z(t, f.path, `physxJointAxis:${U === "slide" ? "linear" : "angular"}:dynamicFrictionEffort`), Pt = typeof et == "number" && Number.isFinite(et) ? et * Q : 0;
263
- z.push(`<joint name="${V(f.path)}" type="${U}" pos="${T(f.localPos1.map((B) => B * p))}" axis="${T(v.toArray())}" ref="${Y}" ${wt ? `range="${f.lowerLimit * C} ${f.upperLimit * C}"` : 'limited="false"'} frictionloss="${Pt}" armature="0.00001"/>`), ft && f.lowerLimit === f.upperLimit && d.push(`<joint joint1="${V(f.path)}" polycoef="${f.lowerLimit * C - Y} 0 0 0 0"/>`);
278
+ const ft = Number.isFinite(f.lowerLimit) && Number.isFinite(f.upperLimit) && Math.abs(f.lowerLimit) < 1e20 && Math.abs(f.upperLimit) < 1e20, Dt = ft && f.lowerLimit < f.upperLimit, J = g * (U === "slide" ? p : p * p), et = Z(t, f.path, `physxJointAxis:${U === "slide" ? "linear" : "angular"}:dynamicFrictionEffort`), Pt = typeof et == "number" && Number.isFinite(et) ? et * J : 0;
279
+ z.push(`<joint name="${V(f.path)}" type="${U}" pos="${T(f.localPos1.map((Y) => Y * p))}" axis="${T(v.toArray())}" ref="${B}" ${Dt ? `range="${f.lowerLimit * C} ${f.upperLimit * C}"` : 'limited="false"'} frictionloss="${Pt}" armature="0.00001"/>`), ft && f.lowerLimit === f.upperLimit && d.push(`<joint joint1="${V(f.path)}" polycoef="${f.lowerLimit * C - B} 0 0 0 0"/>`);
264
280
  const F = f.drive;
265
281
  if (F && ((F.stiffness ?? 0) !== 0 || (F.damping ?? 0) !== 0)) {
266
282
  if (F.type === "acceleration") throw h(`Unsupported USD acceleration drive: ${f.path}`, "E_USD_UNSUPPORTED_DRIVE");
267
- const B = (F.stiffness ?? 0) * Q / C, nt = (F.damping ?? 0) * Q / C, J = F.maxForce == null ? null : F.maxForce * Q;
268
- r.push(`<general joint="${V(f.path)}" gainprm="1" biastype="affine" biasprm="0 ${-B} ${-nt}" ${J != null && Number.isFinite(J) ? `forcelimited="true" forcerange="${-J} ${J}"` : ""}/>`), i.push(B * (F.targetPosition ?? 0) * C + nt * (F.targetVelocity ?? 0) * C);
283
+ const Y = (F.stiffness ?? 0) * J / C, nt = (F.damping ?? 0) * J / C, Q = F.maxForce == null ? null : F.maxForce * J;
284
+ r.push(`<general joint="${V(f.path)}" gainprm="1" biastype="affine" biasprm="0 ${-Y} ${-nt}" ${Q != null && Number.isFinite(Q) ? `forcelimited="true" forcerange="${-Q} ${Q}"` : ""}/>`), s.push(Y * (F.targetPosition ?? 0) * C + nt * (F.targetVelocity ?? 0) * C);
269
285
  }
270
286
  }
271
287
  const m = N.mass;
@@ -283,54 +299,54 @@ function Ct(t, e, n) {
283
299
  const rt = t.data.physics.colliders.filter((U) => U.enabled && U.bodyPath === o);
284
300
  if (!rt.length) throw h(`USD rigid body has no authored collision geometry: ${o}`, "E_USD_MISSING_COLLISION_GEOMETRY");
285
301
  for (const U of rt) {
286
- const v = t.data.physics.materials.find((Y) => Y.path === U.material), C = (m == null ? void 0 : m.density) != null && m.density > 0 ? m.density : v == null ? void 0 : v.density, tt = C != null && C > 0 ? C * g / p ** 3 : 1e3, W = (v == null ? void 0 : v.dynamicFriction) ?? 0.4, q = `density="${tt}" group="3" contype="1" conaffinity="1" friction="${W} 0.01 0.0002"`;
287
- z.push(mt(t, U, o, a, D++, s, q));
302
+ const v = t.data.physics.materials.find((B) => B.path === U.material), C = (m == null ? void 0 : m.density) != null && m.density > 0 ? m.density : v == null ? void 0 : v.density, tt = C != null && C > 0 ? C * g / p ** 3 : 1e3, W = (v == null ? void 0 : v.dynamicFriction) ?? 0.4, q = `density="${tt}" group="3" contype="1" conaffinity="1" friction="${W} 0.01 0.0002"`;
303
+ z.push(mt(t, U, o, a, b++, i, q));
288
304
  }
289
- for (const [U, v] of u) v.body0 === o && z.push(b(U, a));
305
+ for (const [U, v] of u) v.body0 === o && z.push(w(U, a));
290
306
  return z.push("</body>"), z.join("");
291
307
  }, A = t.data.physics.colliders.filter((o) => o.enabled && !o.bodyPath), M = A.map((o) => {
292
- const E = t.data.physics.materials.find((L) => L.path === o.material), N = (E == null ? void 0 : E.density) != null && E.density > 0 ? E.density * g / p ** 3 : 1e3, a = (E == null ? void 0 : E.dynamicFriction) ?? 0.4, $ = `density="${N}" group="3" contype="1" conaffinity="1" friction="${a} 0.01 0.0002"`;
293
- return mt(t, o, "", new X(), D++, s, $);
294
- }).join(""), O = Ft(t, e, A) ? `<geom name="__viewer_default_ground__" type="plane" pos="0 0 ${jt(t, e)}" size="1 1 0.1" group="3" contype="1" conaffinity="1" friction="0.8 0.01 0.0002"/>` : "", P = [...c.keys()].filter((o) => {
308
+ const E = t.data.physics.materials.find((L) => L.path === o.material), N = (E == null ? void 0 : E.density) != null && E.density > 0 ? E.density * g / p ** 3 : 1e3, a = (E == null ? void 0 : E.dynamicFriction) ?? 0.4, I = `density="${N}" group="3" contype="1" conaffinity="1" friction="${a} 0.01 0.0002"`;
309
+ return mt(t, o, "", new X(), b++, i, I);
310
+ }).join(""), O = jt(t, e, A) ? `<geom name="__viewer_default_ground__" type="plane" pos="0 0 ${Bt(t, e)}" size="1 1 0.1" group="3" contype="1" conaffinity="1" friction="0.8 0.01 0.0002"/>` : "", P = [...c.keys()].filter((o) => {
295
311
  var E;
296
312
  return !((E = u.get(o)) != null && E.body0);
297
- }).map((o) => b(o)).join("");
298
- if (w.size !== c.size) throw h("USD joint graph contains unreachable bodies or a cycle.", "E_USD_UNREACHABLE_BODIES");
313
+ }).map((o) => w(o)).join("");
314
+ if (D.size !== c.size) throw h("USD joint graph contains unreachable bodies or a cycle.", "E_USD_UNREACHABLE_BODIES");
299
315
  if (t.data.physics.scenes.length > 1) throw h("Multiple USD PhysicsScene prims are not supported.", "E_USD_MULTIPLE_PHYSICS_SCENES");
300
316
  const x = t.data.physics.scenes[0], K = x != null && x.gravityDirection && x.gravityMagnitude != null && x.gravityMagnitude >= 0 ? new _(...x.gravityDirection).normalize().multiplyScalar(x.gravityMagnitude * p).applyQuaternion(t.scene.quaternion) : new _(0, 0, -9.81);
301
317
  return {
302
318
  format: "mjcf",
303
319
  files: /* @__PURE__ */ new Map(),
304
- initialControls: i,
320
+ initialControls: s,
305
321
  initialVelocities: y,
306
322
  massOverrides: l,
307
- xml: `<mujoco><compiler angle="radian" autolimits="true"/><option integrator="implicitfast" gravity="${T(K.toArray())}"><flag filterparent="disable"/></option><default><geom margin="0.0015" solref="0.004 1"/></default>${s.length ? `<asset>${s.join("")}</asset>` : ""}<worldbody>${O}${M}${P}</worldbody>${S.length ? `<contact>${S.join("")}</contact>` : ""}${d.length ? `<equality>${d.join("")}</equality>` : ""}${r.length ? `<actuator>${r.join("")}</actuator>` : ""}</mujoco>`
323
+ xml: `<mujoco><compiler angle="radian" autolimits="true"/><option integrator="implicitfast" gravity="${T(K.toArray())}"><flag filterparent="disable"/></option><default><geom margin="0.0015" solref="0.004 1"/></default>${i.length ? `<asset>${i.join("")}</asset>` : ""}<worldbody>${O}${M}${P}</worldbody>${S.length ? `<contact>${S.join("")}</contact>` : ""}${d.length ? `<equality>${d.join("")}</equality>` : ""}${r.length ? `<actuator>${r.join("")}</actuator>` : ""}</mujoco>`
308
324
  };
309
325
  }
310
- function Ft(t, e, n = t.data.physics.colliders.filter((s) => s.enabled && !s.bodyPath)) {
326
+ function jt(t, e, n = t.data.physics.colliders.filter((i) => i.enabled && !i.bodyPath)) {
311
327
  if (!e.length || n.some((r) => r.typeName.toLowerCase().includes("plane"))) return !1;
312
- const s = it(t, t.data.physics.colliders.filter(
328
+ const i = st(t, t.data.physics.colliders.filter(
313
329
  (r) => r.enabled && r.bodyPath && e.includes(r.bodyPath)
314
330
  ));
315
- if (s.isEmpty()) return n.length === 0;
316
- const d = Math.max(s.max.x - s.min.x, 1e-6), S = Math.max(s.max.y - s.min.y, 1e-6), l = Math.max(d, S, s.max.z - s.min.z) * 0.05;
331
+ if (i.isEmpty()) return n.length === 0;
332
+ const d = Math.max(i.max.x - i.min.x, 1e-6), S = Math.max(i.max.y - i.min.y, 1e-6), l = Math.max(d, S, i.max.z - i.min.z) * 0.05;
317
333
  return !n.some((r) => {
318
- const i = it(t, [r]);
319
- if (i.isEmpty()) return !1;
320
- const y = i.max.x >= s.min.x && i.min.x <= s.max.x, p = i.max.y >= s.min.y && i.min.y <= s.max.y;
321
- return y && p && i.max.z <= s.min.z + l;
334
+ const s = st(t, [r]);
335
+ if (s.isEmpty()) return !1;
336
+ const y = s.max.x >= i.min.x && s.min.x <= i.max.x, p = s.max.y >= i.min.y && s.min.y <= i.max.y;
337
+ return y && p && s.max.z <= i.min.z + l;
322
338
  });
323
339
  }
324
- function jt(t, e) {
325
- const n = it(t, t.data.physics.colliders.filter(
340
+ function Bt(t, e) {
341
+ const n = st(t, t.data.physics.colliders.filter(
326
342
  (d) => d.enabled && d.bodyPath && e.includes(d.bodyPath)
327
- )), s = n.isEmpty() ? 0 : n.min.z;
328
- return Number.isFinite(s) ? String(s) : "0";
343
+ )), i = n.isEmpty() ? 0 : n.min.z;
344
+ return Number.isFinite(i) ? String(i) : "0";
329
345
  }
330
- function it(t, e) {
346
+ function st(t, e) {
331
347
  const n = new ht();
332
- for (const s of e) {
333
- const d = t.index.objectsByPath.get(s.path);
348
+ for (const i of e) {
349
+ const d = t.index.objectsByPath.get(i.path);
334
350
  d && n.union(new ht().setFromObject(d));
335
351
  }
336
352
  return n;
@@ -338,40 +354,40 @@ function it(t, e) {
338
354
  function gt(t) {
339
355
  return t === "Y" ? new _(0, 1, 0) : t === "Z" ? new _(0, 0, 1) : new _(1, 0, 0);
340
356
  }
341
- function mt(t, e, n, s, d, S, l) {
357
+ function mt(t, e, n, i, d, S, l) {
342
358
  const r = t.index.objectsByPath.get(e.path);
343
359
  if (!r) throw h(`USD collider node is missing: ${e.path}`, "E_USD_MISSING_COLLISION_GEOMETRY");
344
- const i = s.clone().invert().multiply(r.matrixWorld), y = new _(), p = new j(), g = new _();
345
- i.decompose(y, p, g);
346
- const c = e.typeName.replace(/^UsdGeom/, "").toLowerCase(), I = (u, D) => {
347
- const w = Z(t, e.path, u);
348
- return typeof w == "number" ? w : D;
360
+ const s = i.clone().invert().multiply(r.matrixWorld), y = new _(), p = new j(), g = new _();
361
+ s.decompose(y, p, g);
362
+ const c = e.typeName.replace(/^UsdGeom/, "").toLowerCase(), R = (u, b) => {
363
+ const D = Z(t, e.path, u);
364
+ return typeof D == "number" ? D : b;
349
365
  };
350
366
  if (c.includes("cube")) {
351
- const u = Math.abs(I("size", 2)) / 2;
367
+ const u = Math.abs(R("size", 2)) / 2;
352
368
  return `<geom type="box" pos="${T(y.toArray())}" quat="${k(p)}" size="${T([Math.abs(g.x) * u, Math.abs(g.y) * u, Math.abs(g.z) * u])}" ${l}/>`;
353
369
  }
354
370
  if (c.includes("plane")) {
355
371
  if (n) throw h(`USD plane collider requires a static world owner: ${e.path}`, "E_USD_UNSUPPORTED_GEOMETRY");
356
- const u = String(Z(t, e.path, "axis") ?? "Z").toUpperCase(), w = { X: new _(1, 0, 0), Y: new _(0, 1, 0), Z: new _(0, 0, 1) }[u];
357
- if (!w) throw h(`Unsupported USD plane axis: ${u}`, "E_USD_UNSUPPORTED_GEOMETRY");
358
- const b = p.clone().multiply(new j().setFromUnitVectors(new _(0, 0, 1), w));
359
- return `<geom type="plane" pos="${T(y.toArray())}" quat="${k(b)}" size="1 1 0.1" ${l}/>`;
372
+ const u = String(Z(t, e.path, "axis") ?? "Z").toUpperCase(), D = { X: new _(1, 0, 0), Y: new _(0, 1, 0), Z: new _(0, 0, 1) }[u];
373
+ if (!D) throw h(`Unsupported USD plane axis: ${u}`, "E_USD_UNSUPPORTED_GEOMETRY");
374
+ const w = p.clone().multiply(new j().setFromUnitVectors(new _(0, 0, 1), D));
375
+ return `<geom type="plane" pos="${T(y.toArray())}" quat="${k(w)}" size="1 1 0.1" ${l}/>`;
360
376
  }
361
377
  if (c.includes("cone"))
362
378
  throw h(`MuJoCo has no analytic cone geom; a validated mesh conversion is required: ${e.path}`, "E_USD_UNSUPPORTED_GEOMETRY");
363
379
  if (c.includes("sphere")) {
364
380
  const u = [Math.abs(g.x), Math.abs(g.y), Math.abs(g.z)];
365
381
  if (Math.max(...u) - Math.min(...u) > 1e-6) throw h(`USD sphere collider does not support non-uniform scale: ${e.path}`, "E_USD_NONUNIFORM_RADIAL_SCALE");
366
- return `<geom type="sphere" pos="${T(y.toArray())}" quat="${k(p)}" size="${u[0] * I("radius", 1)}" ${l}/>`;
382
+ return `<geom type="sphere" pos="${T(y.toArray())}" quat="${k(p)}" size="${u[0] * R("radius", 1)}" ${l}/>`;
367
383
  }
368
384
  if (c.includes("cylinder") || c.includes("capsule")) {
369
- const u = String(Z(t, e.path, "axis") ?? "Z").toUpperCase(), D = { X: 0, Y: 1, Z: 2 }[u];
370
- if (D === void 0) throw h(`Unsupported USD collider axis: ${u}`, "E_USD_UNSUPPORTED_GEOMETRY");
371
- const w = [Math.abs(g.x), Math.abs(g.y), Math.abs(g.z)], b = w.filter((P, x) => x !== D);
372
- if (Math.abs(b[0] - b[1]) > 1e-6) throw h(`USD ${e.typeName} collider does not support non-uniform radial scale: ${e.path}`, "E_USD_NONUNIFORM_RADIAL_SCALE");
373
- const A = new _(...{ X: [1, 0, 0], Y: [0, 1, 0], Z: [0, 0, 1] }[u]), M = p.clone().multiply(new j().setFromUnitVectors(new _(0, 0, 1), A)), O = I("radius", 1) * b[0], R = I("height", 2) * w[D] / 2;
374
- return `<geom type="${c.includes("capsule") ? "capsule" : "cylinder"}" pos="${T(y.toArray())}" quat="${k(M)}" size="${O} ${R}" ${l}/>`;
385
+ const u = String(Z(t, e.path, "axis") ?? "Z").toUpperCase(), b = { X: 0, Y: 1, Z: 2 }[u];
386
+ if (b === void 0) throw h(`Unsupported USD collider axis: ${u}`, "E_USD_UNSUPPORTED_GEOMETRY");
387
+ const D = [Math.abs(g.x), Math.abs(g.y), Math.abs(g.z)], w = D.filter((P, x) => x !== b);
388
+ if (Math.abs(w[0] - w[1]) > 1e-6) throw h(`USD ${e.typeName} collider does not support non-uniform radial scale: ${e.path}`, "E_USD_NONUNIFORM_RADIAL_SCALE");
389
+ const A = new _(...{ X: [1, 0, 0], Y: [0, 1, 0], Z: [0, 0, 1] }[u]), M = p.clone().multiply(new j().setFromUnitVectors(new _(0, 0, 1), A)), O = R("radius", 1) * w[0], $ = R("height", 2) * D[b] / 2;
390
+ return `<geom type="${c.includes("capsule") ? "capsule" : "cylinder"}" pos="${T(y.toArray())}" quat="${k(M)}" size="${O} ${$}" ${l}/>`;
375
391
  }
376
392
  if (c.includes("mesh")) {
377
393
  if (e.approximation && !["none", "convexHull"].includes(e.approximation)) throw h(`USD mesh approximation cannot be mapped exactly: ${e.path}`, "E_USD_UNSUPPORTED_APPROXIMATION");
@@ -379,37 +395,37 @@ function mt(t, e, n, s, d, S, l) {
379
395
  if (r.traverse((M) => {
380
396
  M instanceof at && u.push(M);
381
397
  }), !u.length) throw h(`USD collider has no mesh geometry: ${e.path}`, "E_USD_MISSING_COLLISION_GEOMETRY");
382
- const D = [], w = [];
383
- let b = 0;
398
+ const b = [], D = [];
399
+ let w = 0;
384
400
  for (const M of u) {
385
401
  const O = M.geometry.getAttribute("position");
386
402
  for (let P = 0; P < O.count; P++) {
387
- const x = new _().fromBufferAttribute(O, P).applyMatrix4(s.clone().invert().multiply(M.matrixWorld));
388
- D.push(x.x, x.y, x.z);
403
+ const x = new _().fromBufferAttribute(O, P).applyMatrix4(i.clone().invert().multiply(M.matrixWorld));
404
+ b.push(x.x, x.y, x.z);
389
405
  }
390
- const R = M.geometry.index;
391
- for (let P = 0; P < (R ? R.count : O.count); P += 3) w.push(b + (R ? R.getX(P) : P), b + (R ? R.getX(P + 1) : P + 1), b + (R ? R.getX(P + 2) : P + 2));
392
- b += O.count;
406
+ const $ = M.geometry.index;
407
+ for (let P = 0; P < ($ ? $.count : O.count); P += 3) D.push(w + ($ ? $.getX(P) : P), w + ($ ? $.getX(P + 1) : P + 1), w + ($ ? $.getX(P + 2) : P + 2));
408
+ w += O.count;
393
409
  }
394
410
  const A = `collision_${d}`;
395
- return S.push(`<mesh name="${A}" vertex="${T(D)}" face="${T(w)}"/>`), `<geom type="mesh" mesh="${A}" ${l}/>`;
411
+ return S.push(`<mesh name="${A}" vertex="${T(b)}" face="${T(D)}"/>`), `<geom type="mesh" mesh="${A}" ${l}/>`;
396
412
  }
397
413
  throw h(`Unsupported USD collider geometry: ${e.typeName}`, "E_USD_UNSUPPORTED_GEOMETRY");
398
414
  }
399
415
  function Yt(t) {
400
416
  const e = t.stage.GetPseudoRoot();
401
417
  try {
402
- const n = Number(e.GetMetadata("metersPerUnit") ?? 0.01), s = Number(e.GetMetadata("kilogramsPerUnit") ?? 1);
418
+ const n = Number(e.GetMetadata("metersPerUnit") ?? 0.01), i = Number(e.GetMetadata("kilogramsPerUnit") ?? 1);
403
419
  if (!Number.isFinite(n) || n <= 0) throw h("USD metersPerUnit must be finite and positive.", "E_USD_INVALID_UNITS");
404
- if (!Number.isFinite(s) || s <= 0) throw h("USD kilogramsPerUnit must be finite and positive.", "E_USD_INVALID_UNITS");
405
- return { metersPerUnit: n, kilogramsPerUnit: s };
420
+ if (!Number.isFinite(i) || i <= 0) throw h("USD kilogramsPerUnit must be finite and positive.", "E_USD_INVALID_UNITS");
421
+ return { metersPerUnit: n, kilogramsPerUnit: i };
406
422
  } finally {
407
423
  e.delete();
408
424
  }
409
425
  }
410
426
  function H(t) {
411
- const [e = 1, n = 0, s = 0, d = 0] = t;
412
- return new j(n, s, d, e).normalize();
427
+ const [e = 1, n = 0, i = 0, d = 0] = t;
428
+ return new j(n, i, d, e).normalize();
413
429
  }
414
430
  function T(t) {
415
431
  return t.join(" ");
@@ -418,21 +434,21 @@ function k(t) {
418
434
  return `${t.w} ${t.x} ${t.y} ${t.z}`;
419
435
  }
420
436
  function Z(t, e, n) {
421
- var i, y;
422
- const s = t.stage;
423
- if (!s || !((y = (i = t.pxr) == null ? void 0 : i.Sdf) != null && y.Path)) return null;
424
- const d = new t.pxr.Sdf.Path(e), S = s.GetPrimAtPath(d), l = S.GetAttribute(n), r = t.pxr.Usd.TimeCode.Default();
437
+ var s, y;
438
+ const i = t.stage;
439
+ if (!i || !((y = (s = t.pxr) == null ? void 0 : s.Sdf) != null && y.Path)) return null;
440
+ const d = new t.pxr.Sdf.Path(e), S = i.GetPrimAtPath(d), l = S.GetAttribute(n), r = t.pxr.Usd.TimeCode.Default();
425
441
  try {
426
442
  return l.IsValid() ? l.Get(r) : null;
427
443
  } finally {
428
444
  r.delete(), l.delete(), S.delete(), d.delete();
429
445
  }
430
446
  }
431
- function Bt() {
447
+ function zt() {
432
448
  if (!globalThis.isSecureContext) throw h("OpenUSD requires a secure context.", "E_USD_SECURE_CONTEXT_REQUIRED");
433
449
  if (!globalThis.crossOriginIsolated) throw h("OpenUSD requires COOP/COEP cross-origin isolation.", "E_USD_CROSS_ORIGIN_ISOLATION_REQUIRED");
434
450
  }
435
- async function zt(t, e) {
451
+ async function Gt(t, e) {
436
452
  var n;
437
453
  if (t.url)
438
454
  try {
@@ -442,63 +458,63 @@ async function zt(t, e) {
442
458
  }
443
459
  return t.resolve(e);
444
460
  }
445
- async function Gt(t) {
461
+ async function qt(t) {
446
462
  const e = t.url ?? await t.resolve(t.entryPath ?? ""), n = await fetch(e, { signal: t.signal });
447
463
  if (!n.ok) throw h(`USD request failed (${n.status}): ${e}`, n.status === 401 || n.status === 403 ? "E_ASSET_AUTH" : "E_ASSET_FETCH");
448
464
  return n.blob();
449
465
  }
450
- const qt = /* @__PURE__ */ new Set(["usd", "usda", "usdc"]), St = 1024, Vt = 8;
451
- let kt = 0;
452
- async function Ht(t, e, n, s, d) {
453
- const S = `/tmp/viewer-usd-resolver/${++kt}`;
466
+ const Vt = /* @__PURE__ */ new Set(["usd", "usda", "usdc"]), St = 1024, kt = 8;
467
+ let Ht = 0;
468
+ async function Xt(t, e, n, i, d) {
469
+ const S = `/tmp/viewer-usd-resolver/${++Ht}`;
454
470
  t.FS.createDir(S);
455
- const l = [{ path: bt(s), blob: n, depth: 0 }], r = /* @__PURE__ */ new Set();
471
+ const l = [{ path: wt(i), blob: n, depth: 0 }], r = /* @__PURE__ */ new Set();
456
472
  try {
457
473
  for (; l.length > 0; ) {
458
474
  e.signal.throwIfAborted();
459
- const i = l.shift();
460
- if (r.has(i.path) || i.depth > Vt) continue;
475
+ const s = l.shift();
476
+ if (r.has(s.path) || s.depth > kt) continue;
461
477
  if (r.size >= St) throw h(`USD dependency limit exceeded (${St}).`, "E_ASSET_RESOURCE_LIMIT");
462
- r.add(i.path);
463
- const y = `${S}/${i.path}`;
464
- t.FS.createDir(y.split("/").slice(0, -1).join("/")), t.FS.writeFile(y, new Uint8Array(await i.blob.arrayBuffer()));
478
+ r.add(s.path);
479
+ const y = `${S}/${s.path}`;
480
+ t.FS.createDir(y.split("/").slice(0, -1).join("/")), t.FS.writeFile(y, new Uint8Array(await s.blob.arrayBuffer()));
465
481
  const p = t.UsdUtils.ExtractSanitizedExternalReferences(y);
466
482
  for (const g of p) {
467
- const c = Xt(i.path, g);
483
+ const c = Wt(s.path, g);
468
484
  if (!c || r.has(c)) continue;
469
- const I = await e.resolve(c), u = await fetch(I, { signal: e.signal });
485
+ const R = await e.resolve(c), u = await fetch(R, { signal: e.signal });
470
486
  if (!u.ok) {
471
- const w = u.status === 401 || u.status === 403 ? "E_ASSET_AUTH" : "E_ASSET_FETCH";
472
- throw h(`USD dependency request failed (${u.status}): ${c}`, w);
487
+ const D = u.status === 401 || u.status === 403 ? "E_ASSET_AUTH" : "E_ASSET_FETCH";
488
+ throw h(`USD dependency request failed (${u.status}): ${c}`, D);
473
489
  }
474
- const D = await u.blob();
475
- d.put(c, D), qt.has(Wt(c)) && l.push({ path: c, blob: D, depth: i.depth + 1 });
490
+ const b = await u.blob();
491
+ d.put(c, b), Vt.has(Jt(c)) && l.push({ path: c, blob: b, depth: s.depth + 1 });
476
492
  }
477
493
  }
478
494
  } finally {
479
- Dt(t, S);
495
+ bt(t, S);
480
496
  }
481
497
  }
482
- function Xt(t, e) {
498
+ function Wt(t, e) {
483
499
  if (!e || /^(?:data|blob):/i.test(e)) return null;
484
500
  if (/^[a-z][a-z0-9+.-]*:/i.test(e) || e.startsWith("/")) return e;
485
501
  const n = t.split("/").slice(0, -1).join("/");
486
- return bt(n ? `${n}/${e}` : e);
502
+ return wt(n ? `${n}/${e}` : e);
487
503
  }
488
- function bt(t) {
504
+ function wt(t) {
489
505
  const e = [];
490
506
  for (const n of t.replaceAll("\\", "/").split("/"))
491
507
  !n || n === "." || (n === ".." ? e.pop() : e.push(n));
492
508
  return e.join("/");
493
509
  }
494
- function Wt(t) {
510
+ function Jt(t) {
495
511
  var e, n;
496
512
  return ((n = (e = t.split(/[?#]/, 1)[0]) == null ? void 0 : e.split(".").pop()) == null ? void 0 : n.toLowerCase()) ?? "";
497
513
  }
498
- function Dt(t, e) {
514
+ function bt(t, e) {
499
515
  if (t.FS.exists(e)) {
500
516
  for (const n of t.FS.listDir(e))
501
- n.isDir ? Dt(t, n.path) : t.FS.deleteFile(n.path);
517
+ n.isDir ? bt(t, n.path) : t.FS.deleteFile(n.path);
502
518
  t.FS.deleteDir(e);
503
519
  }
504
520
  }
@@ -513,10 +529,10 @@ function Ut() {
513
529
  }
514
530
  export {
515
531
  yt as compileUsdCollisionOverlay,
516
- Ct as compileUsdPhysics,
517
- Lt as compileUsdVisual,
518
- vt as isUsdPhysicsFallbackEligible,
519
- ee as loadUsdSimulation,
520
- Ht as resolveUsdResourcePackage,
521
- Ft as shouldInjectUsdDefaultGround
532
+ Ft as compileUsdPhysics,
533
+ Ct as compileUsdVisual,
534
+ Tt as isUsdPhysicsFallbackEligible,
535
+ ne as loadUsdSimulation,
536
+ Xt as resolveUsdResourcePackage,
537
+ jt as shouldInjectUsdDefaultGround
522
538
  };