@webspatial/core-sdk 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/iife/index.global.js +3 -3
- package/dist/iife/index.global.js.map +1 -1
- package/dist/index.js +14 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/scene-polyfill.test.ts +60 -0
- package/src/scene-polyfill.ts +15 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @webspatial/core-sdk
|
|
2
2
|
|
|
3
|
+
## 1.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 12085ea: Fix anchor click interception in the scene polyfill when users click nested elements inside an anchor tag, such as images wrapped by links. The polyfill now uses the anchor found during event bubbling so target-based navigation handling still works for `_blank` and other non-`_self` links.
|
|
8
|
+
|
|
3
9
|
## 1.6.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
(function(){
|
|
3
3
|
if(typeof window === 'undefined') return;
|
|
4
4
|
if(!window.__webspatialsdk__) window.__webspatialsdk__ = {}
|
|
5
|
-
window.__webspatialsdk__['core-sdk-version'] = "1.6.
|
|
5
|
+
window.__webspatialsdk__['core-sdk-version'] = "1.6.1"
|
|
6
6
|
})()
|
|
7
7
|
|
|
8
8
|
"use strict";var webspatialCore=(()=>{var qt=Object.defineProperty;var li=Object.getOwnPropertyDescriptor;var pi=Object.getOwnPropertyNames;var ci=Object.prototype.hasOwnProperty;var x=(i,e)=>()=>(i&&(e=i(i=0)),e);var O=(i,e)=>{for(var t in e)qt(i,t,{get:e[t],enumerable:!0})},di=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of pi(e))!ci.call(i,a)&&a!==t&&qt(i,a,{get:()=>e[a],enumerable:!(n=li(e,a))||n.enumerable});return i};var k=i=>di(qt({},"__esModule",{value:!0}),i);var mi,B,Qt=x(()=>{"use strict";mi=typeof window>"u",B=()=>mi});var rt,be=x(()=>{"use strict";rt=class{callJSB(e,t){return Promise.resolve({success:!0,data:void 0,errorCode:void 0,errorMessage:void 0})}callWebSpatialProtocol(e,t,n,a){return Promise.resolve({success:!0,data:void 0,errorCode:void 0,errorMessage:void 0})}callWebSpatialProtocolSync(e,t,n,a,r){return{success:!0,data:void 0,errorCode:void 0,errorMessage:void 0}}}});function u(i){return{success:!0,data:i,errorCode:"",errorMessage:""}}function f(i,e=""){return{success:!1,data:void 0,errorCode:i,errorMessage:e}}var $=x(()=>{"use strict"});var xe={};O(xe,{PuppeteerPlatform:()=>Kt});var Kt,Ee=x(()=>{"use strict";$();console.log("PuppeteerPlatform");Kt=class{iframeRegistry=new Map;constructor(){}callJSB(e,t){return new Promise(n=>{try{if(window.__handleJSBMessage)try{console.log(` core-sdk Puppeteer Platform: callJSB: ${e}::${t}`);let a=window.__handleJSBMessage(`${e}::${t}`);console.log(` core-sdk Puppeteer Platform callJSB result: ${a}`),n(u(a))}catch{n(f("500","JSB execution error"))}else n(u("ok"))}catch(a){console.error(`PuppeteerPlatform cmd Error: ${e}, msg: ${t} error: ${a}`),n(f("500","Internal error"))}})}createSpatializedElementSync(e,t){try{console.log(`[Puppeteer Platform] Creating spatialized element sync with id: ${e}, url: ${t}`);let n=window;if(n.__handleJSBMessage){let a={id:e,url:t};n.__handleJSBMessage(`CreateSpatialized2DElement::${JSON.stringify(a)}`)}}catch(n){console.error("Error creating spatialized element sync:",n)}}callWebSpatialProtocol(e,t,n,a){return console.log(`PuppeteerPlatform: Calling webspatial protocol: webspatial://${e}${t?`?${t}`:""}`),new Promise(r=>{try{let o=`webspatial://${e}${t?`?${t}`:""}`,{spatialId:s,iframe:l,windowProxy:d}=this.createIframeWindow(o,n,a);e==="createSpatialized2DElement"&&this.createSpatializedElementSync(s,o),console.log(`[Puppeteer Platform] iframe created with spatialId: ${s}`),this.iframeRegistry.set(s,l),r(u({windowProxy:d,id:s}))}catch(o){console.error("Error calling webspatial protocol:",o),r(f("500","Failed to call webspatial protocol"))}})}callWebSpatialProtocolSync(e,t,n,a){try{let r=`webspatial://${e}${t?`?${t}`:""}`;console.log(`Calling webspatial protocol sync: ${r}`);let{spatialId:o,iframe:s,windowProxy:l}=this.createIframeWindow(r,n,a);return e==="createSpatialized2DElement"&&this.createSpatializedElementSync(o,r),this.iframeRegistry.set(o,s),u({windowProxy:l,id:o})}catch(r){return console.error("Error calling webspatial protocol sync:",r),f("500","Failed to call webspatial protocol sync")}}createIframeWindow(e,t,n){let a=document.createElement("iframe");a.style.border="none",a.style.display="none",a.style.width="100%",a.style.height="100%";let r=this.generateUUID();a.spatialId=r,a.id=`spatial-iframe-${r}`;let o=this.parseFeatures(n||"");o.width&&(a.style.width=o.width),o.height&&(a.style.height=o.height),o.left&&(a.style.left=o.left,a.style.position="absolute"),o.top&&(a.style.top=o.top,a.style.position="absolute"),document.body.appendChild(a);let s=this.createEnhancedWindowProxy(a,e,r);return a.src="about:blank",console.log(`PuppeteerPlatform created iframe window with spatialId: ${r}, URL: ${e}`),this.initializeIframeContent(a,e,r),{spatialId:r,iframe:a,windowProxy:s}}createEnhancedWindowProxy(e,t,n){return{location:{href:t,toString:()=>t,reload:()=>{e.contentWindow&&e.contentWindow.location.reload()}},navigator:{userAgent:`Mozilla/5.0 (WebKit) SpatialId/${n}`},close:()=>{console.log(`Closing iframe with spatialId: ${n}`),e.remove(),this.iframeRegistry.delete(n)},document:e.contentDocument||{},contentWindow:e.contentWindow||{},postMessage:(a,r)=>{e.contentWindow&&e.contentWindow.postMessage(a,r||"*")},addEventListener:(a,r)=>{e.contentWindow&&e.contentWindow.addEventListener(a,r)},removeEventListener:(a,r)=>{e.contentWindow&&e.contentWindow.removeEventListener(a,r)},executeScript:a=>{if(e.contentWindow)try{return e.contentWindow.eval(a)}catch(r){return console.error(`Error executing script in iframe ${n}:`,r),null}return null},getIframe:()=>e,getSpatialId:()=>n}}initializeIframeContent(e,t,n){try{e.onload=()=>{try{let a=`
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
<script>${a}</script>
|
|
71
71
|
</body>
|
|
72
72
|
</html>
|
|
73
|
-
`),r.close())}catch(a){console.error("Error initializing iframe content:",a)}}}catch(a){console.error("Error setting up iframe:",a)}}parseFeatures(e){let t={};return e.split(",").forEach(a=>{let[r,o]=a.split("=").map(s=>s.trim());r&&o&&(t[r]=o)}),t}sendMessageToIframe(e,t){let n=this.iframeRegistry.get(e);return n&&n.contentWindow?(n.contentWindow.postMessage(t,window.location.origin),!0):!1}getAllActiveIframes(){let e=[];return this.iframeRegistry.forEach((t,n)=>{e.push({spatialId:n,iframe:t})}),e}dispose(){this.iframeRegistry.forEach((e,t)=>{console.log(`Disposing iframe with spatialId: ${t}`),e.remove()}),this.iframeRegistry.clear()}generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16).toUpperCase()})}}});var c,P=x(()=>{"use strict";c=class i{static eventReceiver={};static init(){window.__SpatialWebEvent=({id:e,data:t})=>{i.eventReceiver[e]?.(t)}}static addEventReceiver(e,t){i.eventReceiver[e]=t}static removeEventReceiver(e){delete i.eventReceiver[e]}}});var ve={};O(ve,{PicoOSPlatform:()=>Yt});function we(){return Zt=(Zt+1)%ui,`rId_${Zt}`}var Zt,ui,Yt,Pe=x(()=>{"use strict";$();P();Zt=0,ui=1e5;Yt=class{async callJSB(e,t){return new Promise((n,a)=>{try{let r=we();c.addEventReceiver(r,s=>{if(c.removeEventReceiver(r),s.success)n(u(s.data));else{let{code:l,message:d}=s.data;n(f(l,d))}});let o=window.webspatialBridge.postMessage(r,e,t);if(o!==""){c.removeEventReceiver(r);let s=JSON.parse(o);if(s.success)n(u(s.data));else{let{code:l,message:d}=s.data;n(f(l,d))}}}catch(r){console.error(`SwanPlatform cmd: ${e}, msg: ${t} error: ${r}`);let{code:o,message:s}=r;n(f(o,s))}})}async callWebSpatialProtocol(e,t,n,a){return new Promise((r,o)=>{let s=we();try{let l=null;c.addEventReceiver(s,d=>{r(u({windowProxy:l,id:d.spatialId})),c.removeEventReceiver(s)}),l=this.openWindow(e,"rid="+s,n,a).windowProxy}catch(l){let{code:d,message:h}=l;c.removeEventReceiver(s),r(f(d,h))}})}callWebSpatialProtocolSync(e,t,n,a){let{spatialId:r="",windowProxy:o}=this.openWindow(e,t,n,a);return u({windowProxy:o,id:r})}openWindow(e,t,n,a){return{spatialId:"",windowProxy:window.open(`webspatial://${e}?${t||""}`,n,a)}}}});var Me={};O(Me,{AndroidPlatform:()=>ie});function Si(){return ee=(ee+1)%yi,`rId_${ee}`}var te,ee,yi,ie,Re=x(()=>{"use strict";$();S();P();te=0,ee=0,yi=1e5;ie=class{async callJSB(e,t){return new Promise((n,a)=>{try{let r=Si();c.addEventReceiver(r,s=>{if(c.removeEventReceiver(r),s.success)n(u(s.data));else{let{code:l,message:d}=s.data;n(f(l,d))}});let o=window.webspatialBridge.postMessage(r,e,t);if(o!==""){c.removeEventReceiver(r);let s=JSON.parse(o);if(s.success)n(u(s.data));else{let{code:l,message:d}=s.data;n(f(l,d))}}}catch(r){console.error(`AndroidPlatform cmd: ${e}, msg: ${t} error: ${r}`);let{code:o,message:s}=r;n(f(o,s))}})}async callWebSpatialProtocol(e,t,n,a){await new Promise(l=>setTimeout(l,16*te)),te++;let r=await new F().execute();for(;!r.data.can;)await new Promise(l=>setTimeout(l,16)),r=await new F().execute();let{windowProxy:o}=this.openWindow(e,t,n,a);for(;!o?.open;)await new Promise(l=>setTimeout(l,16));for(o?.open("about:blank","_self");!o?.__SpatialId;)await new Promise(l=>setTimeout(l,16));let s=o?.__SpatialId;return te--,Promise.resolve(u({windowProxy:o,id:s}))}callWebSpatialProtocolSync(e,t,n,a){let{spatialId:r="",windowProxy:o}=this.openWindow(e,t,n,a);return u({windowProxy:o,id:r})}openWindow(e,t,n,a){return{spatialId:"",windowProxy:window.open(`webspatial://${e}?${t||""}`,n,a)}}}});var Ce={};O(Ce,{VisionOSPlatform:()=>ne});var ne,De=x(()=>{"use strict";$();ne=class{async callJSB(e,t){try{let n=await window.webkit.messageHandlers.bridge.postMessage(`${e}::${t}`);return u(n)}catch(n){let{code:a,message:r}=JSON.parse(n.message);return f(a,r)}}callWebSpatialProtocol(e,t,n,a){let{spatialId:r,windowProxy:o}=this.openWindow(e,t,n,a);return Promise.resolve(u({windowProxy:o,id:r}))}callWebSpatialProtocolSync(e,t,n,a){let{spatialId:r="",windowProxy:o}=this.openWindow(e,t,n,a);return u({windowProxy:o,id:r})}openWindow(e,t,n,a){let r=window.open(`webspatial://${e}?${t||""}`,n,a);return{spatialId:r?.navigator.userAgent?.match(/\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\b/gi)?.[0],windowProxy:r}}}});function fi(i){let e=i.match(/WebSpatial\/(\d+)\.(\d+)\.(\d+)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function gi(i,e){if(!i)return!1;for(let t=0;t<3;t+=1){let n=i[t]-e[t];if(n>0)return!0;if(n<0)return!1}return!1}function Te(){if(B())return new rt;let i=window.navigator.userAgent,e=fi(i);if(window.navigator.userAgent.includes("Puppeteer")){let t=(Ee(),k(xe)).PuppeteerPlatform;return new t}else if(i.includes("PicoWebApp")&&gi(e,[0,0,1])){let t=(Pe(),k(ve)).PicoOSPlatform;return new t}else if(i.includes("Android")||i.includes("Linux")){let t=(Re(),k(Me)).AndroidPlatform;return new t}else{let t=(De(),k(Ce)).VisionOSPlatform;return new t}}var Oe=x(()=>{"use strict";Qt();be()});function ot(i,e){return i===""?0:i.endsWith("%")?e*parseFloat(i)/100:parseFloat(i)}function ze(i){let e=parseFloat(i.getPropertyValue("width")),t=i.getPropertyValue("border-top-left-radius"),n=i.getPropertyValue("border-top-right-radius"),a=i.getPropertyValue("border-bottom-left-radius"),r=i.getPropertyValue("border-bottom-right-radius");return{topLeading:ot(t,e),bottomLeading:ot(a,e),topTrailing:ot(n,e),bottomTrailing:ot(r,e)}}function Ae(i,e,t){let{x:n,y:a,z:r}=i,{x:o,y:s,z:l}=e,{x:d,y:h,z:G}=t,b=new DOMMatrix;return b=b.translate(n,a,r),b=b.rotate(o,s,l),b=b.scale(d,h,G),b}function M(i){let e=globalThis.structuredClone;if(typeof e=="function")try{return e(i)}catch{}return JSON.parse(JSON.stringify(i))}var st=x(()=>{"use strict"});var ae,p,lt,pt,ct,dt,mt,ut,R,yt,St,ft,gt,ht,bt,xt,Et,wt,vt,Pt,Mt,Rt,Ct,Dt,Tt,Ot,zt,D,At,It,Wt,_t,Vt,Ut,F,j,Gt,Lt,kt,Bt,$t,S=x(()=>{"use strict";Oe();st();ae=Te(),p=class{commandType="";async execute(){let e=this.getParams(),t=e?JSON.stringify(e):"";return ae.callJSB(this.commandType,t)}},lt=class extends p{constructor(t,n){super();this.entity=t;this.properties=n}commandType="UpdateEntityProperties";getParams(){let t=Ae(this.properties.position??this.entity.position,this.properties.rotation??this.entity.rotation,this.properties.scale??this.entity.scale).toFloat64Array();return{entityId:this.entity.id,transform:t}}},pt=class extends p{constructor(t,n,a){super();this.entity=t;this.type=n;this.isEnable=a}commandType="UpdateEntityEvent";getParams(){return{type:this.type,entityId:this.entity.id,isEnable:this.isEnable}}},ct=class extends p{properties;commandType="UpdateSpatialSceneProperties";constructor(e){super(),this.properties=e}getParams(){return this.properties}},dt=class extends p{config;commandType="UpdateSceneConfig";constructor(e){super(),this.config=e}getParams(){return{config:this.config}}},mt=class extends p{constructor(t){super();this.id=t}commandType="FocusScene";getParams(){return{id:this.id}}},ut=class extends p{commandType="GetSpatialSceneState";constructor(){super()}getParams(){return{}}},R=class extends p{constructor(t){super();this.spatialObject=t}getParams(){let t=this.getExtraParams();return{id:this.spatialObject.id,...t}}},yt=class extends R{properties;commandType="UpdateSpatialized2DElementProperties";constructor(e,t){super(e),this.properties=t}getExtraParams(){return this.properties}},St=class extends R{properties;commandType="UpdateSpatializedDynamic3DElementProperties";constructor(e,t){super(e),this.properties=t}getExtraParams(){return{id:this.spatialObject.id,...this.properties}}},ft=class extends R{properties;commandType="UpdateUnlitMaterialProperties";constructor(e,t){super(e),this.properties=t}getExtraParams(){return this.properties}},gt=class extends R{matrix;commandType="UpdateSpatializedElementTransform";constructor(e,t){super(e),this.matrix=t}getExtraParams(){return{matrix:Array.from(this.matrix.toFloat64Array())}}},ht=class extends R{properties;commandType="UpdateSpatializedStatic3DElementProperties";constructor(e,t){super(e),this.properties=t}getExtraParams(){return this.properties}},bt=class extends R{commandType="AddSpatializedElementToSpatialized2DElement";spatializedElement;constructor(e,t){super(e),this.spatializedElement=t}getExtraParams(){return{spatializedElementId:this.spatializedElement.id}}},xt=class extends p{commandType="AddSpatializedElementToSpatialScene";spatializedElement;constructor(e){super(),this.spatializedElement=e}getParams(){return{spatializedElementId:this.spatializedElement.id}}},Et=class extends p{constructor(t,n){super();this.modelURL=t;this.sources=n;this.modelURL=t,this.sources=n}commandType="CreateSpatializedStatic3DElement";getParams(){return{modelURL:this.modelURL,sources:this.sources}}},wt=class extends p{getParams(){return{test:!0}}commandType="CreateSpatializedDynamic3DElement"},vt=class extends p{constructor(t){super();this.name=t}getParams(){return{name:this.name}}commandType="CreateSpatialEntity"},Pt=class extends p{constructor(t){super();this.options=t}getParams(){let t=this.options.mesh.id,n=this.options.materials.map(a=>a.id);return{geometryId:t,materialIds:n}}commandType="CreateModelComponent"},Mt=class extends p{constructor(t){super();this.options=t}getParams(){return this.options}commandType="CreateSpatialModelEntity"},Rt=class extends p{constructor(t){super();this.options=t}getParams(){return{url:this.options.url}}commandType="CreateModelAsset"},Ct=class extends p{constructor(t,n={}){super();this.type=t;this.options=n}getParams(){return{type:this.type,...this.options}}commandType="CreateGeometry"},Dt=class extends p{constructor(t){super();this.options=t}getParams(){return this.options}commandType="CreateUnlitMaterial"},Tt=class extends p{constructor(t,n){super();this.entity=t;this.comp=n}getParams(){return{entityId:this.entity.id,componentId:this.comp.id}}commandType="AddComponentToEntity"},Ot=class extends p{constructor(t,n){super();this.entity=t;this.comp=n}getParams(){return{entityId:this.entity.id,componentId:this.comp.id}}commandType="RemoveComponentFromEntity"},zt=class extends p{constructor(t,n){super();this.entityId=t;this.materials=n}getParams(){return{entityId:this.entityId,materialIds:this.materials.map(t=>t.id)}}commandType="SetMaterialsOnEntity"},D=class extends p{constructor(t,n){super();this.childId=t;this.parentId=n}getParams(){return{childId:this.childId,parentId:this.parentId}}commandType="SetParentToEntity"},At=class extends p{constructor(t,n,a){super();this.fromEntityId=t;this.toEntityId=n;this.fromPosition=a}getParams(){return{fromEntityId:this.fromEntityId,toEntityId:this.toEntityId,position:this.fromPosition}}commandType="ConvertFromEntityToEntity"},It=class extends p{constructor(t,n){super();this.fromEntityId=t;this.position=n}getParams(){return{fromEntityId:this.fromEntityId,position:this.position}}commandType="ConvertFromEntityToScene"},Wt=class extends p{constructor(t,n){super();this.entityId=t;this.position=n}getParams(){return{entityId:this.entityId,position:this.position}}commandType="ConvertFromSceneToEntity"},_t=class extends p{constructor(t,n,a){super();this.position=t;this.fromId=n;this.toId=a}getParams(){return{position:this.position,fromId:this.fromId,toId:this.toId}}commandType="ConvertCoordinate"},Vt=class extends p{constructor(t=""){super();this.id=t}commandType="Inspect";getParams(){return this.id?{id:this.id}:{id:""}}},Ut=class extends p{constructor(t){super();this.id=t}commandType="Destroy";getParams(){return{id:this.id}}},F=class extends p{constructor(t=""){super();this.id=t}commandType="CheckWebViewCanCreate";getParams(){return{id:this.id}}},j=class extends p{target;features;async execute(){let e=this.getQuery();return ae.callWebSpatialProtocol(this.commandType,e,this.target,this.features)}executeSync(){let e=this.getQuery();return ae.callWebSpatialProtocolSync(this.commandType,e,this.target,this.features)}getQuery(){let e,t=this.getParams();return t&&(e=Object.keys(t).map(n=>{let a=t[n],r=typeof a=="object"?JSON.stringify(a):a;return`${n}=${encodeURIComponent(r)}`}).join("&")),e}},Gt=class extends j{commandType="createSpatialized2DElement";constructor(){super()}getParams(){return{}}},Lt=class extends j{constructor(t,n,a,r){super();this.url=t;this.config=n;this.target=a;this.features=r}commandType="createSpatialScene";getParams(){return{url:this.url,config:this.config}}},kt=class extends j{constructor(t){super();this.options=t}commandType="createAttachment";getParams(){return{}}},Bt=class extends p{constructor(t,n){super();this.attachmentId=t;this.options=n}commandType="InitializeAttachment";getParams(){return{id:this.attachmentId,parentEntityId:this.options.parentEntityId,position:this.options.position??[0,0,0],size:this.options.size,ownerViewId:this.options.ownerViewId}}},$t=class extends p{constructor(t,n){super();this.attachmentId=t;this.options=n}commandType="UpdateAttachmentEntity";getParams(){return{id:this.attachmentId,...this.options}}}});var zi={};O(zi,{Attachment:()=>Ft,BaseplateVisibilityValues:()=>We,CubeInfo:()=>oe,ModelComponent:()=>Q,PhysicalMetrics:()=>Se,Spatial:()=>U,SpatialBoxGeometry:()=>tt,SpatialComponent:()=>q,SpatialConeGeometry:()=>at,SpatialCylinderGeometry:()=>it,SpatialEntity:()=>T,SpatialGeometry:()=>g,SpatialMaterial:()=>K,SpatialModelAsset:()=>Y,SpatialModelEntity:()=>X,SpatialObject:()=>m,SpatialPlaneGeometry:()=>nt,SpatialScene:()=>v,SpatialSceneState:()=>de,SpatialSceneValues:()=>Ue,SpatialSession:()=>V,SpatialSphereGeometry:()=>et,SpatialUnlitMaterial:()=>Z,Spatialized2DElement:()=>A,SpatializedDynamic3DElement:()=>W,SpatializedElement:()=>w,SpatializedElementType:()=>Ie,SpatializedStatic3DElement:()=>I,WorldAlignmentValues:()=>Ve,WorldScalingValues:()=>_e,createAttachmentEntity:()=>he,isSSREnv:()=>B,isValidBaseplateVisibilityType:()=>se,isValidSceneUnit:()=>z,isValidSpatialSceneType:()=>ce,isValidWorldAlignmentType:()=>pe,isValidWorldScalingType:()=>le});S();var m=class{constructor(e){this.id=e}name;isDestroyed=!1;async inspect(){let e=await new Vt(this.id).execute();if(e.success)return e.data;throw new Error(e.errorMessage)}async destroy(){if(this.isDestroyed)return;let e=await new Ut(this.id).execute();if(e.success)return this.onDestroy(),this.isDestroyed=!0,e.data;if(this.isDestroyed)return;throw new Error(e.errorMessage)}onDestroy(){}};S();S();S();var re,v=class i extends m{static getInstance(){return re||(re=new i("")),re}async convertCoordinate(e,t,n){try{return(await new _t(e,t,n).execute())?.data??e}catch(a){throw console.warn("SpatialScene.convertCoordinate error:",a),a}}async updateSpatialProperties(e){return new ct(e).execute()}async addSpatializedElement(e){return new xt(e).execute()}async updateSceneCreationConfig(e){return new dt(e).execute()}async getState(){return(await new ut().execute()).data.name}};var Ie=(n=>(n[n.Spatialized2DElement=0]="Spatialized2DElement",n[n.SpatializedStatic3DElement=1]="SpatializedStatic3DElement",n[n.SpatializedDynamic3DElement=2]="SpatializedDynamic3DElement",n))(Ie||{}),We=["automatic","visible","hidden"];function se(i){return We.includes(i)}var _e=["automatic","dynamic"];function le(i){return _e.includes(i)}var Ve=["adaptive","automatic","gravityAligned"];function pe(i){return Ve.includes(i)}var Ue=["window","volume"];function ce(i){return Ue.includes(i)}function z(i){if(typeof i=="number")return i>=0;if(typeof i=="string"){if(i.endsWith("px"))return isNaN(Number(i.slice(0,-2)))?!1:Number(i.slice(0,-2))>=0;if(i.endsWith("m"))return isNaN(Number(i.slice(0,-1)))?!1:Number(i.slice(0,-1))>=0}return!1}var de=(r=>(r.idle="idle",r.pending="pending",r.willVisible="willVisible",r.visible="visible",r.fail="fail",r))(de||{}),oe=class{constructor(e,t){this.size=e;this.origin=t;this.size=e,this.origin=t}get x(){return this.origin.x}get y(){return this.origin.y}get z(){return this.origin.z}get width(){return this.size.width}get height(){return this.size.height}get depth(){return this.size.depth}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get back(){return this.z}get front(){return this.z+this.depth}};st();var Se={};O(Se,{getValue:()=>hi,physicalToPoint:()=>ue,pointToPhysical:()=>me,subscribe:()=>bi});P();var E={meterToPtUnscaled:1360,meterToPtScaled:1360};function Ge(i){return i?.worldScalingCompensation??"scaled"}function me(i,e){return ye(),Ge(e)==="unscaled"?i/E.meterToPtUnscaled:i/E.meterToPtScaled}function ue(i,e){return ye(),Ge(e)==="unscaled"?i*E.meterToPtUnscaled:i*E.meterToPtScaled}function ye(){if(typeof window>"u")return;let i=window.__webspatialsdk__?.physicalMetrics;if(!i)return;let e={meterToPtScaled:i.meterToPtScaled??E.meterToPtScaled,meterToPtUnscaled:i.meterToPtUnscaled??E.meterToPtUnscaled};(e.meterToPtScaled!==E.meterToPtScaled||e.meterToPtUnscaled!==E.meterToPtUnscaled)&&(E=e)}function hi(){return ye(),E}function bi(i){if(typeof window>"u")return()=>{};let e=()=>{i()};return c.addEventReceiver("window",e),()=>{c.removeEventReceiver("window")}}var Fe={defaultSize:{width:1280,height:720}},je={defaultSize:{width:"0.94m",height:"0.94m",depth:"0.94m"}},Je={...Fe},Ne={...je},xi="webspatial://";function J(i,e){if(!e)return{...i||{}};let t={...i||{}};for(let n of Object.keys(e)){let a=t[n],r=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&a&&typeof a=="object"&&!Array.isArray(a)?t[n]=J(a,r):t[n]=r}return t}function Le(i){let e={...i||{}},t=i.defaultSize!==void 0?i.defaultSize:i.default_size;return t!==void 0&&(e.defaultSize=t),"default_size"in e&&delete e.default_size,e}var H=class i{originalOpen;static instance;manifestReady=null;static getInstance(){return i.instance||(i.instance=new i),i.instance}init(e){this.manifestReady=this.setupManifest(),this.originalOpen=e.open.bind(e),e.open=this.open}configMap={};callbackReturnMap={};getConfig(e){if(!(e===void 0||!this.configMap[e]))return this.configMap[e]}waitManifest(){return this.manifestReady??Promise.resolve()}ensureAbsoluteUrl(e){if(!e||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e))return e;if(e.startsWith("//"))return`${window.location.protocol}${e}`;try{return new URL(e,document.baseURI).toString()}catch{return e}}async setupManifest(){let e=await this.getPWAManifest();try{let t=e?.xr_spatial_scene;if(!t||typeof t!="object")return;let{overrides:n,...a}=t,r=J(a,n?.window_scene),o=J(a,n?.volume_scene),s=Le(r),l=Le(o);s&&Object.keys(s).length>0&&(Je=s),l&&Object.keys(l).length>0&&(Ne=l)}catch(t){console.warn("SceneManager.setupManifest failed; using built-in defaults.",t?.message||t)}}open=(e,t,n)=>{if(e?.startsWith(xi)){if(e.includes("createSpatialized2DElement")||e.includes("createAttachment")){let l=(window.webSpatial||window.__webspatialShell__)?.genToken?.();if(l){let d=e.includes("createAttachment")?"createAttachment":"createSpatialized2DElement",h=window.location.host,b=`${window.location.protocol}//${h}/${l}/?command=${d}`,L=new URL(e).searchParams.get("rid"),Xt=new URL(b);return L&&Xt.searchParams.set("rid",L),this.originalOpen(Xt.toString(),t,n)}}return this.originalOpen(e,t,n)}if(e=this.ensureAbsoluteUrl(e),t==="_self"||t==="_parent"||t==="_top")return this.originalOpen(e,t,n);let a=t?this.getConfig(t):void 0;if(a===void 0){let l=M(N("window")),[d]=fe(l,"window");a={...d,type:"window"}}let o=new Lt(e,a,t,n).executeSync(),s=o.data?.id;return s&&new mt(s).execute(),o.data?.windowProxy};initScene(e,t,n){let a=n?.type??"window",r=N(a),o=this.callbackReturnMap[e]??M(r),s=t(o),l=Ei(M(s)),d=M(l),h=M(N(a)),G=J(h,d),[b,L]=fe(G,a);L.length>0&&console.warn(`initScene ${e} with errors: ${L.join(", ")}`),this.callbackReturnMap[e]=l,this.configMap[e]={...b,type:a}}async getPWAManifest(e){let t=e;if(!t){let n=document.querySelector('link[rel="manifest"]');t=n?.getAttribute("href")||n?.href}if(t&&(t=this.ensureAbsoluteUrl(t),!!t)){if(t.startsWith("data:"))try{let n=t.indexOf(",");if(n<0)return;let a=t.slice(5,n),r=t.slice(n+1),s=/;base64/i.test(a)?atob(r):decodeURIComponent(r);return JSON.parse(s)}catch{return}try{let n=await fetch(t,{credentials:"same-origin"});if(!n.ok)throw new Error(String(n.status));try{return await n.json()}catch{let a=await n.text();return JSON.parse(a)}}catch{try{let n=await fetch(t);if(!n.ok)return;try{return await n.json()}catch{let a=await n.text();return JSON.parse(a)}}catch{return}}}}};function Ei(i){if(i?.defaultSize){let e=["width","height","depth"];for(let t of e)t in i.defaultSize&&!z(i.defaultSize[t])&&delete i.defaultSize[t]}if(i?.resizability){let e=["minWidth","minHeight","maxWidth","maxHeight"];for(let t of e)t in i.resizability&&!z(i.resizability[t])&&delete i.resizability[t]}return i}function ke(i){return me(i)}function Be(i){return ue(i)}function $e(i,e,t){if(typeof i=="number")return t==="px"&&e==="px"||t==="m"&&e==="m"?i:t==="px"&&e==="m"?ke(i):t==="m"&&e==="px"?Be(i):i;if(e==="m"){if(i.endsWith("m"))return Number(i.slice(0,-1));if(i.endsWith("px"))return ke(Number(i.slice(0,-2)));throw new Error("formatToNumber: invalid str")}else if(e==="px"){if(i.endsWith("px"))return Number(i.slice(0,-2));if(i.endsWith("m"))return Be(Number(i.slice(0,-1)));throw new Error("formatToNumber: invalid str")}else throw new Error("formatToNumber: invalid targetUnit")}function fe(i,e){let t=N(e),n=[],a=e==="window";if(ce(e)||n.push("sceneType"),i.defaultSize){let r=["width","height","depth"];for(let o of r)o in i.defaultSize&&(z(i.defaultSize[o])?i.defaultSize[o]=$e(i.defaultSize[o],a?"px":"m","px"):(delete i.defaultSize[o],n.push(`defaultSize.${o}`)))}if(i.resizability){let r=["minWidth","minHeight","maxWidth","maxHeight"];for(let o of r)o in i.resizability&&(z(i.resizability[o])?i.resizability[o]=$e(i.resizability[o],"px","px"):(delete i.resizability[o],n.push(`resizability.${o}`)))}return i.worldScaling&&(le(i.worldScaling)||(i.worldScaling="automatic",n.push("worldScaling"))),i.worldAlignment&&(pe(i.worldAlignment)||(i.worldAlignment="automatic",n.push("worldAlignment"))),i.baseplateVisibility&&(se(i.baseplateVisibility)||(i.baseplateVisibility="automatic",n.push("baseplateVisibility"))),[i,n]}function He(i,e,t){return H.getInstance().initScene(i,e,t)}function wi(i){H.getInstance().init(i)}function ge(i){i.document.onclick=function(e){let t=e.target,n=!1;for(;!n;){if(t&&t.tagName=="A")return!vi(e);if(t&&t.parentElement)t=t.parentElement;else break}}}function vi(i){let e=i.target;if(e.tagName==="A"){let t=e,n=t.target,a=t.href;if(n&&n!=="_self")return i.preventDefault(),window.open(a,n),!0}}function N(i){return i==="window"?Je||Fe:Ne||je}async function Pi(){if(!window.opener||await v.getInstance().getState()!=="pending")return;function e(t){document.readyState==="interactive"||document.readyState==="complete"?t():document.addEventListener("DOMContentLoaded",t)}e(async()=>{await H.getInstance().waitManifest();let t=window.xrCurrentSceneType??"window",n=N(t),a=M(n),r=a;if(typeof window.xrCurrentSceneDefaults=="function")try{r=await window.xrCurrentSceneDefaults?.(a)}catch(h){console.error(h)}await new Promise((h,G)=>{setTimeout(()=>{h(null)},1e3)});let o=J(M(n),r),[s,l]=fe(o,t);l.length>0&&console.warn(`window.xrCurrentSceneDefaults with errors: ${l.join(", ")}`);let d={...s,type:t};await v.getInstance().updateSceneCreationConfig(d)})}function Xe(){wi(window),ge(window),Pi()}S();S();S();P();function y(i,e){return new CustomEvent(i,{bubbles:!0,cancelable:!1,detail:e})}var w=class extends m{constructor(t){super(t);this.id=t;c.addEventReceiver(t,this.onReceiveEvent.bind(this))}async updateTransform(t){return new gt(this,t).execute()}_cubeInfo;get cubeInfo(){return this._cubeInfo}_transform;_transformInv;get transform(){return this._transform}get transformInv(){return this._transformInv}onReceiveEvent(t){let{type:n}=t;if(n==="objectdestroy")this.isDestroyed=!0;else if(n==="spatialtap"){let a=y("spatialtap",t.detail);this._onSpatialTap?.(a)}else if(n==="spatialdragstart"){let a=y("spatialdragstart",t.detail);this._onSpatialDragStart?.(a)}else if(n==="spatialdrag"){let a=y("spatialdrag",t.detail);this._onSpatialDrag?.(a)}else if(n==="spatialdragend"){let a=y("spatialdragend",t.detail);this._onSpatialDragEnd?.(a)}else if(n==="spatialrotate"){let a=y("spatialrotate",t.detail);this._onSpatialRotate?.(a)}else if(n==="spatialrotateend"){let a=y("spatialrotateend",t.detail);this._onSpatialRotateEnd?.(a)}else if(n==="spatialmagnify"){let a=y("spatialmagnify",t.detail);this._onSpatialMagnify?.(a)}else if(n==="spatialmagnifyend"){let a=y("spatialmagnifyend",t.detail);this._onSpatialMagnifyEnd?.(a)}}_onSpatialTap;set onSpatialTap(t){this._onSpatialTap=t,this.updateProperties({enableTapGesture:t!==void 0})}_onSpatialDragStart;set onSpatialDragStart(t){this._onSpatialDragStart=t,this.updateProperties({enableDragStartGesture:this._onSpatialDragStart!==void 0})}_onSpatialDrag;set onSpatialDrag(t){this._onSpatialDrag=t,this.updateProperties({enableDragGesture:this._onSpatialDrag!==void 0})}_onSpatialDragEnd;set onSpatialDragEnd(t){this._onSpatialDragEnd=t,this.updateProperties({enableDragEndGesture:t!==void 0})}_onSpatialRotate;set onSpatialRotate(t){this._onSpatialRotate=t,this.updateProperties({enableRotateGesture:this._onSpatialRotate!==void 0})}_onSpatialRotateEnd;set onSpatialRotateEnd(t){this._onSpatialRotateEnd=t,this.updateProperties({enableRotateEndGesture:t!==void 0})}_onSpatialMagnify;set onSpatialMagnify(t){this._onSpatialMagnify=t,this.updateProperties({enableMagnifyGesture:t!==void 0})}_onSpatialMagnifyEnd;set onSpatialMagnifyEnd(t){this._onSpatialMagnifyEnd=t,this.updateProperties({enableMagnifyEndGesture:t!==void 0})}onDestroy(){c.removeEventReceiver(this.id)}};var A=class extends w{constructor(t,n){super(t);this.windowProxy=n;ge(n)}async updateProperties(t){return new yt(this,t).execute()}async addSpatializedElement(t){return new bt(this,t).execute()}};S();var I=class extends w{constructor(e,t,n){super(e),this.modelURL=t,this.sources=n}_readyResolve;modelURL;sources;_currentSrc="";get currentSrc(){return this._currentSrc}createReadyPromise(){return this._readyResolve?.(!1),new Promise(e=>{this._readyResolve=e})}ready=this.createReadyPromise();async updateProperties(e){let t=!1;if(e.modelURL!==void 0&&this.modelURL!==e.modelURL&&(this.modelURL=e.modelURL,t=!0),e.sources!==void 0){let n=JSON.stringify(this.sources),a=JSON.stringify(e.sources);n!==a&&(this.sources=e.sources,t=!0)}return t&&(this.ready=this.createReadyPromise()),e.autoplay!==void 0&&(this._autoplay=e.autoplay),e.loop!==void 0&&(this._loop=e.loop),e.playbackRate!==void 0&&(this._playbackRate=e.playbackRate),new ht(this,e).execute()}_duration=0;get duration(){return this._duration}_playbackRate=1;get playbackRate(){return this._playbackRate}set playbackRate(e){this.updateProperties({playbackRate:e})}_paused=!0;get paused(){return this._paused}_onAnimationStateChangeCallback;set onAnimationStateChangeCallback(e){this._onAnimationStateChangeCallback=e}async play(){this._paused=!1,await this.updateProperties({animationPaused:!1})}async pause(){this._paused=!0,await this.updateProperties({animationPaused:!0})}onReceiveEvent(e){e.type==="modelloaded"?(this._currentSrc=e.detail?.src??this.modelURL??"",this._onLoadCallback?.(),this._readyResolve?.(!0)):e.type==="modelloadfailed"?(this._onLoadFailureCallback?.(),this._readyResolve?.(!1)):e.type==="animationstatechange"?(this._paused=e.detail.paused,this._duration=e.detail.duration,this._onAnimationStateChangeCallback?.(e.detail)):super.onReceiveEvent(e)}_autoplay=!1;get autoplay(){return this._autoplay}_loop=!1;get loop(){return this._loop}_onLoadCallback;set onLoadCallback(e){this._onLoadCallback=e}_onLoadFailureCallback;set onLoadFailureCallback(e){this._onLoadFailureCallback=e}updateModelTransform(e){let t=Array.from(e.toFloat64Array());this.updateProperties({modelTransform:t})}};S();var W=class extends w{children=[];events={};constructor(e){super(e)}async addEntity(e){let t=new D(e.id,this.id).execute();return this.children.push(e),e.parent=this,t}addEvent(e,t){this.events[e]=t}removeEvent(e){this.events[e]&&delete this.events[e]}dispatchEvent(e){this.events[e.type]?.(e)}async updateProperties(e){return new St(this,e).execute()}};async function qe(){let i=await new Gt().execute();if(i.success){let{id:e,windowProxy:t}=i.data;return t.document.head.innerHTML=`<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
74
|
-
<base href="${document.baseURI}">`,new A(e,t)}else throw new Error("createSpatialized2DElement failed")}async function Qe(i,e){let t=await new Et(i,e).execute();if(t.success){let{id:n}=t.data;return new I(n,i,e)}else throw new Error("createSpatializedStatic3DElement failed")}async function Ke(){let i=await new wt().execute();if(i.success){let{id:e}=i.data;return new W(e)}else throw new Error("createSpatializedDynamic3DElement failed")}S();var Ft=class extends m{constructor(t,n,a){super(t);this.windowProxy=n;this.options=a}getContainer(){return this.windowProxy.document.body}getWindowProxy(){return this.windowProxy}async update(t){if(!this.isDestroyed)return t.position&&(this.options.position=t.position),t.size&&(this.options.size=t.size),new $t(this.id,t).execute()}};async function he(i){let e=await new kt(i).execute();if(!e.success)throw new Error("createAttachmentEntity failed: "+e?.errorMessage);let{id:t,windowProxy:n}=e.data;return await new Bt(t,i).execute(),new Ft(t,n,i)}S();S();S();P();var T=class extends m{constructor(t,n){super(t);this.userData=n;c.addEventReceiver(t,this.onReceiveEvent)}position={x:0,y:0,z:0};rotation={x:0,y:0,z:0};scale={x:1,y:1,z:1};events={};children=[];parent=null;_enableInput=!1;get enableInput(){return this._enableInput}set enableInput(t){this._enableInput!==t&&(this._enableInput=t,this.updateEntityEvent("spatialtap",t).catch(n=>{console.error("enableInput updateEntityEvent failed","spatialtap",n),this._enableInput===t&&(this._enableInput=!t)}))}async addComponent(t){return new Tt(this,t).execute()}async removeComponent(t){return new Ot(this,t).execute()}async setPosition(t){return this.updateTransform({position:t})}async setRotation(t){return this.updateTransform({rotation:t})}async setScale(t){return this.updateTransform({scale:t})}async addEntity(t){let n=await new D(t.id,this.id).execute();return this.children.push(t),t.parent=this,n}async removeFromParent(){let t=await new D(this.id,void 0).execute();return this.parent&&(this.parent.children=this.parent.children.filter(n=>n.id!==this.id),this.parent=null),t}async updateTransform(t){return this.position=t.position??this.position,this.rotation=t.rotation??this.rotation,this.scale=t.scale??this.scale,new lt(this,t).execute()}async addEvent(t,n){if(this.events[t])this.events[t]=n;else try{await this.updateEntityEvent(t,!0),this.events[t]=n}catch{console.error("addEvent failed",t)}}async removeEvent(t){if(this.events[t]){delete this.events[t];try{await this.updateEntityEvent(t,!1)}catch{console.error("removeEvent failed",t)}}}async updateEntityEvent(t,n){return new pt(this,t,n).execute()}onReceiveEvent=t=>{let{type:n}=t;if(n==="objectdestroy")this.isDestroyed=!0;else if(n==="spatialtap"){let a=y("spatialtap",t.detail);this.dispatchEvent(a)}else if(n==="spatialdragstart"){let a=y("spatialdragstart",t.detail);this.dispatchEvent(a)}else if(n==="spatialdrag"){let a=y("spatialdrag",t.detail);this.dispatchEvent(a)}else if(n==="spatialdragend"){let a=y("spatialdragend",t.detail);this.dispatchEvent(a)}else if(n==="spatialrotate"){let a=y("spatialrotate",t.detail);this.dispatchEvent(a)}else if(n==="spatialrotateend"){let a=y("spatialrotateend",t.detail);this.dispatchEvent(a)}else if(n==="spatialmagnify"){let a=y("spatialmagnify",t.detail);this.dispatchEvent(a)}else if(n==="spatialmagnifyend"){let a=y("spatialmagnifyend",t.detail);this.dispatchEvent(a)}};dispatchEvent(t){t.__origin||Object.defineProperty(t,"__origin",{value:this,enumerable:!1}),this.events[t.type]?.(t),t.bubbles&&!t.cancelBubble&&this.parent&&this.parent.dispatchEvent(t)}onDestroy(){c.removeEventReceiver(this.id),this.children.forEach(t=>{t.parent=null}),this.children=[],this.parent&&(this.parent.children=this.parent.children.filter(t=>t.id!==this.id),this.parent=null)}async convertFromEntityToEntity(t,n,a){return new At(t,n,a).execute()}async convertFromEntityToScene(t,n){return new It(t,n).execute()}async convertFromSceneToEntity(t,n){return new Wt(t,n).execute()}};S();var X=class extends T{constructor(t,n,a){super(t,a);this.id=t;this.options=n;this.userData=a}async setMaterials(t){return new zt(this.id,t).execute()}};P();var q=class extends m{constructor(e){super(e),c.addEventReceiver(e,this.onReceiveEvent)}onReceiveEvent=e=>{let{type:t}=e;t==="objectdestroy"&&(this.isDestroyed=!0)}};var Q=class extends q{constructor(t,n){super(t);this.options=n}};S();var K=class extends m{constructor(t,n){super(t);this.id=t;this.type=n;this.type=n}};var Z=class extends K{constructor(t,n){super(t,"unlit");this.id=t;this.options=n}updateProperties(t){return new ft(this,t).execute()}};var Y=class extends m{constructor(t,n){super(t);this.id=t;this.options=n}};async function Ze(i){let e=await new vt(i?.name).execute();if(e.success){let{id:t}=e.data;return new T(t,i)}else throw new Error("createSpatialEntity failed:"+e?.errorMessage)}async function _(i,e){let t=await new Ct(i.type,e).execute();if(t.success){let{id:n}=t.data;return new i(n,e)}else throw new Error("createSpatialGeometry failed:"+t?.errorMessage)}async function Ye(i){let e=await new Dt(i).execute();if(e.success){let{id:t}=e.data;return new Z(t,i)}else throw new Error("createSpatialUnlitMaterial failed:"+e?.errorMessage)}async function ti(i){let e=await new Pt(i).execute();if(e.success){let{id:t}=e.data;return new Q(t,i)}else throw new Error("createModelComponent failed:"+e?.errorMessage)}async function ei(i,e){let t=await new Mt(i).execute();if(t.success){let{id:n}=t.data;return new X(n,i,e)}else throw new Error("createSpatialModelEntity failed:"+t?.errorMessage)}async function ii(i){let e=await new Rt(i).execute();if(e.success){let{id:t}=e.data;return new Y(t,i)}else throw new Error("createModelAsset failed:"+e?.errorMessage)}var g=class extends m{constructor(t,n){super(t);this.id=t;this.options=n}static type};var tt=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="BoxGeometry"};var et=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="SphereGeometry"};var it=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="CylinderGeometry"};var nt=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="PlaneGeometry"};var at=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="ConeGeometry"};var V=class{getSpatialScene(){return v.getInstance()}createSpatialized2DElement(){return qe()}createSpatializedStatic3DElement(e,t){return Qe(e,t)}initScene=He;createSpatializedDynamic3DElement(){return Ke()}createEntity(e){return Ze(e)}createBoxGeometry(e={}){return _(tt,e)}createPlaneGeometry(e={}){return _(nt,e)}createSphereGeometry(e={}){return _(et,e)}createConeGeometry(e){return _(at,e)}createCylinderGeometry(e){return _(it,e)}createModelComponent(e){return ti(e)}createUnlitMaterial(e){return Ye(e)}createModelAsset(e){return ii(e)}createSpatialModelEntity(e,t){return ei(e,t)}createAttachmentEntity(e){return he(e)}};P();var U=class{wsAppShellVersionFromUA;requestSession(){return this.runInSpatialWeb()?(c.init(),new V):null}runInSpatialWeb(){return navigator.userAgent.indexOf("WebSpatial/")>=0}getShellVersionFromUA(){if(this.wsAppShellVersionFromUA!==void 0)return this.wsAppShellVersionFromUA;if(typeof navigator>"u"||typeof navigator.userAgent!="string")return this.wsAppShellVersionFromUA=null,null;let e=navigator.userAgent.match(/WSAppShell\/(\d+(?:\.\d+){2}(?:[-+][0-9A-Za-z.-]+)*)/);return this.wsAppShellVersionFromUA=e?e[1]:"1.3.0",this.wsAppShellVersionFromUA}isSupported(){return!0}getNativeVersion(){return window.__WebSpatialData&&window.__WebSpatialData.getNativeVersion?window.__WebSpatialData.getNativeVersion():window.WebSpatailNativeVersion==="WS_SHELL_VERSION"?this.getClientVersion():window.WebSpatailNativeVersion}getClientVersion(){return"1.6.0"}};Qt();st();var ni=new U,Ht,jt={backgroundMaterial:"--xr-background-material"},ai="";function Jt(i){i!==ai&&(Ht?.getSpatialScene()?.updateSpatialProperties({material:i}),ai=i)}function Mi(){let e=getComputedStyle(document.documentElement).getPropertyValue(jt.backgroundMaterial);Jt(e||"none")}var C={topLeading:0,bottomLeading:0,topTrailing:0,bottomTrailing:0};function ri(){let i=getComputedStyle(document.documentElement),e=ze(i);Ri(e)}function Ri(i){(C.topLeading!==i.topLeading||C.bottomLeading!==i.bottomLeading||C.topTrailing!==i.topTrailing||C.bottomTrailing!==i.bottomTrailing)&&(Ht?.getSpatialScene()?.updateSpatialProperties({cornerRadius:i}),C.topLeading=i.topLeading,C.bottomLeading=i.bottomLeading,C.topTrailing=i.topTrailing,C.bottomTrailing=i.bottomTrailing)}function Ci(i){Ht?.getSpatialScene().updateSpatialProperties({opacity:i})}function oi(){let i=getComputedStyle(document.documentElement),e=parseFloat(i.getPropertyValue("opacity"));Ci(e)}function Di(){let i=document.documentElement.style,e=new Proxy(i,{set:function(t,n,a){let r=Reflect.set(t,n,a);return n===jt.backgroundMaterial&&Jt(a),(n==="border-radius"||n==="borderRadius"||n==="border-top-left-radius"||n==="borderTopLeftRadius"||n==="border-top-right-radius"||n==="borderTopRightRadius"||n==="border-bottom-left-radius"||n==="borderBottomLeftRadius"||n==="border-bottom-right-radius"||n==="borderBottomRightRadius")&&ri(),n==="opacity"&&oi(),r},get:function(t,n){return typeof t[n]=="function"?function(...a){if(n==="setProperty"){let[r,o]=a;r===jt.backgroundMaterial&&Jt(o)}else if(n==="removeProperty"){let[r]=a;r===jt.backgroundMaterial&&Jt("none")}return t[n](...a)}:Reflect.get(t,n)}});Object.defineProperty(document.documentElement,"style",{get:function(){return e}})}function Ti(){new MutationObserver(Nt).observe(document.head,{childList:!0,subtree:!0})}function Nt(){Mi(),ri(),oi()}function Oi(){new MutationObserver(e=>{e.forEach(t=>{t.type==="attributes"&&t.attributeName&&Nt()})}).observe(document.documentElement,{attributes:!0,attributeFilter:["style","class"]})}async function si(){ni.runInSpatialWeb()&&(Ht=await ni.requestSession(),document.readyState==="complete"?Nt():window.addEventListener("load",()=>{Nt()}),Di(),Ti(),Oi())}!B()&&navigator.userAgent.indexOf("WebSpatial/")>0&&(Xe(),si());return k(zi);})();
|
|
73
|
+
`),r.close())}catch(a){console.error("Error initializing iframe content:",a)}}}catch(a){console.error("Error setting up iframe:",a)}}parseFeatures(e){let t={};return e.split(",").forEach(a=>{let[r,o]=a.split("=").map(s=>s.trim());r&&o&&(t[r]=o)}),t}sendMessageToIframe(e,t){let n=this.iframeRegistry.get(e);return n&&n.contentWindow?(n.contentWindow.postMessage(t,window.location.origin),!0):!1}getAllActiveIframes(){let e=[];return this.iframeRegistry.forEach((t,n)=>{e.push({spatialId:n,iframe:t})}),e}dispose(){this.iframeRegistry.forEach((e,t)=>{console.log(`Disposing iframe with spatialId: ${t}`),e.remove()}),this.iframeRegistry.clear()}generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16).toUpperCase()})}}});var c,P=x(()=>{"use strict";c=class i{static eventReceiver={};static init(){window.__SpatialWebEvent=({id:e,data:t})=>{i.eventReceiver[e]?.(t)}}static addEventReceiver(e,t){i.eventReceiver[e]=t}static removeEventReceiver(e){delete i.eventReceiver[e]}}});var ve={};O(ve,{PicoOSPlatform:()=>Yt});function we(){return Zt=(Zt+1)%ui,`rId_${Zt}`}var Zt,ui,Yt,Pe=x(()=>{"use strict";$();P();Zt=0,ui=1e5;Yt=class{async callJSB(e,t){return new Promise((n,a)=>{try{let r=we();c.addEventReceiver(r,s=>{if(c.removeEventReceiver(r),s.success)n(u(s.data));else{let{code:l,message:d}=s.data;n(f(l,d))}});let o=window.webspatialBridge.postMessage(r,e,t);if(o!==""){c.removeEventReceiver(r);let s=JSON.parse(o);if(s.success)n(u(s.data));else{let{code:l,message:d}=s.data;n(f(l,d))}}}catch(r){console.error(`SwanPlatform cmd: ${e}, msg: ${t} error: ${r}`);let{code:o,message:s}=r;n(f(o,s))}})}async callWebSpatialProtocol(e,t,n,a){return new Promise((r,o)=>{let s=we();try{let l=null;c.addEventReceiver(s,d=>{r(u({windowProxy:l,id:d.spatialId})),c.removeEventReceiver(s)}),l=this.openWindow(e,"rid="+s,n,a).windowProxy}catch(l){let{code:d,message:h}=l;c.removeEventReceiver(s),r(f(d,h))}})}callWebSpatialProtocolSync(e,t,n,a){let{spatialId:r="",windowProxy:o}=this.openWindow(e,t,n,a);return u({windowProxy:o,id:r})}openWindow(e,t,n,a){return{spatialId:"",windowProxy:window.open(`webspatial://${e}?${t||""}`,n,a)}}}});var Me={};O(Me,{AndroidPlatform:()=>ie});function Si(){return ee=(ee+1)%yi,`rId_${ee}`}var te,ee,yi,ie,Re=x(()=>{"use strict";$();S();P();te=0,ee=0,yi=1e5;ie=class{async callJSB(e,t){return new Promise((n,a)=>{try{let r=Si();c.addEventReceiver(r,s=>{if(c.removeEventReceiver(r),s.success)n(u(s.data));else{let{code:l,message:d}=s.data;n(f(l,d))}});let o=window.webspatialBridge.postMessage(r,e,t);if(o!==""){c.removeEventReceiver(r);let s=JSON.parse(o);if(s.success)n(u(s.data));else{let{code:l,message:d}=s.data;n(f(l,d))}}}catch(r){console.error(`AndroidPlatform cmd: ${e}, msg: ${t} error: ${r}`);let{code:o,message:s}=r;n(f(o,s))}})}async callWebSpatialProtocol(e,t,n,a){await new Promise(l=>setTimeout(l,16*te)),te++;let r=await new F().execute();for(;!r.data.can;)await new Promise(l=>setTimeout(l,16)),r=await new F().execute();let{windowProxy:o}=this.openWindow(e,t,n,a);for(;!o?.open;)await new Promise(l=>setTimeout(l,16));for(o?.open("about:blank","_self");!o?.__SpatialId;)await new Promise(l=>setTimeout(l,16));let s=o?.__SpatialId;return te--,Promise.resolve(u({windowProxy:o,id:s}))}callWebSpatialProtocolSync(e,t,n,a){let{spatialId:r="",windowProxy:o}=this.openWindow(e,t,n,a);return u({windowProxy:o,id:r})}openWindow(e,t,n,a){return{spatialId:"",windowProxy:window.open(`webspatial://${e}?${t||""}`,n,a)}}}});var Ce={};O(Ce,{VisionOSPlatform:()=>ne});var ne,De=x(()=>{"use strict";$();ne=class{async callJSB(e,t){try{let n=await window.webkit.messageHandlers.bridge.postMessage(`${e}::${t}`);return u(n)}catch(n){let{code:a,message:r}=JSON.parse(n.message);return f(a,r)}}callWebSpatialProtocol(e,t,n,a){let{spatialId:r,windowProxy:o}=this.openWindow(e,t,n,a);return Promise.resolve(u({windowProxy:o,id:r}))}callWebSpatialProtocolSync(e,t,n,a){let{spatialId:r="",windowProxy:o}=this.openWindow(e,t,n,a);return u({windowProxy:o,id:r})}openWindow(e,t,n,a){let r=window.open(`webspatial://${e}?${t||""}`,n,a);return{spatialId:r?.navigator.userAgent?.match(/\b([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})\b/gi)?.[0],windowProxy:r}}}});function fi(i){let e=i.match(/WebSpatial\/(\d+)\.(\d+)\.(\d+)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function gi(i,e){if(!i)return!1;for(let t=0;t<3;t+=1){let n=i[t]-e[t];if(n>0)return!0;if(n<0)return!1}return!1}function Te(){if(B())return new rt;let i=window.navigator.userAgent,e=fi(i);if(window.navigator.userAgent.includes("Puppeteer")){let t=(Ee(),k(xe)).PuppeteerPlatform;return new t}else if(i.includes("PicoWebApp")&&gi(e,[0,0,1])){let t=(Pe(),k(ve)).PicoOSPlatform;return new t}else if(i.includes("Android")||i.includes("Linux")){let t=(Re(),k(Me)).AndroidPlatform;return new t}else{let t=(De(),k(Ce)).VisionOSPlatform;return new t}}var Oe=x(()=>{"use strict";Qt();be()});function ot(i,e){return i===""?0:i.endsWith("%")?e*parseFloat(i)/100:parseFloat(i)}function ze(i){let e=parseFloat(i.getPropertyValue("width")),t=i.getPropertyValue("border-top-left-radius"),n=i.getPropertyValue("border-top-right-radius"),a=i.getPropertyValue("border-bottom-left-radius"),r=i.getPropertyValue("border-bottom-right-radius");return{topLeading:ot(t,e),bottomLeading:ot(a,e),topTrailing:ot(n,e),bottomTrailing:ot(r,e)}}function Ae(i,e,t){let{x:n,y:a,z:r}=i,{x:o,y:s,z:l}=e,{x:d,y:h,z:G}=t,b=new DOMMatrix;return b=b.translate(n,a,r),b=b.rotate(o,s,l),b=b.scale(d,h,G),b}function M(i){let e=globalThis.structuredClone;if(typeof e=="function")try{return e(i)}catch{}return JSON.parse(JSON.stringify(i))}var st=x(()=>{"use strict"});var ae,p,lt,pt,ct,dt,mt,ut,R,yt,St,ft,gt,ht,bt,xt,Et,wt,vt,Pt,Mt,Rt,Ct,Dt,Tt,Ot,zt,D,At,It,Wt,_t,Vt,Ut,F,j,Gt,Lt,kt,Bt,$t,S=x(()=>{"use strict";Oe();st();ae=Te(),p=class{commandType="";async execute(){let e=this.getParams(),t=e?JSON.stringify(e):"";return ae.callJSB(this.commandType,t)}},lt=class extends p{constructor(t,n){super();this.entity=t;this.properties=n}commandType="UpdateEntityProperties";getParams(){let t=Ae(this.properties.position??this.entity.position,this.properties.rotation??this.entity.rotation,this.properties.scale??this.entity.scale).toFloat64Array();return{entityId:this.entity.id,transform:t}}},pt=class extends p{constructor(t,n,a){super();this.entity=t;this.type=n;this.isEnable=a}commandType="UpdateEntityEvent";getParams(){return{type:this.type,entityId:this.entity.id,isEnable:this.isEnable}}},ct=class extends p{properties;commandType="UpdateSpatialSceneProperties";constructor(e){super(),this.properties=e}getParams(){return this.properties}},dt=class extends p{config;commandType="UpdateSceneConfig";constructor(e){super(),this.config=e}getParams(){return{config:this.config}}},mt=class extends p{constructor(t){super();this.id=t}commandType="FocusScene";getParams(){return{id:this.id}}},ut=class extends p{commandType="GetSpatialSceneState";constructor(){super()}getParams(){return{}}},R=class extends p{constructor(t){super();this.spatialObject=t}getParams(){let t=this.getExtraParams();return{id:this.spatialObject.id,...t}}},yt=class extends R{properties;commandType="UpdateSpatialized2DElementProperties";constructor(e,t){super(e),this.properties=t}getExtraParams(){return this.properties}},St=class extends R{properties;commandType="UpdateSpatializedDynamic3DElementProperties";constructor(e,t){super(e),this.properties=t}getExtraParams(){return{id:this.spatialObject.id,...this.properties}}},ft=class extends R{properties;commandType="UpdateUnlitMaterialProperties";constructor(e,t){super(e),this.properties=t}getExtraParams(){return this.properties}},gt=class extends R{matrix;commandType="UpdateSpatializedElementTransform";constructor(e,t){super(e),this.matrix=t}getExtraParams(){return{matrix:Array.from(this.matrix.toFloat64Array())}}},ht=class extends R{properties;commandType="UpdateSpatializedStatic3DElementProperties";constructor(e,t){super(e),this.properties=t}getExtraParams(){return this.properties}},bt=class extends R{commandType="AddSpatializedElementToSpatialized2DElement";spatializedElement;constructor(e,t){super(e),this.spatializedElement=t}getExtraParams(){return{spatializedElementId:this.spatializedElement.id}}},xt=class extends p{commandType="AddSpatializedElementToSpatialScene";spatializedElement;constructor(e){super(),this.spatializedElement=e}getParams(){return{spatializedElementId:this.spatializedElement.id}}},Et=class extends p{constructor(t,n){super();this.modelURL=t;this.sources=n;this.modelURL=t,this.sources=n}commandType="CreateSpatializedStatic3DElement";getParams(){return{modelURL:this.modelURL,sources:this.sources}}},wt=class extends p{getParams(){return{test:!0}}commandType="CreateSpatializedDynamic3DElement"},vt=class extends p{constructor(t){super();this.name=t}getParams(){return{name:this.name}}commandType="CreateSpatialEntity"},Pt=class extends p{constructor(t){super();this.options=t}getParams(){let t=this.options.mesh.id,n=this.options.materials.map(a=>a.id);return{geometryId:t,materialIds:n}}commandType="CreateModelComponent"},Mt=class extends p{constructor(t){super();this.options=t}getParams(){return this.options}commandType="CreateSpatialModelEntity"},Rt=class extends p{constructor(t){super();this.options=t}getParams(){return{url:this.options.url}}commandType="CreateModelAsset"},Ct=class extends p{constructor(t,n={}){super();this.type=t;this.options=n}getParams(){return{type:this.type,...this.options}}commandType="CreateGeometry"},Dt=class extends p{constructor(t){super();this.options=t}getParams(){return this.options}commandType="CreateUnlitMaterial"},Tt=class extends p{constructor(t,n){super();this.entity=t;this.comp=n}getParams(){return{entityId:this.entity.id,componentId:this.comp.id}}commandType="AddComponentToEntity"},Ot=class extends p{constructor(t,n){super();this.entity=t;this.comp=n}getParams(){return{entityId:this.entity.id,componentId:this.comp.id}}commandType="RemoveComponentFromEntity"},zt=class extends p{constructor(t,n){super();this.entityId=t;this.materials=n}getParams(){return{entityId:this.entityId,materialIds:this.materials.map(t=>t.id)}}commandType="SetMaterialsOnEntity"},D=class extends p{constructor(t,n){super();this.childId=t;this.parentId=n}getParams(){return{childId:this.childId,parentId:this.parentId}}commandType="SetParentToEntity"},At=class extends p{constructor(t,n,a){super();this.fromEntityId=t;this.toEntityId=n;this.fromPosition=a}getParams(){return{fromEntityId:this.fromEntityId,toEntityId:this.toEntityId,position:this.fromPosition}}commandType="ConvertFromEntityToEntity"},It=class extends p{constructor(t,n){super();this.fromEntityId=t;this.position=n}getParams(){return{fromEntityId:this.fromEntityId,position:this.position}}commandType="ConvertFromEntityToScene"},Wt=class extends p{constructor(t,n){super();this.entityId=t;this.position=n}getParams(){return{entityId:this.entityId,position:this.position}}commandType="ConvertFromSceneToEntity"},_t=class extends p{constructor(t,n,a){super();this.position=t;this.fromId=n;this.toId=a}getParams(){return{position:this.position,fromId:this.fromId,toId:this.toId}}commandType="ConvertCoordinate"},Vt=class extends p{constructor(t=""){super();this.id=t}commandType="Inspect";getParams(){return this.id?{id:this.id}:{id:""}}},Ut=class extends p{constructor(t){super();this.id=t}commandType="Destroy";getParams(){return{id:this.id}}},F=class extends p{constructor(t=""){super();this.id=t}commandType="CheckWebViewCanCreate";getParams(){return{id:this.id}}},j=class extends p{target;features;async execute(){let e=this.getQuery();return ae.callWebSpatialProtocol(this.commandType,e,this.target,this.features)}executeSync(){let e=this.getQuery();return ae.callWebSpatialProtocolSync(this.commandType,e,this.target,this.features)}getQuery(){let e,t=this.getParams();return t&&(e=Object.keys(t).map(n=>{let a=t[n],r=typeof a=="object"?JSON.stringify(a):a;return`${n}=${encodeURIComponent(r)}`}).join("&")),e}},Gt=class extends j{commandType="createSpatialized2DElement";constructor(){super()}getParams(){return{}}},Lt=class extends j{constructor(t,n,a,r){super();this.url=t;this.config=n;this.target=a;this.features=r}commandType="createSpatialScene";getParams(){return{url:this.url,config:this.config}}},kt=class extends j{constructor(t){super();this.options=t}commandType="createAttachment";getParams(){return{}}},Bt=class extends p{constructor(t,n){super();this.attachmentId=t;this.options=n}commandType="InitializeAttachment";getParams(){return{id:this.attachmentId,parentEntityId:this.options.parentEntityId,position:this.options.position??[0,0,0],size:this.options.size,ownerViewId:this.options.ownerViewId}}},$t=class extends p{constructor(t,n){super();this.attachmentId=t;this.options=n}commandType="UpdateAttachmentEntity";getParams(){return{id:this.attachmentId,...this.options}}}});var zi={};O(zi,{Attachment:()=>Ft,BaseplateVisibilityValues:()=>We,CubeInfo:()=>oe,ModelComponent:()=>Q,PhysicalMetrics:()=>Se,Spatial:()=>U,SpatialBoxGeometry:()=>tt,SpatialComponent:()=>q,SpatialConeGeometry:()=>at,SpatialCylinderGeometry:()=>it,SpatialEntity:()=>T,SpatialGeometry:()=>g,SpatialMaterial:()=>K,SpatialModelAsset:()=>Y,SpatialModelEntity:()=>X,SpatialObject:()=>m,SpatialPlaneGeometry:()=>nt,SpatialScene:()=>v,SpatialSceneState:()=>de,SpatialSceneValues:()=>Ue,SpatialSession:()=>V,SpatialSphereGeometry:()=>et,SpatialUnlitMaterial:()=>Z,Spatialized2DElement:()=>A,SpatializedDynamic3DElement:()=>W,SpatializedElement:()=>w,SpatializedElementType:()=>Ie,SpatializedStatic3DElement:()=>I,WorldAlignmentValues:()=>Ve,WorldScalingValues:()=>_e,createAttachmentEntity:()=>he,isSSREnv:()=>B,isValidBaseplateVisibilityType:()=>se,isValidSceneUnit:()=>z,isValidSpatialSceneType:()=>ce,isValidWorldAlignmentType:()=>pe,isValidWorldScalingType:()=>le});S();var m=class{constructor(e){this.id=e}name;isDestroyed=!1;async inspect(){let e=await new Vt(this.id).execute();if(e.success)return e.data;throw new Error(e.errorMessage)}async destroy(){if(this.isDestroyed)return;let e=await new Ut(this.id).execute();if(e.success)return this.onDestroy(),this.isDestroyed=!0,e.data;if(this.isDestroyed)return;throw new Error(e.errorMessage)}onDestroy(){}};S();S();S();var re,v=class i extends m{static getInstance(){return re||(re=new i("")),re}async convertCoordinate(e,t,n){try{return(await new _t(e,t,n).execute())?.data??e}catch(a){throw console.warn("SpatialScene.convertCoordinate error:",a),a}}async updateSpatialProperties(e){return new ct(e).execute()}async addSpatializedElement(e){return new xt(e).execute()}async updateSceneCreationConfig(e){return new dt(e).execute()}async getState(){return(await new ut().execute()).data.name}};var Ie=(n=>(n[n.Spatialized2DElement=0]="Spatialized2DElement",n[n.SpatializedStatic3DElement=1]="SpatializedStatic3DElement",n[n.SpatializedDynamic3DElement=2]="SpatializedDynamic3DElement",n))(Ie||{}),We=["automatic","visible","hidden"];function se(i){return We.includes(i)}var _e=["automatic","dynamic"];function le(i){return _e.includes(i)}var Ve=["adaptive","automatic","gravityAligned"];function pe(i){return Ve.includes(i)}var Ue=["window","volume"];function ce(i){return Ue.includes(i)}function z(i){if(typeof i=="number")return i>=0;if(typeof i=="string"){if(i.endsWith("px"))return isNaN(Number(i.slice(0,-2)))?!1:Number(i.slice(0,-2))>=0;if(i.endsWith("m"))return isNaN(Number(i.slice(0,-1)))?!1:Number(i.slice(0,-1))>=0}return!1}var de=(r=>(r.idle="idle",r.pending="pending",r.willVisible="willVisible",r.visible="visible",r.fail="fail",r))(de||{}),oe=class{constructor(e,t){this.size=e;this.origin=t;this.size=e,this.origin=t}get x(){return this.origin.x}get y(){return this.origin.y}get z(){return this.origin.z}get width(){return this.size.width}get height(){return this.size.height}get depth(){return this.size.depth}get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get back(){return this.z}get front(){return this.z+this.depth}};st();var Se={};O(Se,{getValue:()=>hi,physicalToPoint:()=>ue,pointToPhysical:()=>me,subscribe:()=>bi});P();var E={meterToPtUnscaled:1360,meterToPtScaled:1360};function Ge(i){return i?.worldScalingCompensation??"scaled"}function me(i,e){return ye(),Ge(e)==="unscaled"?i/E.meterToPtUnscaled:i/E.meterToPtScaled}function ue(i,e){return ye(),Ge(e)==="unscaled"?i*E.meterToPtUnscaled:i*E.meterToPtScaled}function ye(){if(typeof window>"u")return;let i=window.__webspatialsdk__?.physicalMetrics;if(!i)return;let e={meterToPtScaled:i.meterToPtScaled??E.meterToPtScaled,meterToPtUnscaled:i.meterToPtUnscaled??E.meterToPtUnscaled};(e.meterToPtScaled!==E.meterToPtScaled||e.meterToPtUnscaled!==E.meterToPtUnscaled)&&(E=e)}function hi(){return ye(),E}function bi(i){if(typeof window>"u")return()=>{};let e=()=>{i()};return c.addEventReceiver("window",e),()=>{c.removeEventReceiver("window")}}var Fe={defaultSize:{width:1280,height:720}},je={defaultSize:{width:"0.94m",height:"0.94m",depth:"0.94m"}},Je={...Fe},Ne={...je},xi="webspatial://";function J(i,e){if(!e)return{...i||{}};let t={...i||{}};for(let n of Object.keys(e)){let a=t[n],r=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&a&&typeof a=="object"&&!Array.isArray(a)?t[n]=J(a,r):t[n]=r}return t}function Le(i){let e={...i||{}},t=i.defaultSize!==void 0?i.defaultSize:i.default_size;return t!==void 0&&(e.defaultSize=t),"default_size"in e&&delete e.default_size,e}var H=class i{originalOpen;static instance;manifestReady=null;static getInstance(){return i.instance||(i.instance=new i),i.instance}init(e){this.manifestReady=this.setupManifest(),this.originalOpen=e.open.bind(e),e.open=this.open}configMap={};callbackReturnMap={};getConfig(e){if(!(e===void 0||!this.configMap[e]))return this.configMap[e]}waitManifest(){return this.manifestReady??Promise.resolve()}ensureAbsoluteUrl(e){if(!e||/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e))return e;if(e.startsWith("//"))return`${window.location.protocol}${e}`;try{return new URL(e,document.baseURI).toString()}catch{return e}}async setupManifest(){let e=await this.getPWAManifest();try{let t=e?.xr_spatial_scene;if(!t||typeof t!="object")return;let{overrides:n,...a}=t,r=J(a,n?.window_scene),o=J(a,n?.volume_scene),s=Le(r),l=Le(o);s&&Object.keys(s).length>0&&(Je=s),l&&Object.keys(l).length>0&&(Ne=l)}catch(t){console.warn("SceneManager.setupManifest failed; using built-in defaults.",t?.message||t)}}open=(e,t,n)=>{if(e?.startsWith(xi)){if(e.includes("createSpatialized2DElement")||e.includes("createAttachment")){let l=(window.webSpatial||window.__webspatialShell__)?.genToken?.();if(l){let d=e.includes("createAttachment")?"createAttachment":"createSpatialized2DElement",h=window.location.host,b=`${window.location.protocol}//${h}/${l}/?command=${d}`,L=new URL(e).searchParams.get("rid"),Xt=new URL(b);return L&&Xt.searchParams.set("rid",L),this.originalOpen(Xt.toString(),t,n)}}return this.originalOpen(e,t,n)}if(e=this.ensureAbsoluteUrl(e),t==="_self"||t==="_parent"||t==="_top")return this.originalOpen(e,t,n);let a=t?this.getConfig(t):void 0;if(a===void 0){let l=M(N("window")),[d]=fe(l,"window");a={...d,type:"window"}}let o=new Lt(e,a,t,n).executeSync(),s=o.data?.id;return s&&new mt(s).execute(),o.data?.windowProxy};initScene(e,t,n){let a=n?.type??"window",r=N(a),o=this.callbackReturnMap[e]??M(r),s=t(o),l=Ei(M(s)),d=M(l),h=M(N(a)),G=J(h,d),[b,L]=fe(G,a);L.length>0&&console.warn(`initScene ${e} with errors: ${L.join(", ")}`),this.callbackReturnMap[e]=l,this.configMap[e]={...b,type:a}}async getPWAManifest(e){let t=e;if(!t){let n=document.querySelector('link[rel="manifest"]');t=n?.getAttribute("href")||n?.href}if(t&&(t=this.ensureAbsoluteUrl(t),!!t)){if(t.startsWith("data:"))try{let n=t.indexOf(",");if(n<0)return;let a=t.slice(5,n),r=t.slice(n+1),s=/;base64/i.test(a)?atob(r):decodeURIComponent(r);return JSON.parse(s)}catch{return}try{let n=await fetch(t,{credentials:"same-origin"});if(!n.ok)throw new Error(String(n.status));try{return await n.json()}catch{let a=await n.text();return JSON.parse(a)}}catch{try{let n=await fetch(t);if(!n.ok)return;try{return await n.json()}catch{let a=await n.text();return JSON.parse(a)}}catch{return}}}}};function Ei(i){if(i?.defaultSize){let e=["width","height","depth"];for(let t of e)t in i.defaultSize&&!z(i.defaultSize[t])&&delete i.defaultSize[t]}if(i?.resizability){let e=["minWidth","minHeight","maxWidth","maxHeight"];for(let t of e)t in i.resizability&&!z(i.resizability[t])&&delete i.resizability[t]}return i}function ke(i){return me(i)}function Be(i){return ue(i)}function $e(i,e,t){if(typeof i=="number")return t==="px"&&e==="px"||t==="m"&&e==="m"?i:t==="px"&&e==="m"?ke(i):t==="m"&&e==="px"?Be(i):i;if(e==="m"){if(i.endsWith("m"))return Number(i.slice(0,-1));if(i.endsWith("px"))return ke(Number(i.slice(0,-2)));throw new Error("formatToNumber: invalid str")}else if(e==="px"){if(i.endsWith("px"))return Number(i.slice(0,-2));if(i.endsWith("m"))return Be(Number(i.slice(0,-1)));throw new Error("formatToNumber: invalid str")}else throw new Error("formatToNumber: invalid targetUnit")}function fe(i,e){let t=N(e),n=[],a=e==="window";if(ce(e)||n.push("sceneType"),i.defaultSize){let r=["width","height","depth"];for(let o of r)o in i.defaultSize&&(z(i.defaultSize[o])?i.defaultSize[o]=$e(i.defaultSize[o],a?"px":"m","px"):(delete i.defaultSize[o],n.push(`defaultSize.${o}`)))}if(i.resizability){let r=["minWidth","minHeight","maxWidth","maxHeight"];for(let o of r)o in i.resizability&&(z(i.resizability[o])?i.resizability[o]=$e(i.resizability[o],"px","px"):(delete i.resizability[o],n.push(`resizability.${o}`)))}return i.worldScaling&&(le(i.worldScaling)||(i.worldScaling="automatic",n.push("worldScaling"))),i.worldAlignment&&(pe(i.worldAlignment)||(i.worldAlignment="automatic",n.push("worldAlignment"))),i.baseplateVisibility&&(se(i.baseplateVisibility)||(i.baseplateVisibility="automatic",n.push("baseplateVisibility"))),[i,n]}function He(i,e,t){return H.getInstance().initScene(i,e,t)}function wi(i){H.getInstance().init(i)}function ge(i){i.document.onclick=function(e){let t=e.target;for(;t;){if(t.tagName=="A")return!vi(e,t);if(t.parentElement)t=t.parentElement;else break}}}function vi(i,e){if(i.defaultPrevented)return!1;let t=e.target,n=e.href;if(t&&t!=="_self")return i.preventDefault(),window.open(n,t),!0}function N(i){return i==="window"?Je||Fe:Ne||je}async function Pi(){if(!window.opener||await v.getInstance().getState()!=="pending")return;function e(t){document.readyState==="interactive"||document.readyState==="complete"?t():document.addEventListener("DOMContentLoaded",t)}e(async()=>{await H.getInstance().waitManifest();let t=window.xrCurrentSceneType??"window",n=N(t),a=M(n),r=a;if(typeof window.xrCurrentSceneDefaults=="function")try{r=await window.xrCurrentSceneDefaults?.(a)}catch(h){console.error(h)}await new Promise((h,G)=>{setTimeout(()=>{h(null)},1e3)});let o=J(M(n),r),[s,l]=fe(o,t);l.length>0&&console.warn(`window.xrCurrentSceneDefaults with errors: ${l.join(", ")}`);let d={...s,type:t};await v.getInstance().updateSceneCreationConfig(d)})}function Xe(){wi(window),ge(window),Pi()}S();S();S();P();function y(i,e){return new CustomEvent(i,{bubbles:!0,cancelable:!1,detail:e})}var w=class extends m{constructor(t){super(t);this.id=t;c.addEventReceiver(t,this.onReceiveEvent.bind(this))}async updateTransform(t){return new gt(this,t).execute()}_cubeInfo;get cubeInfo(){return this._cubeInfo}_transform;_transformInv;get transform(){return this._transform}get transformInv(){return this._transformInv}onReceiveEvent(t){let{type:n}=t;if(n==="objectdestroy")this.isDestroyed=!0;else if(n==="spatialtap"){let a=y("spatialtap",t.detail);this._onSpatialTap?.(a)}else if(n==="spatialdragstart"){let a=y("spatialdragstart",t.detail);this._onSpatialDragStart?.(a)}else if(n==="spatialdrag"){let a=y("spatialdrag",t.detail);this._onSpatialDrag?.(a)}else if(n==="spatialdragend"){let a=y("spatialdragend",t.detail);this._onSpatialDragEnd?.(a)}else if(n==="spatialrotate"){let a=y("spatialrotate",t.detail);this._onSpatialRotate?.(a)}else if(n==="spatialrotateend"){let a=y("spatialrotateend",t.detail);this._onSpatialRotateEnd?.(a)}else if(n==="spatialmagnify"){let a=y("spatialmagnify",t.detail);this._onSpatialMagnify?.(a)}else if(n==="spatialmagnifyend"){let a=y("spatialmagnifyend",t.detail);this._onSpatialMagnifyEnd?.(a)}}_onSpatialTap;set onSpatialTap(t){this._onSpatialTap=t,this.updateProperties({enableTapGesture:t!==void 0})}_onSpatialDragStart;set onSpatialDragStart(t){this._onSpatialDragStart=t,this.updateProperties({enableDragStartGesture:this._onSpatialDragStart!==void 0})}_onSpatialDrag;set onSpatialDrag(t){this._onSpatialDrag=t,this.updateProperties({enableDragGesture:this._onSpatialDrag!==void 0})}_onSpatialDragEnd;set onSpatialDragEnd(t){this._onSpatialDragEnd=t,this.updateProperties({enableDragEndGesture:t!==void 0})}_onSpatialRotate;set onSpatialRotate(t){this._onSpatialRotate=t,this.updateProperties({enableRotateGesture:this._onSpatialRotate!==void 0})}_onSpatialRotateEnd;set onSpatialRotateEnd(t){this._onSpatialRotateEnd=t,this.updateProperties({enableRotateEndGesture:t!==void 0})}_onSpatialMagnify;set onSpatialMagnify(t){this._onSpatialMagnify=t,this.updateProperties({enableMagnifyGesture:t!==void 0})}_onSpatialMagnifyEnd;set onSpatialMagnifyEnd(t){this._onSpatialMagnifyEnd=t,this.updateProperties({enableMagnifyEndGesture:t!==void 0})}onDestroy(){c.removeEventReceiver(this.id)}};var A=class extends w{constructor(t,n){super(t);this.windowProxy=n;ge(n)}async updateProperties(t){return new yt(this,t).execute()}async addSpatializedElement(t){return new bt(this,t).execute()}};S();var I=class extends w{constructor(e,t,n){super(e),this.modelURL=t,this.sources=n}_readyResolve;modelURL;sources;_currentSrc="";get currentSrc(){return this._currentSrc}createReadyPromise(){return this._readyResolve?.(!1),new Promise(e=>{this._readyResolve=e})}ready=this.createReadyPromise();async updateProperties(e){let t=!1;if(e.modelURL!==void 0&&this.modelURL!==e.modelURL&&(this.modelURL=e.modelURL,t=!0),e.sources!==void 0){let n=JSON.stringify(this.sources),a=JSON.stringify(e.sources);n!==a&&(this.sources=e.sources,t=!0)}return t&&(this.ready=this.createReadyPromise()),e.autoplay!==void 0&&(this._autoplay=e.autoplay),e.loop!==void 0&&(this._loop=e.loop),e.playbackRate!==void 0&&(this._playbackRate=e.playbackRate),new ht(this,e).execute()}_duration=0;get duration(){return this._duration}_playbackRate=1;get playbackRate(){return this._playbackRate}set playbackRate(e){this.updateProperties({playbackRate:e})}_paused=!0;get paused(){return this._paused}_onAnimationStateChangeCallback;set onAnimationStateChangeCallback(e){this._onAnimationStateChangeCallback=e}async play(){this._paused=!1,await this.updateProperties({animationPaused:!1})}async pause(){this._paused=!0,await this.updateProperties({animationPaused:!0})}onReceiveEvent(e){e.type==="modelloaded"?(this._currentSrc=e.detail?.src??this.modelURL??"",this._onLoadCallback?.(),this._readyResolve?.(!0)):e.type==="modelloadfailed"?(this._onLoadFailureCallback?.(),this._readyResolve?.(!1)):e.type==="animationstatechange"?(this._paused=e.detail.paused,this._duration=e.detail.duration,this._onAnimationStateChangeCallback?.(e.detail)):super.onReceiveEvent(e)}_autoplay=!1;get autoplay(){return this._autoplay}_loop=!1;get loop(){return this._loop}_onLoadCallback;set onLoadCallback(e){this._onLoadCallback=e}_onLoadFailureCallback;set onLoadFailureCallback(e){this._onLoadFailureCallback=e}updateModelTransform(e){let t=Array.from(e.toFloat64Array());this.updateProperties({modelTransform:t})}};S();var W=class extends w{children=[];events={};constructor(e){super(e)}async addEntity(e){let t=new D(e.id,this.id).execute();return this.children.push(e),e.parent=this,t}addEvent(e,t){this.events[e]=t}removeEvent(e){this.events[e]&&delete this.events[e]}dispatchEvent(e){this.events[e.type]?.(e)}async updateProperties(e){return new St(this,e).execute()}};async function qe(){let i=await new Gt().execute();if(i.success){let{id:e,windowProxy:t}=i.data;return t.document.head.innerHTML=`<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
74
|
+
<base href="${document.baseURI}">`,new A(e,t)}else throw new Error("createSpatialized2DElement failed")}async function Qe(i,e){let t=await new Et(i,e).execute();if(t.success){let{id:n}=t.data;return new I(n,i,e)}else throw new Error("createSpatializedStatic3DElement failed")}async function Ke(){let i=await new wt().execute();if(i.success){let{id:e}=i.data;return new W(e)}else throw new Error("createSpatializedDynamic3DElement failed")}S();var Ft=class extends m{constructor(t,n,a){super(t);this.windowProxy=n;this.options=a}getContainer(){return this.windowProxy.document.body}getWindowProxy(){return this.windowProxy}async update(t){if(!this.isDestroyed)return t.position&&(this.options.position=t.position),t.size&&(this.options.size=t.size),new $t(this.id,t).execute()}};async function he(i){let e=await new kt(i).execute();if(!e.success)throw new Error("createAttachmentEntity failed: "+e?.errorMessage);let{id:t,windowProxy:n}=e.data;return await new Bt(t,i).execute(),new Ft(t,n,i)}S();S();S();P();var T=class extends m{constructor(t,n){super(t);this.userData=n;c.addEventReceiver(t,this.onReceiveEvent)}position={x:0,y:0,z:0};rotation={x:0,y:0,z:0};scale={x:1,y:1,z:1};events={};children=[];parent=null;_enableInput=!1;get enableInput(){return this._enableInput}set enableInput(t){this._enableInput!==t&&(this._enableInput=t,this.updateEntityEvent("spatialtap",t).catch(n=>{console.error("enableInput updateEntityEvent failed","spatialtap",n),this._enableInput===t&&(this._enableInput=!t)}))}async addComponent(t){return new Tt(this,t).execute()}async removeComponent(t){return new Ot(this,t).execute()}async setPosition(t){return this.updateTransform({position:t})}async setRotation(t){return this.updateTransform({rotation:t})}async setScale(t){return this.updateTransform({scale:t})}async addEntity(t){let n=await new D(t.id,this.id).execute();return this.children.push(t),t.parent=this,n}async removeFromParent(){let t=await new D(this.id,void 0).execute();return this.parent&&(this.parent.children=this.parent.children.filter(n=>n.id!==this.id),this.parent=null),t}async updateTransform(t){return this.position=t.position??this.position,this.rotation=t.rotation??this.rotation,this.scale=t.scale??this.scale,new lt(this,t).execute()}async addEvent(t,n){if(this.events[t])this.events[t]=n;else try{await this.updateEntityEvent(t,!0),this.events[t]=n}catch{console.error("addEvent failed",t)}}async removeEvent(t){if(this.events[t]){delete this.events[t];try{await this.updateEntityEvent(t,!1)}catch{console.error("removeEvent failed",t)}}}async updateEntityEvent(t,n){return new pt(this,t,n).execute()}onReceiveEvent=t=>{let{type:n}=t;if(n==="objectdestroy")this.isDestroyed=!0;else if(n==="spatialtap"){let a=y("spatialtap",t.detail);this.dispatchEvent(a)}else if(n==="spatialdragstart"){let a=y("spatialdragstart",t.detail);this.dispatchEvent(a)}else if(n==="spatialdrag"){let a=y("spatialdrag",t.detail);this.dispatchEvent(a)}else if(n==="spatialdragend"){let a=y("spatialdragend",t.detail);this.dispatchEvent(a)}else if(n==="spatialrotate"){let a=y("spatialrotate",t.detail);this.dispatchEvent(a)}else if(n==="spatialrotateend"){let a=y("spatialrotateend",t.detail);this.dispatchEvent(a)}else if(n==="spatialmagnify"){let a=y("spatialmagnify",t.detail);this.dispatchEvent(a)}else if(n==="spatialmagnifyend"){let a=y("spatialmagnifyend",t.detail);this.dispatchEvent(a)}};dispatchEvent(t){t.__origin||Object.defineProperty(t,"__origin",{value:this,enumerable:!1}),this.events[t.type]?.(t),t.bubbles&&!t.cancelBubble&&this.parent&&this.parent.dispatchEvent(t)}onDestroy(){c.removeEventReceiver(this.id),this.children.forEach(t=>{t.parent=null}),this.children=[],this.parent&&(this.parent.children=this.parent.children.filter(t=>t.id!==this.id),this.parent=null)}async convertFromEntityToEntity(t,n,a){return new At(t,n,a).execute()}async convertFromEntityToScene(t,n){return new It(t,n).execute()}async convertFromSceneToEntity(t,n){return new Wt(t,n).execute()}};S();var X=class extends T{constructor(t,n,a){super(t,a);this.id=t;this.options=n;this.userData=a}async setMaterials(t){return new zt(this.id,t).execute()}};P();var q=class extends m{constructor(e){super(e),c.addEventReceiver(e,this.onReceiveEvent)}onReceiveEvent=e=>{let{type:t}=e;t==="objectdestroy"&&(this.isDestroyed=!0)}};var Q=class extends q{constructor(t,n){super(t);this.options=n}};S();var K=class extends m{constructor(t,n){super(t);this.id=t;this.type=n;this.type=n}};var Z=class extends K{constructor(t,n){super(t,"unlit");this.id=t;this.options=n}updateProperties(t){return new ft(this,t).execute()}};var Y=class extends m{constructor(t,n){super(t);this.id=t;this.options=n}};async function Ze(i){let e=await new vt(i?.name).execute();if(e.success){let{id:t}=e.data;return new T(t,i)}else throw new Error("createSpatialEntity failed:"+e?.errorMessage)}async function _(i,e){let t=await new Ct(i.type,e).execute();if(t.success){let{id:n}=t.data;return new i(n,e)}else throw new Error("createSpatialGeometry failed:"+t?.errorMessage)}async function Ye(i){let e=await new Dt(i).execute();if(e.success){let{id:t}=e.data;return new Z(t,i)}else throw new Error("createSpatialUnlitMaterial failed:"+e?.errorMessage)}async function ti(i){let e=await new Pt(i).execute();if(e.success){let{id:t}=e.data;return new Q(t,i)}else throw new Error("createModelComponent failed:"+e?.errorMessage)}async function ei(i,e){let t=await new Mt(i).execute();if(t.success){let{id:n}=t.data;return new X(n,i,e)}else throw new Error("createSpatialModelEntity failed:"+t?.errorMessage)}async function ii(i){let e=await new Rt(i).execute();if(e.success){let{id:t}=e.data;return new Y(t,i)}else throw new Error("createModelAsset failed:"+e?.errorMessage)}var g=class extends m{constructor(t,n){super(t);this.id=t;this.options=n}static type};var tt=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="BoxGeometry"};var et=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="SphereGeometry"};var it=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="CylinderGeometry"};var nt=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="PlaneGeometry"};var at=class extends g{constructor(t,n){super(t,n);this.id=t;this.options=n}static type="ConeGeometry"};var V=class{getSpatialScene(){return v.getInstance()}createSpatialized2DElement(){return qe()}createSpatializedStatic3DElement(e,t){return Qe(e,t)}initScene=He;createSpatializedDynamic3DElement(){return Ke()}createEntity(e){return Ze(e)}createBoxGeometry(e={}){return _(tt,e)}createPlaneGeometry(e={}){return _(nt,e)}createSphereGeometry(e={}){return _(et,e)}createConeGeometry(e){return _(at,e)}createCylinderGeometry(e){return _(it,e)}createModelComponent(e){return ti(e)}createUnlitMaterial(e){return Ye(e)}createModelAsset(e){return ii(e)}createSpatialModelEntity(e,t){return ei(e,t)}createAttachmentEntity(e){return he(e)}};P();var U=class{wsAppShellVersionFromUA;requestSession(){return this.runInSpatialWeb()?(c.init(),new V):null}runInSpatialWeb(){return navigator.userAgent.indexOf("WebSpatial/")>=0}getShellVersionFromUA(){if(this.wsAppShellVersionFromUA!==void 0)return this.wsAppShellVersionFromUA;if(typeof navigator>"u"||typeof navigator.userAgent!="string")return this.wsAppShellVersionFromUA=null,null;let e=navigator.userAgent.match(/WSAppShell\/(\d+(?:\.\d+){2}(?:[-+][0-9A-Za-z.-]+)*)/);return this.wsAppShellVersionFromUA=e?e[1]:"1.3.0",this.wsAppShellVersionFromUA}isSupported(){return!0}getNativeVersion(){return window.__WebSpatialData&&window.__WebSpatialData.getNativeVersion?window.__WebSpatialData.getNativeVersion():window.WebSpatailNativeVersion==="WS_SHELL_VERSION"?this.getClientVersion():window.WebSpatailNativeVersion}getClientVersion(){return"1.6.1"}};Qt();st();var ni=new U,Ht,jt={backgroundMaterial:"--xr-background-material"},ai="";function Jt(i){i!==ai&&(Ht?.getSpatialScene()?.updateSpatialProperties({material:i}),ai=i)}function Mi(){let e=getComputedStyle(document.documentElement).getPropertyValue(jt.backgroundMaterial);Jt(e||"none")}var C={topLeading:0,bottomLeading:0,topTrailing:0,bottomTrailing:0};function ri(){let i=getComputedStyle(document.documentElement),e=ze(i);Ri(e)}function Ri(i){(C.topLeading!==i.topLeading||C.bottomLeading!==i.bottomLeading||C.topTrailing!==i.topTrailing||C.bottomTrailing!==i.bottomTrailing)&&(Ht?.getSpatialScene()?.updateSpatialProperties({cornerRadius:i}),C.topLeading=i.topLeading,C.bottomLeading=i.bottomLeading,C.topTrailing=i.topTrailing,C.bottomTrailing=i.bottomTrailing)}function Ci(i){Ht?.getSpatialScene().updateSpatialProperties({opacity:i})}function oi(){let i=getComputedStyle(document.documentElement),e=parseFloat(i.getPropertyValue("opacity"));Ci(e)}function Di(){let i=document.documentElement.style,e=new Proxy(i,{set:function(t,n,a){let r=Reflect.set(t,n,a);return n===jt.backgroundMaterial&&Jt(a),(n==="border-radius"||n==="borderRadius"||n==="border-top-left-radius"||n==="borderTopLeftRadius"||n==="border-top-right-radius"||n==="borderTopRightRadius"||n==="border-bottom-left-radius"||n==="borderBottomLeftRadius"||n==="border-bottom-right-radius"||n==="borderBottomRightRadius")&&ri(),n==="opacity"&&oi(),r},get:function(t,n){return typeof t[n]=="function"?function(...a){if(n==="setProperty"){let[r,o]=a;r===jt.backgroundMaterial&&Jt(o)}else if(n==="removeProperty"){let[r]=a;r===jt.backgroundMaterial&&Jt("none")}return t[n](...a)}:Reflect.get(t,n)}});Object.defineProperty(document.documentElement,"style",{get:function(){return e}})}function Ti(){new MutationObserver(Nt).observe(document.head,{childList:!0,subtree:!0})}function Nt(){Mi(),ri(),oi()}function Oi(){new MutationObserver(e=>{e.forEach(t=>{t.type==="attributes"&&t.attributeName&&Nt()})}).observe(document.documentElement,{attributes:!0,attributeFilter:["style","class"]})}async function si(){ni.runInSpatialWeb()&&(Ht=await ni.requestSession(),document.readyState==="complete"?Nt():window.addEventListener("load",()=>{Nt()}),Di(),Ti(),Oi())}!B()&&navigator.userAgent.indexOf("WebSpatial/")>0&&(Xe(),si());return k(zi);})();
|
|
75
75
|
//# sourceMappingURL=index.global.js.map
|