vis-core 0.33.19 → 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/README.md +6 -2
- package/dist/{dist-6e_r_Ils.js → dist-CBwlzuju.js} +1 -1
- package/dist/e--VPnb9WD.js +1 -0
- package/dist/index.d.ts +18 -12
- package/dist/index.js +1 -1
- package/dist/io.d.ts +14 -6
- package/dist/io.js +1 -1
- package/dist/resource-url-MTT03G1N.js +1 -0
- package/dist/runtimeImages-bGdtc9BO.js +1 -0
- package/dist/{schema-Brre1WzE.js → schema-DCtwlcYa.js} +1 -1
- package/dist/validation-ByK1cs9B.js +1 -0
- package/package.json +2 -2
- package/dist/e-BTBbEYEO.js +0 -1
- package/dist/runtimeImages-DCG8lEY9.js +0 -1
- package/dist/sha2-BCqd-su1.js +0 -1
- package/dist/validation-DDQJc7mH.js +0 -1
package/dist/io.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare type JsonFetchOptions = {
|
|
|
42
42
|
|
|
43
43
|
export declare interface MapExportScope {
|
|
44
44
|
rootAdcode: number;
|
|
45
|
-
maxLevel:
|
|
45
|
+
maxLevel: MapTemplateLevel;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export declare type MapNavigation = {
|
|
@@ -74,6 +74,10 @@ declare interface MapRegionSwitchInteraction {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
export declare type MapTemplateLevel = typeof mapTemplateLevels[number];
|
|
78
|
+
|
|
79
|
+
export declare const mapTemplateLevels: readonly ["world", "country", "province", "city", "district"];
|
|
80
|
+
|
|
77
81
|
/** Retained catalog entries are keyed by the native scene material UUID. */
|
|
78
82
|
declare interface MaterialAlias {
|
|
79
83
|
assetId: string;
|
|
@@ -143,10 +147,9 @@ export declare function mergeRuntimeAssets(previous?: RuntimeAssetCatalog, incom
|
|
|
143
147
|
|
|
144
148
|
declare interface PrefabAsset {
|
|
145
149
|
id: string;
|
|
150
|
+
/** Nonempty, trimmed, project-unique name used for SDK instantiation. */
|
|
146
151
|
name: string;
|
|
147
152
|
revision: number;
|
|
148
|
-
/** Stable public SDK identifier. Omit for assets used only by the editor. */
|
|
149
|
-
sdkKey?: string;
|
|
150
153
|
/** Legacy business templates own complete material snapshots, without promoting scene assets. */
|
|
151
154
|
materialMode?: 'embedded';
|
|
152
155
|
snapshot: Record<string, any>;
|
|
@@ -155,6 +158,10 @@ declare interface PrefabAsset {
|
|
|
155
158
|
/** Read a self-contained ZIP into a document with persistent image payloads. */
|
|
156
159
|
export declare function readSceneBundleZip(input: SceneBundleBinary, name?: string): Promise<VisSceneDocument>;
|
|
157
160
|
|
|
161
|
+
/** Dynamic click navigation follows the actual region level, including skipped city levels.
|
|
162
|
+
* Explicit region actions and projects without dynamic templates retain their authored target. */
|
|
163
|
+
export declare function resolveMapInteractionTemplate(navigation: MapNavigation | undefined, level: string | undefined, fallback: string, clicked: boolean): string;
|
|
164
|
+
|
|
158
165
|
/** Resolve declared URLs only. Repeated calls leave already hydrated data alone. */
|
|
159
166
|
export declare function resolveMediaAssets(value: any, assets: MediaAssetManifest | undefined, read: (path: string, info: MediaAssetInfo) => ArrayBuffer | string): void;
|
|
160
167
|
|
|
@@ -179,13 +186,13 @@ export declare interface RuntimeAssetCatalog {
|
|
|
179
186
|
scope?: MapExportScope;
|
|
180
187
|
/** Explicit delivery contract; omitted only in older packages. */
|
|
181
188
|
mapNavigation?: MapNavigation;
|
|
182
|
-
/** Enumerated
|
|
189
|
+
/** Enumerated navigation targets, including regions never opened in the editor. */
|
|
183
190
|
regions?: Record<string, number[]>;
|
|
184
191
|
declaredSources?: string[];
|
|
185
192
|
/** Explicitly deployed shared files; these sources are not stored inside the ZIP. */
|
|
186
193
|
externalSources?: string[];
|
|
187
194
|
mapDataMode?: 'bundled' | 'external';
|
|
188
|
-
/** Signed authorization restricted to the exported map
|
|
195
|
+
/** Signed authorization restricted to the exported map navigation targets. */
|
|
189
196
|
mapSwitchKey?: string;
|
|
190
197
|
projectId?: string;
|
|
191
198
|
/** Runtime-only base for an unpacked deployment. ZIP imports contain data instead. */
|
|
@@ -244,6 +251,7 @@ declare interface SceneSwitchInteraction {
|
|
|
244
251
|
declare interface SceneViewportDocument {
|
|
245
252
|
id: string;
|
|
246
253
|
name: string;
|
|
254
|
+
/** @deprecated Ignored by the runtime and removed on platform import/export. */
|
|
247
255
|
interactions?: SceneInteraction[];
|
|
248
256
|
cs?: Record<string, number[]>;
|
|
249
257
|
csa?: string;
|
|
@@ -269,7 +277,7 @@ declare interface VisSceneDocument extends SceneDocumentMarker {
|
|
|
269
277
|
scenes: SceneViewportDocument[];
|
|
270
278
|
/** Schema 4: serializable definitions shared by explicit asset identity. */
|
|
271
279
|
materialLibrary?: MaterialAsset[];
|
|
272
|
-
/** Reusable definitions
|
|
280
|
+
/** Reusable definitions retained in deployment exports and instantiated by name. */
|
|
273
281
|
prefabLibrary?: PrefabAsset[];
|
|
274
282
|
c?: Record<string, any>;
|
|
275
283
|
d?: Record<string, any>;
|
package/dist/io.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,r||"default");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}function r(t,r,n){return(r=e(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach(function(e){r(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function o(t,e,r,n,i,o,s){try{var h=t[o](s),u=h.value}catch(t){return void r(t)}h.done?e(u):Promise.resolve(u).then(n,i)}function s(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function h(t){o(s,n,i,h,u,"next",t)}function u(t){o(s,n,i,h,u,"throw",t)}h(void 0)})}}function h(t,e,r=""){const n=(i=t)instanceof Uint8Array||ArrayBuffer.isView(i)&&"Uint8Array"===i.constructor.name&&"BYTES_PER_ELEMENT"in i&&1===i.BYTES_PER_ELEMENT;var i;const o=null==t?void 0:t.length,s=void 0!==e;if(!n||s&&o!==e){const i=(r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${e}`:"")+", got "+(n?`length=${o}`:"type="+typeof t);if(!n)throw new TypeError(i);throw new RangeError(i)}return t}function u(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function c(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function f(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function a(t,e){return t<<32-e|t>>>e}var l=/* @__PURE__ */(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),p=/* @__PURE__ */Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function d(t){if(h(t),l)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=p[t[r]];return e}var b;b=s(function*(){});function y(t,e={}){const r=(e,r)=>t(r).update(e).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=e=>t(e),Object.assign(r,e),Object.freeze(r)}var g=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function v(t,e,r){return t&e^~t&r}function w(t,e,r){return t&e^t&r^e&r}var m=class{constructor(t,e,n,i){r(this,"blockLen",void 0),r(this,"outputLen",void 0),r(this,"canXOF",!1),r(this,"padOffset",void 0),r(this,"isLE",void 0),r(this,"buffer",void 0),r(this,"view",void 0),r(this,"finished",!1),r(this,"length",0),r(this,"pos",0),r(this,"destroyed",!1),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=f(this.buffer)}update(t){u(this),h(t);const{view:e,buffer:r,blockLen:n}=this,i=t.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const e=f(t);for(;n<=i-o;o+=n)this.process(e,o);continue}r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){u(this),function(t,e){h(t,void 0,"digestInto() output");const r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,c(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let h=o;h<n;h++)e[h]=0;r.setBigUint64(n-8,BigInt(8*this.length),i),this.process(r,0);const s=f(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const l=a/4,p=this.get();if(l>p.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<l;h++)s.setUint32(4*h,p[h],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.destroyed=o,t.finished=i,t.length=n,t.pos=s,n%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}},E=/* @__PURE__ */Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),O=/* @__PURE__ */Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),L=/* @__PURE__ */new Uint32Array(64),A=class extends m{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:h}=this;return[t,e,r,n,i,o,s,h]}set(t,e,r,n,i,o,s,h){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|h}process(t,e){for(let f=0;f<16;f++,e+=4)L[f]=t.getUint32(e,!1);for(let f=16;f<64;f++){const t=L[f-15],e=L[f-2],r=a(t,7)^a(t,18)^t>>>3;L[f]=(a(e,17)^a(e,19)^e>>>10)+L[f-7]+r+L[f-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:h,G:u,H:c}=this;for(let f=0;f<64;f++){const t=c+(a(s,6)^a(s,11)^a(s,25))+v(s,h,u)+O[f]+L[f]|0,e=(a(r,2)^a(r,13)^a(r,22))+w(r,n,i)|0;c=u,u=h,h=s,s=o+t|0,o=i,i=n,n=r,r=t+e|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,h=h+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,h,u,c)}roundClean(){c(L)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),c(this.buffer)}},j=class extends A{constructor(){super(32),r(this,"A",0|E[0]),r(this,"B",0|E[1]),r(this,"C",0|E[2]),r(this,"D",0|E[3]),r(this,"E",0|E[4]),r(this,"F",0|E[5]),r(this,"G",0|E[6]),r(this,"H",0|E[7])}},P=/* @__PURE__ */y(()=>new j,/* @__PURE__ */g(1));function S(t,e=""){if(!t||/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(t)||!e)return t;const r=e.replace(/\/+$/,"");return r&&(t===r||t.startsWith(`${r}/`))?t:`${r}/${t.replace(/^\/+/,"").replace(/^(?:\.\/)+/,"")}`}export{i as a,s as i,P as n,r as o,d as r,S as t};
|
|
@@ -0,0 +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--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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Nt as e}from"./dist-
|
|
1
|
+
import{Nt as e}from"./dist-CBwlzuju.js";var s=/* @__PURE__ */e({SCENE_DOCUMENT_FORMAT:()=>n,SCENE_DOCUMENT_SCHEMA_VERSION:()=>6,SCENE_MANIFEST_FORMAT:()=>o,SCENE_MANIFEST_SCHEMA_VERSION:()=>5,assertSupportedSceneDocument:()=>c,isSceneDocument:()=>i,isSceneManifest:()=>a}),n="vis-scene",r=6,o="vis-scene-manifest",t=5;function i(e){if(!e||"object"!=typeof e)return!1;const s=e;return"vis-scene"===s.format&&Number.isInteger(s.schemaVersion)&&s.schemaVersion>=1}function a(e){return!(!e||"object"!=typeof e)&&e.format===o}function c(e){if(i(e)&&6!==e.schemaVersion)throw new Error(`Unsupported scene schema version: ${e.schemaVersion}. Import older documents in editor-platform. Required version: 6`)}export{c as a,s as c,t as i,r as n,i as o,o as r,a as s,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.
|
|
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.
|
|
53
|
+
"gl-draw": "0.19.19",
|
|
54
54
|
"terser": "^5.46.1",
|
|
55
55
|
"three": "0.186.1",
|
|
56
56
|
"vite": "^8.1.0",
|
package/dist/e-BTBbEYEO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,n as r,o as s,r as i,t as n}from"./sha2-BCqd-su1.js";function o(e,t){if(null==e)return{};var r,s,i=function(e,t){if(null==e)return{};var r={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;r[s]=e[s]}return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)r=n[s],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var a,l,c,d=new class{constructor(e=32,t=67108864){s(this,"pending",/* @__PURE__ */new Map),s(this,"values",/* @__PURE__ */new Map),s(this,"bytes",0),s(this,"maxEntries",void 0),s(this,"maxBytes",void 0),this.maxEntries=e,this.maxBytes=t}load(e,t){const r=this.values.get(e);if(r)return this.values.delete(e),this.values.set(e,r),Promise.resolve(r);const s=this.pending.get(e);if(s)return s;const i=Promise.resolve().then(t).then(t=>{if(this.pending.get(e)===i&&(this.pending.delete(e),this.maxEntries>0&&t.bytes<=this.maxBytes))for(this.values.set(e,t),this.bytes+=t.bytes;this.values.size>this.maxEntries||this.bytes>this.maxBytes;)this.deleteValue(this.values.keys().next().value);return t},t=>{throw this.pending.get(e)===i&&this.pending.delete(e),t});return this.pending.set(e,i),i}deleteValue(e){const t=this.values.get(e);t&&(this.bytes-=t.bytes),this.values.delete(e)}clear(e){void 0!==e?(this.pending.delete(e),this.deleteValue(e)):(this.pending.clear(),this.values.clear(),this.bytes=0)}},u=e=>!!/\.(gzip|gz)(?:[?#]|$)/i.test(e),p=(a=t(function*(e,t,r=u){const s=yield window.fetch(e);if(!s.ok){try{var i;yield null===(i=s.body)||void 0===i?void 0:i.cancel()}catch(l){}throw new Error("Network response was not ok.")}let n=s;if(t)try{n=((e,t)=>{const r=Number(e.headers.get("content-length"))||0;let s=0;return e.body?new globalThis.Response(e.body.pipeThrough(new globalThis.TransformStream({start(){t({percent:0,transferredBytes:0,totalBytes:r})},transform(e,i){s+=e.byteLength,t({percent:0===r?0:s/r,transferredBytes:s,totalBytes:r}),i.enqueue(e)},flush(){t({percent:1,transferredBytes:s,totalBytes:r})}})),{status:e.status,statusText:e.statusText,headers:e.headers}):(t({percent:1,totalBytes:r,transferredBytes:s}),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers}))})(n,t)}catch(c){try{var o;yield null===(o=s.body)||void 0===o?void 0:o.cancel(c)}catch(d){}throw c}if(r(e)&&"gzip"!==n.headers.get("content-encoding")){const e=new DecompressionStream("gzip"),t=n.body.pipeThrough(e);n=new Response(t)}const a=yield n.text();return{json:JSON.parse(a),bytes:2*a.length}}),function(e,t){return a.apply(this,arguments)}),f=(l=t(function*(e,t,r=u,s){try{var i,n;const o=null!==(i=null==s||null===(n=s.resolveURL)||void 0===n?void 0:n.call(s,e))&&void 0!==i?i:e,a=((e,t)=>{const r=null==t?void 0:t.cache;if(!1===r)return{enabled:!1,key:e,clone:!1};if(!0===r)return{enabled:!0,key:e,clone:!0};if(r&&"object"==typeof r){var s,i,n;const t=null===(s=r.enabled)||void 0===s||s;return{enabled:t,key:null!==(i=r.key)&&void 0!==i?i:e,clone:!!t&&(null===(n=r.clone)||void 0===n||n)}}return{enabled:!1,key:e,clone:!1}})(o,s),l=()=>p(o,t,()=>r(e)),c=(yield a.enabled?d.load(a.key,l):l()).json;return{res:a.enabled&&a.clone?structuredClone(c):c,err:void 0}}catch(o){return{res:void 0,err:o}}}),function(e,t){return l.apply(this,arguments)}),h=i,y=(c=t(function*(e,t){const{res:r,err:s}=yield f(h(e,null==t?void 0:t.assetsPrefix),void 0,void 0,(null==t?void 0:t.fetchOptions)||{cache:!0});if(s)throw s;return r}),function(e,t){return c.apply(this,arguments)}),m=e=>"string"==typeof e&&!!e&&!/[:\\?#\0]/.test(e)&&!e.split("/").some(e=>!e||"."===e||".."===e);function g(e,t,r){var s,i;if(!(null==e?void 0:e.mapNavigation))return;if("static"===e.mapNavigation.mode)throw Error("此作品为固定场景展示,不支持运行时区域切换或重建。请以动态模式重新导出。");const n=void 0===r?Object.values(null!==(s=e.regions)&&void 0!==s?s:{}).flat():null===(i=e.regions)||void 0===i?void 0:i[r];if(void 0!==r&&!Object.values(e.mapNavigation.templates).includes(r)||!(null==n?void 0:n.includes(t)))throw Error(`区域 ${t} 或场景模板不在动态导出范围内,请调整范围和模板后重新导出。`)}function v(e){if(void 0===e)return;const t=e;if(!t||1!==t.version||!Array.isArray(t.entries))throw Error("Invalid runtime asset catalog");const r=/* @__PURE__ */new Set,s=/* @__PURE__ */new Set,i=/* @__PURE__ */new Set;for(const a of t.entries){var n;if(!a||"string"!=typeof a.id||!a.id||r.has(a.id)||!m(a.path)||s.has(a.path)||!Array.isArray(a.sources)||!a.sources.length||a.sources.some(e=>"string"!=typeof e||!e||i.has(e))||new Set(a.sources).size!==a.sources.length||"string"!=typeof a.mimeType||!/^[\w.+-]+\/[\w.+-]+$/.test(a.mimeType)||!["identity","gzip"].includes(a.encoding)||!Number.isSafeInteger(a.bytes)||a.bytes<0||!/^[a-f0-9]{64}$/.test(a.sha256)||void 0!==a.data&&!(a.data instanceof ArrayBuffer))throw Error(`Invalid runtime asset: ${null!==(n=null==a?void 0:a.path)&&void 0!==n?n:"unknown"}`);r.add(a.id),s.add(a.path),a.sources.forEach(e=>i.add(e))}if(t.scope&&(!Number.isInteger(t.scope.rootAdcode)||t.scope.rootAdcode<0||!["province","city","district"].includes(t.scope.maxLevel)))throw Error("Invalid map export scope");const o=t.mapNavigation;if(void 0!==o){if(!o||!["static","dynamic"].includes(o.mode))throw Error("Invalid map navigation mode");if("dynamic"===o.mode&&(!o.scope||!Number.isInteger(o.scope.rootAdcode)||o.scope.rootAdcode<0||!["province","city","district"].includes(o.scope.maxLevel)||!o.templates||"object"!=typeof o.templates||Array.isArray(o.templates)||Object.entries(o.templates).some(([e,t])=>!["province","city","district"].includes(e)||"string"!=typeof t||!t.trim())))throw Error("Invalid map navigation templates or scope")}if(t.regions&&("object"!=typeof t.regions||Array.isArray(t.regions)||Object.values(t.regions).some(e=>!Array.isArray(e)||e.some(e=>!Number.isInteger(e)||e<0))))throw Error("Invalid runtime region catalog");if(void 0!==t.declaredSources&&(!Array.isArray(t.declaredSources)||t.declaredSources.some(e=>"string"!=typeof e||!e.trim())))throw Error("Invalid declared asset sources");if(void 0!==t.externalSources&&(!Array.isArray(t.externalSources)||t.externalSources.some(e=>"string"!=typeof e||!e.trim()||/[{}\0]/.test(e)||/^(?:data:|blob:|asset:)/i.test(e)||i.has(e))||new Set(t.externalSources).size!==t.externalSources.length))throw Error("Invalid external asset sources");if(void 0!==t.mapDataMode&&!["bundled","external"].includes(t.mapDataMode))throw Error("Invalid map data mode");if(void 0!==t.mapSwitchKey&&("string"!=typeof t.mapSwitchKey||!t.mapSwitchKey.trim()))throw Error("Invalid bundled map switch key");if(void 0!==t.projectId&&("string"!=typeof t.projectId||!t.projectId.trim()||t.projectId.length>64))throw Error("Invalid runtime asset project")}function w(e){const t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode(...e.subarray(r,r+32768)));return btoa(t.join(""))}function b(e){return e instanceof ArrayBuffer?new Uint8Array(e):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function A(e){return x.apply(this,arguments)}function x(){return x=t(function*(e){const t=yield crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,"0")).join("")}),x.apply(this,arguments)}function E(e,t){return S.apply(this,arguments)}function S(){return(S=t(function*(e,t){if(t.length!==e.bytes||(yield A(t))!==e.sha256)throw Error(`资源校验失败:${e.path}`)})).apply(this,arguments)}function I(t,r){var s,i,n,o;if(!r)return t;if(!t)return structuredClone(r);const a=structuredClone(t),l=new Map(a.entries.map(e=>[e.id,e])),c=new Map(a.entries.flatMap(e=>e.sources.map(t=>[t,e.sha256])));for(const e of r.entries){for(const r of e.sources)if(c.has(r)&&c.get(r)!==e.sha256)throw Error(`资源地址存在不同内容:${r}。请修改资源地址或使用“打开项目”导入。`);const t=l.get(e.id);if(t)t.sources=[.../* @__PURE__ */new Set([...t.sources,...e.sources])];else{const t=structuredClone(e);a.entries.push(t),l.set(t.id,t)}for(const r of e.sources)c.set(r,e.sha256)}a.regions=e(e({},t.regions),r.regions),a.declaredSources=[.../* @__PURE__ */new Set([...null!==(s=t.declaredSources)&&void 0!==s?s:[],...null!==(i=r.declaredSources)&&void 0!==i?i:[]])];const d=[.../* @__PURE__ */new Set([...null!==(n=t.externalSources)&&void 0!==n?n:[],...null!==(o=r.externalSources)&&void 0!==o?o:[]])].filter(e=>!c.has(e));return d.length?a.externalSources=d:delete a.externalSources,v(a),a}var j=class{constructor(e,t="",o=!0){var a;s(this,"sources",/* @__PURE__ */new Map),s(this,"resolved",/* @__PURE__ */new Map),s(this,"externals",/* @__PURE__ */new Map),s(this,"catalog",void 0),s(this,"strict",void 0),s(this,"prefix",void 0),s(this,"resolve",e=>{var t;if(/^(data:|blob:)/i.test(e))return e;const s=i(e,this.prefix),o=null!==(t=this.sources.get(e))&&void 0!==t?t:this.sources.get(s);if(!o){var a;const t=null!==(a=this.externals.get(e))&&void 0!==a?a:this.externals.get(s);if(void 0!==t)return t;if(!this.strict)return s;throw Error(`资源包未包含:${e}。请扩大导出范围或补充资源后重新导出。`)}let l=this.resolved.get(o.id);if(!l){if(void 0!==o.data){const e=b(o.data);if(e.byteLength!==o.bytes||r(n(e))!==o.sha256)throw Error(`资源校验失败:${o.path}`);l=URL.createObjectURL(new Blob([e],{type:"gzip"===o.encoding?"application/gzip":o.mimeType}))}else{const e=this.catalog.baseUrl;if(!e)throw Error(`资源缺少文件内容或部署地址:${o.path}`);const t="undefined"==typeof location?"https://bundle.invalid/":location.href;l=new URL(o.path,new URL(e,t)).href}this.resolved.set(o.id,l)}return l}),this.catalog=e,this.prefix=t,this.strict=o,v(e);const l=(e,t)=>{const r=this.sources.get(e);if(r&&r.id!==t.id)throw Error(`资源地址重复:${e}`);this.sources.set(e,t)},c=e=>/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(e)?[e]:[e,i(e,t),`/${e.replace(/^\/+/,"")}`];for(const r of e.entries)for(const e of[...r.sources,`asset://${r.id}`])for(const t of c(e))l(t,r);for(const r of null!==(a=e.externalSources)&&void 0!==a?a:[]){const e=i(r,t);for(const t of c(r))this.externals.set(t,e)}}dispose(){for(const e of this.resolved.values())e.startsWith("blob:")&&URL.revokeObjectURL(e);this.resolved.clear()}},B=["format","schemaVersion","scenes","assets"];function $(e){const t=e.replace(/[?#].*$/,""),r=e.slice(t.length),s=new URL(e,"https://bundle.invalid").pathname;if(/\.zip$/i.test(s)||/(?:^|\/)manifest\.json$/i.test(s))return e;if(/\.[^/]+$/.test(s))throw Error("vis-core 仅支持 ZIP、分包目录或 manifest.json;独立 JSON/GZ 请先通过编辑平台导入并导出 ZIP。");return`${t.replace(/\/$/,"")}/manifest.json${r}`}function U(e,t){return k.apply(this,arguments)}function k(){return(k=t(function*(e,t){try{const r=new Uint8Array(yield e.slice(0,2).arrayBuffer()),s=/\.(gz|gzip)$/i.test(t)||31===r[0]&&139===r[1]?yield new Response(e.stream().pipeThrough(new DecompressionStream("gzip"))).text():yield e.text(),i=JSON.parse(s);if(!i||"object"!=typeof i||Array.isArray(i))throw Error("需要 JSON 对象");return i}catch(r){throw new Error(`无法读取文件 ${t}:${r instanceof Error?r.message:String(r)}`,{cause:r})}})).apply(this,arguments)}function O(e){return T.apply(this,arguments)}function T(){return T=t(function*(r,s="project.zip"){var i;const[{default:n},a,{createTextureFile:l},{SCENE_DOCUMENT_FORMAT:c},{resolveRuntimeImages:d}]=yield Promise.all([import("jszip"),import("./validation-DDQJc7mH.js").then(e=>e.r),import("./dist-6e_r_Ils.js").then(e=>e.R),import("./schema-Brre1WzE.js").then(e=>e.c),import("./runtimeImages-DCG8lEY9.js").then(e=>e.a)]),u=a;let p;try{p=yield n.loadAsync(r instanceof Blob?yield r.arrayBuffer():r)}catch(N){throw new Error(`无法解压 ZIP 文件 ${s}`,{cause:N})}const f=Object.values(p.files).filter(e=>!e.dir&&/(^|\/)manifest\.json$/.test(e.name)&&!e.name.startsWith("__MACOSX/")),h=null!==(i=p.file("manifest.json"))&&void 0!==i?i:1===f.length?f[0]:void 0;if(!h)throw new Error(f.length>1?"ZIP 中有多个 manifest.json,无法确定要导入的项目":"ZIP 中缺少 manifest.json,请选择平台导出的场景分包 ZIP");const y=h.name.slice(0,-13),m=yield U(new Blob([yield h.async("uint8array")]),h.name);u.assertSceneManifest(m);const g=function(){var e=t(function*(e){if(/[:\\?#\0]/.test(e)||e.split("/").some(e=>!e||"."===e||".."===e))throw new Error(`ZIP 内文件路径无效:${e}`);const t=p.file(y+e);if(!t)throw new Error(`ZIP 中缺少文件:${e}`);if(t.unsafeOriginalName&&t.unsafeOriginalName!==t.name)throw new Error(`ZIP 内文件路径无效:${e}`);return new Blob([yield t.async("uint8array")])});return function(t){return e.apply(this,arguments)}}(),v=[];for(const e of m.scenes){var w,b;const t=yield U(yield g(e.source),e.source);if(!(null===(w=t.scene)||void 0===w?void 0:w.object)||t.id!==e.id||(null===(b=t.vis)||void 0===b?void 0:b.type)!==e.vis.type)throw new Error(`场景文件与 manifest 不匹配:${e.source}`);v.push(t)}const{format:A,schemaVersion:x,scenes:S,assets:I}=m,j=e(e({},o(m,B)),{},{format:c,schemaVersion:6,scenes:v});if(u.assertRuntimeSceneDocument(j),j.runtimeAssets){delete j.runtimeAssets.baseUrl;for(const e of j.runtimeAssets.entries){const t=new Uint8Array(yield(yield g(e.path)).arrayBuffer());yield E(e,t),e.data=t.buffer}}const $=/* @__PURE__ */new Map,k={png:"image/png",jpg:"image/jpeg",webp:"image/webp",gif:"image/gif",avif:"image/avif",bmp:"image/bmp"};for(const e of Object.keys(null!=I?I:{})){var O,T,L;const t=new Uint8Array(yield(yield g(e)).arrayBuffer()),r=null!==(O=null!==(T=null==I||null===(L=I[e])||void 0===L?void 0:L.mimeType)&&void 0!==T?T:k[e.split(".").pop()])&&void 0!==O?O:"application/octet-stream";$.set(e,l(t.buffer,r))}return d(j,I,e=>$.get(e)),j}),T.apply(this,arguments)}var L=["assets"],N=e=>r(n(new Uint8Array(e))),M={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array},P={"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/avif":"avif","image/bmp":"bmp","image/svg+xml":"svg","image/vnd.radiance":"hdr","image/x-tga":"tga","video/mp4":"mp4","video/webm":"webm","video/ogg":"ogv","video/quicktime":"mov","video/x-m4v":"m4v"},z=e=>"string"==typeof e&&/^assets\/[\w.-]+$/.test(e)&&!e.includes("..");function C(e){if(void 0!==e){if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Invalid media asset manifest");for(const[t,r]of Object.entries(e)){if(!z(t)||!r||!/^[a-f0-9]{64}$/.test(r.sha256)||!Number.isSafeInteger(r.bytes)||r.bytes<0||!/^[\w.+-]+\/[\w.+-]+$/.test(r.mimeType)||!["image","hdr","tga","video","pixels"].includes(r.kind))throw Error(`Invalid media asset: ${t}`);if("pixels"===r.kind){const e=r.pixels;if(!e||!Object.hasOwn(M,e.type)||!Number.isSafeInteger(e.width)||e.width<=0||!Number.isSafeInteger(e.height)||e.height<=0||void 0!==e.depth&&(!Number.isSafeInteger(e.depth)||e.depth<=0)||r.bytes%M[e.type].BYTES_PER_ELEMENT)throw Error(`Invalid pixel asset: ${t}`)}else if(void 0!==r.pixels)throw Error(`Unexpected pixel metadata: ${t}`)}}}function D(t,r){if(r instanceof ArrayBuffer&&(r.byteLength!==t.bytes||N(r)!==t.sha256))throw Error("Media resource checksum mismatch");return"pixels"===t.kind?e(e({},t.pixels),{},{encoding:"binary",sha256:t.sha256,data:r}):{encoding:"file",kind:t.kind,mimeType:t.mimeType,sha256:t.sha256,data:r}}var R=class{constructor(){s(this,"payloads",/* @__PURE__ */new WeakMap),s(this,"graphs",/* @__PURE__ */new WeakMap),s(this,"rows",/* @__PURE__ */new WeakMap)}row(t,r,s){const i=this.rows.get(t);if(i&&i.graph===s)return i.row;const n=e(e({},t),{},{[r]:s});return this.rows.set(t,{graph:s,row:n}),n}writePayload(t){var r;if("string"==typeof t){const e=/^data:((?:image|video)\/[^;,]+);base64,([\s\S]*)$/i.exec(t);if(!e)return;const r=b(e[2]).buffer;t={encoding:"file",kind:e[1].toLowerCase().startsWith("video/")?"video":"image",mimeType:e[1],sha256:N(r),data:r}}if(!t||"object"!=typeof t)return;const s=this.payloads.get(t);if(s)return s;let i,n;if("file"===t.encoding){if(!(t.data instanceof ArrayBuffer))throw Error("Media export requires owned file bytes");if(i=t.data,n={kind:t.kind,mimeType:t.mimeType,sha256:N(i),bytes:i.byteLength},n.sha256!==t.sha256)throw Error("Media resource checksum mismatch")}else{if(!("binary"===t.encoding||Object.hasOwn(M,t.type)&&(Array.isArray(t.data)||ArrayBuffer.isView(t.data))))return;{const r=M[t.type];if(!r)throw Error("Invalid pixel array type");if("binary"===t.encoding){if(!(t.data instanceof ArrayBuffer)||N(t.data)!==t.sha256)throw Error("Invalid binary pixel resource");i=t.data}else{const e=Array.isArray(t.data)?new r(t.data):t.data;i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}n={kind:"pixels",mimeType:"application/octet-stream",sha256:N(i),bytes:i.byteLength,pixels:e({type:t.type,width:t.width,height:t.height},void 0===t.depth?{}:{depth:t.depth})}}}const o=n.pixels?"-"+N((new TextEncoder).encode(JSON.stringify(n.pixels)).buffer).slice(0,16):"",a="pixels"===n.kind?"bin":null!==(r=P[n.mimeType])&&void 0!==r?r:"bin",l=`assets/${"video"===n.kind?"video":"image"}-${n.sha256}${o}.${a}`;C({[l]:n});const c={path:l,info:n,file:{data:new Uint8Array(i),mimeType:n.mimeType}};return this.payloads.set(t,c),c}prepare(t){var r;const s={},i={};if(void 0!==t._resourcePool||void 0!==t.imageAssets)throw Error("Import legacy resources in editor-platform");const n=e=>{s[e.path]=e.info,i[e.path]=e.file},a=t=>{if(!t)return t;const r=this.graphs.get(t);if(r)return r.files.forEach(n),r.graph;const s=/* @__PURE__ */new Map,i=e=>{const t=e;if(Array.isArray(t))return t.map(i);const r=this.writePayload(t);return r?(s.set(r.path,r),r.path):t},o=e({},t);t.images&&(o.images=t.images.map(t=>e(e({},t),{},{url:i(t.url)}))),t.textures&&(o.textures=t.textures.map(r=>{let s=r.userData;if(!s)return r;if(void 0!==s._dataTexBase64||"number"==typeof s._videoSrc||void 0!==t._texDataPool)throw Error("Import legacy texture data in editor-platform");return void 0!==s._videoSrc&&(s=e(e({},s),{},{_videoSrc:i(s._videoSrc)})),s===r.userData?r:e(e({},r),{},{userData:s})}));const a=[...s.values()];return a.forEach(n),this.graphs.set(t,{graph:o,files:a}),o},{assets:l}=t,c=e({},o(t,L));if(t.scene&&(c.scene=a(t.scene)),t.scenes&&(c.scenes=t.scenes.map(e=>this.row(e,"scene",a(e.scene)))),t.materialLibrary&&(c.materialLibrary=t.materialLibrary.map(e=>this.row(e,"material",a(e.material)))),t.prefabLibrary&&(c.prefabLibrary=t.prefabLibrary.map(e=>this.row(e,"snapshot",a(e.snapshot)))),null===(r=t.d)||void 0===r?void 0:r.chartBg){const r=t.d.chartBg,s=a({images:r.images,textures:[r]});c.d=e(e({},t.d),{},{chartBg:e(e({},s.textures[0]),s.images?{images:s.images}:{})})}return{document:c,assets:s,files:i}}};function _(e,t,r){var s,i,n,o;if(!t)return;C(t);const a=/* @__PURE__ */new Map,l=e=>{if(Array.isArray(e))return e.map(l);if("string"!=typeof e)return e;if(!Object.hasOwn(t,e)){if(/^assets\/(image|video)-[a-f0-9]{64}[.-]/.test(e))throw Error(`Missing media asset metadata: ${e}`);return e}return a.has(e)||a.set(e,D(t[e],r(e,t[e]))),a.get(e)},c=e=>{var t,r,s;for(const i of null!==(t=null==e?void 0:e.images)&&void 0!==t?t:[])i.url=l(i.url);for(const i of null!==(r=null==e?void 0:e.textures)&&void 0!==r?r:[])void 0!==(null===(s=i.userData)||void 0===s?void 0:s._videoSrc)&&(i.userData._videoSrc=l(i.userData._videoSrc))};c(e.scene);for(const d of null!==(s=e.scenes)&&void 0!==s?s:[])c(d.scene);for(const d of null!==(i=e.materialLibrary)&&void 0!==i?i:[])c(d.material);for(const d of null!==(n=e.prefabLibrary)&&void 0!==n?n:[])c(d.snapshot);(null===(o=e.d)||void 0===o?void 0:o.chartBg)&&c({images:e.d.chartBg.images,textures:[e.d.chartBg]})}var Z="undefined"!=typeof crypto&&void 0!==crypto.subtle;function K(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/g,"").replace(/-----END PUBLIC KEY-----/g,"").replace(/\s/g,""),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s.buffer}function V(){return(V=t(function*(e){return crypto.subtle.importKey("spki",K(e),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])})).apply(this,arguments)}var F="-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEU2vGIjpJQFRkGxVrw4gZL3dXm/1\nfrZBlUc8gjzam/VNZbT1swQSq/kLPmYH7ZykBvLzp7SpNdvOQ8rAqdSdvg==\n-----END PUBLIC KEY-----";var Y=Z?function(e){return V.apply(this,arguments)}(F):null,J=Z?null:new Uint8Array(K(F)).slice(26);function Q(e){return W.apply(this,arguments)}function W(){return(W=t(function*(e){let t;try{t=function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,s=atob(t+"=".repeat(r)),i=new Uint8Array(s.length);for(let n=0;n<s.length;n++)i[n]=s.charCodeAt(n);return i}(e)}catch(o){return null}if(t.length<=64)return null;const r=t.slice(0,t.length-64),s=t.slice(t.length-64);let i;try{if(Z){const e=yield Y;i=yield crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},e,s,r)}else{const{p256:e}=yield import("@noble/curves/nist.js");i=e.verify(s,r,J,{lowS:!1})}}catch(a){return null}if(!i)return null;const n=function(e){if(e.length<1)return null;if(123===e[0])try{const t=JSON.parse((new TextDecoder).decode(e));return 2!==t.version||!["runtime","preview"].includes(t.purpose)||"string"!=typeof t.projectId||!t.projectId.trim()||t.projectId.length>64||!Array.isArray(t.adcodes)||!t.adcodes.length||t.adcodes.length>65535||t.adcodes.some(e=>!Number.isInteger(e)||e<0||e>16777215)||new Set(t.adcodes).size!==t.adcodes.length||void 0!==t.expire&&(!Number.isSafeInteger(t.expire)||t.expire<=0)||"preview"===t.purpose&&!t.expire?null:{purpose:t.purpose,projectId:t.projectId,adcodes:t.adcodes,expire:t.expire}}catch(l){return null}const t=e[0],r=!!(2&t),s=!!(4&t),i=!!(8&t);if(-16&t||r&&(s||i))return null;let n,o=1;if(1&t){if(e.length<o+4)return null;n=36e5*((e[o]<<24|e[o+1]<<16|e[o+2]<<8|e[o+3])>>>0),o+=4}let a=null;if(!r){if(e.length<o+1)return null;let t=e[o++];if(i){if(e.length<o+1)return null;t=t<<8|e[o++]}if(!t||e.length!==o+3*t)return null;a=[];for(let r=0;r<t;r++){const t=e[o]<<16|e[o+1]<<8|e[o+2];a.push(t),o+=3}}return o!==e.length?null:{adcodes:a,expire:n,prefixMatch:s}}(r);return n?n.expire&&Date.now()>n.expire?null:n:null})).apply(this,arguments)}function q(e,t,r){return G.apply(this,arguments)}function G(){return(G=t(function*(e,t,r){const s=yield Q(t);if(!(null==s?void 0:s.adcodes)||s.prefixMatch||"preview"===s.purpose||void 0!==r&&s.projectId!==r)return!1;const i=new Set(e),n=new Set(s.adcodes);return i.size>0&&i.size===n.size&&[...i].every(e=>n.has(e))})).apply(this,arguments)}function H(e,t){return X.apply(this,arguments)}function X(){return(X=t(function*(e,t){const r=yield Q(t);return!(!(null==r?void 0:r.adcodes)||r.prefixMatch||"preview"===r.purpose)&&r.adcodes.includes(e)})).apply(this,arguments)}var ee=(e,t)=>{const r=te(e),s=te(t).map(function(e,t){return e^r[Math.floor(t%r.length)]}).join(",");return btoa(s)};function te(e){const t=[];let r=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++s)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t}export{E as _,C as a,y as b,O as c,g as d,v as f,I as g,w as h,R as i,$ as l,b as m,H as n,D as o,A as p,q as r,_ as s,ee as t,j as u,u as v,o as x,f as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Nt as e,O as t,u as a}from"./dist-6e_r_Ils.js";import{a as s}from"./sha2-BCqd-su1.js";import{i as r,s as o}from"./e-BTBbEYEO.js";var i=/* @__PURE__ */e({externalizeRuntimeImages:()=>n,resolveRuntimeAssetImages:()=>f,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,a,s){o(e,a,e=>{const a=s(e);return t(a)?a.data:a})}function d(e,t,s){u(e,t,e=>{const t=s[e];if(!t)throw Error(`Missing texture resource: ${e}`);return a(t.data.buffer.slice(t.data.byteOffset,t.data.byteOffset+t.data.byteLength),t.mimeType)})}function f(e,a,r){var o,i,n,u;const d=new Set(a),f=e=>Array.isArray(e)?e.map(f):"string"==typeof e?d.has(e)?r(e):e:t(e)&&"string"==typeof e.data&&d.has(e.data)?s(s({},e),{},{data:r(e.data)}):e,l=e=>{var t,a,s;for(const r of null!==(t=null==e?void 0:e.images)&&void 0!==t?t:[])r.url=f(r.url);for(const r of null!==(a=null==e?void 0:e.textures)&&void 0!==a?a:[])void 0!==(null===(s=r.userData)||void 0===s?void 0:s._videoSrc)&&(r.userData._videoSrc=f(r.userData._videoSrc))};l(e.scene);for(const t of null!==(o=e.scenes)&&void 0!==o?o:[])l(t.scene);for(const t of null!==(i=e.materialLibrary)&&void 0!==i?i:[])l(t.material);for(const t of null!==(n=e.prefabLibrary)&&void 0!==n?n:[])l(t.snapshot);(null===(u=e.d)||void 0===u?void 0:u.chartBg)&&l({images:e.d.chartBg.images,textures:[e.d.chartBg]})}export{i as a,d as i,f as n,u as r,n as t};
|
package/dist/sha2-BCqd-su1.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,r||"default");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}function r(t,r,n){return(r=e(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach(function(e){r(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function o(t,e,r,n,i,o,s){try{var h=t[o](s),u=h.value}catch(t){return void r(t)}h.done?e(u):Promise.resolve(u).then(n,i)}function s(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function h(t){o(s,n,i,h,u,"next",t)}function u(t){o(s,n,i,h,u,"throw",t)}h(void 0)})}}function h(t,e=""){if(!t||/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(t)||!e)return t;const r=e.replace(/\/+$/,"");return r&&(t===r||t.startsWith(`${r}/`))?t:`${r}/${t.replace(/^\/+/,"").replace(/^(?:\.\/)+/,"")}`}function u(t,e,r=""){const n=(i=t)instanceof Uint8Array||ArrayBuffer.isView(i)&&"Uint8Array"===i.constructor.name&&"BYTES_PER_ELEMENT"in i&&1===i.BYTES_PER_ELEMENT;var i;const o=null==t?void 0:t.length,s=void 0!==e;if(!n||s&&o!==e){const i=(r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${e}`:"")+", got "+(n?`length=${o}`:"type="+typeof t);if(!n)throw new TypeError(i);throw new RangeError(i)}return t}function c(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function f(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function a(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function l(t,e){return t<<32-e|t>>>e}var p=/* @__PURE__ */(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),d=/* @__PURE__ */Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function b(t){if(u(t),p)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=d[t[r]];return e}var y;y=s(function*(){});function g(t,e={}){const r=(e,r)=>t(r).update(e).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=e=>t(e),Object.assign(r,e),Object.freeze(r)}var v=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function w(t,e,r){return t&e^~t&r}function m(t,e,r){return t&e^t&r^e&r}var E=class{constructor(t,e,n,i){r(this,"blockLen",void 0),r(this,"outputLen",void 0),r(this,"canXOF",!1),r(this,"padOffset",void 0),r(this,"isLE",void 0),r(this,"buffer",void 0),r(this,"view",void 0),r(this,"finished",!1),r(this,"length",0),r(this,"pos",0),r(this,"destroyed",!1),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=a(this.buffer)}update(t){c(this),u(t);const{view:e,buffer:r,blockLen:n}=this,i=t.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s===n){const e=a(t);for(;n<=i-o;o+=n)this.process(e,o);continue}r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){c(this),function(t,e){u(t,void 0,"digestInto() output");const r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;e[o++]=128,f(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let u=o;u<n;u++)e[u]=0;r.setBigUint64(n-8,BigInt(8*this.length),i),this.process(r,0);const s=a(t),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const l=h/4,p=this.get();if(l>p.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)s.setUint32(4*u,p[u],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.destroyed=o,t.finished=i,t.length=n,t.pos=s,n%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}},O=/* @__PURE__ */Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),L=/* @__PURE__ */Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),A=/* @__PURE__ */new Uint32Array(64),j=class extends E{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:h}=this;return[t,e,r,n,i,o,s,h]}set(t,e,r,n,i,o,s,h){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|h}process(t,e){for(let f=0;f<16;f++,e+=4)A[f]=t.getUint32(e,!1);for(let f=16;f<64;f++){const t=A[f-15],e=A[f-2],r=l(t,7)^l(t,18)^t>>>3;A[f]=(l(e,17)^l(e,19)^e>>>10)+A[f-7]+r+A[f-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:h,G:u,H:c}=this;for(let f=0;f<64;f++){const t=c+(l(s,6)^l(s,11)^l(s,25))+w(s,h,u)+L[f]+A[f]|0,e=(l(r,2)^l(r,13)^l(r,22))+m(r,n,i)|0;c=u,u=h,h=s,s=o+t|0,o=i,i=n,n=r,r=t+e|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,h=h+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,h,u,c)}roundClean(){f(A)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),f(this.buffer)}},P=class extends j{constructor(){super(32),r(this,"A",0|O[0]),r(this,"B",0|O[1]),r(this,"C",0|O[2]),r(this,"D",0|O[3]),r(this,"E",0|O[4]),r(this,"F",0|O[5]),r(this,"G",0|O[6]),r(this,"H",0|O[7])}},S=/* @__PURE__ */g(()=>new P,/* @__PURE__ */v(1));export{i as a,s as i,b as n,r as o,h as r,S as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as e,F as t,Nt as r,w as i}from"./dist-6e_r_Ils.js";import{a}from"./sha2-BCqd-su1.js";import{a as o,i as n,n as s,o as d,s as l}from"./schema-Brre1WzE.js";import{a as u,f as c,x as f}from"./e-BTBbEYEO.js";var v=["scenes","materialLibrary","prefabLibrary"],m=()=>{throw Error("Legacy resource pools must be imported in editor-platform before runtime loading")};function p(e){var t,r;const i=e.scene;void 0!==(null==i?void 0:i._texDataPool)&&m();const a=e=>{Array.isArray(e)?e.forEach(a):e&&"object"==typeof e&&("_documentResource"in e||"base64"===e.encoding)&&m()};for(const d of null!==(t=null==i?void 0:i.images)&&void 0!==t?t:[])a(d.url);for(const d of null!==(r=null==i?void 0:i.textures)&&void 0!==r?r:[]){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)||m(),a(null===(s=d.userData)||void 0===s?void 0:s._videoSrc)}}function y(e){void 0===e._resourcePool&&void 0===e.imageAssets||m();for(const t of Array.isArray(e.scenes)?e.scenes:[])p(t);for(const t of Array.isArray(e.materialLibrary)?e.materialLibrary:[])p({scene:t.material});for(const t of Array.isArray(e.prefabLibrary)?e.prefabLibrary:[])p({scene:t.snapshot})}function w(e){return o(e),y(e),e}function b(e){w(e);const{scenes:t,materialLibrary:r,prefabLibrary:i}=e,a=f(e,v),o=structuredClone(a);return o.scenes=t.map(e=>structuredClone(e)),r&&(o.materialLibrary=r.map(e=>structuredClone(e))),i&&(o.prefabLibrary=i.map(e=>structuredClone(e))),o}function h(e,t,r){const i=JSON.stringify([e,t,r]),a=[2166136261,2654435769,2246822507,3266489909].map(e=>{let t=e;for(let r=0;r<i.length;r++)t=Math.imul(t^i.charCodeAt(r),16777619);return t^=t>>>16,t=Math.imul(t,2246822507),(t^t>>>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",I="_materialAssetId",E="_materialAssetRevision",$="_materialRuntimeProperties",j=e=>structuredClone(e),D=e=>!!e&&"object"==typeof e&&!Array.isArray(e),A=e=>"map"===e||"matcap"===e||e.endsWith("Map");function O(e,t){var r;if(D(e)){t(e);for(const i of null!==(r=e.children)&&void 0!==r?r:[])O(i,t)}}function k(e,t){if("string"==typeof e)return t(e);if(Array.isArray(e))return e.map(e=>k(e,t));if(D(e))for(const r of Object.keys(e))e[r]=k(e[r],t);return e}function M(e,t){var r;const a=/* @__PURE__ */new Set;i(e,(e,t)=>{"PMREM_PLACEHOLDER"!==e[t]&&a.add(e[t])});for(const[i,d]of Object.entries(e))A(i)&&"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 t of Object.values(e))n(t)}}else t.has(e)&&a.add(e)};n(e.uniforms);for(const i of Object.values(null!==(r=e.uniforms)&&void 0!==r?r:{})){var s;if("t"===(null==i?void 0:i.type)&&"string"==typeof i.value&&"PMREM_PLACEHOLDER"!==i.value&&a.add(i.value),"tv"===(null==i?void 0:i.type))for(const e of null!==(s=i.value)&&void 0!==s?s:[])"string"==typeof e&&"PMREM_PLACEHOLDER"!==e&&a.add(e)}return a}function S(e,t){i(e,(e,r)=>{var i;e[r]=null!==(i=t.get(e[r]))&&void 0!==i?i:e[r]});for(const i of Object.keys(e)){var r;A(i)&&"string"==typeof e[i]&&(e[i]=null!==(r=t.get(e[i]))&&void 0!==r?r:e[i])}e.uniforms&&(e.uniforms=k(e.uniforms,e=>{var r;return null!==(r=t.get(e))&&void 0!==r?r:e}))}function _(e,t){let r=e,i=1;for(;t.has(r);)r=`${e}~${i++}`;return t.add(r),r}function L(e){const t=j(e);return t.userData&&(delete t.userData[I],delete t.userData[E],delete t.userData._materialAssetOverrideHash,delete t.userData._materialDynamic,delete t.userData[$],Object.keys(t.userData).length||delete t.userData),t}function x(e,t,r={}){var i,o,n,s,d,l;const u=new Set(null!==(i=r.editedProperties)&&void 0!==i?i:[]),c=null===(o=t.userData)||void 0===o?void 0:o[$],f=Array.isArray(c)?c.filter(e=>"string"==typeof e&&A(e)&&!u.has(e)):[],v=L(t);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)),h=/* @__PURE__ */new Map,g=/* @__PURE__ */new Map;for(const $ of null!==(d=m.images)&&void 0!==d?d:[]){const e=y.find(e=>e.uuid===$.uuid),t=e&&JSON.stringify(e)!==JSON.stringify($)?_(`${$.uuid}:authored`,b):$.uuid;h.set($.uuid,t),b.add(t),y.some(e=>e.uuid===t)||y.push(a(a({},$),{},{uuid:t}))}for(const $ of null!==(l=m.textures)&&void 0!==l?l:[]){void 0!==$.image&&($.image=k($.image,e=>{var t;return null!==(t=h.get(e))&&void 0!==t?t:e}));const e=p.find(e=>e.uuid===$.uuid),t=e&&JSON.stringify(e)!==JSON.stringify($)?_(`${$.uuid}:authored`,w):$.uuid;g.set($.uuid,t),w.add(t),p.some(e=>e.uuid===t)||p.push(a(a({},$),{},{uuid:t}))}S(m,g);for(const a of f){var I,E;const e=v[a];if(!Object.hasOwn(m,a)){delete v[a];continue}v[a]=m[a];const t=p.find(e=>e.uuid===m[a]),r=p.find(t=>t.uuid===e);if(!t||!r)continue;const i=j(r);i.uuid=t.uuid,void 0===t.image?delete i.image:i.image=j(t.image);const o=null!==(I=i.userData)&&void 0!==I?I:i.userData={};for(const a of Object.keys(o))("_videoSrc"===a||a.startsWith("_dataTex"))&&delete o[a];for(const[a,n]of Object.entries(null!==(E=t.userData)&&void 0!==E?E:{}))("_videoSrc"===a||a.startsWith("_dataTex"))&&(o[a]=j(n));Object.keys(o).length||delete i.userData,JSON.stringify(i)!==JSON.stringify(t)&&(i.uuid=_(`${t.uuid}:sampler`,w),p.push(i),v[a]=i.uuid)}return U({id:"authored-material",name:"",vis:{type:"base",options:{}},scene:{materials:[v],textures:p,images:y}},v.uuid)}function P(e){const t=e.scene,r=r=>{var i;const a=/* @__PURE__ */new Map;for(const o of null!==(i=t[r])&&void 0!==i?i:[]){if("string"!=typeof(null==o?void 0:o.uuid)||!o.uuid||a.has(o.uuid))throw new Error(`Invalid ${r} identity in scene ${e.id}`);a.set(o.uuid,o)}return a},i=r("materials"),a=r("textures");return{scene:e,materials:i,textures:a,images:r("images"),textureIds:new Set(a.keys())}}function C(e,t){const{scene:r,materials:i,textures:a,images:o,textureIds:n}=e;r.scene;const s=i.get(t);if(!s)throw new Error(`Missing material ${t} in scene ${r.id}`);const d=L(s);delete d.textures,delete d.images;const l=M(d,n),u=[],c=/* @__PURE__ */new Set;for(const v of l){const e=a.get(v);if(!e)throw new Error(`Missing texture ${v} for material ${t} in scene ${r.id}`);const i=j(e);u.push(i);for(const t of[i.image].flat()){var f;if("string"==typeof t)if(o.has(t))c.add(t);else if(!(null===(f=i.userData)||void 0===f?void 0:f._videoSrc))throw new Error(`Missing image ${t} for texture ${v} in scene ${r.id}`)}}return u.length&&(d.textures=u),c.size&&(d.images=[...c].map(e=>j(o.get(e)))),d}function U(e,t){return K(e)(t)}function K(e){const t=P(e);return e=>C(t,e)}function R(e,t=h(e.id,"material",e.material.uuid)){var r,i;const o=L(e.material),n=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map;for(const a of null!==(r=o.images)&&void 0!==r?r:[]){const t=a.uuid;a.uuid=h(e.id,"image",t),n.set(t,a.uuid)}for(const d of null!==(i=o.textures)&&void 0!==i?i:[]){const t=d.uuid;d.uuid=h(e.id,"texture",t),s.set(t,d.uuid),d.userData=a(a({},d.userData),{},{[g]:{assetId:e.id,textureUuid:t,imageUuids:[d.image].flat().filter(e=>"string"==typeof e)}}),void 0!==d.image&&(d.image=k(d.image,e=>{var t;return null!==(t=n.get(e))&&void 0!==t?t:e}))}return S(o,s),o.uuid=t,o.name=e.name,o.userData=a(a({},o.userData),{},{[I]:e.id,[E]:e.revision,[g]:{assetId:e.id,materialUuid:e.material.uuid}}),o}function T(e,t){return N(e,t).filter(e=>!e.optionPath)}function N(t,r){const i=[];for(const n of t.scenes){var a,o;const t=new Map((null!==(a=n.scene.materials)&&void 0!==a?a:[]).filter(e=>{var t;return null===(t=e.userData)||void 0===t?void 0:t[I]}).map(e=>[e.uuid,e.userData[I]]));O(n.scene.object,a=>{const o=new Set([a.material].flat());[a.material].flat().forEach((e,o)=>{const s=t.get(e);!s||void 0!==r&&s!==r||i.push({assetId:s,sceneId:n.id,objectId:a.uuid||"",slot:o})}),e(a.userData,(e,s,d)=>{const l=e[s],u=t.get(l);!u||o.has(l)||void 0!==r&&u!==r||(o.add(l),i.push({assetId:u,sceneId:n.id,objectId:a.uuid||"",slot:0,optionPath:d}))},n.scene._sharedOptionsPool)});for(const[e,a]of Object.entries(null!==(o=n.materialAliases)&&void 0!==o?o:{}))void 0!==r&&r!==a.assetId||i.push({assetId:a.assetId,sceneId:n.id,objectId:"",slot:0,alias:e})}return i}function J(e,t){var r;return(null!==(r=e.prefabLibrary)&&void 0!==r?r:[]).filter(e=>{var r;return null===(r=e.snapshot.materials)||void 0===r?void 0:r.some(e=>{var r;return(null===(r=e.userData)||void 0===r?void 0:r[I])===t})})}function z(e,t=[],r=[]){return V(e,t,r).map(e=>j(e))}function V(e,t=[],r=[]){var i,a,o;const n=new Set((null!==(i=e.scene.materials)&&void 0!==i?i:[]).map(e=>{var t;return null===(t=e.userData)||void 0===t?void 0:t[I]}).filter(Boolean));for(const d of r)for(const e of null!==(a=d.snapshot.materials)&&void 0!==a?a:[]){var s;const t=null===(s=e.userData)||void 0===s?void 0:s[I];t&&n.add(t)}for(const d of Object.values(null!==(o=e.materialAliases)&&void 0!==o?o:{}))n.add(d.assetId);return t.filter(t=>n.has(t.id)||"scene"===t.scope.kind&&t.scope.sceneId===e.id)}function H(e){if(void 0!==e&&!Array.isArray(e))throw new Error("Invalid project material library");const t=/* @__PURE__ */new Map;for(const l of null!=e?e:[]){var r,i,a,o,n;if(!D(l)||"string"!=typeof l.id||!l.id||t.has(l.id)||!Number.isInteger(l.revision)||l.revision<1||"string"!=typeof l.name||!D(l.material)||"string"!=typeof l.material.type||!l.material.type||"string"!=typeof l.material.uuid||!l.material.uuid||void 0!==l.locked&&"boolean"!=typeof l.locked||void 0!==l.alwaysExport&&"boolean"!=typeof l.alwaysExport||!D(l.scope)||!["project","scene"].includes(l.scope.kind)||"scene"===l.scope.kind&&("string"!=typeof l.scope.sceneId||!l.scope.sceneId))throw new Error(`Invalid or duplicate material asset ${null!==(n=null==l?void 0:l.id)&&void 0!==n?n:""}`);if(void 0!==(null===(r=l.material.userData)||void 0===r?void 0:r._materialAssetId)||void 0!==(null===(i=l.material.userData)||void 0===i?void 0:i._materialAssetRevision))throw new Error(`Material asset ${l.id} must not contain its own binding`);for(const t of["textures","images"]){var s;if(void 0!==l.material[t]&&!Array.isArray(l.material[t]))throw new Error(`Invalid ${t} in material asset ${l.id}`);const e=/* @__PURE__ */new Set;for(const r of null!==(s=l.material[t])&&void 0!==s?s:[]){if(!D(r)||"string"!=typeof r.uuid||!r.uuid||e.has(r.uuid))throw new Error(`Invalid ${t} identity in material asset ${l.id}`);e.add(r.uuid)}}p({scene:l.material});const e=new Map((null!==(a=l.material.textures)&&void 0!==a?a:[]).map(e=>[e.uuid,e])),u=new Set((null!==(o=l.material.images)&&void 0!==o?o:[]).map(e=>e.uuid));for(const t of M(l.material,new Set(e.keys()))){const r=e.get(t);if(!r)throw new Error(`Missing texture ${t} for material ${l.material.uuid} in scene ${l.id}`);for(const e of[r.image].flat()){var d;if("string"==typeof e&&!u.has(e)&&!(null===(d=r.userData)||void 0===d?void 0:d._videoSrc))throw new Error(`Missing image ${e} for texture ${t} in scene ${l.id}`)}}t.set(l.id,l)}return t}function q(e){G(e,H(e.materialLibrary))}function G(e,t){var r;if(void 0!==e.materialLibrary&&e.schemaVersion<4)throw new Error("Project material library requires schema 4");const i=new Set(e.scenes.map(e=>null==e?void 0:e.id));for(const f of t.values())if("scene"===f.scope.kind&&!i.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!==(r=e.prefabLibrary)&&void 0!==r?r:[]){var a;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!==(a=f.snapshot.materials)&&void 0!==a?a:[]){var o,n;if(!D(e))throw new Error("Invalid prefab material definition");const r=null===(o=e.userData)||void 0===o?void 0:o[I];if(void 0===r)continue;const i=t.get(r);if(!i)throw new Error(`Missing material asset ${r} in prefab ${f.name}`);if("project"!==i.scope.kind)throw new Error(`Prefab ${f.name} requires project material ${r}`);const a=null===(n=e.userData)||void 0===n?void 0:n[E];if(void 0!==a&&(!Number.isInteger(a)||a<1||a>i.revision))throw new Error(`Invalid material asset revision in prefab ${f.name}`)}}for(const f of e.scenes){var s,d,l;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,r]of Object.entries(null!==(s=f.materialAliases)&&void 0!==s?s:{})){if(!e||!D(r)||!t.has(r.assetId)||void 0!==r.locked&&"boolean"!=typeof r.locked)throw new Error(`Invalid material catalog entry ${e} in scene ${f.id}`);F(t.get(r.assetId),f.id)}for(const e of null!==(d=null===(l=f.scene)||void 0===l?void 0:l.materials)&&void 0!==d?d:[]){var u,c;const r=null===(u=e.userData)||void 0===u?void 0:u[I];if(void 0===r)continue;const i=t.get(r);if(!i)throw new Error(`Missing material asset ${r} in scene ${f.id}`);F(i,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>i.revision))throw new Error(`Invalid material asset revision in scene ${f.id}`)}}}function F(e,t){if("scene"===e.scope.kind&&e.scope.sceneId!==t)throw new Error(`Material asset ${e.id} belongs to scene ${e.scope.sceneId}, not ${t}`)}function W(e){const t=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,a=e=>{var a;const o=null===(a=e.userData)||void 0===a?void 0:a[I];t.has(e.uuid)||t.set(e.uuid,e),r.has(o)||r.set(o,e);let n=i.get(e.uuid);n||i.set(e.uuid,n=/* @__PURE__ */new Map),n.has(o)||n.set(o,e)};for(const o of e)a(o);return{byUuid:t,add:a,bound:(e,t)=>{var r;return null===(r=i.get(e))||void 0===r?void 0:r.get(t)},resolve:(e,t)=>{var a,o;return null!==(a=null===(o=i.get(e))||void 0===o?void 0:o.get(t))&&void 0!==a?a:r.get(t)}}}function B(e){const t=/* @__PURE__ */new Map;return e.forEach((e,r)=>{t.has(e.uuid)||t.set(e.uuid,r)}),t}function Q(e,r){var i,a,o;const n=e.scene,s=null!==(i=n.materials)&&void 0!==i?i:[];let d=W(s);for(const[t,y]of Object.entries(null!==(a=e.materialAliases)&&void 0!==a?a:{})){var l,u,c,f,v;const i=r.get(y.assetId);if(!i)throw new Error(`Missing material asset ${y.assetId} in scene ${e.id}`);let a=d.resolve(t,y.assetId);a||(a={uuid:t,type:i.material.type,userData:{[I]:i.id,[E]:i.revision}},s.push(a),d.add(a),n.materials=s);const o=null!==(l=n.materialAliases)&&void 0!==l?l:n.materialAliases={};if(o[t]&&o[t].materialUuid!==a.uuid)throw new Error(`Conflicting material catalog ${t}`);o[t]={materialUuid:a.uuid,locked:!(!(null===(u=o[t])||void 0===u?void 0:u.locked)&&!y.locked),roles:[.../* @__PURE__ */new Set([...null!==(c=null===(f=o[t])||void 0===f?void 0:f.roles)&&void 0!==c?c:[],...null!==(v=y.roles)&&void 0!==v?v:[]])]}}t(n,e.vis.options),d=W(s);const m={};for(const[t,y]of Object.entries(null!==(o=n.materialAliases)&&void 0!==o?o:{})){var p;const e=d.byUuid.get(y.materialUuid),r=null==e||null===(p=e.userData)||void 0===p?void 0:p[I];r&&(m[t]={assetId:r,locked:!!y.locked})}Object.keys(m).length?e.materialAliases=m:delete e.materialAliases}function X(e){return o(e),Y(b(e))}function Y(e){var t;const r=w(e),i=H(r.materialLibrary),o=new Set(i.keys()),n=null!==(t=r.materialLibrary)&&void 0!==t?t:[];for(const f of r.scenes){var s,d,l;let e;Q(f,i);const t=/* @__PURE__ */new Map;for(const d of null!==(s=f.scene.materials)&&void 0!==s?s:[]){var u;if(t.has(d.uuid))throw new Error(`Duplicate material ${d.uuid} in scene ${f.id}`);t.set(d.uuid,d);let r=null===(u=d.userData)||void 0===u?void 0:u[I];if(void 0===r){var c;r=h(f.id,"material-asset",d.uuid);let t=0;for(;o.has(r);)r=h(f.id,"material-asset",`${d.uuid}:${++t}`);o.add(r);const s={id:r,revision:1,name:d.name||d.uuid,scope:{kind:"scene",sceneId:f.id},material:C(null!==(c=e)&&void 0!==c?c:e=P(f),d.uuid)};n.push(s),i.set(r,s),d.userData=a(a({},d.userData),{},{[I]:r,[E]:1})}if(!i.has(r))throw new Error(`Missing material asset ${r} in scene ${f.id}`);F(i.get(r),f.id)}const r={},v=(e,a,o)=>{var n,s,d;const l=i.get(a.assetId);if(!l)throw new Error(`Missing material asset ${a.assetId} in scene ${f.id}`);const u=t.get(null!=o?o:e),c=(null==u||null===(n=u.userData)||void 0===n?void 0:n._materialAssetId)===a.assetId?u.uuid:null!==(s=null===(d=[...t.values()].find(e=>{var t;return(null===(t=e.userData)||void 0===t?void 0:t._materialAssetId)===a.assetId}))||void 0===d?void 0:d.uuid)&&void 0!==s?s:h(l.id,"material",l.material.uuid),v=r[c];if(v&&v.assetId!==a.assetId)throw new Error(`Conflicting material UUID ${c} in scene ${f.id}`);r[c]={assetId:a.assetId,locked:!(!(null==v?void 0:v.locked)&&!a.locked)},a.locked&&(l.locked=!0)};for(const[i,a]of Object.entries(null!==(d=f.materialAliases)&&void 0!==d?d:{}))v(i,a);for(const[i,a]of Object.entries(null!==(l=f.scene.materialAliases)&&void 0!==l?l:{})){const e=t.get(null==a?void 0:a.materialUuid);if(!i||!e||void 0!==a.locked&&"boolean"!=typeof a.locked)throw new Error(`Invalid runtime material alias ${i} in scene ${f.id}`);v(i,{assetId:e.userData[I],locked:!!a.locked},e.uuid)}Object.keys(r).length?f.materialAliases=r:delete f.materialAliases,delete f.scene.materialAliases}return r.schemaVersion=Math.max(r.schemaVersion,4),r.materialLibrary=n,q(r),r}function Z(e,t=[]){return ae(e,H(t))}function ee(e,t=[]){return oe(e,H(t))}function te(e,t=[]){const r=H(t);return e.map(e=>ae(e,r))}function re(e,t){if(Object.is(e,t))return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t||Array.isArray(e)!==Array.isArray(t))return!1;const r=Object.keys(e);return r.length===Object.keys(t).length&&r.every(r=>Object.hasOwn(t,r)&&re(e[r],t[r]))}function ie(e,t,r,i){const o=H(t),n=H(r);if(o.size!==n.size)throw new Error("Material definition patches cannot add or remove assets");const s=function(e,t){if(void 0===e)return;const r=e=>Array.isArray(e)&&e.every(e=>"string"==typeof e&&!!e)&&new Set(e).size===e.length;if(!e||!r(e.assetIds)||!r(e.properties))throw new Error("Invalid material definition scope");const i=new Set(e.assetIds);if(i.size!==t.length||t.some(e=>!i.has(e)))throw new Error("Material definition scope must match the patched assets");return new Set(e.properties)}(i,[...n.keys()]),d=/* @__PURE__ */new Map,l=/* @__PURE__ */new Set(["uuid","type","metadata","textures","images","nodes","inputNodes","uniforms","userData","name"]),u=e=>null==e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e&&Number.isFinite(e);for(const[a,c]of n){const e=o.get(a);if(!e||!re(e.scope,c.scope)||e.locked!==c.locked)throw new Error("Material definition patches cannot change asset identity, scope or lock");if(e.name!==c.name&&s&&!s.has("name"))throw new Error("Material definition patch exceeds declared properties: name");const t=[];for(const r of/* @__PURE__ */new Set([...Object.keys(e.material),...Object.keys(c.material)]))if(!re(e.material[r],c.material[r])||Object.hasOwn(e.material,r)!==Object.hasOwn(c.material,r)){if(l.has(r)||A(r)||!u(e.material[r])||!u(c.material[r]))throw new Error(`Material definition patch requires full materialization: ${r}`);if(s&&!s.has(r))throw new Error(`Material definition patch exceeds declared properties: ${r}`);t.push(r)}d.set(a,{asset:c,properties:t})}return e.map(e=>{var t;let r=!1;const i=(null!==(t=e.scene.materials)&&void 0!==t?t:[]).map(t=>{var i;const o=d.get(null===(i=t.userData)||void 0===i?void 0:i[I]);if(!o)return t;if(F(o.asset,e.id),"string"!=typeof t.uuid||!t.uuid||t.type!==o.asset.material.type)throw new Error("Material definition patches require normalized scene bindings");r=!0;const n=a(a({},t),{},{name:o.asset.name,userData:a(a({},t.userData),{},{[E]:o.asset.revision})});for(const e of o.properties)Object.hasOwn(o.asset.material,e)?n[e]=o.asset.material[e]:delete n[e];return n});return r?a(a({},e),{},{scene:a(a({},e.scene),{},{materials:i})}):e})}function ae(e,t){return oe(j(e),t)}function oe(e,t){var r,i,o,n,s,d,l;const u=e;Q(e,t);const c=e.scene;delete c.materialAliases;const f=null!==(r=c.materials)&&void 0!==r?r:[],v=W(f),m={};for(const[a,I]of Object.entries(null!==(i=e.materialAliases)&&void 0!==i?i:{})){var p;const e=t.get(I.assetId);if(!e)throw new Error(`Missing material asset ${I.assetId} in scene ${u.id}`);const r=v.resolve(a,I.assetId),i=null!==(p=null==r?void 0:r.uuid)&&void 0!==p?p:h(e.id,"material",e.material.uuid),o=m[i];m[i]={assetId:I.assetId,locked:!(!(null==o?void 0:o.locked)&&!I.locked)}}Object.keys(m).length?e.materialAliases=m:delete e.materialAliases;for(const[a,h]of Object.entries(null!==(o=e.materialAliases)&&void 0!==o?o:{})){if(v.bound(a,h.assetId))continue;const e=t.get(h.assetId);if(!e)throw new Error(`Missing material asset ${h.assetId} in scene ${u.id}`);const r={uuid:a,type:e.material.type,userData:{[I]:e.id,[E]:e.revision}};f.push(r),v.add(r)}f.length&&(c.materials=f);const y=null!==(n=c.textures)&&void 0!==n?n:[],w=null!==(s=c.images)&&void 0!==s?s:[],b=B(y),g=B(w),$=new Set(y.map(e=>e.uuid)),D=/* @__PURE__ */new Map,A=/* @__PURE__ */new Set;for(const a of null!==(d=c.materials)&&void 0!==d?d:[]){var k,S,_;const e=null===(k=a.userData)||void 0===k?void 0:k[I];if(void 0===e)continue;const r=t.get(e);if(!r)throw new Error(`Missing material asset ${e} in scene ${u.id}`);F(r,u.id);for(const t of M(a,$))A.add(t);if(D.has(e))continue;const i=R(r);for(const t of null!==(S=i.images)&&void 0!==S?S:[]){const e=g.get(t.uuid);void 0!==e?w[e]=t:(g.set(t.uuid,w.length),w.push(t))}for(const t of null!==(_=i.textures)&&void 0!==_?_:[]){const e=b.get(t.uuid);$.add(t.uuid),void 0!==e?y[e]=t:(b.set(t.uuid,y.length),y.push(t))}delete i.textures,delete i.images,delete i.metadata,D.set(e,i)}c.materials&&(c.materials=c.materials.map(e=>{var t;const r=D.get(null===(t=e.userData)||void 0===t?void 0:t[I]);return r?a(a({},j(r)),{},{uuid:e.uuid}):e}));const L=/* @__PURE__ */new Set;for(const a of null!==(l=c.materials)&&void 0!==l?l:[])for(const e of M(a,$))L.add(e);O(c.object,e=>{for(const t of["background","environment"])"string"==typeof e[t]&&L.add(e[t])});const x=/* @__PURE__ */new Set,P=y.filter(e=>{if(!A.has(e.uuid)||L.has(e.uuid))return!0;for(const t of[e.image].flat())"string"==typeof t&&x.add(t);return!1}),C=new Set(P.flatMap(e=>[e.image].flat()));return(c.textures||P.length)&&(c.textures=P),(c.images||w.length)&&(c.images=w.filter(e=>!x.has(e.uuid)||C.has(e.uuid))),e}function ne(e){const t=b(e),r=H(t.materialLibrary);return G(t,r),t.scenes=t.scenes.map(e=>ae(e,r)),t}function se(e){const t=w(e),r=H(t.materialLibrary);return G(t,r),t.scenes=t.scenes.map(e=>oe(e,r)),t}function de(e,r={}){var i,o,n;const s=r.consumeInput?e.scene:j(e.scene);if(r.omitPrefabPreviews){const e=t=>{var r,i,a,o,n;return!t||!((null===(r=t.userData)||void 0===r?void 0:r._prefabPreview)||(null===(i=t.userData)||void 0===i||null===(i=i._baseObjectUserData)||void 0===i?void 0:i._prefabPreview)||(null===(a=t.userData)||void 0===a?void 0:a._templatePreviewContainer)||(null===(o=t.userData)||void 0===o||null===(o=o._baseObjectUserData)||void 0===o?void 0:o._templatePreviewContainer)||"@TemplatePreview"===(null===(n=t.userData)||void 0===n?void 0:n._baseObjectKeyType))&&(t.children&&(t.children=t.children.filter(e)),!0)};if(!e(s.object))throw new Error("A scene root cannot be a prefab preview")}const d=new Map((null!==(i=s.materials)&&void 0!==i?i:[]).map(e=>{var t;return[null===(t=e.userData)||void 0===t?void 0:t[I],e.uuid]})),l=new Map((null!==(o=s.materials)&&void 0!==o?o:[]).map(e=>[e.uuid,e])),u=a({},s.materialAliases);for(const[t,a]of Object.entries(null!==(n=e.materialAliases)&&void 0!==n?n:{})){var c,f,v,m,p;const r=(null===(c=l.get(t))||void 0===c||null===(c=c.userData)||void 0===c?void 0:c._materialAssetId)===a.assetId?t:d.get(a.assetId);if(!r)throw new Error(`Missing material for alias ${t} in scene ${e.id}`);if(u[t]&&u[t].materialUuid!==r)throw new Error(`Conflicting material catalog ${t}`);u[t]={materialUuid:r,locked:!(!(null===(f=u[t])||void 0===f?void 0:f.locked)&&!a.locked),roles:[.../* @__PURE__ */new Set([...null!==(v=null===(m=u[t])||void 0===m?void 0:m.roles)&&void 0!==v?v:[],...null!==(p=a.roles)&&void 0!==p?p:[]])]}}return Object.keys(u).length&&(s.materialAliases=u),t(s),s}var le=["scenes","materialLibrary","prefabLibrary"];function ue(e,t=e.entrySceneId,r={}){const i=e.scenes.find(e=>e.id===t);if(!i)throw Error(`Scene ${t} was not found`);if(!r.resolveResources)return i;p(i);const a=structuredClone(i);return e.materialLibrary&&ee(a,e.materialLibrary),a}function ce(e,t){const r=ue(e,t,{resolveResources:!0}),{scenes:i,materialLibrary:o,prefabLibrary:n}=e,s=f(e,le);return a(a(a(a({},structuredClone(s)),n?{prefabLibrary:structuredClone(n)}:{}),o?{materialLibrary:z(r,o,n)}:{}),{},{entrySceneId:r.id,scenes:[a(a({},r),{},{interactions:void 0})]})}var fe=/* @__PURE__ */r({assertRuntimeSceneDocument:()=>we,assertSceneManifest:()=>pe});function ve(e,t){if(void 0===e)return;if(!Array.isArray(e))throw new Error("Invalid prefab library");const r=/* @__PURE__ */new Set,i=/* @__PURE__ */new Set;for(const n of e){var a,o;if(!n||"string"!=typeof n.id||!n.id||r.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(r.add(n.id),void 0!==n.sdkKey){if("string"!=typeof n.sdkKey||!n.sdkKey.trim()||n.sdkKey!==n.sdkKey.trim()||i.has(n.sdkKey))throw new Error("Invalid or duplicate prefab SDK key");i.add(n.sdkKey)}if(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 t;return void 0!==(null==e||null===(t=e.userData)||void 0===t?void 0:t._materialAssetId)}))throw new Error("Embedded prefab materials must not reference the project material library");me(n.snapshot.object),t&&ye(n.snapshot,`prefab ${n.id}`)}for(const n of e)if(void 0!==n.sdkKey&&n.sdkKey!==n.id&&r.has(n.sdkKey))throw new Error("Prefab SDK key conflicts with another asset id")}function me(e){var t;if(e){if(["@Group","@PrefabGroup"].some(t=>{var r,i;return(null===(r=e.userData)||void 0===r?void 0:r._baseObjectKeyType)===t||(null===(i=e.userData)||void 0===i?void 0:i._baseObjectKey)===t}))throw new Error("Legacy object or prefab groups must be imported in editor-platform before runtime loading or export");for(const r of null!==(t=e.children)&&void 0!==t?t:[])me(r)}}function pe(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");c(e.runtimeAssets),u(e.assets),y(e),ve(e.prefabLibrary,!0);const t=/* @__PURE__ */new Set;for(const i of e.scenes){var r;if("string"!=typeof(null==i?void 0:i.id)||!i.id||t.has(i.id)||"string"!=typeof i.name||!i.name||"string"!=typeof(null===(r=i.vis)||void 0===r?void 0:r.type)||!i.vis.type||"string"!=typeof i.source||!i.source)throw new Error("Invalid scene manifest entry");t.add(i.id)}if(!t.has(e.entrySceneId))throw new Error(`Invalid scene manifest: entry scene ${e.entrySceneId} was not found`);q({schemaVersion:6,materialLibrary:e.materialLibrary,prefabLibrary:e.prefabLibrary,scenes:e.scenes.map(e=>a(a({},e),{},{scene:{}}))});for(const i of e.scenes)for(const e of i.interactions||[]){const r="switchScene"===e.action.type||"switchMapRegion"===e.action.type?e.action.sceneId:void 0;if(r&&!t.has(r))throw new Error(`Invalid interaction target ${r} in scene ${i.id}`)}}function ye(e,t){const r=e=>{var i;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 ${t}; 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 ${t}`);for(const t of null!==(i=e.children)&&void 0!==i?i:[])r(t)};r(null==e?void 0:e.object)}function we(e){if(!d(e))throw new Error("Unsupported legacy JSON. Import it in editor-platform and export a vis-scene document first.");if(o(e),c(e.runtimeAssets),!Array.isArray(e.scenes)||0===e.scenes.length)throw new Error("Invalid vis-scene document: scenes must not be empty");y(e),q(e),ve(e.prefabLibrary,!0);const t=/* @__PURE__ */new Set;for(const o of e.scenes){var r;if(void 0!==(null==o?void 0:o.eo))throw new Error("Legacy eo must be migrated in editor-platform before runtime loading");if(void 0!==(null==o?void 0:o.set))throw new Error("Legacy set must be migrated to vis.options.controls in editor-platform before runtime loading");if(!(null==o?void 0:o.id)||t.has(o.id))throw new Error("Invalid vis-scene document: duplicate or empty scene id");if(!(null===(r=o.vis)||void 0===r?void 0:r.type)||!o.scene)throw new Error(`Invalid scene ${o.id}: missing vis or scene graph`);const e=t=>{var r,i,a,o,n,s;if(t){if(!0===(null===(r=t.userData)||void 0===r?void 0:r.prefab)||!0===(null===(i=t.userData)||void 0===i||null===(i=i._baseObjectUserData)||void 0===i?void 0:i.prefab))throw new Error("Legacy prefab sources must be imported in editor-platform before runtime loading or export");if(["@Group","@PrefabGroup"].some(e=>{var r,i;return(null===(r=t.userData)||void 0===r?void 0:r._baseObjectKeyType)===e||(null===(i=t.userData)||void 0===i?void 0:i._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=t.userData)||void 0===a?void 0:a._templatePreviewContainer)||(null===(o=t.userData)||void 0===o||null===(o=o._baseObjectUserData)||void 0===o?void 0:o._templatePreviewContainer)||"@TemplatePreview"===(null===(n=t.userData)||void 0===n?void 0:n._baseObjectKeyType))for(const e of null!==(d=t.children)&&void 0!==d?d:[]){var l,u,c,f;if(!(null===(l=e.userData)||void 0===l?void 0:l._prefabPreview)&&!(null===(u=e.userData)||void 0===u||null===(u=u._baseObjectUserData)||void 0===u?void 0:u._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 r of null!==(s=t.children)&&void 0!==s?s:[])e(r)}};e(o.scene.object),ye(o.scene,`scene ${o.id}`),t.add(o.id)}if(!t.has(e.entrySceneId))throw new Error(`Invalid vis-scene document: entry scene ${e.entrySceneId} was not found`);for(const o of e.scenes){if(void 0!==o.interactions&&!Array.isArray(o.interactions))throw new Error(`Invalid scene ${o.id}: interactions must be an array`);const r=/* @__PURE__ */new Set;for(const d of o.interactions||[]){var i,a,n,s,l,u,f;const c="back"===(null==d||null===(i=d.action)||void 0===i?void 0:i.type)||"backMapRegion"===(null==d||null===(a=d.action)||void 0===a?void 0:a.type)&&"map"===o.vis.type||"switchScene"===(null==d||null===(n=d.action)||void 0===n?void 0:n.type)&&t.has(d.action.sceneId)||"switchMapRegion"===(null==d||null===(s=d.action)||void 0===s?void 0:s.type)&&"map"===o.vis.type&&t.has(d.action.sceneId)&&"map"===ue(e,d.action.sceneId).vis.type&&("clicked"===d.action.adcode||Number.isInteger(d.action.adcode)&&d.action.adcode>=0);if("click"!==(null==d?void 0:d.trigger)&&"clickOutside"!==(null==d?void 0:d.trigger)||"switchMapRegion"===(null==d||null===(l=d.action)||void 0===l?void 0:l.type)&&"click"!==d.trigger||!d.objectId||"clickOutside"===d.trigger&&void 0!==d.filter||void 0!==d.filter&&("include"!==d.filter.mode&&"exclude"!==d.filter.mode||void 0!==d.filter.objectIds&&(!Array.isArray(d.filter.objectIds)||d.filter.objectIds.some(e=>"string"!=typeof e||!e))||void 0!==d.filter.baseObjectTypes&&(!Array.isArray(d.filter.baseObjectTypes)||d.filter.baseObjectTypes.some(e=>"string"!=typeof e||!e))||!(null===(u=d.filter.objectIds)||void 0===u?void 0:u.length)&&!(null===(f=d.filter.baseObjectTypes)||void 0===f?void 0:f.length))||!c||r.has(`${d.trigger}:${d.objectId}`))throw new Error(`Invalid interaction in scene ${o.id}`);r.add(`${d.trigger}:${d.objectId}`)}}}export{L as A,E as C,U as D,K as E,y as F,p as I,b as L,O as M,g as N,R as O,h as P,w as R,I as S,j as T,N as _,ce as a,V as b,ee as c,Z as d,te as f,q as g,F as h,ue as i,_ as j,x as k,ne as l,X as m,pe as n,de as o,Y as p,fe as r,se as s,we as t,ie as u,T as v,$ as w,z as x,J as y};
|