@epigraph/previewer 0.0.8 → 0.0.9
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.
|
@@ -6718,7 +6718,7 @@ ${l.join(`
|
|
|
6718
6718
|
}`};function Ud(o,e,t){let i=t;const s=new se;return o.updateWorldMatrix(!0,!0),o.traverseVisible(l=>{const{geometry:u}=l;if(u!==void 0){const{position:d}=u.attributes;if(d!==void 0)for(let f=0,g=d.count;f<g;f++)l.isMesh?l.getVertexPosition(f,s):s.fromBufferAttribute(d,f),l.isSkinnedMesh||s.applyMatrix4(l.matrixWorld),i=e(i,s)}}),i}function mH(o){const e=new Map,t=new Map,i=o.clone();return RI(o,i,function(s,l){e.set(l,s),t.set(s,l)}),i.traverse(function(s){if(!s.isSkinnedMesh)return;const l=s,u=e.get(s),d=u.skeleton.bones;l.skeleton=u.skeleton.clone(),l.bindMatrix.copy(u.bindMatrix),l.skeleton.bones=d.map(function(f){return t.get(f)}),l.bind(l.skeleton,l.bindMatrix)}),i}function RI(o,e,t){t(o,e);for(let i=0;i<o.children.length;i++)RI(o.children[i],e.children[i],t)}class AH{constructor(e,t,i,s,l){this.xrLight=e,this.renderer=t,this.lightProbe=i,this.xrWebGLBinding=null,this.estimationStartCallback=l,this.frameCallback=this.onXRFrame.bind(this);const u=t.xr.getSession();if(s&&"XRWebGLBinding"in window){const d=new Z_(16);e.environment=d.texture;const f=t.getContext();switch(u.preferredReflectionFormat){case"srgba8":f.getExtension("EXT_sRGB");break;case"rgba16f":f.getExtension("OES_texture_half_float");break}this.xrWebGLBinding=new XRWebGLBinding(u,f),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}u.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const s=t.getLightEstimate(this.lightProbe);if(s){this.xrLight.lightProbe.sh.fromArray(s.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const l=Math.max(1,Math.max(s.primaryLightIntensity.x,Math.max(s.primaryLightIntensity.y,s.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(s.primaryLightIntensity.x/l,s.primaryLightIntensity.y/l,s.primaryLightIntensity.z/l),this.xrLight.directionalLight.intensity=l,this.xrLight.directionalLight.position.copy(s.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class _H extends fi{constructor(e,t=!0){super(),this.lightProbe=new zB,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new lb,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let i=null,s=!1;e.xr.addEventListener("sessionstart",()=>{const l=e.xr.getSession();"requestLightProbe"in l&&l.requestLightProbe({reflectionFormat:l.preferredReflectionFormat}).then(u=>{i=new AH(this,e,u,t,()=>{s=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{i&&(i.dispose(),i=null),s&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{i&&(i.dispose(),i=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class bH{constructor({scene:e,sceneHierarchyToCastShadow:t,targetRenderer:i,settings:s}){this.__enabled=!0,this.__settings={},this.__shadowState={shadow:{blur:4,darkness:.6,opacity:1},plane:{color:"#ffffff",opacity:0},showWireframe:!1},this.__blurPlane={},this.__renderTarget={},this.__renderTargetBlur={},this.__shadowCamera={},this.__depthMaterial={},this.__horizontalBlurMaterial={},this.__verticalBlurMaterial={},this.__planeMaterial={},this.__scene=e,this.__sceneHierarchyToCastShadow=t,this.__targetRenderer=i,this.__settings=s,this.__shadowState.shadow.opacity=this.__settings.intensity,this.__shadowState.shadow.blur=this.__settings.softness,this.__planeMaterial.opacity=this.__settings.intensity,this.__planeMaterial.needsUpdate=!0,this.setup()}isEnabled(){return this.__enabled}enable(){this.__enabled=!0}disable(){this.__enabled=!1}updateSettings(e){this.__settings=e,this.updateShadowIntensity(),this.updateShadowSoftness()}updateShadowSoftness(){this.__shadowState.shadow.blur=this.__settings.softness}updateShadowIntensity(){this.__shadowState.shadow.opacity=this.__settings.intensity,this.__planeMaterial.opacity=this.__settings.intensity,this.__planeMaterial.needsUpdate=!0}__blurShadow(e){this.__blurPlane.visible=!0,this.__blurPlane.material=this.__horizontalBlurMaterial,this.__blurPlane.material.uniforms.tDiffuse.value=this.__renderTarget.texture,this.__horizontalBlurMaterial.uniforms.h.value=e*1/256,this.__targetRenderer.setRenderTarget(this.__renderTargetBlur),this.__targetRenderer.render(this.__blurPlane,this.__shadowCamera),this.__blurPlane.material=this.__verticalBlurMaterial,this.__blurPlane.material.uniforms.tDiffuse.value=this.__renderTargetBlur.texture,this.__verticalBlurMaterial.uniforms.v.value=e*1/256,this.__targetRenderer.setRenderTarget(this.__renderTarget),this.__targetRenderer.render(this.__blurPlane,this.__shadowCamera),this.__blurPlane.visible=!1}setup(){if(!this.__enabled)return;const{planeLength:e,planeWidth:t,cameraHeight:i}=this.__settings,s=e,l=t,u=i,d=new fi;d.position.y=0,this.__scene.add(d),this.__renderTarget=new Yi(512,512),this.__renderTarget.texture.generateMipmaps=!1,this.__renderTargetBlur=new Yi(512,512),this.__renderTargetBlur.texture.generateMipmaps=!1;const f=new Ls(l,s).rotateX(Math.PI/2);this.__planeMaterial=new Mi({map:this.__renderTarget.texture,opacity:this.__shadowState.shadow.opacity,transparent:!0,depthWrite:!1});const g=new lt(f,this.__planeMaterial);g.renderOrder=1,d.add(g),g.scale.y=-1,this.__blurPlane=new lt(f),this.__blurPlane.visible=!1,d.add(this.__blurPlane);const m=new Mi({color:this.__shadowState.plane.color,opacity:this.__shadowState.plane.opacity,transparent:!0,depthWrite:!1}),_=new lt(f,m);_.rotateX(Math.PI),d.add(_),this.__shadowCamera=new Pa(-l/2,l/2,s/2,-s/2,0,u),this.__shadowCamera.rotation.x=Math.PI/2,d.add(this.__shadowCamera),this.__depthMaterial=new rb,this.__depthMaterial.userData.darkness={value:this.__shadowState.shadow.darkness},this.__depthMaterial.onBeforeCompile=b=>{b.uniforms.darkness=this.__depthMaterial.userData.darkness,b.fragmentShader=`
|
|
6719
6719
|
uniform float darkness;
|
|
6720
6720
|
${b.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );")}
|
|
6721
|
-
`},this.__depthMaterial.depthTest=!1,this.__depthMaterial.depthWrite=!1,this.__horizontalBlurMaterial=new $i(II),this.__horizontalBlurMaterial.depthTest=!1,this.__verticalBlurMaterial=new $i(MI),this.__verticalBlurMaterial.depthTest=!1}reCalculate(){const e=this.__scene.background;this.__scene.background=null,this.__scene.overrideMaterial=this.__depthMaterial;const t=this.__targetRenderer.getClearAlpha();this.__targetRenderer.setClearAlpha(0),this.__targetRenderer.setRenderTarget(this.__renderTarget),this.__targetRenderer.render(this.__sceneHierarchyToCastShadow,this.__shadowCamera),this.__scene.overrideMaterial=null,this.__blurShadow(this.__shadowState.shadow.blur),this.__blurShadow(this.__shadowState.shadow.blur*.4),this.__targetRenderer.setRenderTarget(null),this.__targetRenderer.setClearAlpha(t),this.__scene.background=e}}class uh{constructor(e){this._success=e}get success(){return this._success}set success(e){this._success=e}get failed(){return!this._success}}class yH extends uh{constructor(e=!1,t=void 0){super(e),this.__payload=t}get payload(){return this.__payload}set payload(e){this.__payload=e}}var BI=(o=>(o.Empty="entity-empty",o.Gltf="entity-mesh",o.Render="entity-render",o.Proxy="entity-proxy",o.Collider="entity-collider",o.Asset="entity-asset",o))(BI||{});class vH extends fi{constructor(){super(),this._entityType=BI.Empty}get entityType(){return this._entityType}destroy(){let e;const t=new yH(!1,e);return e=void 0,t.success=!0,t.payload=e,t}}class Dm{constructor(e){this.__name=e}getName(){return this.__name}}class Ba extends Pt{constructor(e){super(),this.epgType="PLUG",this.__connectionId="",this.__isPrimary=!1,this.__receiver=null,this.__debugGeo=null,this.__config=e,this.name=e.name,this.__connectionId=e.connectionId,this.__isPrimary=e.isPrimary;const t=e.position;this.position.set(t.x,t.y,t.z);const i=e.rotation;this.rotation.set(i.x,i.y,i.z)}get config(){return this.__config}get connectionId(){return this.__connectionId}get isPrimary(){return this.__isPrimary}get isOpen(){return this.__receiver===null}get receiver(){return this.__receiver}connect(e){this.__receiver=e.receiver}disconnect(){this.__receiver=null}clone(e){return new Ba(this.__config).copy(this,e)}showDebug(){const e=new se().setFromEuler(this.rotation).normalize(),t=this.position,i=.2,s=16711680;this.__debugGeo=new bC(e,t,i,s,.06,.06);const l=document.createElement("div");l.textContent=this.name;const u=new Rb(l);l.style.pointerEvents="none";const d=new se;this.getWorldDirection(d),d.normalize();const f=this.position.clone().addScaledVector(d,Math.random());u.position.set(f.x,f.y,f.z),this.__debugGeo.add(u),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),Rt.dispose3(this.__debugGeo))}}class Vr extends Pt{constructor(e){super(),this.epgType="RECEIVER",this.__connectionId="",this.__plug=null,this.__debugGeo=null,this.__config=e,this.name=e.name,this.__connectionId=e.connectionId;const t=e.position;this.position.set(t.x,t.y,t.z);const i=e.rotation;this.rotation.set(i.x,i.y,i.z)}get config(){return this.__config}get connectionId(){return this.__connectionId}get isOpen(){return this.__plug===null}get plug(){return this.__plug}connect(e){this.__plug=e.plug}disconnect(){this.__plug=null}clone(e){return new Vr(this.__config).copy(this,e)}showDebug(){const e=new se().setFromEuler(this.rotation.clone()).normalize(),t=this.position,i=.1,s=65280;this.__debugGeo=new bC(e,t,i,s,.01,.08);const l=document.createElement("div");l.textContent=this.name,l.style.color="green";const u=new Rb(l);l.style.pointerEvents="none",this.__debugGeo.add(u),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),Rt.dispose3(this.__debugGeo))}}var Bb=(o=>(o.Gltf="media-asset-gltf",o.Proxy="media-asset-proxy",o.Render="media-asset-render",o))(Bb||{}),c_=(o=>(o.Plug="plug",o.Receiver="receiver",o))(c_||{});class LI{constructor({id:e,uri:t,appWcRef:i}){this._type="media-asset-gltf",this._id=crypto.randomUUID(),this._loadingProgress=0,this._state="declared",this._resource=null,e&&(this._id=e),this._appWcRef=i,this._uri=t}get id(){return this._id}get uri(){return this._uri}get loadingProgress(){return this._loadingProgress}get state(){return this._state}get isLoaded(){return this._state==="loaded"}get type(){return this._type}get resource(){return this._resource}highlight(){}updateLoadingProgress(e){this._loadingProgress=e,this._appWcRef.eventsManager.assetLoadProgress.fire({progress:e})}async load(){if(this._state==="loaded"||this._state==="loading")return Promise.resolve(!0);this._state="loading";const e=await this._appWcRef.loaders.gltfLoader.loadAsync(this._uri,t=>{this.updateLoadingProgress(t.loaded/t.total*100)}).catch(t=>(window.epigraph.logger.groupCollapsed({title:""}),window.epigraph.logger.error({title:"An error occurred while trying to load an asset!",details:t}),this._state="failed",Promise.reject()));return e===void 0?Promise.reject(!1):(this._resource=e,await this._parseLoadedGltf(),this._state="loaded",Promise.resolve(!0))}async _parseLoadedGltf(){window.epigraph.logger.info({title:"Parsing GLTF data",details:this._resource})}unload(){return this._resource={},Promise.resolve(!0)}}class wH extends LI{constructor({id:e,uri:t,appWcRef:i}){super({id:e,uri:t,appWcRef:i}),this._type=Bb.Proxy,this.__plugs=[],this.__receivers=[]}get plugs(){return this.__plugs}get receivers(){return this.__receivers}async _parseLoadedGltf(){if(!this._resource?.scene)return;const e=[];this._resource.scene.traverse(t=>{if(t.userData.epgType===c_.Receiver){const i=new Vr({name:t.name,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__receivers.push(i),e.push(t)}else if(t.userData.epgType===c_.Plug){const i=new Ba({name:t.name,isPrimary:t.userData.isPrimary,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__plugs.push(i),e.push(t)}});for(const t of this.__receivers)this._resource.scene.add(t);for(const t of this.__plugs)this._resource.scene.add(t);for(const t of e)t.removeFromParent(),Rt.dispose3(t)}unload(){return this._resource={},this.__plugs=[],this.__receivers=[],Promise.resolve(!0)}}class PI extends LI{constructor({id:e,uri:t,appWcRef:i}){super({id:e,uri:t,appWcRef:i}),this._loggerContext="GLTF RENDER",this._type=Bb.Render,this.__variantsExtensionName="KHR_materials_variants",this.__finishNamesFromAsset=[]}get khrVariantsExtensionName(){return this.__variantsExtensionName}get khrVariantsExtension(){return this.__variantsExtension}get finishNamesFromAsset(){return this.__finishNamesFromAsset}async _parseLoadedGltf(){this._resource?.scene.traverse(t=>{t instanceof lt&&(t.castShadow=!0)});const e=this._resource?.userData?.gltfExtensions;if(!e){this.__variantsExtension=null,this.__finishNamesFromAsset=["default"];return}if(this.__variantsExtension=e[this.__variantsExtensionName],this.__variantsExtension?.variants)for(const t of this.__variantsExtension.variants)this.__finishNamesFromAsset.push(t.name)}unload(){return this._resource={},this.__variantsExtension={},this.__finishNamesFromAsset=[],Promise.resolve(!0)}}class DI{constructor(e,t){this._loggerContext="ASSET",this.__autoGenerateProxyEntity=!1,this.__finishes=new Map,this.__brandMaterialLibraries=new Map,this.__hotspots=[],this.__assetOverrides=null,this.__id=e.id,this.__name=e.name,this.__config=e,this.__appWcRef=t,this.__proxyGltf=new wH({id:String(e.id),uri:e.proxyGeo,appWcRef:this.__appWcRef}),this.__autoGenerateProxyEntity=e.autoGenerateProxyEntity,this.__renderGltf=new PI({id:String(e.id),uri:e.renderGeo,appWcRef:this.__appWcRef});for(const i in e.finishes)this.__finishes.set(i,new Dm(i));e.brandMaterialLibraries||(e.brandMaterialLibraries=[]),e.hotspots&&(this.__hotspots=e.hotspots)}get id(){return this.__id}get name(){return this.__name}get assetRootDir(){return new URL(this.__renderGltf.uri+"/../../").href}get assetOverrides(){return this.__assetOverrides}get proxyGltf(){return this.__proxyGltf}get autoGenerateProxyEntity(){return this.__autoGenerateProxyEntity}get renderGltf(){return this.__renderGltf}get finishes(){return this.__finishes}get hotspots(){return this.__hotspots}get brandMaterialLibraries(){return this.__brandMaterialLibraries}get allFinishIds(){const e=[];for(const t of this.__finishes.keys())e.push(t);return e}async loadProxyGltf(){return!this.__proxyGltf||this.__proxyGltf.isLoaded?Promise.resolve(!0):await this.__proxyGltf.load()}pullFinishesFromRenderGltf(){this.__renderGltf.finishNamesFromAsset.forEach(e=>{this.__finishes.has(e)||this.__finishes.set(e,new Dm(e))})}async parseAssetOverrideJson(){let e=this.__renderGltf.resource?.asset.extras?.epgOverrides;if(!e)return null;e=e.replace("./","");const t=new URL(e,this.assetRootDir),i=await fetch(t).catch(s=>{window.epigraph.logger.error({title:`Failed to load asset override file: ${t}`,details:s})});i&&(this.__assetOverrides=await i.json())}async loadRenderGltf(e=!1){if(this.__renderGltf.isLoaded)return Promise.resolve(!0);await this.__renderGltf.load().catch(t=>(window.epigraph.logger.error({title:`Failed to load asset: ${this.__id}`,details:t,contextOverride:this._loggerContext}),Promise.reject(!1)));for(const t of this.__config.brandMaterialLibraries){const i=this.__appWcRef.experienceData.materialLibraryCollection.materialLibraries.get(t);if(await i?.load(),!i){window.epigraph.logger.warn({title:`Material library ${t} not found in brand material libraries.`,contextOverride:this._loggerContext});continue}this.__brandMaterialLibraries.set(i.id,i);for(const s of i.finishNamesFromAsset)this.finishes.has(s)||this.__finishes.set(s,new Dm(s))}return e&&this.pullFinishesFromRenderGltf(),await this.parseAssetOverrideJson(),Promise.resolve(!0)}async load(e=!1){return Promise.all([this.loadRenderGltf(e),this.loadProxyGltf()])}}var EH=Object.defineProperty,NI=(o,e,t,i)=>{for(var s=void 0,l=o.length-1,u;l>=0;l--)(u=o[l])&&(s=u(e,t,s)||s);return s&&EH(e,t,s),s};class OI{constructor({appWcRef:e}){this._loggerContext="SOLUTION MANAGER",this._appWcRef=e}initialize(){window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext})}}const Lb=class Bf extends Ea{constructor(){super(),this._loggerContext="SOLUTION MANAGER",this.enabled=!1}static{this.webComponentName="solution-manager"}connectedCallback(){super.connectedCallback(),window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext})}firstUpdated(e){super.firstUpdated(e)}static setupWebComponent(){window.customElements.get(Bf.webComponentName)||window.customElements.define(Bf.webComponentName,Bf)}render(){return we`
|
|
6721
|
+
`},this.__depthMaterial.depthTest=!1,this.__depthMaterial.depthWrite=!1,this.__horizontalBlurMaterial=new $i(II),this.__horizontalBlurMaterial.depthTest=!1,this.__verticalBlurMaterial=new $i(MI),this.__verticalBlurMaterial.depthTest=!1}reCalculate(){const e=this.__scene.background;this.__scene.background=null,this.__scene.overrideMaterial=this.__depthMaterial;const t=this.__targetRenderer.getClearAlpha();this.__targetRenderer.setClearAlpha(0),this.__targetRenderer.setRenderTarget(this.__renderTarget),this.__targetRenderer.render(this.__sceneHierarchyToCastShadow,this.__shadowCamera),this.__scene.overrideMaterial=null,this.__blurShadow(this.__shadowState.shadow.blur),this.__blurShadow(this.__shadowState.shadow.blur*.4),this.__targetRenderer.setRenderTarget(null),this.__targetRenderer.setClearAlpha(t),this.__scene.background=e}}class uh{constructor(e){this._success=e}get success(){return this._success}set success(e){this._success=e}get failed(){return!this._success}}class yH extends uh{constructor(e=!1,t=void 0){super(e),this.__payload=t}get payload(){return this.__payload}set payload(e){this.__payload=e}}var BI=(o=>(o.Empty="entity-empty",o.Gltf="entity-mesh",o.Render="entity-render",o.Proxy="entity-proxy",o.Collider="entity-collider",o.Asset="entity-asset",o))(BI||{});class vH extends fi{constructor(){super(),this._entityType=BI.Empty}get entityType(){return this._entityType}destroy(){let e;const t=new yH(!1,e);return e=void 0,t.success=!0,t.payload=e,t}}class Dm{constructor(e){this.__name=e}getName(){return this.__name}}class Ba extends Pt{constructor(e){super(),this.epgType="PLUG",this.__connectionId="",this.__isPrimary=!1,this.__receiver=null,this.__debugGeo=null,this.__config=e,this.name=e.name,this.__connectionId=e.connectionId,this.__isPrimary=e.isPrimary;const t=e.position;this.position.set(t.x,t.y,t.z);const i=e.rotation;this.rotation.set(i.x,i.y,i.z)}get config(){return this.__config}get connectionId(){return this.__connectionId}get isPrimary(){return this.__isPrimary}get isOpen(){return this.__receiver===null}get receiver(){return this.__receiver}connect(e){this.__receiver=e.receiver}disconnect(){this.__receiver=null}clone(e){return new Ba(this.__config).copy(this,e)}showDebug(){const e=new se().setFromEuler(this.rotation).normalize(),t=this.position,i=.2,s=16711680;this.__debugGeo=new bC(e,t,i,s,.06,.06);const l=document.createElement("div");l.textContent=this.name;const u=new Rb(l);l.style.pointerEvents="none";const d=new se;this.getWorldDirection(d),d.normalize();const f=this.position.clone().addScaledVector(d,Math.random());u.position.set(f.x,f.y,f.z),this.__debugGeo.add(u),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),Rt.dispose3(this.__debugGeo))}}class Vr extends Pt{constructor(e){super(),this.epgType="RECEIVER",this.__connectionId="",this.__plug=null,this.__debugGeo=null,this.__config=e,this.name=e.name,this.__connectionId=e.connectionId;const t=e.position;this.position.set(t.x,t.y,t.z);const i=e.rotation;this.rotation.set(i.x,i.y,i.z)}get config(){return this.__config}get connectionId(){return this.__connectionId}get isOpen(){return this.__plug===null}get plug(){return this.__plug}connect(e){this.__plug=e.plug}disconnect(){this.__plug=null}clone(e){return new Vr(this.__config).copy(this,e)}showDebug(){const e=new se().setFromEuler(this.rotation.clone()).normalize(),t=this.position,i=.1,s=65280;this.__debugGeo=new bC(e,t,i,s,.01,.08);const l=document.createElement("div");l.textContent=this.name,l.style.color="green";const u=new Rb(l);l.style.pointerEvents="none",this.__debugGeo.add(u),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),Rt.dispose3(this.__debugGeo))}}var Bb=(o=>(o.Gltf="media-asset-gltf",o.Proxy="media-asset-proxy",o.Render="media-asset-render",o))(Bb||{}),c_=(o=>(o.Plug="plug",o.Receiver="receiver",o))(c_||{});class LI{constructor({id:e,uri:t,appWcRef:i}){this._type="media-asset-gltf",this._id=crypto.randomUUID(),this._loadingProgress=0,this._state="declared",this._resource=null,e&&(this._id=e),this._appWcRef=i,this._uri=t}get id(){return this._id}get uri(){return this._uri}get loadingProgress(){return this._loadingProgress}get state(){return this._state}get isLoaded(){return this._state==="loaded"}get type(){return this._type}get resource(){return this._resource}highlight(){}updateLoadingProgress(e){this._loadingProgress=e,this._appWcRef.eventsManager.assetLoadProgress.fire({progress:e})}async load(){if(this._state==="loaded"||this._state==="loading")return Promise.resolve(!0);this._state="loading";const e=await this._appWcRef.loaders.gltfLoader.loadAsync(this._uri,t=>{this.updateLoadingProgress(t.loaded/t.total*100)}).catch(t=>(window.epigraph.logger.groupCollapsed({title:""}),window.epigraph.logger.error({title:"An error occurred while trying to load an asset!",details:t}),this._state="failed",Promise.reject()));return e===void 0?Promise.reject(!1):(this._resource=e,await this._parseLoadedGltf(),this._state="loaded",Promise.resolve(!0))}async _parseLoadedGltf(){window.epigraph.logger.info({title:"Parsing GLTF data",details:this._resource})}unload(){return this._resource={},Promise.resolve(!0)}}class wH extends LI{constructor({id:e,uri:t,appWcRef:i}){super({id:e,uri:t,appWcRef:i}),this._type=Bb.Proxy,this.__plugs=[],this.__receivers=[]}get plugs(){return this.__plugs}get receivers(){return this.__receivers}async _parseLoadedGltf(){if(!this._resource?.scene)return;const e=[];this._resource.scene.traverse(t=>{if(t.userData.epgType===c_.Receiver){const i=new Vr({name:t.name,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__receivers.push(i),e.push(t)}else if(t.userData.epgType===c_.Plug){const i=new Ba({name:t.name,isPrimary:t.userData.isPrimary,connectionId:t.userData.connectionId,position:t.position.clone(),rotation:t.rotation.clone()});this.__plugs.push(i),e.push(t)}});for(const t of this.__receivers)this._resource.scene.add(t);for(const t of this.__plugs)this._resource.scene.add(t);for(const t of e)t.removeFromParent(),Rt.dispose3(t)}unload(){return this._resource={},this.__plugs=[],this.__receivers=[],Promise.resolve(!0)}}class PI extends LI{constructor({id:e,uri:t,appWcRef:i}){super({id:e,uri:t,appWcRef:i}),this._loggerContext="GLTF RENDER",this._type=Bb.Render,this.__variantsExtensionName="KHR_materials_variants",this.__finishNamesFromAsset=[]}get khrVariantsExtensionName(){return this.__variantsExtensionName}get khrVariantsExtension(){return this.__variantsExtension}get finishNamesFromAsset(){return this.__finishNamesFromAsset}async _parseLoadedGltf(){this._resource?.scene.traverse(t=>{t instanceof lt&&(t.castShadow=!0)});const e=this._resource?.userData?.gltfExtensions;if(!e){this.__variantsExtension=null,this.__finishNamesFromAsset=["default"];return}if(this.__variantsExtension=e[this.__variantsExtensionName],this.__variantsExtension?.variants)for(const t of this.__variantsExtension.variants)this.__finishNamesFromAsset.push(t.name)}unload(){return this._resource={},this.__variantsExtension={},this.__finishNamesFromAsset=[],Promise.resolve(!0)}}class DI{constructor(e,t){this._loggerContext="ASSET",this.__autoGenerateProxyEntity=!1,this.__finishes=new Map,this.__brandMaterialLibraries=new Map,this.__hotspots=[],this.__assetOverrides=null,this.__id=e.id,this.__name=e.name,this.__config=e,this.__appWcRef=t,this.__proxyGltf=new wH({id:String(e.id),uri:e.proxyGeo,appWcRef:this.__appWcRef}),this.__autoGenerateProxyEntity=e.autoGenerateProxyEntity,this.__renderGltf=new PI({id:String(e.id),uri:e.renderGeo,appWcRef:this.__appWcRef});for(const i in e.finishes)this.__finishes.set(i,new Dm(i));e.brandMaterialLibraries||(e.brandMaterialLibraries=[]),e.hotspots&&(this.__hotspots=e.hotspots)}get id(){return this.__id}get name(){return this.__name}get assetRootDir(){return new URL(this.__renderGltf.uri+"/../../").href}get assetOverrides(){return this.__assetOverrides}get proxyGltf(){return this.__proxyGltf}get autoGenerateProxyEntity(){return this.__autoGenerateProxyEntity}get renderGltf(){return this.__renderGltf}get finishes(){return this.__finishes}get hotspots(){return this.__hotspots}get brandMaterialLibraries(){return this.__brandMaterialLibraries}get allFinishIds(){const e=[];for(const t of this.__finishes.keys())e.push(t);return e}async loadProxyGltf(){return!this.__proxyGltf||this.__proxyGltf.isLoaded?Promise.resolve(!0):await this.__proxyGltf.load()}pullFinishesFromRenderGltf(){this.__renderGltf.finishNamesFromAsset.forEach(e=>{this.__finishes.has(e)||this.__finishes.set(e,new Dm(e))})}async parseAssetOverrideJson(){let e=this.__renderGltf.resource?.asset.extras?.epgOverrides;if(!e)return null;e=e.replace("./","");const t=new URL(e,this.assetRootDir),i=await fetch(t).catch(s=>{window.epigraph.logger.error({title:`Failed to load asset override file: ${t}`,details:s})});i&&(this.__assetOverrides=await i.json())}async loadRenderGltf(e=!1){await this.__renderGltf.load().catch(t=>(window.epigraph.logger.error({title:`Failed to load asset: ${this.__id}`,details:t,contextOverride:this._loggerContext}),Promise.reject(!1)));for(const t of this.__config.brandMaterialLibraries){const i=this.__appWcRef.experienceData.materialLibraryCollection.materialLibraries.get(t);if(await i?.load(),!i){window.epigraph.logger.warn({title:`Material library ${t} not found in brand material libraries.`,contextOverride:this._loggerContext});continue}this.__brandMaterialLibraries.set(i.id,i);for(const s of i.finishNamesFromAsset)this.finishes.has(s)||this.__finishes.set(s,new Dm(s))}return e&&this.pullFinishesFromRenderGltf(),await this.parseAssetOverrideJson(),Promise.resolve(!0)}async load(e=!1){return Promise.all([this.loadRenderGltf(e),this.loadProxyGltf()])}}var EH=Object.defineProperty,NI=(o,e,t,i)=>{for(var s=void 0,l=o.length-1,u;l>=0;l--)(u=o[l])&&(s=u(e,t,s)||s);return s&&EH(e,t,s),s};class OI{constructor({appWcRef:e}){this._loggerContext="SOLUTION MANAGER",this._appWcRef=e}initialize(){window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext})}}const Lb=class Bf extends Ea{constructor(){super(),this._loggerContext="SOLUTION MANAGER",this.enabled=!1}static{this.webComponentName="solution-manager"}connectedCallback(){super.connectedCallback(),window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext})}firstUpdated(e){super.firstUpdated(e)}static setupWebComponent(){window.customElements.get(Bf.webComponentName)||window.customElements.define(Bf.webComponentName,Bf)}render(){return we`
|
|
6722
6722
|
${Rt.getCustomStylesTemplate()}
|
|
6723
6723
|
`}};NI([ce({type:Boolean,attribute:"enabled"})],Lb.prototype,"enabled");NI([ce({attribute:!1})],Lb.prototype,"appWcRef");let Kp=Lb;class xH{constructor({id:e,name:t,receiver:i,plug:s}){this.__name=t,this.__plug=s,this.__receiver=i,e?this.__id=e:this.__id=`${this.__receiver.uuid}-${this.__plug.uuid}`}get id(){return this.__id}get name(){return this.__name}get plug(){return this.__plug}isPrimary(){return this.__plug?.isPrimary}get receiver(){return this.__receiver}connect(){this.__receiver.connect(this),this.__plug.connect(this)}disconnect(){this.__plug&&this.__plug.disconnect(),this.__receiver&&this.__receiver.disconnect()}}class SH{constructor({id:e,receiver:t,plug:i}){this.__id=e,this.__plug=i,this.__receiver=t}get id(){return this.__id}get plug(){return this.__plug}set plug(e){this.__plug=e}get receiver(){return this.__receiver}set receiver(e){this.__receiver=e}disconnect(){this.__receiver.disconnect(),this.__plug.disconnect()}}class TH extends fi{constructor(e){super(),this.name="ENTITIES",this._loggerContext="SCENE STRUCTURE",this.__appWcRef=e,this.__eventsManager=this.__appWcRef.eventsManager}async setupRootEntity(e,t){const i=await new DI({id:0,name:"Root",proxyGeo:e??"https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/proxies/root-proxy.glb",autoGenerateProxyEntity:!1,renderGeo:t??"https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/staging-assets/pipeline-assets/3d-assets/render/root-render.glb",finishes:{},hotspots:[],brandMaterialLibraries:[]},this.__appWcRef);await i.load().catch(()=>Promise.reject(!1));const s=new xo(i,this.__appWcRef);await s.initialize(),this.add(s),this.__rootEntity=s}get rootEntity(){return this.__rootEntity}isEmpty(){return this.__rootEntity===void 0||this.__rootEntity.children.length===0}isNotEmpty(){return!this.isEmpty()}addEntity(e){this.__rootEntity.add(e),this.__eventsManager.structureNodeAddedEvent.fire({node:e})}getFirstEntity(){return this.isEmpty()?null:this.getSceneEntities()[0]}getEntityForAssetName(e){const t=this.getSceneEntities();let i;for(const s of t)if(s.asset.name===e){i=s;break}return i}getEntityForAssetId(e){const t=this.getSceneEntities();let i;for(const s of t)if(s.asset.id===e){i=s;break}return i}getSceneEntities(e=!1){const t=[];return this.__rootEntity.traverse(i=>{!e&&i.uuid===this.__rootEntity.uuid||i instanceof xo&&t.push(i)}),t}getPossibleConnectionsForAssetInScene(e){const t=[];window.epigraph.logger.info({title:"Getting connections for asset in scene:",details:e,contextOverride:this._loggerContext});for(const i of this.getSceneEntities(!0)){const s=i.findPossibleConnectionsForAsset(e);s.length>0&&t.push(...s)}return window.epigraph.logger.table({title:"Possible Connections",details:t}),t}getAllConnectionsInScene(){const e=new Map;return this.traverse(t=>{if(t instanceof Vr||t instanceof Ba){if(t.connectionId===""||e.has(t.connectionId))return;let s=null,l=null;if(t instanceof Vr?(s=t,l=t.plug):t instanceof Ba&&(s=t.receiver,l=t),s!==null&&l!==null){const u=new SH({id:t.connectionId,receiver:s,plug:l});e.set(t.connectionId,u)}}}),e}}class CH extends OI{constructor(e){super({appWcRef:e}),this._loggerContext="SCENE MANAGER",this.__currentSceneBounds=new Ii,this.__sceneStructure=new TH(this._appWcRef)}get sceneStructure(){return this.__sceneStructure}get currentSceneBounds(){return this.__currentSceneBounds}recalculateSceneBounds(){this.currentSceneBounds.setFromPoints([new se]),this.__sceneStructure.isNotEmpty()&&this.__sceneStructure.rootEntity.traverse(e=>{e instanceof lt&&e.userData.isProxyMesh&&this.currentSceneBounds.expandByObject(e)}),this._appWcRef.eventsManager.sceneBoundsChanged.fire()}}class xo extends vH{constructor(e,t){super(),this.epgType="ENTITY_ASSET",this.__autoGeneratedProxy=new fi,this.__proxyEntity=new fi,this.__renderEntity=new fi,this.__activeFinish="",this.__hotspots=new fi,this.__renderEntityBoundsBox=new Ii,this.__renderEntityBoundsSize=new se,this.__animationMixer=null,this.__animations=new Map,this.name=e.name,this.__appWcRef=t,this.__proxyEntity.name="PROXY",this.add(this.__proxyEntity),this.__renderEntity.name="RENDER",this.add(this.__renderEntity),this.__hotspots.name="HOTSPOTS",this.add(this.__hotspots),this.__asset=e}get asset(){return this.__asset}get isRoot(){return this.name.toLowerCase()==="root"}get proxy(){return this.__proxyEntity}get render(){return this.__renderEntity}get activeFinish(){return this.__activeFinish}get allAssetFinishes(){return this.__asset.finishes}get allFinishIds(){return this.__asset.allFinishIds}highlight(){this.__renderEntity.traverseVisible(e=>{const t=e;if(t.isMesh){const i=t.material;if(!i.emissive)return;(i.emissive.r>0||i.emissive.g>0||i.emissive.b>0)&&(i.userData.epgData={orignalEmissive:i.emissive.clone(),originalEmissiveIntensity:i.emissiveIntensity}),i.emissive.r=1,i.emissive.g=1,i.emissive.b=1,i.emissiveIntensity=1}})}unhighlight(){this.__renderEntity.traverseVisible(e=>{const t=e;if(t.isMesh){const i=t.material;if(!i.emissive)return;const s=i?.userData?.epgData?.orignalEmissive;s?(i.emissive.r=s.r,i.emissive.g=s.g,i.emissive.b=s.b):(i.emissive.r=0,i.emissive.g=0,i.emissive.b=0);const l=i?.userData?.epgData?.orignalEmissiveIntensity;i.emissiveIntensity=l!==void 0?l:0}})}addHotspot(e){e.entity.name=`HOTSPOT-${this.asset.name}-${crypto.randomUUID()}`,e.entity.userData.epgId=e.hotspotId,e.entity.position.set(e.config.position.x,e.config.position.y,e.config.position.z),this.__hotspots.add(e.entity)}removeHotspot(e){let t;this.__hotspots.traverse(i=>{i.userData.epgId===e&&(t=i)}),t&&(t.removeFromParent(),Rt.dispose3(t))}__selectFinishByKHRMaterialsVariantsExtension(e,t,i,s){const l=new uh(!1);window.epigraph.logger.info({title:"Attempting to load finish by KHR Materials Variants",details:i});const u=e.variants.findIndex(d=>d.name===i);return this.__renderEntity.traverse(async d=>{if(!(d instanceof lt)||!d.isMesh||!d.userData.gltfExtensions)return;const f=d.userData.gltfExtensions[t];if(!f)return window.epigraph.logger.error({title:"No variants extension found in mesh.",details:f}),Promise.reject(l);d.userData.originalMaterial||(d.userData.originalMaterial=d.material);const g=f.mappings.find(m=>m.variants.includes(u));if(g&&s.resource){const m=s.resource.parser;d.material=await m.getDependency("material",g.material),m.assignFinalMaterial(d),l.success=!0}else window.epigraph.logger.info({title:"Variant has no effect on this Object.",details:{object:d,finishId:i}}),d.material=d.userData.originalMaterial,l.success=!1}),l}async __selectFinishByMaterialLibrary(e,t,i){const s=new uh(!1);window.epigraph.logger.info({title:"Attempting to load finish by material library",details:i});for(const l of this.asset.brandMaterialLibraries.values()){const u=l.resource?.scene.children[0];if(!u)continue;const d=l.finishNamesFromAsset,f={};for(const m of u.userData.gltfExtensions[t].mappings){const _=d[m.variants[0]];f[_]=m.material}if(f[i]===void 0)continue;const g=await l.resource.parser.getDependency("material",f[i]);this.__renderEntity.traverse(async m=>{m instanceof lt&&(m.material=g,await this.__processAnyOverridesForAsset(i,m),m.material.needsUpdate=!0)})}return s.success=!1,s}async __processAnyOverridesForAsset(e,t){const i=this.__asset.assetOverrides;if(!i)return;const s=i.brandMaterialLibrary;if(s){const l=s[e];if(l){l.sort((u,d)=>{const f=u.name.includes("."),g=d.name.includes(".");return f&&!g?1:!f&&g?-1:0});for(const u of l){const d=u.name,f=u.value,g=u.type,m=t.material;switch(window.epigraph.logger.info({title:`Override Property on asset: ${this.asset.id} MLIB: ${d} -> overrides[override]`}),g){case"image":await this.__processImageOverride(d,f,m);break;case"color":await this.__processColorOverride(d,f,m);break;case"number":await this.__processNumberOverride(d,f,m);break}}}}}__applyFinalPropertyValue(e,t,i){let s=i;const l=e.split(".");l.length===2&&(s=s[l[0]],e=l[1]),!(!s||!(e in s))&&(s[e]=t)}async __processImageOverride(e,t,i){const s=new URL(t,`${this.__asset.assetRootDir}overrides/`).href,l=await this.__appWcRef.loaders.textureLoader.loadAsync(s).catch(u=>{window.epigraph.logger.error({title:`Couldn't load texture: ${s}`,details:u,contextOverride:"ASSET ENTITY"})});l&&(l.flipY=!1,this.__applyFinalPropertyValue(e,l,i))}__processColorOverride(e,t,i){const s=JSON.parse(t),l=new je(s[0],s[1],s[2]);this.__applyFinalPropertyValue(e,l,i)}__processNumberOverride(e,t,i){this.__applyFinalPropertyValue(e,parseFloat(t),i)}async selectAssetFinish(e){window.epigraph.logger.info({title:`Switching to asset finish: ${e}`});const t=new uh(!1),i=this.__asset.renderGltf;if(!i)return Promise.reject(t);const s=i.khrVariantsExtension,l=i.khrVariantsExtensionName;if(!s?.variants)return window.epigraph.logger.warn({title:"No KHR_Materials_Variants found in asset. Using default material."}),this.allFinishIds.length===1&&this.allFinishIds.includes(e)&&(this.__activeFinish=e),t.success=!0,Promise.resolve(t);const u=await this.__selectFinishByKHRMaterialsVariantsExtension(s,l,e,i);if(t.success=u.success,t.failed===!0){const d=await this.__selectFinishByMaterialLibrary(s,l,e);t.success=d.success}return this.__activeFinish=e,Promise.resolve(t)}findPossibleConnectionsForAsset(e){const t=[];return window.epigraph.logger.info({title:"Getting connections for asset in scene:",details:e}),this.__proxyEntity.traverse(i=>{if(!(i instanceof Vr))return;const s=i,l=e.proxyGltf?.plugs??[];for(const u of l)u.connectionId===s.connectionId&&t.push(new xH({name:u.connectionId,receiver:s,plug:u}))}),t}getAnimationMixer(){return this.__animationMixer}getAllAnimations(){return this.__animations}async initialize(){this.__asset.autoGenerateProxyEntity?(await this.__initializeRenderEntity(),await this.__initializeProxyEntity()):(await this.__initializeProxyEntity(),await this.__initializeRenderEntity())}async __initializeRenderEntity(){const e=this.__asset?.renderGltf?.resource?.scene?.clone(!0);if(!e)return Promise.reject();this.__renderEntity.add(e),this.__renderEntityBoundsBox.setFromObject(e,!0),this.__renderEntityBoundsBox.getSize(this.__renderEntityBoundsSize);const t=new se;if(this.__renderEntityBoundsBox.getCenter(t),this.__asset.autoGenerateProxyEntity){window.epigraph.logger.group({title:""}),window.epigraph.logger.info({title:"Attempting to place render geo at the grid for AssetEntity...",details:this.__asset,contextOverride:"ASSET ENTITY"});const i=new fi;i.name="rendergeopivot";const s=new cs(.01,.01,.01),l=new Mi({color:65280,depthTest:!1}),u=new lt(s,l);i.add(u),this.__renderEntity.add(i),i.position.set(t.x,this.__renderEntityBoundsBox.min.y,t.z),i.attach(e),i.position.set(0,0,0),this.__renderEntity.attach(e),i.removeFromParent(),Rt.dispose3(i),window.epigraph.logger.info({title:"Done!!"}),window.epigraph.logger.groupEnd()}this.__updateAnimations()}async __initializeProxyEntity(){let e=this.__asset.proxyGltf.resource?.scene.clone();if((!e||this.__asset.autoGenerateProxyEntity)&&(this.__autoGenerateProxyScene(),e=this.__autoGeneratedProxy),!e)return window.epigraph.logger.error({title:"Failed to load OR auto generate proxy asset",details:this.__asset,contextOverride:"ASSET ENTITY"}),Promise.reject();this.__proxyEntity.add(e),this.__proxyEntity.traverse(t=>{t instanceof lt&&(t.userData.isProxyMesh=!0,t.visible=!1)})}__autoGenerateProxyScene(){window.epigraph.logger.info({title:"Attempting to auto generate proxy for asset...",details:this.__asset,contextOverride:"ASSET ENTITY"});const e=new cs,t=new Mi({color:65280,opacity:.5,transparent:!0}),i=new lt(e,t);i.name="AutoGeneratedProxyMesh",i.scale.set(this.__renderEntityBoundsSize.x,this.__renderEntityBoundsSize.y,this.__renderEntityBoundsSize.z);const s=new se;this.__renderEntityBoundsBox.getCenter(s);const l=new fi;l.name="proxygeopivot";const u=new Lp(.01,10,10),d=new Mi({color:255,depthTest:!1}),f=new lt(u,d);l.add(f),this.__proxyEntity.add(l),l.translateY(-this.__renderEntityBoundsSize.y*.5),l.attach(i),l.position.set(0,0,0),this.__proxyEntity.add(i),l.removeFromParent(),Rt.dispose3(l),this.__autoGeneratedProxy.add(i)}__updateAnimations(){if(this.__animationMixer=null,this.__animations.clear(),this.__renderEntity.animations&&this.__asset.renderGltf.resource&&this.__asset.renderGltf.resource.animations.length>0){this.__animationMixer=new AC(this.__renderEntity.children[0]);for(const e of this.__asset.renderGltf.resource.animations)this.__animations.set(e.name,this.__animationMixer.clipAction(e))}}}function kI(o,e,t,i){const s=Object.entries(o);class l extends $i{static key=Hs.generateUUID();constructor(d){super({uniforms:s.reduce((f,[g,m])=>{const _=J_.clone({[g]:{value:m}});return{...f,..._}},{}),vertexShader:e,fragmentShader:t});for(const[f]of s)Object.defineProperty(this,f,{get:()=>this.uniforms[f].value,set:g=>this.uniforms[f].value=g});Object.assign(this,d)}}return l}const IH=kI({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");function MH(o){return o.isLight}function RH(o){return!!o.geometry}const BH=kI({color:new je(0),blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv;
|
|
6724
6724
|
void main() {
|
|
@@ -9218,7 +9218,7 @@ void main() {
|
|
|
9218
9218
|
<div id="appCanvasContainer" class="app-canvas-container">
|
|
9219
9219
|
<span id="cameraAimIndicator" class="camera-aim-indicator hide"></span>
|
|
9220
9220
|
</div>
|
|
9221
|
-
`:Ue}getWebComponentName(){return qu.webComponentName}async _resolveIdentifierAndType(){this.sku?(this._identifierType="sku",this._identifier=this.sku):this.shopify_variant_id?(this._identifierType="shopify_variant_id",this._identifier=this.shopify_variant_id):this.upc?(this._identifierType="upc",this._identifier=this.upc):this.asin?(this._identifierType="asin",this._identifier=this.asin):this.experience_id?(this._identifierType="experience_id",this._identifier=this.experience_id):this.product_variant_uuid&&(this._identifierType="product_variant_uuid",this._identifier=this.product_variant_uuid)}async _onAuthenticationFailed(e){window.epigraph.logger.error({title:"AUTHENTICATION FAILED: Expand for details...",details:e,contextOverride:this._loggerContext}),this.onLoadFailed(ay.MODULE_FAILED_ERRORS.AUTHENTICATION_FAILED,{errorCode:A3.AuthenticationFailedError,message:e}),await this.disconnectedCallback()}async setupRenderEngine(){window.epigraph.logger.info({title:"Initiliazing Render Engine"}),this._renderEngine=new rV(this);const{canvasHtmlElem:e}=await this._renderEngine.setup();this.appCanvasContainerElemRef.appendChild(e),new ResizeObserver(this.__onWebComponentResize.bind(this)).observe(this.appCanvasContainerElemRef)}_showCustomViewInYourSpaceButton(){this._getSlottedElements(this.customViewInYourSpaceButtonSlotElem).forEach(t=>{const i=t;i.style.visibility="visible",i.style.transition="opacity 0.5s ease-in-out",i.style.opacity="1"})}_hideCustomViewInYourSpaceButton(){this._getSlottedElements(this.customViewInYourSpaceButtonSlotElem).forEach(t=>{const i=t,s=500;i.style.transition=`opacity ${s/1e3}s ease-in-out`,i.style.opacity="0",setTimeout(()=>i.style.visibility="hidden",s)})}_sendAnalyticsEventsOnModuleLoadStart(){const e=new PR(!1);this._epigraphAnalytics.sendEvent(e)}_sendAnalyticsEventsOnModuleLoadFinish(){const e=this.timeElapsedSinceLoadBegin,t=new DR(!1,e);this._epigraphAnalytics.sendEvent(t);const i=window.epigraph.isSessionWebGL2Compatible();let s;this.viewInYourSpaceManager.canLaunchAr()?s=i?qc.SUPPORT_TYPE.AR_WEBGL2:qc.SUPPORT_TYPE.AR:s=i?qc.SUPPORT_TYPE.QR_WEBGL2:qc.SUPPORT_TYPE.QR;const l=new qc(s);this._epigraphAnalytics.sendEvent(l)}_onNewExperienceLoadStart(){this.isLoading=!0,this._loadingProgress=0,this._hideCustomViewInYourSpaceButton(),this.showSplashScreen(),this.hotspotsManager?.activeHotspot&&this.hotspotsManager.closeActiveHotspot(),this._sendAnalyticsEventsOnModuleLoadStart()}_onNewExperienceLoadFinish(){this._onSceneHierarchyUpdate(),this.isLoading=!1,this._showCustomViewInYourSpaceButton(),this._eventsManager.experienceUpdatedEvent.fire(),this._eventsManager.appReadyEvent.fire(),this.hideSplashScreen(),setTimeout(()=>{this._isSceneInteractedWith||(this.playInteractionPrompt=!0)},3e3),this._sendAnalyticsEventsOnModuleLoadFinish()}_onDimensionsToolControlClick(e){e.stopPropagation(),e.preventDefault();const t=e.target;t.active?this.showDimensions():this.hideDimensions();const i=new Wr(Wr.BUTTON_TYPE.DIMENSION_TOGGLE,t.id);this._epigraphAnalytics.sendEvent(i)}_onViewInYourSpaceToolControlClick(e){e.stopPropagation(),e.preventDefault();const t=e.target;this.launchAR();const i=new Wr(Wr.BUTTON_TYPE.AR_VIEW,t.id);this._epigraphAnalytics.sendEvent(i)}async _onSceneHierarchyUpdate(e=!1){if(this.sceneManager.recalculateSceneBounds(),this.featuresToEnable.dimensions&&this.dimensionsManager.repopulateDimensionIndicators(),this.featuresToEnable.hotspots&&this._repopulateHotspots(),e)return Promise.resolve([]);await this._cameraManager.fitCameraToSceneBounds()}_renderAppManagers(){return we`
|
|
9221
|
+
`:Ue}getWebComponentName(){return qu.webComponentName}async _resolveIdentifierAndType(){this.sku?(this._identifierType="sku",this._identifier=this.sku):this.shopify_variant_id?(this._identifierType="shopify_variant_id",this._identifier=this.shopify_variant_id):this.upc?(this._identifierType="upc",this._identifier=this.upc):this.asin?(this._identifierType="asin",this._identifier=this.asin):this.experience_id?(this._identifierType="experience_id",this._identifier=this.experience_id):this.product_variant_uuid&&(this._identifierType="product_variant_uuid",this._identifier=this.product_variant_uuid)}async _onAuthenticationFailed(e){window.epigraph.logger.error({title:"AUTHENTICATION FAILED: Expand for details...",details:e,contextOverride:this._loggerContext}),this.onLoadFailed(ay.MODULE_FAILED_ERRORS.AUTHENTICATION_FAILED,{errorCode:A3.AuthenticationFailedError,message:e}),await this.disconnectedCallback()}async setupRenderEngine(){window.epigraph.logger.info({title:"Initiliazing Render Engine"}),this._renderEngine=new rV(this);const{canvasHtmlElem:e}=await this._renderEngine.setup();this.appCanvasContainerElemRef.appendChild(e),new ResizeObserver(this.__onWebComponentResize.bind(this)).observe(this.appCanvasContainerElemRef)}_showCustomViewInYourSpaceButton(){this._getSlottedElements(this.customViewInYourSpaceButtonSlotElem).forEach(t=>{const i=t;i.style.visibility="visible",i.style.transition="opacity 0.5s ease-in-out",i.style.opacity="1"})}_hideCustomViewInYourSpaceButton(){this._getSlottedElements(this.customViewInYourSpaceButtonSlotElem).forEach(t=>{const i=t,s=500;i.style.transition=`opacity ${s/1e3}s ease-in-out`,i.style.opacity="0",setTimeout(()=>i.style.visibility="hidden",s)})}_sendAnalyticsEventsOnModuleLoadStart(){const e=new PR(!1);this._epigraphAnalytics.sendEvent(e)}_sendAnalyticsEventsOnModuleLoadFinish(){const e=this.timeElapsedSinceLoadBegin,t=new DR(!1,e);this._epigraphAnalytics.sendEvent(t);const i=window.epigraph.isSessionWebGL2Compatible();let s;this.viewInYourSpaceManager.canLaunchAr()?s=i?qc.SUPPORT_TYPE.AR_WEBGL2:qc.SUPPORT_TYPE.AR:s=i?qc.SUPPORT_TYPE.QR_WEBGL2:qc.SUPPORT_TYPE.QR;const l=new qc(s);this._epigraphAnalytics.sendEvent(l)}_onNewExperienceLoadStart(){this.isLoading=!0,this._loadingProgress=0,this._hideCustomViewInYourSpaceButton(),this.showSplashScreen(),this.hotspotsManager?.activeHotspot&&this.hotspotsManager.closeActiveHotspot(),this._sendAnalyticsEventsOnModuleLoadStart()}_onNewExperienceLoadFinish(){this._onSceneHierarchyUpdate(),this.isLoading=!1,this._showCustomViewInYourSpaceButton(),this._eventsManager.experienceUpdatedEvent.fire(),this._eventsManager.appReadyEvent.fire(),this.hideSplashScreen(),setTimeout(()=>{this._isSceneInteractedWith||(this.playInteractionPrompt=!0)},3e3),this._sendAnalyticsEventsOnModuleLoadFinish()}toggleDimensions(){this.dimensionsManager.enabled?this.hideDimensions():this.showDimensions()}_onDimensionsToolControlClick(e){e.stopPropagation(),e.preventDefault();const t=e.target;t.active?this.showDimensions():this.hideDimensions();const i=new Wr(Wr.BUTTON_TYPE.DIMENSION_TOGGLE,t.id);this._epigraphAnalytics.sendEvent(i)}_onViewInYourSpaceToolControlClick(e){e.stopPropagation(),e.preventDefault();const t=e.target;this.launchAR();const i=new Wr(Wr.BUTTON_TYPE.AR_VIEW,t.id);this._epigraphAnalytics.sendEvent(i)}async _onSceneHierarchyUpdate(e=!1){if(this.sceneManager.recalculateSceneBounds(),this.featuresToEnable.dimensions&&this.dimensionsManager.repopulateDimensionIndicators(),this.featuresToEnable.hotspots&&this._repopulateHotspots(),e)return Promise.resolve([]);await this._cameraManager.fitCameraToSceneBounds()}_renderAppManagers(){return we`
|
|
9222
9222
|
<div id="appManagersContainer" class="app-managers-container">
|
|
9223
9223
|
${this._renderDimensionsManager()}
|
|
9224
9224
|
|