@nebula-spatial/studio 0.0.0-stage → 0.1.1
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 +206 -3
- package/dist/ai/contract.d.ts +73 -0
- package/dist/ai/host.d.ts +28 -0
- package/dist/asset/dependency-scan.d.ts +78 -0
- package/dist/asset/intake.d.ts +84 -0
- package/dist/asset/layout-detect.d.ts +40 -0
- package/dist/asset/media-type.d.ts +10 -0
- package/dist/asset/model-inspection.d.ts +127 -0
- package/dist/asset/record.d.ts +35 -0
- package/dist/asset/remote-asset-resolver.d.ts +36 -0
- package/dist/asset/repairs.d.ts +53 -0
- package/dist/asset/resource-locator.d.ts +15 -0
- package/dist/asset/revision-diff.d.ts +33 -0
- package/dist/asset/source-contracts.d.ts +21 -0
- package/dist/asset/source-paths.d.ts +15 -0
- package/dist/asset/usd-inspection.d.ts +39 -0
- package/dist/asset/usd-source-metadata.d.ts +142 -0
- package/dist/asset/visual-intake.d.ts +27 -0
- package/dist/asset/visual-record.d.ts +22 -0
- package/dist/asset/web-intake.d.ts +46 -0
- package/dist/asset-source-BExlEcRt.js +444 -0
- package/dist/assets/openusd_three_loader-DLiqJWUM.js +13769 -0
- package/dist/assets/usd-export-worker-BRxTLqer.js +182 -0
- package/dist/assets/usd-worker-DekqMsQv.js +1392 -0
- package/dist/builders-BAXRR5o5.js +1854 -0
- package/dist/core/asset-task.d.ts +105 -0
- package/dist/core/context.d.ts +23 -0
- package/dist/core/host.d.ts +432 -0
- package/dist/core/persistence-controller.d.ts +58 -0
- package/dist/core/plugins.d.ts +139 -0
- package/dist/core/scene-tree.d.ts +62 -0
- package/dist/core/versions.d.ts +2 -0
- package/dist/core/when.d.ts +13 -0
- package/dist/core/write-policy.d.ts +29 -0
- package/dist/delivery/build-plan.d.ts +2 -0
- package/dist/delivery/contracts.d.ts +362 -0
- package/dist/delivery/digest.d.ts +3 -0
- package/dist/delivery/evidence.d.ts +10 -0
- package/dist/delivery/export-evidence.d.ts +3 -0
- package/dist/delivery/index.d.ts +9 -0
- package/dist/delivery/prim-name.d.ts +17 -0
- package/dist/delivery/profile.d.ts +4 -0
- package/dist/doc/builders.d.ts +99 -0
- package/dist/doc/command.d.ts +195 -0
- package/dist/doc/domain-extensions.d.ts +34 -0
- package/dist/doc/node-facts.d.ts +87 -0
- package/dist/doc/physics-facts.d.ts +74 -0
- package/dist/doc/placement-policy.d.ts +71 -0
- package/dist/doc/random-placement.d.ts +30 -0
- package/dist/doc/scene-graph.d.ts +80 -0
- package/dist/doc/scene-regions.d.ts +29 -0
- package/dist/doc/schema.d.ts +452 -0
- package/dist/doc/task.d.ts +71 -0
- package/dist/doc/validate.d.ts +68 -0
- package/dist/editor/asset-source.d.ts +15 -0
- package/dist/editor/editor.d.ts +246 -0
- package/dist/editor/index.d.ts +22 -0
- package/dist/editor/shortcuts.d.ts +2 -0
- package/dist/editor/types.d.ts +143 -0
- package/dist/editor/ui-plugins.d.ts +64 -0
- package/dist/editor.js +1755 -0
- package/dist/editorial-BkAFWfbg.js +83 -0
- package/dist/export-evidence-DMNRhgL9.js +2705 -0
- package/dist/generalization/domain.d.ts +10 -0
- package/dist/generalization/generalization.d.ts +371 -0
- package/dist/generalization/index.d.ts +11 -0
- package/dist/generalization.js +1659 -0
- package/dist/history/undo-stack.d.ts +74 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.js +2840 -0
- package/dist/mjcf-visual-Bt4bUxd1.js +72 -0
- package/dist/mujoco-runtime-BYZnrvbR.js +467 -0
- package/dist/persist/content-addressed.d.ts +11 -0
- package/dist/persist/create-scene-package-from-host.d.ts +7 -0
- package/dist/persist/indexeddb-store.d.ts +69 -0
- package/dist/persist/scene-file.d.ts +52 -0
- package/dist/persist/scene-package.d.ts +8 -0
- package/dist/persist/snapshot.d.ts +5 -0
- package/dist/physics-facts-tfQYyNTD.js +337 -0
- package/dist/placement-policy-DY_FNRDu.js +405 -0
- package/dist/ports/asset-ingestor.d.ts +41 -0
- package/dist/ports/asset-source.d.ts +57 -0
- package/dist/ports/delivery.d.ts +13 -0
- package/dist/ports/persistence.d.ts +29 -0
- package/dist/project/asset-catalog.d.ts +21 -0
- package/dist/project/contracts.d.ts +272 -0
- package/dist/project/editorial.d.ts +16 -0
- package/dist/project/identity.d.ts +20 -0
- package/dist/project/index.d.ts +9 -0
- package/dist/project/scene-document.d.ts +5 -0
- package/dist/project/source-dependencies.d.ts +7 -0
- package/dist/remote-asset-resolver-Cb8cfNmw.js +136 -0
- package/dist/scene/index.d.ts +12 -0
- package/dist/scene-graph-DBLKAhxa.js +681 -0
- package/dist/scene-session-Cy6vDJ1l.js +21981 -0
- package/dist/scene.js +244 -0
- package/dist/session-BRBrCLdd.js +963 -0
- package/dist/session-DI5tPJxn.js +825 -0
- package/dist/session-q3uuG7OP.js +296 -0
- package/dist/studio/delivery-catalog.d.ts +28 -0
- package/dist/studio/in-memory-asset-source.d.ts +15 -0
- package/dist/studio/index.d.ts +31 -0
- package/dist/studio/indexeddb-asset-source.d.ts +32 -0
- package/dist/studio/indexeddb-persistence.d.ts +13 -0
- package/dist/studio/remote-asset-importer.d.ts +56 -0
- package/dist/studio/source-package.d.ts +9 -0
- package/dist/studio/usd-export-client.d.ts +13 -0
- package/dist/studio/usd-export-protocol.d.ts +98 -0
- package/dist/studio/usd-export-worker.d.ts +1 -0
- package/dist/studio/usd-zip-reader.d.ts +14 -0
- package/dist/studio/web-asset-ingestor.d.ts +10 -0
- package/dist/studio/web-host.d.ts +8 -0
- package/dist/studio.js +5545 -0
- package/dist/urdf-session-CQir2nb2.js +1230 -0
- package/dist/usd-session-DZJnEEOs.js +7385 -0
- package/dist/util/asset-facts.d.ts +3 -0
- package/dist/util/data.d.ts +17 -0
- package/dist/util/diagnostics.d.ts +38 -0
- package/dist/util/geometry.d.ts +11 -0
- package/dist/util/hash.d.ts +9 -0
- package/dist/util/ids.d.ts +20 -0
- package/dist/util/math.d.ts +47 -0
- package/dist/util/ply-metadata.d.ts +19 -0
- package/dist/util/studio-source.d.ts +23 -0
- package/dist/version.d.ts +5 -0
- package/dist/view/appearance.d.ts +13 -0
- package/dist/view/authoring-appearance.d.ts +25 -0
- package/dist/view/bounds-preview.d.ts +34 -0
- package/dist/view/bounds.d.ts +11 -0
- package/dist/view/camera-zoom.d.ts +3 -0
- package/dist/view/geometry-anchors.d.ts +20 -0
- package/dist/view/gizmo-appearance.d.ts +5 -0
- package/dist/view/gizmo.d.ts +81 -0
- package/dist/view/group-selection.d.ts +13 -0
- package/dist/view/node-features.d.ts +39 -0
- package/dist/view/picking.d.ts +49 -0
- package/dist/view/placement.d.ts +48 -0
- package/dist/view/region-editing.d.ts +25 -0
- package/dist/view/rotation-guide.d.ts +36 -0
- package/dist/view/runtime-capabilities.d.ts +22 -0
- package/dist/view/scene-session.d.ts +258 -0
- package/dist/view/screen-bounds.d.ts +17 -0
- package/dist/view/selection-transform.d.ts +20 -0
- package/dist/wasm-module-DZn2AM1W.js +13 -0
- package/dist/xacro-DLRXyk60.js +76 -0
- package/node_modules/@nebula-spatial/cad-loader/CHANGELOG.md +48 -0
- package/node_modules/@nebula-spatial/cad-loader/README.md +108 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/cad-types.d.ts +26 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/errors.d.ts +5 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/index.d.ts +24 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/index.js +2354 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/bin-group-reader.d.ts +9 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/bin-parser.d.ts +78 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/dxbs-sidecar.d.ts +24 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/geometry-segments.d.ts +20 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/text-roundtrip.d.ts +4 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/types.d.ts +81 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/runtime-text-decoder.d.ts +8 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/types.d.ts +153 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/utils/insert-bbox.d.ts +10 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/utils/viewport-rect.d.ts +21 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/index.d.ts +36 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/index.js +5829 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/geo-loader.d.ts +59 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/automatic-external-resources.d.ts +26 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/external-variant-sidecar-fetch.d.ts +13 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/flow-control.d.ts +29 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/frame-budget-scheduler.d.ts +21 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-compact-executor.d.ts +19 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-local-adapter.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-pipeline.d.ts +92 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-worker-adapter.d.ts +13 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node-builder.d.ts +34 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node-load-sink.d.ts +28 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node.d.ts +304 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare-worker-types.d.ts +94 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare.d.ts +38 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare.worker.d.ts +1 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/insert-model-builder.d.ts +10 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/insert-runtime-geometry.d.ts +15 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/line-canonical.d.ts +37 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/line-quality.d.ts +9 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/prepare-credit-gate.d.ts +20 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/transport.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/render-resource/cad-render-node.d.ts +80 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/render-resource/geo-node-cad-render-node.d.ts +12 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/geo-cad-line-geometry.d.ts +28 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/geo-cad-line-material.d.ts +18 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/block-geometry-registry.d.ts +35 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/insert-instance-table.d.ts +23 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/viewport-instance-presenter.d.ts +66 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/selection/cad-insert-selection.d.ts +35 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/selection/cad-text-selection.d.ts +31 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/annotation-idle-gate.d.ts +14 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-document-session.d.ts +187 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-font-runtime.d.ts +11 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-insert-id.d.ts +6 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-text-warmup.d.ts +38 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/create-cad-document-session.d.ts +5 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/load-session.d.ts +90 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/viewport-coverage.d.ts +32 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/abort.d.ts +3 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/cad-display-color.d.ts +55 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/cad-load-source.d.ts +8 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/color-buffer.d.ts +6 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/constants.d.ts +11 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/display-color-buffer.d.ts +27 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/errors.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/text-builder.d.ts +25 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/text-font.d.ts +12 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/types.d.ts +57 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/insert-bbox.d.ts +1 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/timing.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/viewport-rect.d.ts +1 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/viewer-theme.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/workers/geo-prepare.worker.js +2264 -0
- package/node_modules/@nebula-spatial/cad-loader/package.json +62 -0
- package/node_modules/@nebula-spatial/viewer/CHANGELOG.md +426 -0
- package/node_modules/@nebula-spatial/viewer/FBX-MATERIAL-CONVERSION.md +97 -0
- package/node_modules/@nebula-spatial/viewer/README.md +1056 -0
- package/node_modules/@nebula-spatial/viewer/USD-VISUAL-MATERIAL-SUPPORT.md +89 -0
- package/node_modules/@nebula-spatial/viewer/basis/basis_transcoder.js +19 -0
- package/node_modules/@nebula-spatial/viewer/basis/basis_transcoder.wasm +0 -0
- package/node_modules/@nebula-spatial/viewer/dist/asset-ir-DEOK9SqE.js +382 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/ground-grid.d.ts +6 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/source-types.d.ts +19 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/types.d.ts +393 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/usd-worker-Bom5cjz3.js +1392 -0
- package/node_modules/@nebula-spatial/viewer/dist/cad/text.d.ts +2 -0
- package/node_modules/@nebula-spatial/viewer/dist/cad/types.d.ts +368 -0
- package/node_modules/@nebula-spatial/viewer/dist/index-ByBlfVc0.js +12132 -0
- package/node_modules/@nebula-spatial/viewer/dist/index.d.ts +32 -0
- package/node_modules/@nebula-spatial/viewer/dist/index.js +26 -0
- package/node_modules/@nebula-spatial/viewer/dist/inspection/types.d.ts +112 -0
- package/node_modules/@nebula-spatial/viewer/dist/mjcf-visual-DVRa0w90.js +72 -0
- package/node_modules/@nebula-spatial/viewer/dist/mujoco-runtime-Dhx6Ua2u.js +463 -0
- package/node_modules/@nebula-spatial/viewer/dist/plugins.d.ts +179 -0
- package/node_modules/@nebula-spatial/viewer/dist/scene/instances.d.ts +36 -0
- package/node_modules/@nebula-spatial/viewer/dist/scene/types.d.ts +258 -0
- package/node_modules/@nebula-spatial/viewer/dist/session-B-j6KdA-.js +389 -0
- package/node_modules/@nebula-spatial/viewer/dist/session-B4AICTeJ.js +963 -0
- package/node_modules/@nebula-spatial/viewer/dist/session-BAG5cDYe.js +9153 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/mujoco-runtime.d.ts +118 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/mujoco-wasm-module.d.ts +11 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/openusd-wasm-module.d.ts +10 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/physics-runtime-state.d.ts +75 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/types.d.ts +129 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-inspection.d.ts +66 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-query.d.ts +50 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-resource-policy.d.ts +28 -0
- package/node_modules/@nebula-spatial/viewer/dist/types.d.ts +278 -0
- package/node_modules/@nebula-spatial/viewer/dist/ui/types.d.ts +48 -0
- package/node_modules/@nebula-spatial/viewer/dist/urdf-session-kemAnBn8.js +3231 -0
- package/node_modules/@nebula-spatial/viewer/dist/usd-session-QtwGKI7v.js +6771 -0
- package/node_modules/@nebula-spatial/viewer/dist/version.d.ts +5 -0
- package/node_modules/@nebula-spatial/viewer/dist/viewer.d.ts +2 -0
- package/node_modules/@nebula-spatial/viewer/dist/xacro-CYTPS7mh.js +1537 -0
- package/node_modules/@nebula-spatial/viewer/openusd/openusd-runtime-manifest.json +15 -0
- package/node_modules/@nebula-spatial/viewer/openusd/openusd_probe.js +14 -0
- package/node_modules/@nebula-spatial/viewer/openusd/openusd_probe.wasm +0 -0
- package/node_modules/@nebula-spatial/viewer/package.json +66 -0
- package/package.json +87 -6
|
@@ -0,0 +1,444 @@
|
|
|
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
|
+
};
|