@nebula-spatial/studio 0.1.1 → 0.1.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.
- package/README.md +2 -0
- package/dist/{builders-BAXRR5o5.js → builders-lydx4-Rh.js} +1 -1
- package/dist/core/session-persistence-controller.d.ts +55 -0
- package/dist/doc/placement-policy.d.ts +4 -0
- package/dist/editor/editor.d.ts +3 -1
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/session-persistence.d.ts +54 -0
- package/dist/editor.js +727 -490
- package/dist/{export-evidence-DMNRhgL9.js → export-evidence-z2Ne7Trf.js} +654 -972
- package/dist/generalization.js +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +226 -219
- package/dist/{mjcf-visual-Bt4bUxd1.js → mjcf-visual-IOy-ucto.js} +1 -1
- package/dist/persist/indexeddb-store.d.ts +22 -2
- package/dist/persist/session.d.ts +22 -0
- package/dist/persist/snapshot.d.ts +24 -0
- package/dist/{physics-facts-tfQYyNTD.js → physics-facts-D-URIBrt.js} +8 -7
- package/dist/{placement-policy-DY_FNRDu.js → placement-policy-C6dV6Tf-.js} +161 -141
- package/dist/ports/persistence.d.ts +45 -1
- package/dist/project/contracts.d.ts +3 -0
- package/dist/remote-asset-resolver-D-UeyDMD.js +311 -0
- package/dist/{scene-graph-DBLKAhxa.js → scene-graph-DVOXjMmp.js} +2 -2
- package/dist/{scene-session-Cy6vDJ1l.js → scene-session-PhoFXFCY.js} +3365 -3340
- package/dist/scene.js +2 -2
- package/dist/{session-BRBrCLdd.js → session-2bp8YOA4.js} +2 -2
- package/dist/{session-q3uuG7OP.js → session-B3WbC7Y2.js} +1 -1
- package/dist/session-B9kEf4xN.js +915 -0
- package/dist/{session-DI5tPJxn.js → session-DYThdzLZ.js} +4 -4
- package/dist/studio/index.d.ts +5 -0
- package/dist/studio/indexeddb-persistence.d.ts +2 -0
- package/dist/studio/indexeddb-session-persistence.d.ts +11 -0
- package/dist/studio/scene-package-asset-sources.d.ts +14 -0
- package/dist/studio.js +1422 -1220
- package/dist/{urdf-session-CQir2nb2.js → urdf-session-CRXL4bHf.js} +3 -3
- package/dist/{usd-session-DZJnEEOs.js → usd-session-CTzInpNy.js} +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/view/scene-session.d.ts +5 -1
- package/dist/{xacro-DLRXyk60.js → xacro-IpPHTMYs.js} +1 -1
- package/package.json +1 -1
- package/dist/asset-source-BExlEcRt.js +0 -444
- package/dist/editorial-BkAFWfbg.js +0 -83
- package/dist/remote-asset-resolver-Cb8cfNmw.js +0 -136
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var We = Object.defineProperty;
|
|
2
2
|
var Ce = (i, e, n) => e in i ? We(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
3
|
var A = (i, e, n) => Ce(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { d as Ge, f as Te, g as Ve, w as ye, h as ge, p as Je } from "./session-
|
|
5
|
-
import { b as L, j as Pe, k as be, g as Be, h as Qe, i as we, l as Xe, S as Ke, m as ve, f as Me } from "./scene-session-
|
|
4
|
+
import { d as Ge, f as Te, g as Ve, w as ye, h as ge, p as Je } from "./session-DYThdzLZ.js";
|
|
5
|
+
import { b as L, j as Pe, k as be, g as Be, h as Qe, i as we, l as Xe, S as Ke, m as ve, f as Me } from "./scene-session-PhoFXFCY.js";
|
|
6
6
|
import { Quaternion as O, Euler as X, LoadingManager as _e, Group as q, Mesh as U, MeshLambertMaterial as Ze, MeshPhongMaterial as Re, MeshStandardMaterial as oe, TextureLoader as Ye, SRGBColorSpace as He, RepeatWrapping as et, BoxGeometry as re, SphereGeometry as ae, CylinderGeometry as De, CapsuleGeometry as qe, Matrix4 as W, Vector3 as z, MathUtils as tt, Matrix3 as Ae, Box3 as $e, AxesHelper as it, ArrowHelper as Ee, Line as nt, BufferGeometry as st, LineBasicMaterial as je, Float32BufferAttribute as ot, MeshBasicMaterial as Se, LineSegments as rt, EdgesGeometry as at } from "three";
|
|
7
7
|
import { GLTFLoader as lt } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
8
8
|
import { ColladaLoader as ct } from "three/examples/jsm/loaders/ColladaLoader.js";
|
|
@@ -1090,7 +1090,7 @@ async function Tt(i, e, n) {
|
|
|
1090
1090
|
const r = e.format === "xacro";
|
|
1091
1091
|
if (r) {
|
|
1092
1092
|
(D = e.reportProgress) == null || D.call(e, "xacro", "正在展开 Xacro 宏与依赖文件...");
|
|
1093
|
-
const { expandXacro: v } = await import("./xacro-
|
|
1093
|
+
const { expandXacro: v } = await import("./xacro-IpPHTMYs.js");
|
|
1094
1094
|
s = await v(s, t, n, e.options.xacro, e.signal);
|
|
1095
1095
|
}
|
|
1096
1096
|
if (e.signal.aborted) throw Q();
|
|
@@ -2,9 +2,9 @@ var jr = Object.defineProperty;
|
|
|
2
2
|
var Fr = (e, t, n) => t in e ? jr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var Bt = (e, t, n) => Fr(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { Mesh as Oe, MeshPhysicalMaterial as oe, FrontSide as Gr, DoubleSide as zr, DataTexture as Yn, UnsignedByteType as Jn, RGBAFormat as Hn, NoColorSpace as Pe, Color as Ee, Float32BufferAttribute as Wr, TextureLoader as Zt, Texture as Mt, SRGBColorSpace as yn, RepeatWrapping as me, MeshStandardMaterial as En, MirroredRepeatWrapping as Ns, ClampToEdgeWrapping as Yt, Matrix3 as Xr, CanvasTexture as qr, Box3 as xn, Vector3 as ne, Group as Tt, Quaternion as $e, Matrix4 as Ze, SkinnedMesh as Vt, Skeleton as Yr, AnimationMixer as Jr, LoopRepeat as Hr, Sphere as Kr } from "three";
|
|
5
|
-
import { i as Zr, c as Qr, U as eo, a as to, b as no, r as Ls, n as Wt, u as so, d as ro, p as oo, e as ao, f as io } from "./session-
|
|
5
|
+
import { i as Zr, c as Qr, U as eo, a as to, b as no, r as Ls, n as Wt, u as so, d as ro, p as oo, e as ao, f as io } from "./session-DYThdzLZ.js";
|
|
6
6
|
import { ConvexGeometry as co } from "three/examples/jsm/geometries/ConvexGeometry.js";
|
|
7
|
-
import { o as xt, b as ks, g as Kn, h as Zn, i as Bs, f as Qn, C as es } from "./scene-session-
|
|
7
|
+
import { o as xt, b as ks, g as Kn, h as Zn, i as Bs, f as Qn, C as es } from "./scene-session-PhoFXFCY.js";
|
|
8
8
|
import { i as uo } from "./wasm-module-DZn2AM1W.js";
|
|
9
9
|
import { buildUSDScene as lo, createUSDLoadedModel as po } from "@openusd-wasm/three-loader";
|
|
10
10
|
import { KTX2Loader as fo } from "three/addons/loaders/KTX2Loader.js";
|
package/dist/version.d.ts
CHANGED
|
@@ -146,7 +146,9 @@ export interface StudioSceneSession {
|
|
|
146
146
|
setEditorial(editorial: Readonly<Record<string, StudioEditorialState>>): void;
|
|
147
147
|
/** Measures a hidden asset preview, seats its real footprint at the point,
|
|
148
148
|
* then removes the preview. Returns data for one subsequent Add Command. */
|
|
149
|
-
preparePlacement(assetId: string, point: Vec3, snap?: number | 'adaptive'
|
|
149
|
+
preparePlacement(assetId: string, point: Vec3, snap?: number | 'adaptive', options?: {
|
|
150
|
+
readonly avoidOverlap?: boolean;
|
|
151
|
+
}): Promise<LocalTransform>;
|
|
150
152
|
beginPlacementPreview(assetId: string, transform: LocalTransform): Promise<boolean>;
|
|
151
153
|
updatePlacementPreview(transform: LocalTransform): Promise<boolean>;
|
|
152
154
|
confirmPlacementPreview(): Promise<LocalTransform | null>;
|
|
@@ -157,6 +159,8 @@ export interface StudioSceneSession {
|
|
|
157
159
|
*/
|
|
158
160
|
measureAssets(assetIds: readonly string[]): Promise<Record<string, Vec3>>;
|
|
159
161
|
measureAssetBounds(assetId: string): Promise<Vec3Bounds>;
|
|
162
|
+
/** Last runtime-measured source-local bounds for an asset revision. */
|
|
163
|
+
getMeasuredAssetBounds?(assetId: string): Vec3Bounds | null;
|
|
160
164
|
/** The transform gizmo is centered on the editable selection. */
|
|
161
165
|
select(ids: readonly string[], primary?: string | null): void;
|
|
162
166
|
selectRegion(regionId: string | null): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XacroParser as y } from "xacro-parser";
|
|
2
|
-
import { n as g } from "./session-
|
|
2
|
+
import { n as g } from "./session-DYThdzLZ.js";
|
|
3
3
|
const A = "http://wiki.ros.org/xacro", o = (n) => Object.assign(new Error(n), { code: "E_XACRO_EXPAND" });
|
|
4
4
|
async function X(n, m, u, c, s) {
|
|
5
5
|
var w, b;
|
package/package.json
CHANGED
|
@@ -1,444 +0,0 @@
|
|
|
1
|
-
import { k as p, s as b, g as _ } from "./builders-BAXRR5o5.js";
|
|
2
|
-
const I = "application/octet-stream", C = {
|
|
3
|
-
".usda": "model/vnd.usda",
|
|
4
|
-
".usd": "model/vnd.usda",
|
|
5
|
-
".usdc": "model/vnd.usdc",
|
|
6
|
-
".usdz": "model/vnd.usdz+zip",
|
|
7
|
-
".glb": "model/gltf-binary",
|
|
8
|
-
".gltf": "model/gltf+json",
|
|
9
|
-
".ply": "application/x-ply",
|
|
10
|
-
".spz": "application/x-spz",
|
|
11
|
-
".splat": "application/x-gaussian-splat",
|
|
12
|
-
".ksplat": "application/x-ksplat",
|
|
13
|
-
".rad": "application/x-rad",
|
|
14
|
-
".zip": "application/zip",
|
|
15
|
-
".json": "application/json",
|
|
16
|
-
".png": "image/png",
|
|
17
|
-
".jpg": "image/jpeg",
|
|
18
|
-
".jpeg": "image/jpeg",
|
|
19
|
-
".webp": "image/webp",
|
|
20
|
-
".ktx2": "image/ktx2",
|
|
21
|
-
".exr": "image/x-exr",
|
|
22
|
-
".mdl": "text/plain"
|
|
23
|
-
}, O = /* @__PURE__ */ new Set([
|
|
24
|
-
I,
|
|
25
|
-
"binary/octet-stream"
|
|
26
|
-
]);
|
|
27
|
-
function $(t) {
|
|
28
|
-
return C[M(t)] ?? null;
|
|
29
|
-
}
|
|
30
|
-
function H(t) {
|
|
31
|
-
return $(t) ?? I;
|
|
32
|
-
}
|
|
33
|
-
function z(t, ...e) {
|
|
34
|
-
for (const o of e) {
|
|
35
|
-
const n = F(o);
|
|
36
|
-
if (n) return n;
|
|
37
|
-
}
|
|
38
|
-
return $(t);
|
|
39
|
-
}
|
|
40
|
-
function M(t) {
|
|
41
|
-
const e = t.replaceAll("\\", "/"), o = e.slice(e.lastIndexOf("/") + 1).toLowerCase(), n = o.lastIndexOf(".");
|
|
42
|
-
return n >= 0 ? o.slice(n) : "";
|
|
43
|
-
}
|
|
44
|
-
function F(t) {
|
|
45
|
-
const e = t == null ? void 0 : t.trim();
|
|
46
|
-
return !e || O.has(e.toLowerCase()) ? null : e;
|
|
47
|
-
}
|
|
48
|
-
const w = "ASSET_SOURCE_INVALID_LOCATOR";
|
|
49
|
-
function m(t) {
|
|
50
|
-
if (!t || t.startsWith("/") || t.includes("\\"))
|
|
51
|
-
throw new p(
|
|
52
|
-
w,
|
|
53
|
-
`Package resource path must be a non-empty forward-slash relative path: ${t}.`
|
|
54
|
-
);
|
|
55
|
-
const e = [];
|
|
56
|
-
for (const n of t.split("/"))
|
|
57
|
-
if (!(!n || n === ".")) {
|
|
58
|
-
if (n === "..") {
|
|
59
|
-
if (e.length === 0)
|
|
60
|
-
throw new p(
|
|
61
|
-
w,
|
|
62
|
-
`Package resource path escapes its logical root: ${t}.`
|
|
63
|
-
);
|
|
64
|
-
e.pop();
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
e.push(n);
|
|
68
|
-
}
|
|
69
|
-
const o = e.join("/");
|
|
70
|
-
if (!o)
|
|
71
|
-
throw new p(
|
|
72
|
-
w,
|
|
73
|
-
`Package resource path normalizes to an empty value: ${t}.`
|
|
74
|
-
);
|
|
75
|
-
return o;
|
|
76
|
-
}
|
|
77
|
-
function S(t) {
|
|
78
|
-
const e = new URL(t);
|
|
79
|
-
if (e.protocol !== "http:" && e.protocol !== "https:" || e.username || e.password || e.hash)
|
|
80
|
-
throw new p(
|
|
81
|
-
w,
|
|
82
|
-
`Remote resource URL must be an absolute HTTP(S) URL without credentials or fragment: ${t}.`
|
|
83
|
-
);
|
|
84
|
-
return `${e.origin}${e.pathname}`;
|
|
85
|
-
}
|
|
86
|
-
function k(t) {
|
|
87
|
-
return t.kind === "package-path" ? { kind: "package-path", path: m(t.path) } : { kind: "remote-url", url: S(t.url) };
|
|
88
|
-
}
|
|
89
|
-
function l(t) {
|
|
90
|
-
const e = k(t);
|
|
91
|
-
return e.kind === "package-path" ? `package:${e.path}` : `remote:${e.url}`;
|
|
92
|
-
}
|
|
93
|
-
function j(t, e) {
|
|
94
|
-
return `res_${b(`${l(t)}\0${e}`).slice(0, 32)}`;
|
|
95
|
-
}
|
|
96
|
-
function Y(t) {
|
|
97
|
-
return t.kind === "package-path" ? m(t.path) : null;
|
|
98
|
-
}
|
|
99
|
-
function G(t) {
|
|
100
|
-
return t.kind === "remote-url" ? S(t.url) : null;
|
|
101
|
-
}
|
|
102
|
-
function K(t) {
|
|
103
|
-
const e = k(t);
|
|
104
|
-
if (e.kind === "package-path") return e.path;
|
|
105
|
-
const o = new URL(e.url), n = o.pathname.split("/").filter(Boolean), s = n.length === 0 ? "r-root" : [
|
|
106
|
-
`p-${encodeURIComponent(n[0])}`,
|
|
107
|
-
...n.slice(1)
|
|
108
|
-
].join("/");
|
|
109
|
-
return m(
|
|
110
|
-
`remote-assets/${encodeURIComponent(o.origin)}/${s}`
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
function X(t, e, o = []) {
|
|
114
|
-
const n = e.trim();
|
|
115
|
-
if (!n) return null;
|
|
116
|
-
const s = k(t), u = new Set(o.map(l));
|
|
117
|
-
if (s.kind === "remote-url")
|
|
118
|
-
try {
|
|
119
|
-
const c = new URL(n, s.url);
|
|
120
|
-
return {
|
|
121
|
-
kind: "remote-url",
|
|
122
|
-
url: S(c.href)
|
|
123
|
-
};
|
|
124
|
-
} catch {
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
if (/^[a-z][a-z\d+.-]*:/i.test(n)) return null;
|
|
128
|
-
if (n.startsWith("/"))
|
|
129
|
-
try {
|
|
130
|
-
return { kind: "package-path", path: m(n.slice(1)) };
|
|
131
|
-
} catch {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
const r = s.path.split("/");
|
|
135
|
-
r.pop();
|
|
136
|
-
let a = null;
|
|
137
|
-
for (let c = r.length; c >= 0; c -= 1) {
|
|
138
|
-
const i = r.slice(0, c).join("/");
|
|
139
|
-
try {
|
|
140
|
-
const d = {
|
|
141
|
-
kind: "package-path",
|
|
142
|
-
path: m(i ? `${i}/${n}` : n)
|
|
143
|
-
};
|
|
144
|
-
if (a ?? (a = d), u.size === 0 || u.has(l(d)))
|
|
145
|
-
return d;
|
|
146
|
-
} catch {
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return a;
|
|
150
|
-
}
|
|
151
|
-
const f = {
|
|
152
|
-
unavailable: "ASSET_SOURCE_UNAVAILABLE",
|
|
153
|
-
conflict: "SOURCE_REVISION_CONFLICT",
|
|
154
|
-
unverifiable: "SOURCE_FACTS_UNVERIFIABLE",
|
|
155
|
-
factsMismatch: "ASSET_SOURCE_FACTS_MISMATCH",
|
|
156
|
-
invalidLocator: "ASSET_SOURCE_INVALID_LOCATOR"
|
|
157
|
-
};
|
|
158
|
-
function U(t) {
|
|
159
|
-
const e = new URL(t.entryUrl);
|
|
160
|
-
if (e.protocol !== "http:" && e.protocol !== "https:" || e.username || e.password || e.hash)
|
|
161
|
-
throw new p(
|
|
162
|
-
f.invalidLocator,
|
|
163
|
-
`Remote asset entry URL must be an absolute HTTP(S) URL without credentials or fragment: ${t.entryUrl}.`
|
|
164
|
-
);
|
|
165
|
-
const o = t.allowedScopes ? t.allowedScopes.map(R) : void 0, n = {
|
|
166
|
-
kind: "remote-entry",
|
|
167
|
-
revisionId: t.revisionId,
|
|
168
|
-
entryUrl: e.href,
|
|
169
|
-
...t.request ? { request: t.request } : {},
|
|
170
|
-
...o ? { allowedScopes: o } : {}
|
|
171
|
-
};
|
|
172
|
-
if (!A(n, e))
|
|
173
|
-
throw new p(
|
|
174
|
-
f.invalidLocator,
|
|
175
|
-
`Remote asset entry URL is outside its allowed scopes: ${e.href}.`
|
|
176
|
-
);
|
|
177
|
-
return n;
|
|
178
|
-
}
|
|
179
|
-
function v(t) {
|
|
180
|
-
if (!t.allowedScopes) return [];
|
|
181
|
-
const e = /* @__PURE__ */ new Map();
|
|
182
|
-
for (const o of t.allowedScopes) {
|
|
183
|
-
const n = R(o);
|
|
184
|
-
e.set(`${n.origin}\0${n.pathPrefix}`, n);
|
|
185
|
-
}
|
|
186
|
-
return [...e.values()].sort((o, n) => o.origin.localeCompare(n.origin) || o.pathPrefix.localeCompare(n.pathPrefix));
|
|
187
|
-
}
|
|
188
|
-
function A(t, e) {
|
|
189
|
-
return t.allowedScopes ? v(t).some((o) => N(e, o)) : e.protocol === "http:" || e.protocol === "https:";
|
|
190
|
-
}
|
|
191
|
-
function D(t, e) {
|
|
192
|
-
const o = E(t), n = T(e), s = o.endsWith("/") ? o : `${o}/`;
|
|
193
|
-
return n === "/" || s === n || o.startsWith(n);
|
|
194
|
-
}
|
|
195
|
-
function N(t, e) {
|
|
196
|
-
const o = R(e);
|
|
197
|
-
return t.origin === o.origin && D(t.pathname, o.pathPrefix);
|
|
198
|
-
}
|
|
199
|
-
function P(t) {
|
|
200
|
-
return S(t.entryUrl);
|
|
201
|
-
}
|
|
202
|
-
function R(t) {
|
|
203
|
-
const e = new URL(t.origin);
|
|
204
|
-
if (e.protocol !== "http:" && e.protocol !== "https:" || e.username || e.password || e.pathname !== "/" || e.search || e.hash)
|
|
205
|
-
throw new p(
|
|
206
|
-
f.invalidLocator,
|
|
207
|
-
`Asset scope origin must be a canonical HTTP(S) origin: ${t.origin}.`
|
|
208
|
-
);
|
|
209
|
-
return {
|
|
210
|
-
origin: e.origin,
|
|
211
|
-
pathPrefix: T(t.pathPrefix)
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function T(t) {
|
|
215
|
-
if (!t.startsWith("/"))
|
|
216
|
-
throw new p(
|
|
217
|
-
f.invalidLocator,
|
|
218
|
-
`Asset scope pathPrefix must be absolute: ${t}.`
|
|
219
|
-
);
|
|
220
|
-
const e = E(t);
|
|
221
|
-
return e.endsWith("/") ? e : `${e}/`;
|
|
222
|
-
}
|
|
223
|
-
function E(t) {
|
|
224
|
-
const e = new URL(t, "https://scope.invalid");
|
|
225
|
-
let o;
|
|
226
|
-
try {
|
|
227
|
-
o = decodeURIComponent(e.pathname);
|
|
228
|
-
} catch {
|
|
229
|
-
throw new p(
|
|
230
|
-
f.invalidLocator,
|
|
231
|
-
`Asset resource path contains invalid URL escaping: ${t}.`
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
const n = [];
|
|
235
|
-
for (const s of o.split("/"))
|
|
236
|
-
!s || s === "." || (s === ".." ? n.pop() : n.push(s));
|
|
237
|
-
return `/${n.join("/")}${o.endsWith("/") && n.length ? "/" : ""}`;
|
|
238
|
-
}
|
|
239
|
-
function q(t) {
|
|
240
|
-
return "visualRevisionId" in t ? t.visualRevisionId : t.revisionId;
|
|
241
|
-
}
|
|
242
|
-
function J(t) {
|
|
243
|
-
return t.kind === "local-package" ? {
|
|
244
|
-
kind: "local-package",
|
|
245
|
-
revisionId: t.revisionId,
|
|
246
|
-
entryPath: t.entryPath,
|
|
247
|
-
files: t.files.map((e) => ({ locator: e.locator, blob: e.blob }))
|
|
248
|
-
} : {
|
|
249
|
-
kind: "remote-entry",
|
|
250
|
-
revisionId: t.revisionId,
|
|
251
|
-
entryUrl: t.entryUrl,
|
|
252
|
-
...t.request ? { request: t.request } : {},
|
|
253
|
-
...t.allowedScopes ? { allowedScopes: t.allowedScopes.map((e) => ({ ...e })) } : {}
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
async function W(t, e = {}) {
|
|
257
|
-
var r, a, c;
|
|
258
|
-
if ((r = e.signal) == null || r.throwIfAborted(), t.kind === "remote-entry") {
|
|
259
|
-
const i = U(t);
|
|
260
|
-
return {
|
|
261
|
-
source: i,
|
|
262
|
-
facts: [],
|
|
263
|
-
fingerprint: L(i)
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
const o = [];
|
|
267
|
-
for (const i of t.files) {
|
|
268
|
-
(a = e.signal) == null || a.throwIfAborted();
|
|
269
|
-
const d = k(i.locator);
|
|
270
|
-
if (d.kind !== "package-path")
|
|
271
|
-
throw new p(
|
|
272
|
-
f.invalidLocator,
|
|
273
|
-
`Local asset sources cannot contain remote resources: ${d.url}.`
|
|
274
|
-
);
|
|
275
|
-
const g = m(d.path), y = new Uint8Array(await i.blob.arrayBuffer());
|
|
276
|
-
(c = e.signal) == null || c.throwIfAborted(), o.push({
|
|
277
|
-
locator: { kind: "package-path", path: g },
|
|
278
|
-
blob: i.blob,
|
|
279
|
-
resourceId: j(
|
|
280
|
-
{ kind: "package-path", path: g },
|
|
281
|
-
b(y)
|
|
282
|
-
),
|
|
283
|
-
sha256: b(y),
|
|
284
|
-
byteSize: y.byteLength,
|
|
285
|
-
mediaType: z(g, i.blob.type) ?? I
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
o.sort((i, d) => i.resourceId.localeCompare(d.resourceId));
|
|
289
|
-
const n = m(t.entryPath);
|
|
290
|
-
if (!o.some((i) => i.locator.kind === "package-path" && i.locator.path === n))
|
|
291
|
-
throw new p(
|
|
292
|
-
f.unverifiable,
|
|
293
|
-
`Local asset source is missing its entry: ${t.entryPath}.`
|
|
294
|
-
);
|
|
295
|
-
const s = {
|
|
296
|
-
kind: "local-package",
|
|
297
|
-
revisionId: t.revisionId,
|
|
298
|
-
entryPath: n,
|
|
299
|
-
files: o.map((i) => ({ locator: i.locator, blob: i.blob }))
|
|
300
|
-
}, u = o.map(({ resourceId: i, locator: d, sha256: g, byteSize: y, mediaType: x }) => ({
|
|
301
|
-
resourceId: i,
|
|
302
|
-
locator: d,
|
|
303
|
-
sha256: g,
|
|
304
|
-
byteSize: y,
|
|
305
|
-
mediaType: x
|
|
306
|
-
}));
|
|
307
|
-
return {
|
|
308
|
-
source: s,
|
|
309
|
-
facts: u,
|
|
310
|
-
fingerprint: L(s, u)
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
function B(t, e) {
|
|
314
|
-
const o = q(e);
|
|
315
|
-
if (t.revisionId !== o)
|
|
316
|
-
throw h(
|
|
317
|
-
`Asset source revision ${t.revisionId} does not match requested revision ${o}.`
|
|
318
|
-
);
|
|
319
|
-
const n = e.resources.find((r) => r.resourceId === e.entryResourceId);
|
|
320
|
-
if (!n)
|
|
321
|
-
throw h(
|
|
322
|
-
`Asset source entry does not match revision facts for ${o}.`
|
|
323
|
-
);
|
|
324
|
-
if (t.kind === "remote-entry") {
|
|
325
|
-
if (U(t), n.locator.kind !== "remote-url" || n.locator.url !== P(t))
|
|
326
|
-
throw h(
|
|
327
|
-
`Remote asset source entry does not match revision facts for ${o}.`
|
|
328
|
-
);
|
|
329
|
-
for (const r of e.resources) {
|
|
330
|
-
if (r.locator.kind !== "remote-url")
|
|
331
|
-
throw h(
|
|
332
|
-
`Remote asset source does not authorize revision resource ${l(r.locator)}.`
|
|
333
|
-
);
|
|
334
|
-
const a = new URL(r.locator.url);
|
|
335
|
-
if (!A(t, a))
|
|
336
|
-
throw h(
|
|
337
|
-
`Remote asset source does not authorize revision resource ${l(r.locator)}.`
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
if (n.locator.kind !== "package-path" || n.locator.path !== t.entryPath)
|
|
343
|
-
throw h(
|
|
344
|
-
`Local asset source entry does not match revision facts for ${o}.`
|
|
345
|
-
);
|
|
346
|
-
const s = new Map(e.resources.map((r) => [
|
|
347
|
-
l(r.locator),
|
|
348
|
-
r
|
|
349
|
-
])), u = new Map(t.files.map((r) => [
|
|
350
|
-
l(r.locator),
|
|
351
|
-
r
|
|
352
|
-
]));
|
|
353
|
-
if (s.size !== u.size)
|
|
354
|
-
throw h(`Local asset source path set does not match ${o}.`);
|
|
355
|
-
for (const [r, a] of u) {
|
|
356
|
-
const c = s.get(r);
|
|
357
|
-
if (!c || a.blob.size !== c.byteSize)
|
|
358
|
-
throw h(`Local asset source facts do not match ${o}/${r}.`);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
async function Q(t, e, o = {}) {
|
|
362
|
-
var r;
|
|
363
|
-
if (B(t, e), t.kind === "remote-entry") return;
|
|
364
|
-
const n = await W(t, o), s = new Map(e.resources.map((a) => [
|
|
365
|
-
l(a.locator),
|
|
366
|
-
a
|
|
367
|
-
])), u = new Map(t.files.map((a) => [
|
|
368
|
-
l(a.locator),
|
|
369
|
-
a.blob
|
|
370
|
-
]));
|
|
371
|
-
for (const a of n.facts) {
|
|
372
|
-
const c = s.get(l(a.locator));
|
|
373
|
-
if (!c || c.sha256 !== a.sha256 || c.byteSize !== a.byteSize)
|
|
374
|
-
throw h(`Local asset source bytes do not match ${t.revisionId}/${l(a.locator)}.`);
|
|
375
|
-
const i = z(
|
|
376
|
-
a.locator.kind === "package-path" ? a.locator.path : a.locator.url,
|
|
377
|
-
(r = u.get(l(a.locator))) == null ? void 0 : r.type
|
|
378
|
-
);
|
|
379
|
-
if (i && i !== c.mediaType)
|
|
380
|
-
throw h(
|
|
381
|
-
`Local asset source mediaType does not match ${t.revisionId}/${l(a.locator)}.`
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
function L(t, e = []) {
|
|
386
|
-
return _(
|
|
387
|
-
t.kind === "local-package" ? {
|
|
388
|
-
kind: t.kind,
|
|
389
|
-
revisionId: t.revisionId,
|
|
390
|
-
entryPath: t.entryPath,
|
|
391
|
-
facts: e.map((o) => ({
|
|
392
|
-
locator: o.locator,
|
|
393
|
-
sha256: o.sha256,
|
|
394
|
-
byteSize: o.byteSize,
|
|
395
|
-
mediaType: o.mediaType
|
|
396
|
-
})).sort((o, n) => l(o.locator).localeCompare(
|
|
397
|
-
l(n.locator)
|
|
398
|
-
))
|
|
399
|
-
} : {
|
|
400
|
-
kind: t.kind,
|
|
401
|
-
revisionId: t.revisionId,
|
|
402
|
-
entryUrl: P(t),
|
|
403
|
-
scopePolicy: t.allowedScopes === void 0 ? "unrestricted-http" : "explicit",
|
|
404
|
-
scopes: v(t).map((o) => `${o.origin}${o.pathPrefix}`)
|
|
405
|
-
}
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
function Z(t) {
|
|
409
|
-
return {
|
|
410
|
-
assetId: t.revisionId,
|
|
411
|
-
entryLocator: { kind: "package-path", path: t.entryPath },
|
|
412
|
-
files: t.files.map((e) => ({ locator: e.locator, blob: e.blob }))
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
function h(t) {
|
|
416
|
-
return new p(f.factsMismatch, t);
|
|
417
|
-
}
|
|
418
|
-
export {
|
|
419
|
-
I as D,
|
|
420
|
-
f as S,
|
|
421
|
-
l as a,
|
|
422
|
-
X as b,
|
|
423
|
-
S as c,
|
|
424
|
-
B as d,
|
|
425
|
-
P as e,
|
|
426
|
-
J as f,
|
|
427
|
-
m as g,
|
|
428
|
-
U as h,
|
|
429
|
-
v as i,
|
|
430
|
-
D as j,
|
|
431
|
-
W as k,
|
|
432
|
-
G as l,
|
|
433
|
-
H as m,
|
|
434
|
-
k as n,
|
|
435
|
-
q as o,
|
|
436
|
-
Y as p,
|
|
437
|
-
L as q,
|
|
438
|
-
z as r,
|
|
439
|
-
Z as s,
|
|
440
|
-
K as t,
|
|
441
|
-
j as u,
|
|
442
|
-
Q as v,
|
|
443
|
-
A as w
|
|
444
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { w as l } from "./scene-graph-DBLKAhxa.js";
|
|
2
|
-
const f = Object.freeze({ hidden: !1, locked: !1 });
|
|
3
|
-
function E(e) {
|
|
4
|
-
const t = u(e.document).flatMap((a) => {
|
|
5
|
-
const d = e.editorial[a] ?? f;
|
|
6
|
-
return d.hidden || d.locked ? [{ nodeId: a, hidden: d.hidden, locked: d.locked }] : [];
|
|
7
|
-
}), n = [...new Set(e.selection.instanceIds)], i = e.selection.primaryId, r = {
|
|
8
|
-
format: "sim-studio.editorial-state@1",
|
|
9
|
-
schemaVersion: 1,
|
|
10
|
-
selection: { nodeIds: n, primaryNodeId: i },
|
|
11
|
-
nodeStates: t,
|
|
12
|
-
camera: e.camera ? s(e.camera) : null
|
|
13
|
-
};
|
|
14
|
-
return h(r, e.document), r;
|
|
15
|
-
}
|
|
16
|
-
function h(e, o) {
|
|
17
|
-
if (e.format !== "sim-studio.editorial-state@1" || e.schemaVersion !== 1)
|
|
18
|
-
throw new Error("Unsupported editorial state format.");
|
|
19
|
-
const t = new Set(l(o.root).map((r) => r.nodeId)), n = /* @__PURE__ */ new Set();
|
|
20
|
-
for (const r of e.nodeStates) {
|
|
21
|
-
if (c(r.nodeId, t), n.has(r.nodeId))
|
|
22
|
-
throw new Error(`Editorial state repeats node ${r.nodeId}.`);
|
|
23
|
-
n.add(r.nodeId);
|
|
24
|
-
}
|
|
25
|
-
const i = /* @__PURE__ */ new Set();
|
|
26
|
-
for (const r of e.selection.nodeIds) {
|
|
27
|
-
if (c(r, t), i.has(r))
|
|
28
|
-
throw new Error(`Editorial selection repeats node ${r}.`);
|
|
29
|
-
i.add(r);
|
|
30
|
-
}
|
|
31
|
-
if (e.selection.primaryNodeId !== null && !i.has(e.selection.primaryNodeId))
|
|
32
|
-
throw new Error(`Editorial primary selection is not in the selection: ${e.selection.primaryNodeId}`);
|
|
33
|
-
e.camera && s(e.camera);
|
|
34
|
-
}
|
|
35
|
-
function I(e) {
|
|
36
|
-
return Object.freeze(Object.fromEntries(
|
|
37
|
-
e.nodeStates.map((o) => [
|
|
38
|
-
o.nodeId,
|
|
39
|
-
Object.freeze({ hidden: o.hidden, locked: o.locked })
|
|
40
|
-
])
|
|
41
|
-
));
|
|
42
|
-
}
|
|
43
|
-
function p(e) {
|
|
44
|
-
return s(e);
|
|
45
|
-
}
|
|
46
|
-
function s(e) {
|
|
47
|
-
if (e.schemaVersion !== 1 || e.viewMode !== "2d" && e.viewMode !== "3d")
|
|
48
|
-
throw new Error("Editorial camera schema or view mode is invalid.");
|
|
49
|
-
if (e.viewMode === "2d" && !e.orthographic)
|
|
50
|
-
throw new Error("A 2D editorial camera requires orthographic facts.");
|
|
51
|
-
if (e.viewMode === "3d" && !e.orbit)
|
|
52
|
-
throw new Error("A 3D editorial camera requires orbit facts.");
|
|
53
|
-
for (const o of w(e))
|
|
54
|
-
if (!Number.isFinite(o)) throw new Error("Editorial camera contains a non-finite value.");
|
|
55
|
-
return {
|
|
56
|
-
schemaVersion: 1,
|
|
57
|
-
viewMode: e.viewMode,
|
|
58
|
-
...e.orbit ? { orbit: { ...e.orbit } } : {},
|
|
59
|
-
...e.orthographic ? { orthographic: { ...e.orthographic } } : {}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function w(e) {
|
|
63
|
-
return [
|
|
64
|
-
...e.orbit ? Object.values(e.orbit) : [],
|
|
65
|
-
...e.orthographic ? Object.values(e.orthographic) : []
|
|
66
|
-
];
|
|
67
|
-
}
|
|
68
|
-
function u(e) {
|
|
69
|
-
return l(e.root).filter((o) => o.nodeId !== e.root.nodeId).map((o) => o.nodeId).sort((o, t) => o.localeCompare(t));
|
|
70
|
-
}
|
|
71
|
-
function c(e, o) {
|
|
72
|
-
if (!o.has(e)) throw new Error(`Editorial state references unknown node ${e}.`);
|
|
73
|
-
}
|
|
74
|
-
function b(e, o) {
|
|
75
|
-
return e.nodeStates.find((t) => t.nodeId === o) ?? { nodeId: o, hidden: !1, locked: !1 };
|
|
76
|
-
}
|
|
77
|
-
export {
|
|
78
|
-
h as a,
|
|
79
|
-
I as b,
|
|
80
|
-
E as c,
|
|
81
|
-
b as e,
|
|
82
|
-
p as n
|
|
83
|
-
};
|