@epigraph/solutions 0.38.0-beta.1 → 0.38.0-beta.3

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.
@@ -31,7 +31,7 @@ var xd=(o=>(o.Release="release",o.Staging="staging",o.Dev="dev",o))(xd||{});let
31
31
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
32
  * See the License for the specific language governing permissions and
33
33
  * limitations under the License.
34
- */var gS;const Yc=Symbol("analyticsPluginsMap");gS=Yc;class MM{constructor(e,t){this[gS]=new Map,this.__consentPlugin=null,e&&t&&(this.__consentPlugin=this.buildConsentPlugin(e,t)),window.addEventListener("epigraphAnalyticsConsentChange",this.__onConsentChangeFromEvent)}__onConsentChangeFromEvent(e){let t=e;this.__overrideConsent=t.detail.hasConsent;for(const i of this[Yc].values())this.__hasConsent()||i.setStatus(Vr.RESTRICTED)}addEventPlugin(e){this[Yc].has(e.getUniquePluginIdentifier())||(this[Yc].set(e.getUniquePluginIdentifier(),e),e.setupPlugin())}__hasConsent(){let e=!0;return this.__overrideConsent!==void 0?(e=this.__overrideConsent,e):(this.__consentPlugin&&(e=this.__consentPlugin.hasConsent()),e)}sendEvent(e){this[Yc].forEach(t=>{t.sendEvent(e,this.__hasConsent())})}buildConsentPlugin(e,t){return e.toLowerCase()===hS.OneTrust.toLowerCase()?new xM(t):null}}let AS=class{constructor(e,t,i,a=""){this._success=e,this._payload=t,this._status=i,this._message=a}get success(){return this._success}get payload(){return this._payload}get status(){return this._status}get message(){return this._message}};function IM(o,e,t=""){return new AS(!0,o,e,t)}function tb(o,e,t=""){return new AS(!1,o,e,t)}let I0=class{constructor(e="https://api.myepigraph.com/api/",t,i,a="",l="",h="v1/"){this.epigraphXPath="",this.epigraphComponentVersion=a,this.epigraphSessionId=i,this.epigraphXPath=l,this.baseUrl=e+h,this.epgLocation=t}async getButtonBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorByExperienceId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator/experience_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorByClientAccessKey(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator/client_access_key/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorLiteByExperienceId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator-lite/experience_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorLiteByProjectId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator-lite/project_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async postExperienceSaveAndShare(e,t){const i=`experience/${e}/save`,a=this.buildNexusUrl(i),l={save_data:JSON.stringify(t)},h=new Headers;return h.set("Content-Type","application/json"),await this.callNexusAPI(a,"POST",JSON.stringify(l),h)}async getExperienceSaveAndShare(e,t){const i=`experience/${e}/save/${t}`,a=this.buildNexusUrl(i);return await this.callNexusAPI(a,"GET")}async callNexusAPI(e,t="GET",i,a=new Headers){a=this.addRequiredHeaders(a);const l={method:t,body:i,headers:a};try{const h=await fetch(e,l),d=await h.json();if(!h.ok){let p="Unable to retrieve configurator experience";return d.message&&(p=d.message),Promise.resolve(tb(d,h.status,p))}return Promise.resolve(IM(d,h.status))}catch{return Promise.resolve(tb({},500,"Unknown error"))}}buildNexusUrl(e,t={}){let i=new URL(this.baseUrl);i.pathname+=e;for(const[a,l]of Object.entries(t))i.searchParams.set(a,l);return i}addRequiredHeaders(e){return e.has("accept")||e.set("accept","application/json"),e.has("EPG-Location")||e.set("EPG-location",this.epgLocation),e.has("EPG-Session-ID")||e.set("EPG-Session-ID",this.epigraphSessionId),e.has("EPG-XPATH")||e.set("EPG-XPATH",this.epigraphXPath),e.has("EPG-Version")||e.set("EPG-Version",this.epigraphComponentVersion),e}};var Cd=(o=>(o.PRODUCTION="https://api.myepigraph.com/api/",o.STAGING="https://nexus.epigraph.dev/api/",o.LOCAL="https://nexus.test/api/",o))(Cd||{});/**
34
+ */var gS;const Yc=Symbol("analyticsPluginsMap");gS=Yc;class MM{constructor(e,t){this[gS]=new Map,this.__consentPlugin=null,e&&t&&(this.__consentPlugin=this.buildConsentPlugin(e,t)),window.addEventListener("epigraphAnalyticsConsentChange",this.__onConsentChangeFromEvent)}__onConsentChangeFromEvent(e){let t=e;this.__overrideConsent=t.detail.hasConsent;for(const i of this[Yc].values())this.__hasConsent()||i.setStatus(Vr.RESTRICTED)}addEventPlugin(e){this[Yc].has(e.getUniquePluginIdentifier())||(this[Yc].set(e.getUniquePluginIdentifier(),e),e.setupPlugin())}__hasConsent(){let e=!0;return this.__overrideConsent!==void 0?(e=this.__overrideConsent,e):(this.__consentPlugin&&(e=this.__consentPlugin.hasConsent()),e)}sendEvent(e){this[Yc].forEach(t=>{t.sendEvent(e,this.__hasConsent())})}buildConsentPlugin(e,t){return e.toLowerCase()===hS.OneTrust.toLowerCase()?new xM(t):null}}let AS=class{constructor(e,t,i,a=""){this._success=e,this._payload=t,this._status=i,this._message=a}get success(){return this._success}get payload(){return this._payload}get status(){return this._status}get message(){return this._message}};function IM(o,e,t=""){return new AS(!0,o,e,t)}function tb(o,e,t=""){return new AS(!1,o,e,t)}let I0=class{constructor(e="https://api.myepigraph.com/api/",t,i,a="",l="",h="v1/"){this.epigraphXPath="",this.epigraphComponentVersion=a,this.epigraphSessionId=i,this.epigraphXPath=l,this.baseUrl=e+h,this.epgLocation=t}async getButtonBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorByExperienceId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator/experience_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorByClientAccessKey(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator/client_access_key/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorLiteByExperienceId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator-lite/experience_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorLiteByProjectId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator-lite/project_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async postExperienceSaveAndShare(e,t){const i=`experience/${e}/save`,a=this.buildNexusUrl(i),l={save_data:JSON.stringify(t)},h=new Headers;return h.set("Content-Type","application/json"),await this.callNexusAPI(a,"POST",JSON.stringify(l),h)}async getExperienceSaveAndShare(e,t){const i=`experience/${e}/save/${t}`,a=this.buildNexusUrl(i);return await this.callNexusAPI(a,"GET")}async callNexusAPI(e,t="GET",i,a=new Headers){a=this.addRequiredHeaders(a);const l={method:t,body:i,headers:a};try{const h=await fetch(e,l),d=await h.json();if(!h.ok){let p="Unable to retrieve configurator experience";return d.message&&(p=d.message),Promise.resolve(tb(d,h.status,p))}return Promise.resolve(IM(d,h.status))}catch(h){return console.log(h),Promise.resolve(tb({},500,"Unknown error"))}}buildNexusUrl(e,t={}){let i=new URL(this.baseUrl);i.pathname+=e;for(const[a,l]of Object.entries(t))i.searchParams.set(a,l);return i}addRequiredHeaders(e){return e.has("accept")||e.set("accept","application/json"),e.has("EPG-Location")||e.set("EPG-location",this.epgLocation),e.has("EPG-Session-ID")||e.set("EPG-Session-ID",this.epigraphSessionId),e.has("EPG-XPATH")||e.set("EPG-XPATH",this.epigraphXPath),e.has("EPG-Version")||e.set("EPG-Version",this.epigraphComponentVersion),e}};var Cd=(o=>(o.PRODUCTION="https://api.myepigraph.com/api/",o.STAGING="https://nexus.epigraph.dev/api/",o.LOCAL="https://nexus.test/api/",o))(Cd||{});/**
35
35
  * @license
36
36
  * Copyright 2019 Google LLC
37
37
  * SPDX-License-Identifier: BSD-3-Clause
@@ -4165,7 +4165,7 @@ ${l.join(`
4165
4165
  ${y.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );")}
4166
4166
  `},this.__depthMaterial.depthTest=!1,this.__depthMaterial.depthWrite=!1,this.__horizontalBlurMaterial=new Ni(fC),this.__horizontalBlurMaterial.depthTest=!1,this.__verticalBlurMaterial=new Ni(pC),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.__scene,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 Et{static isTouchDevice(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}static async wait(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}static generateStylesDomElem(e,t=""){const i=document.createElement("style");return i.setAttribute("id",e),i.innerHTML=t,i}static generateHtmlDivElem(e,t=""){const i=document.createElement("div");return i.setAttribute("id",e),i.innerHTML=t,i}static getRandomIntegerInRange(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}static getUrlParameterByName(e,t=window.location.search){const i=new URLSearchParams(t);return Object.fromEntries(i.entries())[e]}static getBaseUrl(){const e=Et.getUrlParameterByName("parentUrl");return e||window.location.href}static normalizeRadian(e){return Math.atan2(Math.sin(e),Math.cos(e))}static isBetweenOnCircle(e,t,i){return e=Et.normalizeRadian(e),t=Et.normalizeRadian(t),i=Et.normalizeRadian(i),t<=i?e>=t&&e<=i:e>=t||e<=i}static getPointInBetweenByPercentage(e,t,i){let a=t.clone().sub(e);const l=a.length();return a=a.normalize().multiplyScalar(l*i),e.clone().add(a)}static clampAzimuth(e,t,i){if(Math.abs(t)==1/0||i==1/0)return e;const a=Et.normalizeRadian(e),l=Et.normalizeRadian(t),h=Et.normalizeRadian(i);if(Et.isBetweenOnCircle(a,l,h))return a;const d=Math.abs(Et.normalizeRadian(a-l)),p=Math.abs(Et.normalizeRadian(a-h));return d<p?l:h}static resolveNexusEndpoint(e){let t=Cd.PRODUCTION;return e=="local"?t=Cd.LOCAL:e==="staging"&&(t=Cd.STAGING),t}static parseUrlForEpigraphParams(e){const t=new Map,i=new Xg(e);t.set(Mi.epigraphSessionId,i.getParameterInUrl(Mi.epigraphSessionId)),t.set(Mi.identifier,i.getParameterInUrl(Mi.identifier)),t.set(Mi.identifierType,i.getParameterInUrl(Mi.identifierType)),t.set(Mi.type,i.getParameterInUrl(Mi.type));const a=i.getParameterInUrl(Mi.action);return a&&t.set(lh.AR,JSON.parse(a)[lh.AR]),t}static generateShareableUrl({baseUrl:e,identifier:t,identifierType:i,sharedConfig:a,arCompatible:l=!1}){const h=new Map;return h.set(Mi.epigraphSessionId,window.epigraph.epigraphSessionId),h.set(Mi.identifier,t),h.set(Mi.identifierType,i),a&&h.set(Mi.sharedConfig,a),l&&h.set(Mi.action,`{"${lh.AR}":true}`),new Xg(e).generateQrCodeUrl(Object.fromEntries(h.entries()),!1)}static _dispose3(e){e instanceof ot&&e.geometry.dispose(),e instanceof ot&&(Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material.dispose(),e.material?.map?.dispose())}static dispose3(e){e.traverse(t=>{t instanceof ot&&Et._dispose3(t)}),(e instanceof ot||e instanceof Dn)&&Et._dispose3(e)}static animateValue(e,t,i,a){const l=performance.now();function h(d){const p=d-l,m=Math.min(p/i,1),A=e+(t-e)*m;a(A),m<1&&requestAnimationFrame(h)}requestAnimationFrame(h)}static getCustomStylesTemplate(){const t=document.querySelector("#epigraphCustomStyles")?.content?.cloneNode(!0);return t||Ue}}class gC{constructor(e){this._success=e}get success(){return this._success}set success(e){this._success=e}get failed(){return!this._success}}class LU extends gC{constructor(e=!1,t=void 0){super(e),this.__payload=t}get payload(){return this.__payload}set payload(e){this.__payload=e}}var AC=(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))(AC||{});class DU extends li{constructor(){super(),this._entityType=AC.Empty}get entityType(){return this._entityType}destroy(){let e;const t=new LU(!1,e);return e=void 0,t.success=!0,t.payload=e,t}}class Cv{constructor(e){this.__name=e}getName(){return this.__name}}class Jr extends Lt{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 Jr(this.__config).copy(this,e)}showDebug(){const e=new se().setFromEuler(this.rotation).normalize(),t=this.position,i=.2,a=16711680;this.__debugGeo=new t1(e,t,i,a,.06,.06);const l=document.createElement("div");l.textContent=this.name;const h=new E_(l);l.style.pointerEvents="none";const d=new se;this.getWorldDirection(d),d.normalize();const p=this.position.clone().addScaledVector(d,Math.random());h.position.set(p.x,p.y,p.z),this.__debugGeo.add(h),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),Et.dispose3(this.__debugGeo))}}class ur extends Lt{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 ur(this.__config).copy(this,e)}showDebug(){const e=new se().setFromEuler(this.rotation.clone()).normalize(),t=this.position,i=.1,a=65280;this.__debugGeo=new t1(e,t,i,a,.01,.08);const l=document.createElement("div");l.textContent=this.name,l.style.color="green";const h=new E_(l);l.style.pointerEvents="none",this.__debugGeo.add(h),this.add(this.__debugGeo)}hideDebug(){this.__debugGeo&&(this.__debugGeo.clear(),this.__debugGeo?.removeFromParent(),Et.dispose3(this.__debugGeo))}}var x_=(o=>(o.Gltf="media-asset-gltf",o.Proxy="media-asset-proxy",o.Render="media-asset-render",o))(x_||{}),JA=(o=>(o.Plug="plug",o.Receiver="receiver",o))(JA||{});class _C{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 NU extends _C{constructor({id:e,uri:t,appWcRef:i}){super({id:e,uri:t,appWcRef:i}),this._type=x_.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===JA.Receiver){const i=new ur({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===JA.Plug){const i=new Jr({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(),Et.dispose3(t)}unload(){return this._resource={},this.__plugs=[],this.__receivers=[],Promise.resolve(!0)}}class OU extends _C{constructor({id:e,uri:t,appWcRef:i}){super({id:e,uri:t,appWcRef:i}),this._type=x_.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(){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);this._resource?.scene.traverse(t=>{t instanceof ot&&(t.castShadow=!0)})}unload(){return this._resource={},this.__variantsExtension={},this.__finishNamesFromAsset=[],Promise.resolve(!0)}}class bC{constructor(e,t){this._loggerContext="ASSET",this.__autoGenerateProxyEntity=!1,this.__finishes=new Map,this.__hotspots=[],this.__id=e.id,this.__name=e.name,this.__appWcRef=t,this.__proxyGltf=new NU({id:String(e.id),uri:e.proxyGeo,appWcRef:this.__appWcRef}),this.__autoGenerateProxyEntity=e.autoGenerateProxyEntity,this.__renderGltf=new OU({id:String(e.id),uri:e.renderGeo,appWcRef:this.__appWcRef});for(const i in e.finishes)this.__finishes.set(i,new Cv(i));e.hotspots&&(this.__hotspots=e.hotspots)}get id(){return this.__id}get name(){return this.__name}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 allFinishIds(){const e=[];for(const t of this.__finishes.keys())e.push(t);return e}async loadProxyGltf(){return this.__proxyGltf?await this.__proxyGltf.load():Promise.resolve(!0)}pullFinishesFromRenderGltf(){this.__renderGltf.finishNamesFromAsset.forEach(e=>{this.__finishes.has(e)||this.__finishes.set(e,new Cv(e))})}async loadRenderGltf(e=!1){return 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))),e&&this.pullFinishesFromRenderGltf(),Promise.resolve(!0)}async load(e=!1){return Promise.all([this.loadRenderGltf(e),this.loadProxyGltf()])}}var kU=Object.defineProperty,yC=(o,e,t,i)=>{for(var a=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(a=h(e,t,a)||a);return a&&kU(e,t,a),a};class vC{constructor({appWcRef:e}){this._loggerContext="SOLUTION MANAGER",this._appWcRef=e}initialize(){window.epigraph.logger.info({title:"Initializing...",contextOverride:this._loggerContext})}}const S_=class Dd extends dl{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(Dd.webComponentName)||window.customElements.define(Dd.webComponentName,Dd)}render(){return Ee`
4167
4167
  ${Et.getCustomStylesTemplate()}
4168
- `}};yC([he({type:Boolean,attribute:"enabled"})],S_.prototype,"enabled");yC([he({attribute:!1})],S_.prototype,"appWcRef");let Yf=S_;class UU{constructor({id:e,name:t,receiver:i,plug:a}){this.__name=t,this.__plug=a,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 FU{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 $U extends li{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 bC({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:[]},this.__appWcRef);await i.load().catch(()=>Promise.reject(!1));const a=new Va(i);await a.initialize(),this.add(a),this.__rootEntity=a}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]}getEntityForAssetId(e){const t=this.getSceneEntities();let i;for(const a of t)if(a.asset.id===e){i=a;break}return i}getSceneEntities(e=!1){const t=[];return this.__rootEntity.traverse(i=>{!e&&i.uuid===this.__rootEntity.uuid||i instanceof Va&&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 a=i.findPossibleConnectionsForAsset(e);a.length>0&&t.push(...a)}return window.epigraph.logger.table({title:"Possible Connections",details:t}),t}getAllConnectionsInScene(){const e=new Map;return this.traverse(t=>{if(t instanceof ur||t instanceof Jr){if(t.connectionId===""||e.has(t.connectionId))return;let a=null,l=null;if(t instanceof ur?(a=t,l=t.plug):t instanceof Jr&&(a=t.receiver,l=t),a!==null&&l!==null){const h=new FU({id:t.connectionId,receiver:a,plug:l});e.set(t.connectionId,h)}}}),e}}class zU extends vC{constructor(e){super({appWcRef:e}),this._loggerContext="SCENE MANAGER",this.__currentSceneBounds=new vi,this.__sceneStructure=new $U(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 ot&&e.userData.isProxyMesh&&this.currentSceneBounds.expandByObject(e)}),this._appWcRef.eventsManager.sceneBoundsChanged.fire()}}class Va extends DU{constructor(e){super(),this.epgType="ENTITY_ASSET",this.__autoGeneratedProxy=new li,this.__proxyEntity=new li,this.__renderEntity=new li,this.__activeFinish="",this.__hotspots=new li,this.__renderEntityBoundsBox=new vi,this.__renderEntityBoundsSize=new se,this.__animationMixer=null,this.__animations=[],this.__animationNames=[],this.name=e.name,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;(i.emissive.r>0||i.emissive.g>0||i.emissive.b>0)&&(i.userData.epgData={orignalEmissive:i.emissive.clone()}),i.emissive.r=1,i.emissive.g=1,i.emissive.b=1}})}unhighlight(){this.__renderEntity.traverseVisible(e=>{const t=e;if(t.isMesh){const i=t.material,a=i?.userData?.epgData?.orignalEmissive;a?(i.emissive.r=a.r,i.emissive.g=a.g,i.emissive.b=a.b):(i.emissive.r=0,i.emissive.g=0,i.emissive.b=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(),Et.dispose3(t))}async selectAssetFinish(e,t=this.__renderEntity){window.epigraph.logger.info({title:`Switching to asset finish: ${e}`});const i=new gC(!1),a=this.__asset.renderGltf;if(!a)return Promise.reject(i);const l=a.khrVariantsExtension,h=a.khrVariantsExtensionName;if(!l?.variants||h===void 0)return window.epigraph.logger.warn({title:"No Variants found in asset. Using default material."}),i.success=!0,Promise.resolve(i);const d=l.variants.findIndex(p=>p.name===e);return t.traverse(async p=>{if(!(p instanceof ot)||!p.isMesh||!p.userData.gltfExtensions)return;const m=p.userData.gltfExtensions[h];if(!m)return window.epigraph.logger.error({title:"No Variants found in asset. Using default material."}),Promise.reject(i);p.userData.originalMaterial||(p.userData.originalMaterial=p.material);const A=m.mappings.find(_=>_.variants.includes(d));if(A&&a.resource){const _=a.resource.parser;p.material=await _.getDependency("material",A.material),_.assignFinalMaterial(p)}else window.epigraph.logger.warn({title:`Variant not found. Missing Variant ID: ${e}`,details:{message:"Available Variants",variants:l.variants}}),p.material=p.userData.originalMaterial;i.success=!0}),this.__activeFinish=e,Promise.resolve(i)}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 ur))return;const a=i,l=e.proxyGltf?.plugs??[];for(const h of l)h.connectionId===a.connectionId&&t.push(new UU({name:h.connectionId,receiver:a,plug:h}))}),t}getAnimationMixer(){return this.__animationMixer}getAllAnimations(){return this.__animations}getAllAnimationNames(){return this.__animationNames}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.proxyGltf){window.epigraph.logger.warn({title:"Attempted to place render geo at the grid for AssetEntity...",details:this});const i=new li;i.name="rendergeopivot";const a=new Wn(.01,.01,.01),l=new wi({color:65280,depthTest:!1}),h=new ot(a,l);i.add(h),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(),Et.dispose3(i)}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 ot&&(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 Wn,t=new wi({color:65280,opacity:.5,transparent:!0}),i=new ot(e,t);i.name="AutoGeneratedProxyMesh",i.scale.set(this.__renderEntityBoundsSize.x,this.__renderEntityBoundsSize.y,this.__renderEntityBoundsSize.z);const a=new se;this.__renderEntityBoundsBox.getCenter(a);const l=new li;l.name="proxygeopivot";const h=new zf(.01,10,10),d=new wi({color:255,depthTest:!1}),p=new ot(h,d);l.add(p),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(),Et.dispose3(l),this.__autoGeneratedProxy.add(i)}__updateAnimations(){if(this.__animationMixer=null,this.__animations=[],this.__renderEntity.animations&&this.__asset.renderGltf.resource&&this.__asset.renderGltf.resource.animations.length>0){this.__animationMixer=new ZS(this.__renderEntity.children[0]);for(const e of this.__asset.renderGltf.resource.animations)this.__animations.push(this.__animationMixer.clipAction(e)),this.__animationNames.push(e.name)}}}function wC(o,e,t,i){const a=Object.entries(o);class l extends Ni{static key=Ms.generateUUID();constructor(d){super({uniforms:a.reduce((p,[m,A])=>{const _=W0.clone({[m]:{value:A}});return{...p,..._}},{}),vertexShader:e,fragmentShader:t});for(const[p]of a)Object.defineProperty(this,p,{get:()=>this.uniforms[p].value,set:m=>this.uniforms[p].value=m});Object.assign(this,d)}}return l}const GU=wC({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");function HU(o){return o.isLight}function VU(o){return!!o.geometry}const QU=wC({color:new je(0),blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv;
4168
+ `}};yC([he({type:Boolean,attribute:"enabled"})],S_.prototype,"enabled");yC([he({attribute:!1})],S_.prototype,"appWcRef");let Yf=S_;class UU{constructor({id:e,name:t,receiver:i,plug:a}){this.__name=t,this.__plug=a,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 FU{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 $U extends li{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 bC({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:[]},this.__appWcRef);await i.load().catch(()=>Promise.reject(!1));const a=new Va(i);await a.initialize(),this.add(a),this.__rootEntity=a}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]}getEntityForAssetId(e){const t=this.getSceneEntities();let i;for(const a of t)if(a.asset.id===e){i=a;break}return i}getSceneEntities(e=!1){const t=[];return this.__rootEntity.traverse(i=>{!e&&i.uuid===this.__rootEntity.uuid||i instanceof Va&&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 a=i.findPossibleConnectionsForAsset(e);a.length>0&&t.push(...a)}return window.epigraph.logger.table({title:"Possible Connections",details:t}),t}getAllConnectionsInScene(){const e=new Map;return this.traverse(t=>{if(t instanceof ur||t instanceof Jr){if(t.connectionId===""||e.has(t.connectionId))return;let a=null,l=null;if(t instanceof ur?(a=t,l=t.plug):t instanceof Jr&&(a=t.receiver,l=t),a!==null&&l!==null){const h=new FU({id:t.connectionId,receiver:a,plug:l});e.set(t.connectionId,h)}}}),e}}class zU extends vC{constructor(e){super({appWcRef:e}),this._loggerContext="SCENE MANAGER",this.__currentSceneBounds=new vi,this.__sceneStructure=new $U(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 ot&&e.userData.isProxyMesh&&this.currentSceneBounds.expandByObject(e)}),this._appWcRef.eventsManager.sceneBoundsChanged.fire()}}class Va extends DU{constructor(e){super(),this.epgType="ENTITY_ASSET",this.__autoGeneratedProxy=new li,this.__proxyEntity=new li,this.__renderEntity=new li,this.__activeFinish="",this.__hotspots=new li,this.__renderEntityBoundsBox=new vi,this.__renderEntityBoundsSize=new se,this.__animationMixer=null,this.__animations=[],this.__animationNames=[],this.name=e.name,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;(i.emissive.r>0||i.emissive.g>0||i.emissive.b>0)&&(i.userData.epgData={orignalEmissive:i.emissive.clone()}),i.emissive.r=1,i.emissive.g=1,i.emissive.b=1}})}unhighlight(){this.__renderEntity.traverseVisible(e=>{const t=e;if(t.isMesh){const i=t.material,a=i?.userData?.epgData?.orignalEmissive;a?(i.emissive.r=a.r,i.emissive.g=a.g,i.emissive.b=a.b):(i.emissive.r=0,i.emissive.g=0,i.emissive.b=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(),Et.dispose3(t))}async selectAssetFinish(e,t=this.__renderEntity){window.epigraph.logger.info({title:`Switching to asset finish: ${e}`});const i=new gC(!1),a=this.__asset.renderGltf;if(!a)return Promise.reject(i);const l=a.khrVariantsExtension,h=a.khrVariantsExtensionName;if(!l?.variants||h===void 0)return window.epigraph.logger.warn({title:"No Variants found in asset. Using default material."}),this.allFinishIds.length===1&&this.allFinishIds.includes(e)&&(this.__activeFinish=e),i.success=!0,Promise.resolve(i);const d=l.variants.findIndex(p=>p.name===e);return t.traverse(async p=>{if(!(p instanceof ot)||!p.isMesh||!p.userData.gltfExtensions)return;const m=p.userData.gltfExtensions[h];if(!m)return window.epigraph.logger.error({title:"No Variants found in asset. Using default material."}),Promise.reject(i);p.userData.originalMaterial||(p.userData.originalMaterial=p.material);const A=m.mappings.find(_=>_.variants.includes(d));if(A&&a.resource){const _=a.resource.parser;p.material=await _.getDependency("material",A.material),_.assignFinalMaterial(p)}else window.epigraph.logger.warn({title:`Variant not found. Missing Variant ID: ${e}`,details:{message:"Available Variants",variants:l.variants}}),p.material=p.userData.originalMaterial;i.success=!0}),this.__activeFinish=e,Promise.resolve(i)}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 ur))return;const a=i,l=e.proxyGltf?.plugs??[];for(const h of l)h.connectionId===a.connectionId&&t.push(new UU({name:h.connectionId,receiver:a,plug:h}))}),t}getAnimationMixer(){return this.__animationMixer}getAllAnimations(){return this.__animations}getAllAnimationNames(){return this.__animationNames}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.proxyGltf){window.epigraph.logger.warn({title:"Attempted to place render geo at the grid for AssetEntity...",details:this});const i=new li;i.name="rendergeopivot";const a=new Wn(.01,.01,.01),l=new wi({color:65280,depthTest:!1}),h=new ot(a,l);i.add(h),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(),Et.dispose3(i)}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 ot&&(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 Wn,t=new wi({color:65280,opacity:.5,transparent:!0}),i=new ot(e,t);i.name="AutoGeneratedProxyMesh",i.scale.set(this.__renderEntityBoundsSize.x,this.__renderEntityBoundsSize.y,this.__renderEntityBoundsSize.z);const a=new se;this.__renderEntityBoundsBox.getCenter(a);const l=new li;l.name="proxygeopivot";const h=new zf(.01,10,10),d=new wi({color:255,depthTest:!1}),p=new ot(h,d);l.add(p),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(),Et.dispose3(l),this.__autoGeneratedProxy.add(i)}__updateAnimations(){if(this.__animationMixer=null,this.__animations=[],this.__renderEntity.animations&&this.__asset.renderGltf.resource&&this.__asset.renderGltf.resource.animations.length>0){this.__animationMixer=new ZS(this.__renderEntity.children[0]);for(const e of this.__asset.renderGltf.resource.animations)this.__animations.push(this.__animationMixer.clipAction(e)),this.__animationNames.push(e.name)}}}function wC(o,e,t,i){const a=Object.entries(o);class l extends Ni{static key=Ms.generateUUID();constructor(d){super({uniforms:a.reduce((p,[m,A])=>{const _=W0.clone({[m]:{value:A}});return{...p,..._}},{}),vertexShader:e,fragmentShader:t});for(const[p]of a)Object.defineProperty(this,p,{get:()=>this.uniforms[p].value,set:m=>this.uniforms[p].value=m});Object.assign(this,d)}}return l}const GU=wC({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");function HU(o){return o.isLight}function VU(o){return!!o.geometry}const QU=wC({color:new je(0),blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv;
4169
4169
  void main() {
4170
4170
  gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);
4171
4171
  vUv = uv;
@@ -4363,7 +4363,7 @@ vec3 texelOld = texture2D(previousShadowMap, vUv).rgb;
4363
4363
  .hotspot-indicator.occluded {
4364
4364
  opacity: 0.3;
4365
4365
  }
4366
- `}get config(){return this.__config}get assetId(){return this.__config.assetId}get name(){return this.__config.name}get hotspotId(){return this.__config.hotspotId}get position(){return this.entity.getWorldPosition(this.__worldPosition),this.__worldPosition}get normals(){return this.__normals}get camera(){return this.__camera}get header(){return this.__config.header}get details(){return this.__config.details}get carousel(){return this.__config.carousel}get finishes(){return this.__config.finishes}get animation(){return this.__config.animation}get desktopPlacement(){return this.__config.desktopPlacement}get hidden(){const e=this.__appWcRef.sceneManager.sceneStructure.getEntityForAssetId(this.assetId);if(!e)return!1;const t=e.activeFinish;return!this.finishes.includes(t)}__updateHotspotPosition(){this.__localPosition.set(this.__config.position.x,this.__config.position.y,this.__config.position.z),this.entity.position.set(this.__localPosition.x,this.__localPosition.y,this.__localPosition.z)}__updateHotspotNormals(){if(!this.__config.normals){const a=new se;this.__appWcRef.sceneManager.currentSceneBounds.getCenter(a),this.__normals.subVectors(this.position,a);return}const{x:e,y:t,z:i}=this.__config.normals;this.__normals.set(e,t,i)}__updateCamera(){this.__camera.position.set(this.__config.camera.position.x,this.__config.camera.position.y,this.__config.camera.position.z),this.__camera.target.set(this.__config.camera.target.x,this.__config.camera.target.y,this.__config.camera.target.z),this.__camera.focalLength=this.__config.camera.focalLength}updateConfig(e){this.__config=e,this.__updateHotspotPosition(),this.__updateHotspotNormals(),this.__updateCamera()}_onHotspotClick(){this.__hotspotsManager.activeHotspot||(this.visited=!0,this.__appWcRef.eventsManager.hotspotClickedEvent.fire({hotspot:this}))}__isFacingCamera(){return this.__appWcRef.cameraManager.getCameras().main.getWorldDirection(this.__cameraDirection),this.__normals.angleTo(this.__cameraDirection)>Math.PI/2.2}renderAnnotationTemplate(e){const t=e!==void 0&&e===this.hotspotId;if(this.__hotspotsManager.activeHotspot&&!t||this.hidden)return Ue;this.__screenPosition=this.__appWcRef.getScreenPositionFromWorld(this.position);const i=e!==void 0&&e!==this.hotspotId;let a="top-left";return this.__screenPosition.y>this.__appWcRef.canvasSize.height*.12?a="top":a="bottom",this.__screenPosition.x>this.__appWcRef.canvasSize.width*.5?a+="-right":a+="-left",Ee`
4366
+ `}get config(){return this.__config}get assetId(){return this.__config.assetId}get name(){return this.__config.name}get hotspotId(){return this.__config.hotspotId}get position(){return this.entity.getWorldPosition(this.__worldPosition),this.__worldPosition}get normals(){return this.__normals}get camera(){return this.__camera}get header(){return this.__config.header}get details(){return this.__config.details}get carousel(){return this.__config.carousel}get finishes(){return this.__config.finishes}get animation(){return this.__config.animation}get desktopPlacement(){return this.__config.desktopPlacement}get hidden(){const e=this.__appWcRef.sceneManager.sceneStructure.getEntityForAssetId(this.assetId);if(!e)return!0;if(this.finishes.includes("*"))return!1;const t=e.activeFinish;return!this.finishes.includes(t)}__updateHotspotPosition(){this.__localPosition.set(this.__config.position.x,this.__config.position.y,this.__config.position.z),this.entity.position.set(this.__localPosition.x,this.__localPosition.y,this.__localPosition.z)}__updateHotspotNormals(){if(!this.__config.normals){const a=new se;this.__appWcRef.sceneManager.currentSceneBounds.getCenter(a),this.__normals.subVectors(this.position,a);return}const{x:e,y:t,z:i}=this.__config.normals;this.__normals.set(e,t,i)}__updateCamera(){this.__camera.position.set(this.__config.camera.position.x,this.__config.camera.position.y,this.__config.camera.position.z),this.__camera.target.set(this.__config.camera.target.x,this.__config.camera.target.y,this.__config.camera.target.z),this.__camera.focalLength=this.__config.camera.focalLength}updateConfig(e){this.__config=e,this.__updateHotspotPosition(),this.__updateHotspotNormals(),this.__updateCamera()}_onHotspotClick(){this.__hotspotsManager.activeHotspot||(this.visited=!0,this.__appWcRef.eventsManager.hotspotClickedEvent.fire({hotspot:this}))}__isFacingCamera(){return this.__appWcRef.cameraManager.getCameras().main.getWorldDirection(this.__cameraDirection),this.__normals.angleTo(this.__cameraDirection)>Math.PI/2.2}renderAnnotationTemplate(e){const t=e!==void 0&&e===this.hotspotId;if(this.__hotspotsManager.activeHotspot&&!t||this.hidden)return Ue;this.__screenPosition=this.__appWcRef.getScreenPositionFromWorld(this.position);const i=e!==void 0&&e!==this.hotspotId;let a="top-left";return this.__screenPosition.y>this.__appWcRef.canvasSize.height*.12?a="top":a="bottom",this.__screenPosition.x>this.__appWcRef.canvasSize.width*.5?a+="-right":a+="-left",Ee`
4367
4367
  <epg-tool-hotspot
4368
4368
  class="hotspot-indicator ${i?"inactive":""} ${this.__isFacingCamera()?"":"occluded"}"
4369
4369
  style="left: ${this.__screenPosition.x}px; top: ${this.__screenPosition.y}px"
@@ -8728,7 +8728,7 @@ void main() {
8728
8728
  <div class="view-in-your-space-button ${this._hasActiveHotspot?"hide":""}">
8729
8729
  <slot name=${c0.slotCustomViewInYourSpaceButton.name} @click=${this.launchAR}></slot>
8730
8730
  </div>
8731
- `}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof Va)for(const i of t.asset.hotspots)this.hotspotsManager.addHotspot(i,!1)}),e}_repopulateHotspots(){window.epigraph.logger.info({title:"Override to repopulate hotspots in scene on identifier changes"}),this.featuresToEnable.hotspots===!0&&this.hotspotsManager&&(this.hotspotsManager.removeAllHotspots(),this.getAllHotspotsFromScene(),this.updateHotspotsOrder(Array.from(this.hotspotsManager.hotspots.keys())))}_setupAnalytics(){this._nexusAnalyticsPlugin=new EM({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),sessionId:window.epigraph.epigraphSessionId,xPath:this.xPath,verboseLogging:!1,sendToStaging:!1}),this._epigraphAnalytics.addEventPlugin(this._nexusAnalyticsPlugin),this.gaMeasurementId&&(this._ga4AnalyticsPlugin=new wM({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),verboseLogging:!1}),this._epigraphAnalytics.addEventPlugin(this._ga4AnalyticsPlugin))}__onWebComponentResize(){const{width:e,height:t}=this.getBoundingClientRect();if(this.__canvasSize.width=e,this.__canvasSize.height=t,this.renderEngine.mainRenderer.setSize(e,t),this.renderEngine.textRenderer.setSize(e,t),this.renderEngine.effectsComposer.setSize(e,t),this.cameraManager){const i=this.renderEngine.canvas.clientWidth/this.renderEngine.canvas.clientHeight;this.cameraManager.getCameras().main.aspect=i,this.cameraManager.getCameras().main.updateProjectionMatrix(),this.cameraManager.getCameras().screenshot.aspect=i,this.cameraManager.getCameras().screenshot.updateProjectionMatrix()}this.dimensionsManager&&!this.hotspotsManager?.activeHotspot&&this.cameraManager.fitCameraToSceneBounds(!1),this.isPortraitOrientation=e<700,this.postRenderFrameUpdateInEngine(this.renderEngine.getClockDelta())}__onDimensionsPositionChanged(){this.renderEngine.updateDimensionLines(this.dimensionsManager.getCurrentDimensionsIndicatorState())}showSplashScreen(){this.splashScreenElem?.show()}hideSplashScreen(){this.splashScreenElem?.hide()}_setupResizeObservers(){new ResizeObserver(t=>{for(const i of t){const{width:a,height:l}=i.target.getBoundingClientRect(),h=a*.5,d=l*.5;if(h>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const p=this.toolsetElem?.getBoundingClientRect();if(!p)continue;const m=p.width>h,A=p.height>d;this._isToolsetLargerThanTheLeftBottomQuadrant=m||A}}}).observe(this)}async _postExperienceDataInitialization(){if(!this._identifier||!this._identifierType)return Promise.resolve(!0);const e=this._experienceData.productVariantCollection.getProductVariantByIdentifierAndType(this._identifier,this._identifierType);return e?await this.spawnProductVariant(e):Promise.resolve(!1)}async spawnProductVariant(e){if(!e.productParts)return Promise.reject(!1);for(const t of e.productParts)await this.spawnProductPart(t);return Promise.resolve(!0)}async spawnProductPart(e){const t=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!t)return Promise.reject(!1);await t.load();const i=await this.spawnAssetInScene(t);if(!i)return Promise.reject(!1);const a=e.finish;return a?(await i.selectAssetFinish(a),Promise.resolve(!0)):Promise.resolve(!1)}async _fetchExperienceDataConfig(){return null}async _buildExperienceData(){const e=await this._fetchExperienceDataConfig();if(e===null)return await this._onAuthenticationFailed("Unable to retrieve experience data config."),Promise.reject();if(console.log(e),e===void 0||e.success===!1)return await this._onAuthenticationFailed(e.message),Promise.reject();this._experienceData=new BH({nexusApiResultPayload:e.payload,appWcRef:this}),await this._experienceData.initialize()}async _clearAndLoadNewExperienceInScene(){this._onNewExperienceLoadStart(),await this._buildExperienceData().catch(e=>(window.epigraph.logger.error({title:`Couldn't build experience data for "${this.identifierType}" - "${this.identifier}"`,details:e,contextOverride:this._loggerContext}),Promise.reject(e))),await this._resetSession(),await this._postExperienceDataInitialization(),this.parsedUrlParams.get(lh.AR)&&!this.didARAutoLaunch&&(await this.launchAR(),this.didARAutoLaunch=!0),this._onNewExperienceLoadFinish()}async _onIdentifierOrTypeChange(){this.isAppReady&&(await this._resolveIdentifierAndType(),!(!this._identifier||!this._identifierType)&&(window.epigraph.logger.info({title:"IDENTIFIER CHANGED",details:`${this._identifierType} = ${this._identifier}`}),this._nexusAnalyticsPlugin&&(this._nexusAnalyticsPlugin.experienceID=this._identifier),this._ga4AnalyticsPlugin&&(this._ga4AnalyticsPlugin.experienceID=this._identifier),await this._clearAndLoadNewExperienceInScene().catch(e=>(window.epigraph.logger.error({title:"Error while clearing the session and loading a new experience.",details:e}),Promise.reject(e)))))}showCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.add("show")}hideCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.remove("show")}_onPlayInteractionPromptChange(){this.playInteractionPrompt?this.__onPlayInteractionPrompt():(this.hideCameraInteractionPromptIndicator(),this._cameraManager?.mainCameraControls?.stop&&this._cameraManager?.mainCameraControls?.stop())}connectedCallback(){super.connectedCallback(),this._loadTimeBegin=performance.now(),this.parsedUrlParams=Et.parseUrlForEpigraphParams(this.baseUrlOverride),this._setupAnalytics()}firstUpdated(){this.modalView&&(this.hide=!0),this._setup().then(()=>{this.featuresToEnable.viewer===!0&&(this._setupResizeObservers(),this.hideSplashScreen()),window.epigraph.logger.info({title:"All Initializations Complete",contextOverride:this._loggerContext}),this.isAppReady=!0,this._onIdentifierOrTypeChange()}).catch(e=>{window.epigraph.logger.error({title:"Error while setup",details:e})})}updated(e){(e.has("sku")||e.has("shopify_variant_id")||e.has("upc")||e.has("asin")||e.has("experience_id")||e.has("product_variant_uuid")||e.has("customVersionId"))&&this._onIdentifierOrTypeChange(),e.has("playInteractionPrompt")&&this._onPlayInteractionPromptChange(),e.has("_isActiveHotspot")&&(this._hasActiveHotspot?this._hideCustomViewInYourSpaceButton():this._showCustomViewInYourSpaceButton()),e.has("debug")&&this.eventsManager.debugChanged.fire({value:this.debug}),e.has("modalView")&&(this.hide=this.modalView)}_getSlottedElements(e){const t=e.assignedElements();return[...t.length>0?t:e.children]}disconnectedCallback(){super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return Ee`
8731
+ `}getAllHotspotsFromScene(){const e=[];return this.sceneManager.sceneStructure.traverse(t=>{if(t instanceof Va)for(const i of t.asset.hotspots)this.hotspotsManager.addHotspot(i,!1)}),e}_repopulateHotspots(){window.epigraph.logger.info({title:"Override to repopulate hotspots in scene on identifier changes"}),this.featuresToEnable.hotspots===!0&&this.hotspotsManager&&(this.hotspotsManager.removeAllHotspots(),this.getAllHotspotsFromScene(),this.updateHotspotsOrder(Array.from(this.hotspotsManager.hotspots.keys())))}_setupAnalytics(){this._nexusAnalyticsPlugin=new EM({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),sessionId:window.epigraph.epigraphSessionId,xPath:this.xPath,verboseLogging:!1,sendToStaging:!1}),this._epigraphAnalytics.addEventPlugin(this._nexusAnalyticsPlugin),this.gaMeasurementId&&(this._ga4AnalyticsPlugin=new wM({trackingID:this.gaMeasurementId,experienceID:this.experience_id,solution:this.getWebComponentName(),verboseLogging:!1}),this._epigraphAnalytics.addEventPlugin(this._ga4AnalyticsPlugin))}__onWebComponentResize(){const{width:e,height:t}=this.getBoundingClientRect();if(this.__canvasSize.width=e,this.__canvasSize.height=t,this.renderEngine.mainRenderer.setSize(e,t),this.renderEngine.textRenderer.setSize(e,t),this.renderEngine.effectsComposer.setSize(e,t),this.cameraManager){const i=this.renderEngine.canvas.clientWidth/this.renderEngine.canvas.clientHeight;this.cameraManager.getCameras().main.aspect=i,this.cameraManager.getCameras().main.updateProjectionMatrix(),this.cameraManager.getCameras().screenshot.aspect=i,this.cameraManager.getCameras().screenshot.updateProjectionMatrix()}this.dimensionsManager&&!this.hotspotsManager?.activeHotspot&&this.cameraManager.fitCameraToSceneBounds(!1),this.isPortraitOrientation=e<700,this.postRenderFrameUpdateInEngine(this.renderEngine.getClockDelta())}__onDimensionsPositionChanged(){this.renderEngine.updateDimensionLines(this.dimensionsManager.getCurrentDimensionsIndicatorState())}showSplashScreen(){this.splashScreenElem?.show()}hideSplashScreen(){this.splashScreenElem?.hide()}_setupResizeObservers(){new ResizeObserver(t=>{for(const i of t){const{width:a,height:l}=i.target.getBoundingClientRect(),h=a*.5,d=l*.5;if(h>230)this._isToolsetLargerThanTheLeftBottomQuadrant=!1;else{const p=this.toolsetElem?.getBoundingClientRect();if(!p)continue;const m=p.width>h,A=p.height>d;this._isToolsetLargerThanTheLeftBottomQuadrant=m||A}}}).observe(this)}async _postExperienceDataInitialization(){if(!this._identifier||!this._identifierType)return Promise.resolve(!0);const e=this._experienceData.productVariantCollection.getProductVariantByIdentifierAndType(this._identifier,this._identifierType);return e?await this.spawnProductVariant(e):Promise.resolve(!1)}async spawnProductVariant(e){if(!e.productParts)return Promise.reject(!1);for(const t of e.productParts)await this.spawnProductPart(t);return Promise.resolve(!0)}async spawnProductPart(e){const t=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!t)return Promise.reject(!1);await t.load();const i=await this.spawnAssetInScene(t);if(!i)return Promise.reject(!1);const a=e.finish;return a?(await i.selectAssetFinish(a),Promise.resolve(!0)):Promise.resolve(!1)}async _fetchExperienceDataConfig(){return null}async _buildExperienceData(){const e=await this._fetchExperienceDataConfig();if(e===null)return await this._onAuthenticationFailed("Unable to retrieve experience data config."),Promise.reject();if(!e.success)return await this._onAuthenticationFailed(e.message),Promise.reject();this._experienceData=new BH({nexusApiResultPayload:e.payload,appWcRef:this}),await this._experienceData.initialize()}async _clearAndLoadNewExperienceInScene(){this._onNewExperienceLoadStart(),await this._buildExperienceData().catch(e=>(window.epigraph.logger.error({title:`Couldn't build experience data for "${this.identifierType}" - "${this.identifier}"`,details:e,contextOverride:this._loggerContext}),Promise.reject(e))),await this._resetSession(),await this._postExperienceDataInitialization(),this.parsedUrlParams.get(lh.AR)&&!this.didARAutoLaunch&&(await this.launchAR(),this.didARAutoLaunch=!0),this._onNewExperienceLoadFinish()}async _onIdentifierOrTypeChange(){this.isAppReady&&(await this._resolveIdentifierAndType(),!(!this._identifier||!this._identifierType)&&(window.epigraph.logger.info({title:"IDENTIFIER CHANGED",details:`${this._identifierType} = ${this._identifier}`}),this._nexusAnalyticsPlugin&&(this._nexusAnalyticsPlugin.experienceID=this._identifier),this._ga4AnalyticsPlugin&&(this._ga4AnalyticsPlugin.experienceID=this._identifier),await this._clearAndLoadNewExperienceInScene().catch(e=>(window.epigraph.logger.error({title:"Error while clearing the session and loading a new experience.",details:e}),Promise.reject(e)))))}showCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.add("show")}hideCameraInteractionPromptIndicator(){this.cameraInteractionPromptIndicatorElemRef?.classList.remove("show")}_onPlayInteractionPromptChange(){this.playInteractionPrompt?this.__onPlayInteractionPrompt():(this.hideCameraInteractionPromptIndicator(),this._cameraManager?.mainCameraControls?.stop&&this._cameraManager?.mainCameraControls?.stop())}connectedCallback(){super.connectedCallback(),this._loadTimeBegin=performance.now(),this.parsedUrlParams=Et.parseUrlForEpigraphParams(this.baseUrlOverride),this._setupAnalytics()}firstUpdated(){this.modalView&&(this.hide=!0),this._setup().then(()=>{this.featuresToEnable.viewer===!0&&(this._setupResizeObservers(),this.hideSplashScreen()),window.epigraph.logger.info({title:"All Initializations Complete",contextOverride:this._loggerContext}),this.isAppReady=!0,this._onIdentifierOrTypeChange()}).catch(e=>{window.epigraph.logger.error({title:"Error while setup",details:e})})}updated(e){(e.has("sku")||e.has("shopify_variant_id")||e.has("upc")||e.has("asin")||e.has("experience_id")||e.has("product_variant_uuid")||e.has("customVersionId"))&&this._onIdentifierOrTypeChange(),e.has("playInteractionPrompt")&&this._onPlayInteractionPromptChange(),e.has("_isActiveHotspot")&&(this._hasActiveHotspot?this._hideCustomViewInYourSpaceButton():this._showCustomViewInYourSpaceButton()),e.has("debug")&&this.eventsManager.debugChanged.fire({value:this.debug}),e.has("modalView")&&(this.hide=this.modalView)}_getSlottedElements(e){const t=e.assignedElements();return[...t.length>0?t:e.children]}disconnectedCallback(){super.disconnectedCallback()}showFullScreenModal(){this.hide=!1}hideFullScreenModal(){this.hide=!0}render(){return Ee`
8732
8732
  ${Et.getCustomStylesTemplate()}
8733
8733
 
8734
8734
  <epg-button-icon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/solutions",
3
- "version": "0.38.0-beta.1",
3
+ "version": "0.38.0-beta.3",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-solutions.js",
6
6
  "files": [