vis-core 0.33.20 → 0.33.21

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/dist/io.d.ts CHANGED
@@ -147,10 +147,9 @@ export declare function mergeRuntimeAssets(previous?: RuntimeAssetCatalog, incom
147
147
 
148
148
  declare interface PrefabAsset {
149
149
  id: string;
150
+ /** Nonempty, trimmed, project-unique name used for SDK instantiation. */
150
151
  name: string;
151
152
  revision: number;
152
- /** Stable public SDK identifier. Omit for assets used only by the editor. */
153
- sdkKey?: string;
154
153
  /** Legacy business templates own complete material snapshots, without promoting scene assets. */
155
154
  materialMode?: 'embedded';
156
155
  snapshot: Record<string, any>;
@@ -278,7 +277,7 @@ declare interface VisSceneDocument extends SceneDocumentMarker {
278
277
  scenes: SceneViewportDocument[];
279
278
  /** Schema 4: serializable definitions shared by explicit asset identity. */
280
279
  materialLibrary?: MaterialAsset[];
281
- /** Reusable definitions. SDK-enabled assets are retained in deployment exports. */
280
+ /** Reusable definitions retained in deployment exports and instantiated by name. */
282
281
  prefabLibrary?: PrefabAsset[];
283
282
  c?: Record<string, any>;
284
283
  d?: Record<string, any>;
package/dist/io.js CHANGED
@@ -1 +1 @@
1
- import{t as s}from"./resource-url-MTT03G1N.js";import{C as a,S as r,_ as o,a as m,b as t,c as e,d as i,h as c,i as p,m as u,n as f,o as j,r as n,s as v,t as x,u as y,v as b,x as d,y as h}from"./e-DsI3lCu-.js";var l=s;export{p as MediaAssetWriter,u as RuntimeAssetResolver,c as assertMapNavigationTarget,m as assertMediaAssets,o as assetDigest,x as cityJsonName,b as decodeAssetBytes,h as encodeAssetBytes,y as isGzip,i as jsonFetch,t as mapTemplateLevels,j as mediaAssetPayload,d as mergeRuntimeAssets,e as readSceneBundleZip,r as resolveMapInteractionTemplate,v as resolveMediaAssets,l as resolveResourceUrl,a as verifyAssetBytes,f as verifySwitchKey,n as verifySwitchKeyScope};
1
+ import{t as s}from"./resource-url-MTT03G1N.js";import{C as a,S as r,_ as o,a as m,b as t,c as e,d as i,h as c,i as p,m as u,n as f,o as j,r as n,s as v,t as x,u as y,v as b,x as d,y as h}from"./e--VPnb9WD.js";var l=s;export{p as MediaAssetWriter,u as RuntimeAssetResolver,c as assertMapNavigationTarget,m as assertMediaAssets,o as assetDigest,x as cityJsonName,b as decodeAssetBytes,h as encodeAssetBytes,y as isGzip,i as jsonFetch,t as mapTemplateLevels,j as mediaAssetPayload,d as mergeRuntimeAssets,e as readSceneBundleZip,r as resolveMapInteractionTemplate,v as resolveMediaAssets,l as resolveResourceUrl,a as verifyAssetBytes,f as verifySwitchKey,n as verifySwitchKeyScope};
@@ -1 +1 @@
1
- import{Nt as e,O as t,u as s}from"./dist-CBwlzuju.js";import{a}from"./resource-url-MTT03G1N.js";import{i as r,s as o}from"./e-DsI3lCu-.js";var i=/* @__PURE__ */e({externalizeRuntimeImages:()=>n,resolveRuntimeAssetImages:()=>l,resolveRuntimeImages:()=>u,restoreRuntimeImageFiles:()=>d});function n(e){const t=(new r).prepare(e);return Object.assign(e,t.document,{assets:t.assets}),t.files}function u(e,s,a){o(e,s,e=>{const s=a(e);return t(s)?s.data:s})}function d(e,t,a){u(e,t,e=>{const t=a[e];if(!t)throw Error(`Missing texture resource: ${e}`);return s(t.data.buffer.slice(t.data.byteOffset,t.data.byteOffset+t.data.byteLength),t.mimeType)})}function l(e,s,r){var o,i,n,u;const d=new Set(s),l=e=>Array.isArray(e)?e.map(l):"string"==typeof e?d.has(e)?r(e):e:t(e)&&"string"==typeof e.data&&d.has(e.data)?a(a({},e),{},{data:r(e.data)}):e,f=e=>{var t,s,a;for(const r of null!==(t=null==e?void 0:e.images)&&void 0!==t?t:[])r.url=l(r.url);for(const r of null!==(s=null==e?void 0:e.textures)&&void 0!==s?s:[])void 0!==(null===(a=r.userData)||void 0===a?void 0:a._videoSrc)&&(r.userData._videoSrc=l(r.userData._videoSrc))};f(e.scene);for(const t of null!==(o=e.scenes)&&void 0!==o?o:[])f(t.scene);for(const t of null!==(i=e.materialLibrary)&&void 0!==i?i:[])f(t.material);for(const t of null!==(n=e.prefabLibrary)&&void 0!==n?n:[])f(t.snapshot);(null===(u=e.d)||void 0===u?void 0:u.chartBg)&&f({images:e.d.chartBg.images,textures:[e.d.chartBg]})}export{i as a,d as i,l as n,u as r,n as t};
1
+ import{Nt as e,O as t,u as s}from"./dist-CBwlzuju.js";import{a}from"./resource-url-MTT03G1N.js";import{i as r,s as o}from"./e--VPnb9WD.js";var i=/* @__PURE__ */e({externalizeRuntimeImages:()=>n,resolveRuntimeAssetImages:()=>l,resolveRuntimeImages:()=>u,restoreRuntimeImageFiles:()=>d});function n(e){const t=(new r).prepare(e);return Object.assign(e,t.document,{assets:t.assets}),t.files}function u(e,s,a){o(e,s,e=>{const s=a(e);return t(s)?s.data:s})}function d(e,t,a){u(e,t,e=>{const t=a[e];if(!t)throw Error(`Missing texture resource: ${e}`);return s(t.data.buffer.slice(t.data.byteOffset,t.data.byteOffset+t.data.byteLength),t.mimeType)})}function l(e,s,r){var o,i,n,u;const d=new Set(s),l=e=>Array.isArray(e)?e.map(l):"string"==typeof e?d.has(e)?r(e):e:t(e)&&"string"==typeof e.data&&d.has(e.data)?a(a({},e),{},{data:r(e.data)}):e,f=e=>{var t,s,a;for(const r of null!==(t=null==e?void 0:e.images)&&void 0!==t?t:[])r.url=l(r.url);for(const r of null!==(s=null==e?void 0:e.textures)&&void 0!==s?s:[])void 0!==(null===(a=r.userData)||void 0===a?void 0:a._videoSrc)&&(r.userData._videoSrc=l(r.userData._videoSrc))};f(e.scene);for(const t of null!==(o=e.scenes)&&void 0!==o?o:[])f(t.scene);for(const t of null!==(i=e.materialLibrary)&&void 0!==i?i:[])f(t.material);for(const t of null!==(n=e.prefabLibrary)&&void 0!==n?n:[])f(t.snapshot);(null===(u=e.d)||void 0===u?void 0:u.chartBg)&&f({images:e.d.chartBg.images,textures:[e.d.chartBg]})}export{i as a,d as i,l as n,u as r,n as t};
@@ -0,0 +1 @@
1
+ import{Nt as e,w as r}from"./dist-CBwlzuju.js";import{a as i}from"./resource-url-MTT03G1N.js";import{a as t,g as a,p as o}from"./e--VPnb9WD.js";import{a as n,i as s,n as d,o as u,s as l}from"./schema-DCtwlcYa.js";function c({id:e,name:r,revision:t,materialMode:a,snapshot:o}){return i(i({id:e,name:r,revision:t},a?{materialMode:a}:{}),{},{snapshot:o})}var f=["scenes","materialLibrary","prefabLibrary"],v=()=>{throw Error("Legacy resource pools must be imported in editor-platform before runtime loading")};function m(e){var r,i;const t=e.scene;void 0!==(null==t?void 0:t._texDataPool)&&v();const a=e=>{Array.isArray(e)?e.forEach(a):e&&"object"==typeof e&&("_documentResource"in e||"base64"===e.encoding)&&v()};for(const d of null!==(r=null==t?void 0:t.images)&&void 0!==r?r:[])a(d.url);for(const d of null!==(i=null==t?void 0:t.textures)&&void 0!==i?i:[]){var o,n,s;void 0===(null===(o=d.userData)||void 0===o?void 0:o._dataTexBase64)&&"number"!=typeof(null===(n=d.userData)||void 0===n?void 0:n._videoSrc)||v(),a(null===(s=d.userData)||void 0===s?void 0:s._videoSrc)}}function p(e){void 0===e._resourcePool&&void 0===e.imageAssets||v();for(const r of Array.isArray(e.scenes)?e.scenes:[])m(r);for(const r of Array.isArray(e.materialLibrary)?e.materialLibrary:[])m({scene:r.material});for(const r of Array.isArray(e.prefabLibrary)?e.prefabLibrary:[])m({scene:r.snapshot})}function y(e){return n(e),p(e),e}function b(e){y(e);const{scenes:r,materialLibrary:i,prefabLibrary:t}=e,a=o(e,f),n=structuredClone(a);return n.scenes=r.map(e=>structuredClone(e)),i&&(n.materialLibrary=i.map(e=>structuredClone(e))),t&&(n.prefabLibrary=t.map(e=>structuredClone(c(e)))),n}function w(e,r,i){const t=JSON.stringify([e,r,i]),a=[2166136261,2654435769,2246822507,3266489909].map(e=>{let r=e;for(let i=0;i<t.length;i++)r=Math.imul(r^t.charCodeAt(i),16777619);return r^=r>>>16,r=Math.imul(r,2246822507),(r^r>>>13)>>>0}).map(e=>e.toString(16).padStart(8,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-8${a.slice(13,16)}-${(3&parseInt(a[16],16)|8).toString(16)}${a.slice(17,20)}-${a.slice(20)}`}var g="_resourceSource",h="_materialAssetId",E="_materialAssetRevision",$="_materialRuntimeProperties",D=e=>structuredClone(e),I=e=>!!e&&"object"==typeof e&&!Array.isArray(e),j=e=>"map"===e||"matcap"===e||e.endsWith("Map");function A(e,r){var i;if(I(e)){r(e);for(const t of null!==(i=e.children)&&void 0!==i?i:[])A(t,r)}}function _(e,r){if("string"==typeof e)return r(e);if(Array.isArray(e))return e.map(e=>_(e,r));if(I(e))for(const i of Object.keys(e))e[i]=_(e[i],r);return e}function O(e,i){var t;const a=/* @__PURE__ */new Set;r(e,(e,r)=>{"PMREM_PLACEHOLDER"!==e[r]&&a.add(e[r])});for(const[r,d]of Object.entries(e))j(r)&&"string"==typeof d&&"PMREM_PLACEHOLDER"!==d&&a.add(d);const o=/* @__PURE__ */new Set,n=e=>{if("string"!=typeof e){if(e&&"object"==typeof e&&!o.has(e)){o.add(e);for(const r of Object.values(e))n(r)}}else i.has(e)&&a.add(e)};n(e.uniforms);for(const r of Object.values(null!==(t=e.uniforms)&&void 0!==t?t:{})){var s;if("t"===(null==r?void 0:r.type)&&"string"==typeof r.value&&"PMREM_PLACEHOLDER"!==r.value&&a.add(r.value),"tv"===(null==r?void 0:r.type))for(const e of null!==(s=r.value)&&void 0!==s?s:[])"string"==typeof e&&"PMREM_PLACEHOLDER"!==e&&a.add(e)}return a}function S(e,i){r(e,(e,r)=>{var t;e[r]=null!==(t=i.get(e[r]))&&void 0!==t?t:e[r]});for(const r of Object.keys(e)){var t;j(r)&&"string"==typeof e[r]&&(e[r]=null!==(t=i.get(e[r]))&&void 0!==t?t:e[r])}e.uniforms&&(e.uniforms=_(e.uniforms,e=>{var r;return null!==(r=i.get(e))&&void 0!==r?r:e}))}function L(e,r){let i=e,t=1;for(;r.has(i);)i=`${e}~${t++}`;return r.add(i),i}function M(e){const r=D(e);return r.userData&&(delete r.userData[h],delete r.userData[E],delete r.userData._materialAssetOverrideHash,delete r.userData._materialDynamic,delete r.userData[$],Object.keys(r.userData).length||delete r.userData),r}function x(e,r,t={}){var a,o,n,s,d,u;const l=new Set(null!==(a=t.editedProperties)&&void 0!==a?a:[]),c=null===(o=r.userData)||void 0===o?void 0:o[$],f=Array.isArray(c)?c.filter(e=>"string"==typeof e&&j(e)&&!l.has(e)):[],v=M(r);if(!f.length)return v;const m=M(e),p=null!==(n=v.textures)&&void 0!==n?n:[],y=null!==(s=v.images)&&void 0!==s?s:[],b=new Set(p.map(e=>e.uuid)),w=new Set(y.map(e=>e.uuid)),g=/* @__PURE__ */new Map,h=/* @__PURE__ */new Map;for(const $ of null!==(d=m.images)&&void 0!==d?d:[]){const e=y.find(e=>e.uuid===$.uuid),r=e&&JSON.stringify(e)!==JSON.stringify($)?L(`${$.uuid}:authored`,w):$.uuid;g.set($.uuid,r),w.add(r),y.some(e=>e.uuid===r)||y.push(i(i({},$),{},{uuid:r}))}for(const $ of null!==(u=m.textures)&&void 0!==u?u:[]){void 0!==$.image&&($.image=_($.image,e=>{var r;return null!==(r=g.get(e))&&void 0!==r?r:e}));const e=p.find(e=>e.uuid===$.uuid),r=e&&JSON.stringify(e)!==JSON.stringify($)?L(`${$.uuid}:authored`,b):$.uuid;h.set($.uuid,r),b.add(r),p.some(e=>e.uuid===r)||p.push(i(i({},$),{},{uuid:r}))}S(m,h);for(const i of f){var E,I;const e=v[i];if(!Object.hasOwn(m,i)){delete v[i];continue}v[i]=m[i];const r=p.find(e=>e.uuid===m[i]),t=p.find(r=>r.uuid===e);if(!r||!t)continue;const a=D(t);a.uuid=r.uuid,void 0===r.image?delete a.image:a.image=D(r.image);const o=null!==(E=a.userData)&&void 0!==E?E:a.userData={};for(const i of Object.keys(o))("_videoSrc"===i||i.startsWith("_dataTex"))&&delete o[i];for(const[i,n]of Object.entries(null!==(I=r.userData)&&void 0!==I?I:{}))("_videoSrc"===i||i.startsWith("_dataTex"))&&(o[i]=D(n));Object.keys(o).length||delete a.userData,JSON.stringify(a)!==JSON.stringify(r)&&(a.uuid=L(`${r.uuid}:sampler`,b),p.push(a),v[i]=a.uuid)}return C({id:"authored-material",name:"",vis:{type:"base",options:{}},scene:{materials:[v],textures:p,images:y}},v.uuid)}function P(e){const r=e.scene,i=i=>{var t;const a=/* @__PURE__ */new Map;for(const o of null!==(t=r[i])&&void 0!==t?t:[]){if("string"!=typeof(null==o?void 0:o.uuid)||!o.uuid||a.has(o.uuid))throw new Error(`Invalid ${i} identity in scene ${e.id}`);a.set(o.uuid,o)}return a},t=i("materials"),a=i("textures");return{scene:e,materials:t,textures:a,images:i("images"),textureIds:new Set(a.keys())}}function k(e,r){const{scene:i,materials:t,textures:a,images:o,textureIds:n}=e;i.scene;const s=t.get(r);if(!s)throw new Error(`Missing material ${r} in scene ${i.id}`);const d=M(s);delete d.textures,delete d.images;const u=O(d,n),l=[],c=/* @__PURE__ */new Set;for(const v of u){const e=a.get(v);if(!e)throw new Error(`Missing texture ${v} for material ${r} in scene ${i.id}`);const t=D(e);l.push(t);for(const r of[t.image].flat()){var f;if("string"==typeof r)if(o.has(r))c.add(r);else if(!(null===(f=t.userData)||void 0===f?void 0:f._videoSrc))throw new Error(`Missing image ${r} for texture ${v} in scene ${i.id}`)}}return l.length&&(d.textures=l),c.size&&(d.images=[...c].map(e=>D(o.get(e)))),d}function C(e,r){return N(e)(r)}function N(e){const r=P(e);return e=>k(r,e)}function R(e,r=w(e.id,"material",e.material.uuid)){var t,a;const o=M(e.material),n=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map;for(const i of null!==(t=o.images)&&void 0!==t?t:[]){const r=i.uuid;i.uuid=w(e.id,"image",r),n.set(r,i.uuid)}for(const d of null!==(a=o.textures)&&void 0!==a?a:[]){const r=d.uuid;d.uuid=w(e.id,"texture",r),s.set(r,d.uuid),d.userData=i(i({},d.userData),{},{[g]:{assetId:e.id,textureUuid:r,imageUuids:[d.image].flat().filter(e=>"string"==typeof e)}}),void 0!==d.image&&(d.image=_(d.image,e=>{var r;return null!==(r=n.get(e))&&void 0!==r?r:e}))}return S(o,s),o.uuid=r,o.name=e.name,o.userData=i(i({},o.userData),{},{[h]:e.id,[E]:e.revision,[g]:{assetId:e.id,materialUuid:e.material.uuid}}),o}function T(e){if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid project material library");const r=/* @__PURE__ */new Map;for(const u of null!=e?e:[]){var i,t,a,o,n;if(!I(u)||"string"!=typeof u.id||!u.id||r.has(u.id)||!Number.isInteger(u.revision)||u.revision<1||"string"!=typeof u.name||!I(u.material)||"string"!=typeof u.material.type||!u.material.type||"string"!=typeof u.material.uuid||!u.material.uuid||void 0!==u.locked&&"boolean"!=typeof u.locked||void 0!==u.alwaysExport&&"boolean"!=typeof u.alwaysExport||!I(u.scope)||!["project","scene"].includes(u.scope.kind)||"scene"===u.scope.kind&&("string"!=typeof u.scope.sceneId||!u.scope.sceneId))throw new Error(`Invalid or duplicate material asset ${null!==(n=null==u?void 0:u.id)&&void 0!==n?n:""}`);if(void 0!==(null===(i=u.material.userData)||void 0===i?void 0:i._materialAssetId)||void 0!==(null===(t=u.material.userData)||void 0===t?void 0:t._materialAssetRevision))throw new Error(`Material asset ${u.id} must not contain its own binding`);for(const r of["textures","images"]){var s;if(void 0!==u.material[r]&&!Array.isArray(u.material[r]))throw new Error(`Invalid ${r} in material asset ${u.id}`);const e=/* @__PURE__ */new Set;for(const i of null!==(s=u.material[r])&&void 0!==s?s:[]){if(!I(i)||"string"!=typeof i.uuid||!i.uuid||e.has(i.uuid))throw new Error(`Invalid ${r} identity in material asset ${u.id}`);e.add(i.uuid)}}m({scene:u.material});const e=new Map((null!==(a=u.material.textures)&&void 0!==a?a:[]).map(e=>[e.uuid,e])),l=new Set((null!==(o=u.material.images)&&void 0!==o?o:[]).map(e=>e.uuid));for(const r of O(u.material,new Set(e.keys()))){const i=e.get(r);if(!i)throw new Error(`Missing texture ${r} for material ${u.material.uuid} in scene ${u.id}`);for(const e of[i.image].flat()){var d;if("string"==typeof e&&!l.has(e)&&!(null===(d=i.userData)||void 0===d?void 0:d._videoSrc))throw new Error(`Missing image ${e} for texture ${r} in scene ${u.id}`)}}r.set(u.id,u)}return r}function U(e){J(e,T(e.materialLibrary))}function J(e,r){var i;if(void 0!==e.materialLibrary&&e.schemaVersion<4)throw new Error("Project material library requires schema 4");const t=new Set(e.scenes.map(e=>null==e?void 0:e.id));for(const f of r.values())if("scene"===f.scope.kind&&!t.has(f.scope.sceneId))throw new Error(`Material asset ${f.id} belongs to missing scene ${f.scope.sceneId}`);if(void 0!==e.prefabLibrary&&!Array.isArray(e.prefabLibrary))throw new Error("Invalid prefab library");for(const f of null!==(i=e.prefabLibrary)&&void 0!==i?i:[]){var a;if(!I(f)||!I(f.snapshot)||void 0!==f.snapshot.materials&&!Array.isArray(f.snapshot.materials))throw new Error("Invalid prefab material definitions");for(const e of null!==(a=f.snapshot.materials)&&void 0!==a?a:[]){var o,n;if(!I(e))throw new Error("Invalid prefab material definition");const i=null===(o=e.userData)||void 0===o?void 0:o[h];if(void 0===i)continue;const t=r.get(i);if(!t)throw new Error(`Missing material asset ${i} in prefab ${f.name}`);if("project"!==t.scope.kind)throw new Error(`Prefab ${f.name} requires project material ${i}`);const a=null===(n=e.userData)||void 0===n?void 0:n[E];if(void 0!==a&&(!Number.isInteger(a)||a<1||a>t.revision))throw new Error(`Invalid material asset revision in prefab ${f.name}`)}}for(const f of e.scenes){var s,d,u;if(!f)throw new Error("Invalid material scene");if(void 0!==f.materialAliases&&!I(f.materialAliases))throw new Error(`Invalid material catalog in scene ${f.id}`);for(const[e,i]of Object.entries(null!==(s=f.materialAliases)&&void 0!==s?s:{})){if(!e||!I(i)||!r.has(i.assetId)||void 0!==i.locked&&"boolean"!=typeof i.locked)throw new Error(`Invalid material catalog entry ${e} in scene ${f.id}`);K(r.get(i.assetId),f.id)}for(const e of null!==(d=null===(u=f.scene)||void 0===u?void 0:u.materials)&&void 0!==d?d:[]){var l,c;const i=null===(l=e.userData)||void 0===l?void 0:l[h];if(void 0===i)continue;const t=r.get(i);if(!t)throw new Error(`Missing material asset ${i} in scene ${f.id}`);K(t,f.id);const a=null===(c=e.userData)||void 0===c?void 0:c[E];if(void 0!==a&&(!Number.isInteger(a)||a<1||a>t.revision))throw new Error(`Invalid material asset revision in scene ${f.id}`)}}}function K(e,r){if("scene"===e.scope.kind&&e.scope.sceneId!==r)throw new Error(`Material asset ${e.id} belongs to scene ${e.scope.sceneId}, not ${r}`)}var H=/* @__PURE__ */e({assertRuntimeSceneDocument:()=>z,assertSceneManifest:()=>W});function V(e,r){if(void 0===e)return;if(!Array.isArray(e))throw new Error("Invalid prefab library");const i=/* @__PURE__ */new Set,t=/* @__PURE__ */new Set;for(const n of e){var a,o;if(!n||"string"!=typeof n.id||!n.id||i.has(n.id)||"string"!=typeof n.name||!Number.isInteger(n.revision)||n.revision<1||!(null===(a=n.snapshot)||void 0===a?void 0:a.object))throw new Error("Invalid prefab definition");if(i.add(n.id),!n.name.trim()||n.name!==n.name.trim()||t.has(n.name))throw new Error("Invalid or duplicate prefab name");if(t.add(n.name),void 0!==n.materialMode&&"embedded"!==n.materialMode)throw new Error("Invalid prefab material mode");if("embedded"===n.materialMode&&(null!==(o=n.snapshot.materials)&&void 0!==o?o:[]).some(e=>{var r;return void 0!==(null==e||null===(r=e.userData)||void 0===r?void 0:r._materialAssetId)}))throw new Error("Embedded prefab materials must not reference the project material library");G(n.snapshot.object),r&&q(n.snapshot,`prefab ${n.id}`)}}function G(e){var r;if(e){if(["@Group","@PrefabGroup"].some(r=>{var i,t;return(null===(i=e.userData)||void 0===i?void 0:i._baseObjectKeyType)===r||(null===(t=e.userData)||void 0===t?void 0:t._baseObjectKey)===r}))throw new Error("Legacy object or prefab groups must be imported in editor-platform before runtime loading or export");for(const i of null!==(r=e.children)&&void 0!==r?r:[])G(i)}}function W(e){if(!l(e))throw new Error("Invalid scene manifest format");if(5!==e.schemaVersion)throw new Error(`Unsupported scene manifest version: ${e.schemaVersion}`);if(!Array.isArray(e.scenes)||0===e.scenes.length)throw new Error("Invalid scene manifest: scenes must not be empty");a(e.runtimeAssets),t(e.assets),p(e),V(e.prefabLibrary,!0);const r=/* @__PURE__ */new Set;for(const i of e.scenes){var o;if("string"!=typeof(null==i?void 0:i.id)||!i.id||r.has(i.id)||"string"!=typeof i.name||!i.name||"string"!=typeof(null===(o=i.vis)||void 0===o?void 0:o.type)||!i.vis.type||"string"!=typeof i.source||!i.source)throw new Error("Invalid scene manifest entry");r.add(i.id)}if(!r.has(e.entrySceneId))throw new Error(`Invalid scene manifest: entry scene ${e.entrySceneId} was not found`);U({schemaVersion:6,materialLibrary:e.materialLibrary,prefabLibrary:e.prefabLibrary,scenes:e.scenes.map(e=>i(i({},e),{},{scene:{}}))})}function q(e,r){const i=e=>{var t;if(!e)return;const a=e.userData;if(void 0!==(null==a?void 0:a._baseObjectKey)||void 0!==(null==a?void 0:a._baseObjectUuid))throw new Error(`Legacy wrapper identity in ${r}; import it in editor-platform before exporting schema 5`);if(void 0!==(null==a?void 0:a._baseObjectObjectType)&&(1!==a._baseObjectIdentityVersion||"string"!=typeof e.uuid||!e.uuid))throw new Error(`Invalid canonical wrapper identity in ${r}`);for(const r of null!==(t=e.children)&&void 0!==t?t:[])i(r)};i(null==e?void 0:e.object)}function z(e){if(!u(e))throw new Error("Unsupported legacy JSON. Import it in editor-platform and export a vis-scene document first.");if(n(e),a(e.runtimeAssets),!Array.isArray(e.scenes)||0===e.scenes.length)throw new Error("Invalid vis-scene document: scenes must not be empty");p(e),U(e),V(e.prefabLibrary,!0);const r=/* @__PURE__ */new Set;for(const t of e.scenes){var i;if(void 0!==(null==t?void 0:t.eo))throw new Error("Legacy eo must be migrated in editor-platform before runtime loading");if(void 0!==(null==t?void 0:t.set))throw new Error("Legacy set must be migrated to vis.options.controls in editor-platform before runtime loading");if(!(null==t?void 0:t.id)||r.has(t.id))throw new Error("Invalid vis-scene document: duplicate or empty scene id");if(!(null===(i=t.vis)||void 0===i?void 0:i.type)||!t.scene)throw new Error(`Invalid scene ${t.id}: missing vis or scene graph`);const e=r=>{var i,t,a,o,n,s;if(r){if(!0===(null===(i=r.userData)||void 0===i?void 0:i.prefab)||!0===(null===(t=r.userData)||void 0===t||null===(t=t._baseObjectUserData)||void 0===t?void 0:t.prefab))throw new Error("Legacy prefab sources must be imported in editor-platform before runtime loading or export");if(["@Group","@PrefabGroup"].some(e=>{var i,t;return(null===(i=r.userData)||void 0===i?void 0:i._baseObjectKeyType)===e||(null===(t=r.userData)||void 0===t?void 0:t._baseObjectKey)===e}))throw new Error("Legacy object or prefab groups must be imported in editor-platform before runtime loading or export");var d;if((null===(a=r.userData)||void 0===a?void 0:a._templatePreviewContainer)||(null===(o=r.userData)||void 0===o||null===(o=o._baseObjectUserData)||void 0===o?void 0:o._templatePreviewContainer)||"@TemplatePreview"===(null===(n=r.userData)||void 0===n?void 0:n._baseObjectKeyType))for(const e of null!==(d=r.children)&&void 0!==d?d:[]){var u,l,c,f;if(!(null===(u=e.userData)||void 0===u?void 0:u._prefabPreview)&&!(null===(l=e.userData)||void 0===l||null===(l=l._baseObjectUserData)||void 0===l?void 0:l._prefabPreview)&&!(null===(c=e.userData)||void 0===c?void 0:c._templatePreviewContainer)&&"@TemplatePreview"!==(null===(f=e.userData)||void 0===f?void 0:f._baseObjectKeyType))throw new Error("Template preview containers cannot contain ordinary scene instances")}for(const i of null!==(s=r.children)&&void 0!==s?s:[])e(i)}};e(t.scene.object),q(t.scene,`scene ${t.id}`),r.add(t.id)}if(!r.has(e.entrySceneId))throw new Error(`Invalid vis-scene document: entry scene ${e.entrySceneId} was not found`)}export{g as C,b as D,m as E,y as O,A as S,p as T,x as _,U as a,O as b,h as c,D as d,N as f,R as g,P as h,K as i,c as k,E as l,C as m,W as n,J as o,k as p,H as r,T as s,z as t,$ as u,M as v,w,L as x,j as y};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vis-core",
3
- "version": "0.33.20",
3
+ "version": "0.33.21",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "prettier": "fe-stack/prettier.json",
@@ -50,7 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@types/node": "^25.0.6",
52
52
  "fe-stack": "0.2.0",
53
- "gl-draw": "0.19.18",
53
+ "gl-draw": "0.19.19",
54
54
  "terser": "^5.46.1",
55
55
  "three": "0.186.1",
56
56
  "vite": "^8.1.0",
@@ -1 +0,0 @@
1
- import{Nt as e,w as r}from"./dist-CBwlzuju.js";import{a as i}from"./resource-url-MTT03G1N.js";import{a as t,g as o,p as a}from"./e-DsI3lCu-.js";import{a as n,i as s,n as d,o as u,s as l}from"./schema-DCtwlcYa.js";var c=["scenes","materialLibrary","prefabLibrary"],f=()=>{throw Error("Legacy resource pools must be imported in editor-platform before runtime loading")};function v(e){var r,i;const t=e.scene;void 0!==(null==t?void 0:t._texDataPool)&&f();const o=e=>{Array.isArray(e)?e.forEach(o):e&&"object"==typeof e&&("_documentResource"in e||"base64"===e.encoding)&&f()};for(const d of null!==(r=null==t?void 0:t.images)&&void 0!==r?r:[])o(d.url);for(const d of null!==(i=null==t?void 0:t.textures)&&void 0!==i?i:[]){var a,n,s;void 0===(null===(a=d.userData)||void 0===a?void 0:a._dataTexBase64)&&"number"!=typeof(null===(n=d.userData)||void 0===n?void 0:n._videoSrc)||f(),o(null===(s=d.userData)||void 0===s?void 0:s._videoSrc)}}function m(e){void 0===e._resourcePool&&void 0===e.imageAssets||f();for(const r of Array.isArray(e.scenes)?e.scenes:[])v(r);for(const r of Array.isArray(e.materialLibrary)?e.materialLibrary:[])v({scene:r.material});for(const r of Array.isArray(e.prefabLibrary)?e.prefabLibrary:[])v({scene:r.snapshot})}function p(e){return n(e),m(e),e}function y(e){p(e);const{scenes:r,materialLibrary:i,prefabLibrary:t}=e,o=a(e,c),n=structuredClone(o);return n.scenes=r.map(e=>structuredClone(e)),i&&(n.materialLibrary=i.map(e=>structuredClone(e))),t&&(n.prefabLibrary=t.map(e=>structuredClone(e))),n}function w(e,r,i){const t=JSON.stringify([e,r,i]),o=[2166136261,2654435769,2246822507,3266489909].map(e=>{let r=e;for(let i=0;i<t.length;i++)r=Math.imul(r^t.charCodeAt(i),16777619);return r^=r>>>16,r=Math.imul(r,2246822507),(r^r>>>13)>>>0}).map(e=>e.toString(16).padStart(8,"0")).join("");return`${o.slice(0,8)}-${o.slice(8,12)}-8${o.slice(13,16)}-${(3&parseInt(o[16],16)|8).toString(16)}${o.slice(17,20)}-${o.slice(20)}`}var b="_resourceSource",g="_materialAssetId",h="_materialAssetRevision",E="_materialRuntimeProperties",$=e=>structuredClone(e),D=e=>!!e&&"object"==typeof e&&!Array.isArray(e),I=e=>"map"===e||"matcap"===e||e.endsWith("Map");function j(e,r){var i;if(D(e)){r(e);for(const t of null!==(i=e.children)&&void 0!==i?i:[])j(t,r)}}function A(e,r){if("string"==typeof e)return r(e);if(Array.isArray(e))return e.map(e=>A(e,r));if(D(e))for(const i of Object.keys(e))e[i]=A(e[i],r);return e}function _(e,i){var t;const o=/* @__PURE__ */new Set;r(e,(e,r)=>{"PMREM_PLACEHOLDER"!==e[r]&&o.add(e[r])});for(const[r,d]of Object.entries(e))I(r)&&"string"==typeof d&&"PMREM_PLACEHOLDER"!==d&&o.add(d);const a=/* @__PURE__ */new Set,n=e=>{if("string"!=typeof e){if(e&&"object"==typeof e&&!a.has(e)){a.add(e);for(const r of Object.values(e))n(r)}}else i.has(e)&&o.add(e)};n(e.uniforms);for(const r of Object.values(null!==(t=e.uniforms)&&void 0!==t?t:{})){var s;if("t"===(null==r?void 0:r.type)&&"string"==typeof r.value&&"PMREM_PLACEHOLDER"!==r.value&&o.add(r.value),"tv"===(null==r?void 0:r.type))for(const e of null!==(s=r.value)&&void 0!==s?s:[])"string"==typeof e&&"PMREM_PLACEHOLDER"!==e&&o.add(e)}return o}function S(e,i){r(e,(e,r)=>{var t;e[r]=null!==(t=i.get(e[r]))&&void 0!==t?t:e[r]});for(const r of Object.keys(e)){var t;I(r)&&"string"==typeof e[r]&&(e[r]=null!==(t=i.get(e[r]))&&void 0!==t?t:e[r])}e.uniforms&&(e.uniforms=A(e.uniforms,e=>{var r;return null!==(r=i.get(e))&&void 0!==r?r:e}))}function O(e,r){let i=e,t=1;for(;r.has(i);)i=`${e}~${t++}`;return r.add(i),i}function L(e){const r=$(e);return r.userData&&(delete r.userData[g],delete r.userData[h],delete r.userData._materialAssetOverrideHash,delete r.userData._materialDynamic,delete r.userData[E],Object.keys(r.userData).length||delete r.userData),r}function x(e,r,t={}){var o,a,n,s,d,u;const l=new Set(null!==(o=t.editedProperties)&&void 0!==o?o:[]),c=null===(a=r.userData)||void 0===a?void 0:a[E],f=Array.isArray(c)?c.filter(e=>"string"==typeof e&&I(e)&&!l.has(e)):[],v=L(r);if(!f.length)return v;const m=L(e),p=null!==(n=v.textures)&&void 0!==n?n:[],y=null!==(s=v.images)&&void 0!==s?s:[],w=new Set(p.map(e=>e.uuid)),b=new Set(y.map(e=>e.uuid)),g=/* @__PURE__ */new Map,h=/* @__PURE__ */new Map;for(const E of null!==(d=m.images)&&void 0!==d?d:[]){const e=y.find(e=>e.uuid===E.uuid),r=e&&JSON.stringify(e)!==JSON.stringify(E)?O(`${E.uuid}:authored`,b):E.uuid;g.set(E.uuid,r),b.add(r),y.some(e=>e.uuid===r)||y.push(i(i({},E),{},{uuid:r}))}for(const E of null!==(u=m.textures)&&void 0!==u?u:[]){void 0!==E.image&&(E.image=A(E.image,e=>{var r;return null!==(r=g.get(e))&&void 0!==r?r:e}));const e=p.find(e=>e.uuid===E.uuid),r=e&&JSON.stringify(e)!==JSON.stringify(E)?O(`${E.uuid}:authored`,w):E.uuid;h.set(E.uuid,r),w.add(r),p.some(e=>e.uuid===r)||p.push(i(i({},E),{},{uuid:r}))}S(m,h);for(const i of f){var D,j;const e=v[i];if(!Object.hasOwn(m,i)){delete v[i];continue}v[i]=m[i];const r=p.find(e=>e.uuid===m[i]),t=p.find(r=>r.uuid===e);if(!r||!t)continue;const o=$(t);o.uuid=r.uuid,void 0===r.image?delete o.image:o.image=$(r.image);const a=null!==(D=o.userData)&&void 0!==D?D:o.userData={};for(const i of Object.keys(a))("_videoSrc"===i||i.startsWith("_dataTex"))&&delete a[i];for(const[i,n]of Object.entries(null!==(j=r.userData)&&void 0!==j?j:{}))("_videoSrc"===i||i.startsWith("_dataTex"))&&(a[i]=$(n));Object.keys(a).length||delete o.userData,JSON.stringify(o)!==JSON.stringify(r)&&(o.uuid=O(`${r.uuid}:sampler`,w),p.push(o),v[i]=o.uuid)}return P({id:"authored-material",name:"",vis:{type:"base",options:{}},scene:{materials:[v],textures:p,images:y}},v.uuid)}function M(e){const r=e.scene,i=i=>{var t;const o=/* @__PURE__ */new Map;for(const a of null!==(t=r[i])&&void 0!==t?t:[]){if("string"!=typeof(null==a?void 0:a.uuid)||!a.uuid||o.has(a.uuid))throw new Error(`Invalid ${i} identity in scene ${e.id}`);o.set(a.uuid,a)}return o},t=i("materials"),o=i("textures");return{scene:e,materials:t,textures:o,images:i("images"),textureIds:new Set(o.keys())}}function k(e,r){const{scene:i,materials:t,textures:o,images:a,textureIds:n}=e;i.scene;const s=t.get(r);if(!s)throw new Error(`Missing material ${r} in scene ${i.id}`);const d=L(s);delete d.textures,delete d.images;const u=_(d,n),l=[],c=/* @__PURE__ */new Set;for(const v of u){const e=o.get(v);if(!e)throw new Error(`Missing texture ${v} for material ${r} in scene ${i.id}`);const t=$(e);l.push(t);for(const r of[t.image].flat()){var f;if("string"==typeof r)if(a.has(r))c.add(r);else if(!(null===(f=t.userData)||void 0===f?void 0:f._videoSrc))throw new Error(`Missing image ${r} for texture ${v} in scene ${i.id}`)}}return l.length&&(d.textures=l),c.size&&(d.images=[...c].map(e=>$(a.get(e)))),d}function P(e,r){return K(e)(r)}function K(e){const r=M(e);return e=>k(r,e)}function C(e,r=w(e.id,"material",e.material.uuid)){var t,o;const a=L(e.material),n=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map;for(const i of null!==(t=a.images)&&void 0!==t?t:[]){const r=i.uuid;i.uuid=w(e.id,"image",r),n.set(r,i.uuid)}for(const d of null!==(o=a.textures)&&void 0!==o?o:[]){const r=d.uuid;d.uuid=w(e.id,"texture",r),s.set(r,d.uuid),d.userData=i(i({},d.userData),{},{[b]:{assetId:e.id,textureUuid:r,imageUuids:[d.image].flat().filter(e=>"string"==typeof e)}}),void 0!==d.image&&(d.image=A(d.image,e=>{var r;return null!==(r=n.get(e))&&void 0!==r?r:e}))}return S(a,s),a.uuid=r,a.name=e.name,a.userData=i(i({},a.userData),{},{[g]:e.id,[h]:e.revision,[b]:{assetId:e.id,materialUuid:e.material.uuid}}),a}function N(e){if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid project material library");const r=/* @__PURE__ */new Map;for(const u of null!=e?e:[]){var i,t,o,a,n;if(!D(u)||"string"!=typeof u.id||!u.id||r.has(u.id)||!Number.isInteger(u.revision)||u.revision<1||"string"!=typeof u.name||!D(u.material)||"string"!=typeof u.material.type||!u.material.type||"string"!=typeof u.material.uuid||!u.material.uuid||void 0!==u.locked&&"boolean"!=typeof u.locked||void 0!==u.alwaysExport&&"boolean"!=typeof u.alwaysExport||!D(u.scope)||!["project","scene"].includes(u.scope.kind)||"scene"===u.scope.kind&&("string"!=typeof u.scope.sceneId||!u.scope.sceneId))throw new Error(`Invalid or duplicate material asset ${null!==(n=null==u?void 0:u.id)&&void 0!==n?n:""}`);if(void 0!==(null===(i=u.material.userData)||void 0===i?void 0:i._materialAssetId)||void 0!==(null===(t=u.material.userData)||void 0===t?void 0:t._materialAssetRevision))throw new Error(`Material asset ${u.id} must not contain its own binding`);for(const r of["textures","images"]){var s;if(void 0!==u.material[r]&&!Array.isArray(u.material[r]))throw new Error(`Invalid ${r} in material asset ${u.id}`);const e=/* @__PURE__ */new Set;for(const i of null!==(s=u.material[r])&&void 0!==s?s:[]){if(!D(i)||"string"!=typeof i.uuid||!i.uuid||e.has(i.uuid))throw new Error(`Invalid ${r} identity in material asset ${u.id}`);e.add(i.uuid)}}v({scene:u.material});const e=new Map((null!==(o=u.material.textures)&&void 0!==o?o:[]).map(e=>[e.uuid,e])),l=new Set((null!==(a=u.material.images)&&void 0!==a?a:[]).map(e=>e.uuid));for(const r of _(u.material,new Set(e.keys()))){const i=e.get(r);if(!i)throw new Error(`Missing texture ${r} for material ${u.material.uuid} in scene ${u.id}`);for(const e of[i.image].flat()){var d;if("string"==typeof e&&!l.has(e)&&!(null===(d=i.userData)||void 0===d?void 0:d._videoSrc))throw new Error(`Missing image ${e} for texture ${r} in scene ${u.id}`)}}r.set(u.id,u)}return r}function R(e){T(e,N(e.materialLibrary))}function T(e,r){var i;if(void 0!==e.materialLibrary&&e.schemaVersion<4)throw new Error("Project material library requires schema 4");const t=new Set(e.scenes.map(e=>null==e?void 0:e.id));for(const f of r.values())if("scene"===f.scope.kind&&!t.has(f.scope.sceneId))throw new Error(`Material asset ${f.id} belongs to missing scene ${f.scope.sceneId}`);if(void 0!==e.prefabLibrary&&!Array.isArray(e.prefabLibrary))throw new Error("Invalid prefab library");for(const f of null!==(i=e.prefabLibrary)&&void 0!==i?i:[]){var o;if(!D(f)||!D(f.snapshot)||void 0!==f.snapshot.materials&&!Array.isArray(f.snapshot.materials))throw new Error("Invalid prefab material definitions");for(const e of null!==(o=f.snapshot.materials)&&void 0!==o?o:[]){var a,n;if(!D(e))throw new Error("Invalid prefab material definition");const i=null===(a=e.userData)||void 0===a?void 0:a[g];if(void 0===i)continue;const t=r.get(i);if(!t)throw new Error(`Missing material asset ${i} in prefab ${f.name}`);if("project"!==t.scope.kind)throw new Error(`Prefab ${f.name} requires project material ${i}`);const o=null===(n=e.userData)||void 0===n?void 0:n[h];if(void 0!==o&&(!Number.isInteger(o)||o<1||o>t.revision))throw new Error(`Invalid material asset revision in prefab ${f.name}`)}}for(const f of e.scenes){var s,d,u;if(!f)throw new Error("Invalid material scene");if(void 0!==f.materialAliases&&!D(f.materialAliases))throw new Error(`Invalid material catalog in scene ${f.id}`);for(const[e,i]of Object.entries(null!==(s=f.materialAliases)&&void 0!==s?s:{})){if(!e||!D(i)||!r.has(i.assetId)||void 0!==i.locked&&"boolean"!=typeof i.locked)throw new Error(`Invalid material catalog entry ${e} in scene ${f.id}`);U(r.get(i.assetId),f.id)}for(const e of null!==(d=null===(u=f.scene)||void 0===u?void 0:u.materials)&&void 0!==d?d:[]){var l,c;const i=null===(l=e.userData)||void 0===l?void 0:l[g];if(void 0===i)continue;const t=r.get(i);if(!t)throw new Error(`Missing material asset ${i} in scene ${f.id}`);U(t,f.id);const o=null===(c=e.userData)||void 0===c?void 0:c[h];if(void 0!==o&&(!Number.isInteger(o)||o<1||o>t.revision))throw new Error(`Invalid material asset revision in scene ${f.id}`)}}}function U(e,r){if("scene"===e.scope.kind&&e.scope.sceneId!==r)throw new Error(`Material asset ${e.id} belongs to scene ${e.scope.sceneId}, not ${r}`)}var J=/* @__PURE__ */e({assertRuntimeSceneDocument:()=>q,assertSceneManifest:()=>G});function H(e,r){if(void 0===e)return;if(!Array.isArray(e))throw new Error("Invalid prefab library");const i=/* @__PURE__ */new Set,t=/* @__PURE__ */new Set;for(const n of e){var o,a;if(!n||"string"!=typeof n.id||!n.id||i.has(n.id)||"string"!=typeof n.name||!Number.isInteger(n.revision)||n.revision<1||!(null===(o=n.snapshot)||void 0===o?void 0:o.object))throw new Error("Invalid prefab definition");if(i.add(n.id),void 0!==n.sdkKey){if("string"!=typeof n.sdkKey||!n.sdkKey.trim()||n.sdkKey!==n.sdkKey.trim()||t.has(n.sdkKey))throw new Error("Invalid or duplicate prefab SDK key");t.add(n.sdkKey)}if(void 0!==n.materialMode&&"embedded"!==n.materialMode)throw new Error("Invalid prefab material mode");if("embedded"===n.materialMode&&(null!==(a=n.snapshot.materials)&&void 0!==a?a:[]).some(e=>{var r;return void 0!==(null==e||null===(r=e.userData)||void 0===r?void 0:r._materialAssetId)}))throw new Error("Embedded prefab materials must not reference the project material library");V(n.snapshot.object),r&&W(n.snapshot,`prefab ${n.id}`)}for(const n of e)if(void 0!==n.sdkKey&&n.sdkKey!==n.id&&i.has(n.sdkKey))throw new Error("Prefab SDK key conflicts with another asset id")}function V(e){var r;if(e){if(["@Group","@PrefabGroup"].some(r=>{var i,t;return(null===(i=e.userData)||void 0===i?void 0:i._baseObjectKeyType)===r||(null===(t=e.userData)||void 0===t?void 0:t._baseObjectKey)===r}))throw new Error("Legacy object or prefab groups must be imported in editor-platform before runtime loading or export");for(const i of null!==(r=e.children)&&void 0!==r?r:[])V(i)}}function G(e){if(!l(e))throw new Error("Invalid scene manifest format");if(5!==e.schemaVersion)throw new Error(`Unsupported scene manifest version: ${e.schemaVersion}`);if(!Array.isArray(e.scenes)||0===e.scenes.length)throw new Error("Invalid scene manifest: scenes must not be empty");o(e.runtimeAssets),t(e.assets),m(e),H(e.prefabLibrary,!0);const r=/* @__PURE__ */new Set;for(const i of e.scenes){var a;if("string"!=typeof(null==i?void 0:i.id)||!i.id||r.has(i.id)||"string"!=typeof i.name||!i.name||"string"!=typeof(null===(a=i.vis)||void 0===a?void 0:a.type)||!i.vis.type||"string"!=typeof i.source||!i.source)throw new Error("Invalid scene manifest entry");r.add(i.id)}if(!r.has(e.entrySceneId))throw new Error(`Invalid scene manifest: entry scene ${e.entrySceneId} was not found`);R({schemaVersion:6,materialLibrary:e.materialLibrary,prefabLibrary:e.prefabLibrary,scenes:e.scenes.map(e=>i(i({},e),{},{scene:{}}))})}function W(e,r){const i=e=>{var t;if(!e)return;const o=e.userData;if(void 0!==(null==o?void 0:o._baseObjectKey)||void 0!==(null==o?void 0:o._baseObjectUuid))throw new Error(`Legacy wrapper identity in ${r}; import it in editor-platform before exporting schema 5`);if(void 0!==(null==o?void 0:o._baseObjectObjectType)&&(1!==o._baseObjectIdentityVersion||"string"!=typeof e.uuid||!e.uuid))throw new Error(`Invalid canonical wrapper identity in ${r}`);for(const r of null!==(t=e.children)&&void 0!==t?t:[])i(r)};i(null==e?void 0:e.object)}function q(e){if(!u(e))throw new Error("Unsupported legacy JSON. Import it in editor-platform and export a vis-scene document first.");if(n(e),o(e.runtimeAssets),!Array.isArray(e.scenes)||0===e.scenes.length)throw new Error("Invalid vis-scene document: scenes must not be empty");m(e),R(e),H(e.prefabLibrary,!0);const r=/* @__PURE__ */new Set;for(const t of e.scenes){var i;if(void 0!==(null==t?void 0:t.eo))throw new Error("Legacy eo must be migrated in editor-platform before runtime loading");if(void 0!==(null==t?void 0:t.set))throw new Error("Legacy set must be migrated to vis.options.controls in editor-platform before runtime loading");if(!(null==t?void 0:t.id)||r.has(t.id))throw new Error("Invalid vis-scene document: duplicate or empty scene id");if(!(null===(i=t.vis)||void 0===i?void 0:i.type)||!t.scene)throw new Error(`Invalid scene ${t.id}: missing vis or scene graph`);const e=r=>{var i,t,o,a,n,s;if(r){if(!0===(null===(i=r.userData)||void 0===i?void 0:i.prefab)||!0===(null===(t=r.userData)||void 0===t||null===(t=t._baseObjectUserData)||void 0===t?void 0:t.prefab))throw new Error("Legacy prefab sources must be imported in editor-platform before runtime loading or export");if(["@Group","@PrefabGroup"].some(e=>{var i,t;return(null===(i=r.userData)||void 0===i?void 0:i._baseObjectKeyType)===e||(null===(t=r.userData)||void 0===t?void 0:t._baseObjectKey)===e}))throw new Error("Legacy object or prefab groups must be imported in editor-platform before runtime loading or export");var d;if((null===(o=r.userData)||void 0===o?void 0:o._templatePreviewContainer)||(null===(a=r.userData)||void 0===a||null===(a=a._baseObjectUserData)||void 0===a?void 0:a._templatePreviewContainer)||"@TemplatePreview"===(null===(n=r.userData)||void 0===n?void 0:n._baseObjectKeyType))for(const e of null!==(d=r.children)&&void 0!==d?d:[]){var u,l,c,f;if(!(null===(u=e.userData)||void 0===u?void 0:u._prefabPreview)&&!(null===(l=e.userData)||void 0===l||null===(l=l._baseObjectUserData)||void 0===l?void 0:l._prefabPreview)&&!(null===(c=e.userData)||void 0===c?void 0:c._templatePreviewContainer)&&"@TemplatePreview"!==(null===(f=e.userData)||void 0===f?void 0:f._baseObjectKeyType))throw new Error("Template preview containers cannot contain ordinary scene instances")}for(const i of null!==(s=r.children)&&void 0!==s?s:[])e(i)}};e(t.scene.object),W(t.scene,`scene ${t.id}`),r.add(t.id)}if(!r.has(e.entrySceneId))throw new Error(`Invalid vis-scene document: entry scene ${e.entrySceneId} was not found`)}export{b as C,y as D,v as E,p as O,j as S,m as T,x as _,R as a,_ as b,g as c,$ as d,K as f,C as g,M as h,U as i,h as l,P as m,G as n,T as o,k as p,J as r,N as s,q as t,E as u,L as v,w,O as x,I as y};