@epigraph/solutions 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4196,12 +4196,12 @@ vec3 texelOld = texture2D(previousShadowMap, vUv).rgb;
4196
4196
  */let jl=class Od{constructor(e,t,i,a,l="div"){this.parent=e,this.object=t,this.property=i,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement("div"),this.domElement.classList.add("controller"),this.domElement.classList.add(a),this.$name=document.createElement("div"),this.$name.classList.add("name"),Od.nextNameID=Od.nextNameID||0,this.$name.id="lil-gui-name-"+ ++Od.nextNameID,this.$widget=document.createElement(l),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(i)}name(e){return this._name=e,this.$name.innerHTML=e,this}onChange(e){return this._onChange=e,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(e=!0){return this.disable(!e)}disable(e=!0){return e===this._disabled||(this._disabled=e,this.domElement.classList.toggle("disabled",e),this.$disable.toggleAttribute("disabled",e)),this}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(e){const t=this.parent.add(this.object,this.property,e);return t.name(this._name),this.destroy(),t}min(e){return this}max(e){return this}step(e){return this}decimals(e){return this}listen(e=!0){return this._listening=e,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const e=this.save();e!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=e}getValue(){return this.object[this.property]}setValue(e){return this.object[this.property]=e,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(e){return this.setValue(e),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}},jU=class extends jl{constructor(e,t,i){super(e,t,i,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}};function ZA(o){let e,t;return(e=o.match(/(#|0x)?([a-f0-9]{6})/i))?t=e[2]:(e=o.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?t=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=o.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(t=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),!!t&&"#"+t}const WU={isPrimitive:!0,match:o=>typeof o=="string",fromHexString:ZA,toHexString:ZA},$h={isPrimitive:!0,match:o=>typeof o=="number",fromHexString:o=>parseInt(o.substring(1),16),toHexString:o=>"#"+o.toString(16).padStart(6,0)},YU={isPrimitive:!1,match:Array.isArray,fromHexString(o,e,t=1){const i=$h.fromHexString(o);e[0]=(i>>16&255)/255*t,e[1]=(i>>8&255)/255*t,e[2]=(255&i)/255*t},toHexString:([o,e,t],i=1)=>$h.toHexString(o*(i=255/i)<<16^e*i<<8^t*i<<0)},XU={isPrimitive:!1,match:o=>Object(o)===o,fromHexString(o,e,t=1){const i=$h.fromHexString(o);e.r=(i>>16&255)/255*t,e.g=(i>>8&255)/255*t,e.b=(255&i)/255*t},toHexString:({r:o,g:e,b:t},i=1)=>$h.toHexString(o*(i=255/i)<<16^e*i<<8^t*i<<0)},KU=[WU,$h,YU,XU];let JU=class extends jl{constructor(e,t,i,a){var l;super(e,t,i,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(l=this.initialValue,KU.find(h=>h.match(l))),this._rgbScale=a,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const h=ZA(this.$text.value);h&&this._setValueFromHexString(h)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(e){if(this._format.isPrimitive){const t=this._format.fromHexString(e);this.setValue(t)}else this._format.fromHexString(e,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(e){return this._setValueFromHexString(e),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}},vm=class extends jl{constructor(e,t,i){super(e,t,i,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",a=>{a.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}};class ZU extends jl{constructor(e,t,i,a,l,h){super(e,t,i,"number"),this._initInput(),this.min(a),this.max(l);const d=h!==void 0;this.step(d?h:this._getImplicitStep(),d),this.updateDisplay()}decimals(e){return this._decimals=e,this.updateDisplay(),this}min(e){return this._min=e,this._onUpdateMinMax(),this}max(e){return this._max=e,this._onUpdateMinMax(),this}step(e,t=!0){return this._step=e,this._stepExplicit=t,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let t=(e-this._min)/(this._max-this._min);t=Math.max(0,Math.min(t,1)),this.$fill.style.width=100*t+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?e:e.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const e=A=>{const _=parseFloat(this.$input.value);isNaN(_)||(this._snapClampSetValue(_+A),this.$input.value=this.getValue())};let t,i,a,l,h,d=!1;const p=A=>{if(d){const _=A.clientX-t,y=A.clientY-i;Math.abs(y)>5?(A.preventDefault(),this.$input.blur(),d=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(_)>5&&m()}if(!d){const _=A.clientY-a;h-=_*this._step*this._arrowKeyMultiplier(A),l+h>this._max?h=this._max-l:l+h<this._min&&(h=this._min-l),this._snapClampSetValue(l+h)}a=A.clientY},m=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",m)};this.$input.addEventListener("input",()=>{let A=parseFloat(this.$input.value);isNaN(A)||(this._stepExplicit&&(A=this._snap(A)),this.setValue(this._clamp(A)))}),this.$input.addEventListener("keydown",A=>{A.code==="Enter"&&this.$input.blur(),A.code==="ArrowUp"&&(A.preventDefault(),e(this._step*this._arrowKeyMultiplier(A))),A.code==="ArrowDown"&&(A.preventDefault(),e(this._step*this._arrowKeyMultiplier(A)*-1))}),this.$input.addEventListener("wheel",A=>{this._inputFocused&&(A.preventDefault(),e(this._step*this._normalizeMouseWheel(A)))},{passive:!1}),this.$input.addEventListener("mousedown",A=>{t=A.clientX,i=a=A.clientY,d=!0,l=this.getValue(),h=0,window.addEventListener("mousemove",p),window.addEventListener("mouseup",m)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const e=y=>{const w=this.$slider.getBoundingClientRect();let E=(C=y,T=w.left,x=w.right,P=this._min,I=this._max,(C-T)/(x-T)*(I-P)+P);var C,T,x,P,I;this._snapClampSetValue(E)},t=y=>{e(y.clientX)},i=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",i)};let a,l,h=!1;const d=y=>{y.preventDefault(),this._setDraggingStyle(!0),e(y.touches[0].clientX),h=!1},p=y=>{if(h){const w=y.touches[0].clientX-a,E=y.touches[0].clientY-l;Math.abs(w)>Math.abs(E)?d(y):(window.removeEventListener("touchmove",p),window.removeEventListener("touchend",m))}else y.preventDefault(),e(y.touches[0].clientX)},m=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",p),window.removeEventListener("touchend",m)},A=this._callOnFinishChange.bind(this);let _;this.$slider.addEventListener("mousedown",y=>{this._setDraggingStyle(!0),e(y.clientX),window.addEventListener("mousemove",t),window.addEventListener("mouseup",i)}),this.$slider.addEventListener("touchstart",y=>{y.touches.length>1||(this._hasScrollBar?(a=y.touches[0].clientX,l=y.touches[0].clientY,h=!0):d(y),window.addEventListener("touchmove",p,{passive:!1}),window.addEventListener("touchend",m))},{passive:!1}),this.$slider.addEventListener("wheel",y=>{if(Math.abs(y.deltaX)<Math.abs(y.deltaY)&&this._hasScrollBar)return;y.preventDefault();const w=this._normalizeMouseWheel(y)*this._step;this._snapClampSetValue(this.getValue()+w),this.$input.value=this.getValue(),clearTimeout(_),_=setTimeout(A,400)},{passive:!1})}_setDraggingStyle(e,t="horizontal"){this.$slider&&this.$slider.classList.toggle("active",e),document.body.classList.toggle("lil-gui-dragging",e),document.body.classList.toggle("lil-gui-"+t,e)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(e){let{deltaX:t,deltaY:i}=e;return Math.floor(e.deltaY)!==e.deltaY&&e.wheelDelta&&(t=0,i=-e.wheelDelta/120,i*=this._stepExplicit?1:10),t+-i}_arrowKeyMultiplier(e){let t=this._stepExplicit?1:10;return e.shiftKey?t*=10:e.altKey&&(t/=10),t}_snap(e){const t=Math.round(e/this._step)*this._step;return parseFloat(t.toPrecision(15))}_clamp(e){return e<this._min&&(e=this._min),e>this._max&&(e=this._max),e}_snapClampSetValue(e){this.setValue(this._clamp(this._snap(e)))}get _hasScrollBar(){const e=this.parent.root.$children;return e.scrollHeight>e.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}let eF=class extends jl{constructor(e,t,i,a){super(e,t,i,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(a)?a:Object.values(a),this._names=Array.isArray(a)?a:Object.keys(a),this._names.forEach(l=>{const h=document.createElement("option");h.innerHTML=l,this.$select.appendChild(h)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const e=this.getValue(),t=this._values.indexOf(e);return this.$select.selectedIndex=t,this.$display.innerHTML=t===-1?e:this._names[t],this}};class tF extends jl{constructor(e,t,i){super(e,t,i,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",a=>{a.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let Mv=!1;class T_{constructor({parent:e,autoPlace:t=e===void 0,container:i,width:a,title:l="Controls",injectStyles:h=!0,touchStyles:d=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",p=>{p.code!=="Enter"&&p.code!=="Space"||(p.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(l),d&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!Mv&&h&&((function(p){const m=document.createElement("style");m.innerHTML=p;const A=document.querySelector("head link[rel=stylesheet], head style");A?document.head.insertBefore(m,A):document.head.appendChild(m)})('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"↕";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"▾";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"▸"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"✓";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),Mv=!0),i?i.appendChild(this.domElement):t&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),a&&this.domElement.style.setProperty("--width",a+"px"),this.domElement.addEventListener("keydown",p=>p.stopPropagation()),this.domElement.addEventListener("keyup",p=>p.stopPropagation())}add(e,t,i,a,l){if(Object(i)===i)return new eF(this,e,t,i);const h=e[t];switch(typeof h){case"number":return new ZU(this,e,t,i,a,l);case"boolean":return new jU(this,e,t);case"string":return new tF(this,e,t);case"function":return new vm(this,e,t)}console.error(`gui.add failed
4197
4197
  property:`,t,`
4198
4198
  object:`,e,`
4199
- value:`,h)}addColor(e,t,i=1){return new JU(this,e,t,i)}addFolder(e){return new T_({parent:this,title:e})}load(e,t=!0){return e.controllers&&this.controllers.forEach(i=>{i instanceof vm||i._name in e.controllers&&i.load(e.controllers[i._name])}),t&&e.folders&&this.folders.forEach(i=>{i._title in e.folders&&i.load(e.folders[i._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(i=>{if(!(i instanceof vm)){if(i._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${i._name}"`);t.controllers[i._name]=i.save()}}),e&&this.folders.forEach(i=>{if(i._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${i._title}"`);t.folders[i._title]=i.save()}),t}open(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const i=l=>{l.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",i))};this.$children.addEventListener("transitionend",i);const a=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=a+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}class iF{constructor({scene:e,targetRenderer:t,settings:i,appWcRef:a}){this.enabled=!0,this.__settings={},this.__shadowParams={temporal:!1,limit:1/0},this.__lightParams={amount:8,intensity:parseInt(Gl.replace(/\D+/g,""))>=155?Math.PI:1,bias:.001,mapSize:1024,size:8,near:.5,far:200},this.api={count:0},this.__gLights=new li,this.gui=new T_,this.__scene=e,this.__targetRenderer=t,this.__settings=i,this.__appWcRef=a,this.setup()}get camera(){return this.__camera}set camera(e){this.__camera=e}enable(){window.epigraph.logger.info({title:"Enabling Accumulative Shadows!"}),this.enabled=!0,this.__groundPlane.visible=!0}disable(){window.epigraph.logger.info({title:"Disabling Accumulative Shadows!"}),this.enabled=!1,this.__groundPlane.visible=!1}reset(){this.__progressiveLightMap.clear(),this.__shadowMaterial.opacity=0,this.__shadowMaterial.alphaTest=0,this.api.count=0,!this.__shadowParams.temporal&&this.__settings.shadowParams.frames!==1/0&&this.reCalculate(this.__settings.shadowParams.frames)}__addGui(){this.gui.title("Accumulative Shadow Controls");const e=this.gui.addFolder("Shadow Material");e.add(this.__settings.shadowMaterial,"opacity",0,1).onChange(a=>{this.__shadowMaterial.opacity=a}),e.add(this.__settings.shadowMaterial,"alphaTest",0,1).onChange(a=>{this.__shadowMaterial.alphaTest=a}),e.addColor(this.__shadowMaterial,"color"),e.add(this.__shadowMaterial,"blend",0,3);const t=this.gui.addFolder("Shadow params");t.add(this.__settings.shadowParams,"frames",2,100,1).onFinishChange(this.reset.bind(this)),t.add(this.__settings.shadowParams,"scale",.5,30).onChange(a=>{this.__groundPlane.scale.setScalar(a)}).onFinishChange(this.reset.bind(this)),t.add(this.__settings.shadowParams,"radius",.1,5).onFinishChange(this.reset.bind(this)),t.add(this.__settings.shadowParams,"ambient",0,1).onFinishChange(this.reset.bind(this));const i=this.gui.addFolder("💡 Light source");i.add(this.__settings.light.direction,"x",-5,5).name("Light Direction X").onFinishChange(this.reset.bind(this)),i.add(this.__settings.light.direction,"y",1,5).name("Light Direction Y").onFinishChange(this.reset.bind(this)),i.add(this.__settings.light.direction,"z",-5,5).name("Light Direction Z").onFinishChange(this.reset.bind(this))}__showGui(){this.gui.show()}__hideGui(){this.gui.hide()}__setupEventListeners(){this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.structureChangedEvent.name,this.reset.bind(this)),this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.debugChanged.name,(e=>{e.detail.value===!0?this.__showGui():this.__hideGui()}))}setup(){this.__progressiveLightMap=new qU(this.__targetRenderer,this.__scene,1024),this.__shadowMaterial=new QU({map:this.__progressiveLightMap.progressiveLightMap2.texture,transparent:!0,depthWrite:!1,toneMapped:!0,blend:this.__settings.shadowMaterial.blend,alphaTest:0,color:new je(this.__settings.shadowMaterial.color)}),this.__groundPlane=new ot(new ms(1,1).rotateX(-Math.PI/2),this.__shadowMaterial),this.__groundPlane.name="ACCUMULATIVE_SHADOW_GROUND_PLANE",this.__groundPlane.scale.setScalar(this.__settings.shadowParams.scale),this.__groundPlane.receiveShadow=!0,this.__scene.add(this.__groundPlane),this.__progressiveLightMap.configure(this.__groundPlane);for(let e=0;e<this.__lightParams.amount;e++){const t=new s_(16777215,this.__lightParams.intensity/this.__lightParams.amount);t.name="dir_light_"+e,t.castShadow=!0,t.shadow.bias=this.__lightParams.bias,t.shadow.camera.near=this.__lightParams.near,t.shadow.camera.far=this.__lightParams.far,t.shadow.camera.right=this.__lightParams.size/2,t.shadow.camera.left=-this.__lightParams.size/2,t.shadow.camera.top=this.__lightParams.size/2,t.shadow.camera.bottom=-this.__lightParams.size/2,t.shadow.mapSize.width=this.__lightParams.mapSize,t.shadow.mapSize.height=this.__lightParams.mapSize,this.__gLights.add(t)}this.__setupEventListeners(),this.__addGui(),this.__appWcRef.debug?this.__showGui():this.__hideGui()}temporalUpdate(){this.enabled!==!1&&(this.__shadowParams.temporal||this.__settings.shadowParams.frames===1/0)&&this.api.count<this.__settings.shadowParams.frames&&this.api.count<this.__shadowParams.limit&&(this.reCalculate(),this.api.count++)}__randomiseLightPositions(){const e=Object.keys(this.__settings.light.direction).length;for(let t=0;t<this.__gLights.children.length;t++){const i=this.__gLights.children[t];if(Math.random()>this.__settings.shadowParams.ambient)i.position.set(this.__settings.light.direction.x+Ms.randFloatSpread(this.__settings.shadowParams.radius),this.__settings.light.direction.y+Ms.randFloatSpread(this.__settings.shadowParams.radius),this.__settings.light.direction.z+Ms.randFloatSpread(this.__settings.shadowParams.radius));else{const a=Math.acos(2*Math.random()-1)-Math.PI/2,l=2*Math.PI*Math.random();i.position.set(Math.cos(a)*Math.cos(l)*e,Math.abs(Math.cos(a)*Math.sin(l)*e),Math.sin(a)*e)}}}reCalculate(e=1){if(this.__camera){this.__settings.shadowMaterial.blend=Math.max(2,this.__settings.shadowParams.frames===1/0?this.__settings.shadowMaterial.blend:this.__settings.shadowParams.frames),this.__shadowParams.temporal?(this.__shadowMaterial.opacity=Math.min(this.__settings.shadowMaterial.opacity,this.__shadowMaterial.opacity+this.__settings.shadowMaterial.opacity/this.__settings.shadowMaterial.blend),this.__shadowMaterial.alphaTest=Math.min(this.__settings.shadowMaterial.alphaTest,this.__shadowMaterial.alphaTest+this.__settings.shadowMaterial.alphaTest/this.__settings.shadowMaterial.blend)):(this.__shadowMaterial.opacity=this.__settings.shadowMaterial.opacity,this.__shadowMaterial.alphaTest=this.__settings.shadowMaterial.alphaTest),this.__scene.add(this.__gLights),this.__progressiveLightMap.prepare();for(let t=0;t<e;t++)this.__randomiseLightPositions(),this.__progressiveLightMap.update(this.__camera,this.__settings.shadowMaterial.blend);this.__scene.remove(this.__gLights),this.__progressiveLightMap.finish()}}}var E1=(o=>(o.NONE="none",o.CONTACT="contact",o.ACCUMULATIVE="accumulative",o))(E1||{});class nF extends EventTarget{constructor(e){super(),this._loggerContext="THREEJS ENGINE",this.__scene=new Yr,this.__tweenGroup=new pC,this.__clock=new ZS,this.__effectsComposer={},this.__canvas={},this.__mainRenderer={},this.__textRenderer={},this.__screenshotRenderer={},this.__sceneHierarchy={baseSceneGrp:new li,lightsGrp:new li,sceneStructure:{},dimensionLinesGrp:new li,miscGrp:new li},this.__defaultEnvMap="https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/env-maps/neutral.hdr",this.__lengthLine={},this.__depthLine={},this.__heightLine={},this.__textureAnisotropyToUse=4,this.__appWcRef=e,this.__sceneHierarchy.sceneStructure=this.__appWcRef.sceneManager.sceneStructure}get canvas(){return this.__canvas}get scene(){return this.__scene}get productSettings(){return this.__appWcRef.productSettings}get mainRenderer(){return this.__mainRenderer}get textRenderer(){return this.__textRenderer}get effectsComposer(){return this.__effectsComposer}get screenshotRenderer(){return this.__screenshotRenderer}get sceneHierarchy(){return this.__sceneHierarchy}get contactShadows(){return this.__contactShadows}get accumulativeShadows(){return this.__accumulativeShadows}getClockDelta(){return this.__clock.getDelta()}get tweenGroup(){return this.__tweenGroup}updateAllTextureAnisotropy(){this.__scene.traverse(e=>{const i=e.material;i?.map&&(i.map.anisotropy=this.__textureAnisotropyToUse,i.needsUpdate=!0)})}printSceneHierarchy(e=!1){(function t(i){if(e===!0)console.group(`------ ${i.name} ------`),console.log(i);else{const a="epgType"in i?i.epgType:i.type;console.group(" <"+a+"> "+i.name)}i.children.forEach(t),console.groupEnd()})(this.__scene)}printSceneStructure(){let e="--";(function t(i){if(i instanceof Va||i instanceof ur){const a=i.epgType;console.group(`${e} < ${a} > ${i.name} || ${i.uuid}`),e+="--|"}i.children.forEach(t),console.groupEnd()})(this.__sceneHierarchy.sceneStructure)}async emptyScene(){Et.dispose3(this.scene),this.__sceneHierarchy.baseSceneGrp.clear(),this.__sceneHierarchy.lightsGrp.clear();const e=[];this.__sceneHierarchy.sceneStructure.rootEntity.traverse(t=>{t.uuid!==this.__sceneHierarchy.sceneStructure.rootEntity.uuid&&t instanceof Va&&e.push(t)});for(const t of e)t.removeFromParent(),Et.dispose3(t)}async _setupSceneHierarchy(){this.__sceneHierarchy.baseSceneGrp.name="GRP_BASE_SCENE",this.__scene.add(this.__sceneHierarchy.baseSceneGrp),this.__sceneHierarchy.lightsGrp.name="GRP_LIGHTS",this.__scene.add(this.__sceneHierarchy.lightsGrp),this.__scene.add(this.__sceneHierarchy.sceneStructure),this.__sceneHierarchy.dimensionLinesGrp.name="GRP_DIMENSIONS_LINES",this.__scene.add(this.__sceneHierarchy.dimensionLinesGrp),this.__sceneHierarchy.miscGrp.name="GRP_MISC",this.__scene.add(this.__sceneHierarchy.miscGrp)}async _setupLights({envMap:e=this.__defaultEnvMap}){this.__mainRenderer.outputColorSpace=Vt,this.__mainRenderer.toneMapping=N0,new u1().load(e,i=>{i.mapping=Mh,this.__scene.environment=i})}__setupEffectComposer(){this.__effectsComposer=new MU(this.__mainRenderer),window.epigraph.logger.info({title:"Effects to enable",details:this.productSettings.postEffect,contextOverride:this._loggerContext})}__constructLineSegment(e,t,i){const a=[e,t],l=new bi().setFromPoints(a),h=new Ka(l,i);return h.castShadow=!1,h}__setupDimensionLines(){const e={color:new je().setHex(11776947).convertSRGBToLinear(),scale:1,dashSize:.02,gapSize:.02},t=new Fp(e),i=new Fp(e),a=new Fp(e),l=new se;this.__lengthLine=this.__constructLineSegment(l,l,t),this.__depthLine=this.__constructLineSegment(l,l,i),this.__heightLine=this.__constructLineSegment(l,l,a),this.__sceneHierarchy.dimensionLinesGrp.add(this.__lengthLine),this.__sceneHierarchy.dimensionLinesGrp.add(this.__depthLine),this.__sceneHierarchy.dimensionLinesGrp.add(this.__heightLine),this.setDimensionsVisibility(!1)}updateDimensionLines(e){this.__lengthLine.geometry?.setFromPoints([e.length.begin.worldPos,e.length.end.worldPos]),this.__depthLine.geometry?.setFromPoints([e.width.begin.worldPos,e.width.end.worldPos]),this.__heightLine.geometry?.setFromPoints([e.height.begin.worldPos,e.height.end.worldPos]),this.__lengthLine?.computeLineDistances(),this.__depthLine?.computeLineDistances(),this.__heightLine?.computeLineDistances()}frameUpdate(){this.__appWcRef.eventsManager.frameUpdated.fire()}repopulateHotspotIndicators(){this.__appWcRef.eventsManager.hotspotsUpdatedEvent.fire()}setDimensionsVisibility(e){this.__lengthLine.visible=e,this.__depthLine.visible=e,this.__heightLine.visible=e}async getSceneAsUsdzUrl(){const e=this.__sceneHierarchy.sceneStructure;this.printSceneHierarchy();const i=await new s1().parseAsync(e),a=new Blob([i],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(a)}async getSceneAsGlbUrl(){const e=new FN,t=new Fh,a=this.__sceneHierarchy.sceneStructure;this.printSceneHierarchy();const l={binary:!0,forceIndices:!0,trs:!1,onlyVisible:!0,embedImages:!0,maxTextureSize:1024},h=await t.parseAsync(a,l),d=await e.readBinary(new Uint8Array(h)),p=await this.optimizeGlb(d),m=await e.writeBinary(p);return await this.saveArrayBufferAsURL(m)}async optimizeGlb(e){const i=e.getRoot().listNodes();for(const a of i){a.setExtras({});const l=a.getName();(l==="GRP_ProxyMesh"||l==="GRP_LoadingPlaceholder")&&a.dispose()}return await e.transform(iO(),_O()),e}async saveArrayBufferAsURL(e){const t=new Blob([e],{type:"application/gltf-buffer"});return window.epigraph.logger.info({title:"Approx scene GLB size: "+t.size/1e6}),URL.createObjectURL(t)}__perFrameUpdate(){const e=this.__clock.getDelta();this.__contactShadows?.isEnabled()&&this.__contactShadows.reCalculate(),this.__appWcRef.postRenderFrameUpdateInEngine(e),this.__effectsComposer.render(),this.__tweenGroup.update(),requestAnimationFrame(this.__perFrameUpdate.bind(this))}__setupRenderers(){this.__mainRenderer=new df({antialias:this.productSettings.renderQuality.antiAlias,alpha:this.__appWcRef.transparentBackground}),this.__appWcRef.transparentBackground||this.__mainRenderer.setClearColor(this.productSettings.camera.backgroundColor),this.productSettings.screenshots.enabled&&(this.__screenshotRenderer=new df({antialias:this.productSettings.renderQuality.antiAlias,preserveDrawingBuffer:!0}),document.body.appendChild(this.__screenshotRenderer.domElement),this.__screenshotRenderer.domElement.style.display="none"),this.__textRenderer=new f1,this.__textRenderer.setSize(window.innerWidth,window.innerHeight),this.__textRenderer.domElement.style.position="absolute",this.__textRenderer.domElement.style.top="0px",this.__textRenderer.domElement.style.pointerEvents="none",document.body.appendChild(this.__textRenderer.domElement)}showTextRenderer(){this.__textRenderer.domElement.style.display="block"}hideTextRenderer(){this.__textRenderer.domElement.style.display="none"}__setupShadows(){switch(this.__mainRenderer.shadowMap.enabled=!0,this.productSettings.shadows.shadowType){case"contact":this.__mainRenderer.shadowMap.type=L0,this.__contactShadows||(this.__contactShadows=new PU({scene:this.__scene,sceneHierarchyToCastShadow:this.__sceneHierarchy.sceneStructure,targetRenderer:this.__mainRenderer,settings:this.productSettings.shadows.contactShadows})),this.__accumulativeShadows?.disable(),this.__contactShadows?.enable();break;case"accumulative":this.__mainRenderer.shadowMap.type=ES,this.__accumulativeShadows||(this.__accumulativeShadows=new iF({scene:this.__scene,targetRenderer:this.__mainRenderer,settings:this.productSettings.shadows.accumulativeShadows,appWcRef:this.__appWcRef})),this.__contactShadows?.disable(),this.__accumulativeShadows?.enable();break;case"none":this.__accumulativeShadows?.disable(),this.__contactShadows?.disable();break}}async setup(){this.__setupRenderers(),this.__canvas=this.__mainRenderer.domElement,await this._setupSceneHierarchy(),await this._setupLights({envMap:this.__defaultEnvMap}),this.__setupShadows(),this.__setupDimensionLines(),this.__setupEffectComposer();const e=this.__mainRenderer.capabilities.getMaxAnisotropy();e<this.__textureAnisotropyToUse&&(this.__textureAnisotropyToUse=e),this.__perFrameUpdate(),requestAnimationFrame(this.__perFrameUpdate.bind(this));const t={canvasHtmlElem:this.__canvas,renderer:this.__mainRenderer,screenshotRenderer:this.__screenshotRenderer??void 0},i=1;return this.mainRenderer.setPixelRatio(i),this.effectsComposer.setPixelRatio(i),this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.experienceUpdatedEvent.name,()=>{this.__setupShadows()}),Promise.resolve(t)}}/*!
4199
+ value:`,h)}addColor(e,t,i=1){return new JU(this,e,t,i)}addFolder(e){return new T_({parent:this,title:e})}load(e,t=!0){return e.controllers&&this.controllers.forEach(i=>{i instanceof vm||i._name in e.controllers&&i.load(e.controllers[i._name])}),t&&e.folders&&this.folders.forEach(i=>{i._title in e.folders&&i.load(e.folders[i._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(i=>{if(!(i instanceof vm)){if(i._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${i._name}"`);t.controllers[i._name]=i.save()}}),e&&this.folders.forEach(i=>{if(i._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${i._title}"`);t.folders[i._title]=i.save()}),t}open(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const i=l=>{l.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",i))};this.$children.addEventListener("transitionend",i);const a=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=a+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}class iF{constructor({scene:e,targetRenderer:t,settings:i,appWcRef:a}){this.enabled=!0,this.__settings={},this.__shadowParams={temporal:!1,limit:1/0},this.__lightParams={amount:8,intensity:parseInt(Gl.replace(/\D+/g,""))>=155?Math.PI:1,bias:.001,mapSize:1024,size:8,near:.5,far:200},this.api={count:0},this.__gLights=new li,this.gui=new T_,this.__scene=e,this.__targetRenderer=t,this.__settings=i,this.__appWcRef=a,this.setup()}get camera(){return this.__camera}set camera(e){this.__camera=e}enable(){window.epigraph.logger.info({title:"Enabling Accumulative Shadows!"}),this.enabled=!0,this.__groundPlane.visible=!0}disable(){window.epigraph.logger.info({title:"Disabling Accumulative Shadows!"}),this.enabled=!1,this.__groundPlane.visible=!1}reset(){this.__progressiveLightMap.clear(),this.__shadowMaterial.opacity=0,this.__shadowMaterial.alphaTest=0,this.api.count=0,!this.__shadowParams.temporal&&this.__settings.shadowParams.frames!==1/0&&this.reCalculate(this.__settings.shadowParams.frames)}__addGui(){this.gui.title("Accumulative Shadow Controls");const e=this.gui.addFolder("Shadow Material");e.add(this.__settings.shadowMaterial,"opacity",0,1).onChange(a=>{this.__shadowMaterial.opacity=a}),e.add(this.__settings.shadowMaterial,"alphaTest",0,1).onChange(a=>{this.__shadowMaterial.alphaTest=a}),e.addColor(this.__shadowMaterial,"color"),e.add(this.__shadowMaterial,"blend",0,3);const t=this.gui.addFolder("Shadow params");t.add(this.__settings.shadowParams,"frames",2,100,1).onFinishChange(this.reset.bind(this)),t.add(this.__settings.shadowParams,"scale",.5,30).onChange(a=>{this.__groundPlane.scale.setScalar(a)}).onFinishChange(this.reset.bind(this)),t.add(this.__settings.shadowParams,"radius",.1,5).onFinishChange(this.reset.bind(this)),t.add(this.__settings.shadowParams,"ambient",0,1).onFinishChange(this.reset.bind(this));const i=this.gui.addFolder("💡 Light source");i.add(this.__settings.light.direction,"x",-5,5).name("Light Direction X").onFinishChange(this.reset.bind(this)),i.add(this.__settings.light.direction,"y",1,5).name("Light Direction Y").onFinishChange(this.reset.bind(this)),i.add(this.__settings.light.direction,"z",-5,5).name("Light Direction Z").onFinishChange(this.reset.bind(this))}__showGui(){this.gui.show()}__hideGui(){this.gui.hide()}__setupEventListeners(){this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.structureChangedEvent.name,this.reset.bind(this)),this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.debugChanged.name,(e=>{e.detail.value===!0?this.__showGui():this.__hideGui()}))}setup(){this.__progressiveLightMap=new qU(this.__targetRenderer,this.__scene,1024),this.__shadowMaterial=new QU({map:this.__progressiveLightMap.progressiveLightMap2.texture,transparent:!0,depthWrite:!1,toneMapped:!0,blend:this.__settings.shadowMaterial.blend,alphaTest:0,color:new je(this.__settings.shadowMaterial.color)}),this.__groundPlane=new ot(new ms(1,1).rotateX(-Math.PI/2),this.__shadowMaterial),this.__groundPlane.name="ACCUMULATIVE_SHADOW_GROUND_PLANE",this.__groundPlane.scale.setScalar(this.__settings.shadowParams.scale),this.__groundPlane.receiveShadow=!0,this.__scene.add(this.__groundPlane),this.__progressiveLightMap.configure(this.__groundPlane);for(let e=0;e<this.__lightParams.amount;e++){const t=new s_(16777215,this.__lightParams.intensity/this.__lightParams.amount);t.name="dir_light_"+e,t.castShadow=!0,t.shadow.bias=this.__lightParams.bias,t.shadow.camera.near=this.__lightParams.near,t.shadow.camera.far=this.__lightParams.far,t.shadow.camera.right=this.__lightParams.size/2,t.shadow.camera.left=-this.__lightParams.size/2,t.shadow.camera.top=this.__lightParams.size/2,t.shadow.camera.bottom=-this.__lightParams.size/2,t.shadow.mapSize.width=this.__lightParams.mapSize,t.shadow.mapSize.height=this.__lightParams.mapSize,this.__gLights.add(t)}this.__setupEventListeners(),this.__addGui(),this.__appWcRef.debug?this.__showGui():this.__hideGui()}temporalUpdate(){this.enabled!==!1&&(this.__shadowParams.temporal||this.__settings.shadowParams.frames===1/0)&&this.api.count<this.__settings.shadowParams.frames&&this.api.count<this.__shadowParams.limit&&(this.reCalculate(),this.api.count++)}__randomiseLightPositions(){const e=Object.keys(this.__settings.light.direction).length;for(let t=0;t<this.__gLights.children.length;t++){const i=this.__gLights.children[t];if(Math.random()>this.__settings.shadowParams.ambient)i.position.set(this.__settings.light.direction.x+Ms.randFloatSpread(this.__settings.shadowParams.radius),this.__settings.light.direction.y+Ms.randFloatSpread(this.__settings.shadowParams.radius),this.__settings.light.direction.z+Ms.randFloatSpread(this.__settings.shadowParams.radius));else{const a=Math.acos(2*Math.random()-1)-Math.PI/2,l=2*Math.PI*Math.random();i.position.set(Math.cos(a)*Math.cos(l)*e,Math.abs(Math.cos(a)*Math.sin(l)*e),Math.sin(a)*e)}}}reCalculate(e=1){if(this.__camera){this.__settings.shadowMaterial.blend=Math.max(2,this.__settings.shadowParams.frames===1/0?this.__settings.shadowMaterial.blend:this.__settings.shadowParams.frames),this.__shadowParams.temporal?(this.__shadowMaterial.opacity=Math.min(this.__settings.shadowMaterial.opacity,this.__shadowMaterial.opacity+this.__settings.shadowMaterial.opacity/this.__settings.shadowMaterial.blend),this.__shadowMaterial.alphaTest=Math.min(this.__settings.shadowMaterial.alphaTest,this.__shadowMaterial.alphaTest+this.__settings.shadowMaterial.alphaTest/this.__settings.shadowMaterial.blend)):(this.__shadowMaterial.opacity=this.__settings.shadowMaterial.opacity,this.__shadowMaterial.alphaTest=this.__settings.shadowMaterial.alphaTest),this.__scene.add(this.__gLights),this.__progressiveLightMap.prepare();for(let t=0;t<e;t++)this.__randomiseLightPositions(),this.__progressiveLightMap.update(this.__camera,this.__settings.shadowMaterial.blend);this.__scene.remove(this.__gLights),this.__progressiveLightMap.finish()}}}var E1=(o=>(o.NONE="none",o.CONTACT="contact",o.ACCUMULATIVE="accumulative",o))(E1||{});class nF extends EventTarget{constructor(e){super(),this._loggerContext="THREEJS ENGINE",this.__scene=new Yr,this.__tweenGroup=new pC,this.__clock=new ZS,this.__effectsComposer={},this.__canvas={},this.__mainRenderer={},this.__textRenderer={},this.__screenshotRenderer={},this.__sceneHierarchy={baseSceneGrp:new li,lightsGrp:new li,sceneStructure:{},dimensionLinesGrp:new li,miscGrp:new li},this.__defaultEnvMap="https://asset.myepigraph.com/configurator-assets/epigraph-solution-assets/env-maps/neutral.hdr",this.__lengthLine={},this.__depthLine={},this.__heightLine={},this.__textureAnisotropyToUse=4,this.__appWcRef=e,this.__sceneHierarchy.sceneStructure=this.__appWcRef.sceneManager.sceneStructure}get canvas(){return this.__canvas}get scene(){return this.__scene}get productSettings(){return this.__appWcRef.productSettings}get mainRenderer(){return this.__mainRenderer}get textRenderer(){return this.__textRenderer}get effectsComposer(){return this.__effectsComposer}get screenshotRenderer(){return this.__screenshotRenderer}get sceneHierarchy(){return this.__sceneHierarchy}get contactShadows(){return this.__contactShadows}get accumulativeShadows(){return this.__accumulativeShadows}getClockDelta(){return this.__clock.getDelta()}get tweenGroup(){return this.__tweenGroup}updateAllTextureAnisotropy(){this.__scene.traverse(e=>{const i=e.material;i?.map&&(i.map.anisotropy=this.__textureAnisotropyToUse,i.needsUpdate=!0)})}printSceneHierarchy(e=!1){(function t(i){if(e===!0)console.group(`------ ${i.name} ------`),console.log(i);else{const a="epgType"in i?i.epgType:i.type;console.group(" <"+a+"> "+i.name)}i.children.forEach(t),console.groupEnd()})(this.__scene)}printSceneStructure(){let e="--";(function t(i){if(i instanceof Va||i instanceof ur){const a=i.epgType;console.group(`${e} < ${a} > ${i.name} || ${i.uuid}`),e+="--|"}i.children.forEach(t),console.groupEnd()})(this.__sceneHierarchy.sceneStructure)}async emptyScene(){Et.dispose3(this.scene),this.__sceneHierarchy.baseSceneGrp.clear(),this.__sceneHierarchy.lightsGrp.clear();const e=[];this.__sceneHierarchy.sceneStructure.rootEntity.traverse(t=>{t.uuid!==this.__sceneHierarchy.sceneStructure.rootEntity.uuid&&t instanceof Va&&e.push(t)});for(const t of e)t.removeFromParent(),Et.dispose3(t)}async _setupSceneHierarchy(){this.__sceneHierarchy.baseSceneGrp.name="GRP_BASE_SCENE",this.__scene.add(this.__sceneHierarchy.baseSceneGrp),this.__sceneHierarchy.lightsGrp.name="GRP_LIGHTS",this.__scene.add(this.__sceneHierarchy.lightsGrp),this.__scene.add(this.__sceneHierarchy.sceneStructure),this.__sceneHierarchy.dimensionLinesGrp.name="GRP_DIMENSIONS_LINES",this.__scene.add(this.__sceneHierarchy.dimensionLinesGrp),this.__sceneHierarchy.miscGrp.name="GRP_MISC",this.__scene.add(this.__sceneHierarchy.miscGrp)}async _setupLights({envMap:e=this.__defaultEnvMap}){this.__mainRenderer.outputColorSpace=Vt,this.__mainRenderer.toneMapping=N0,new u1().load(e,i=>{i.mapping=Mh,this.__scene.environment=i})}__setupEffectComposer(){this.__effectsComposer=new MU(this.__mainRenderer),window.epigraph.logger.info({title:"Effects to enable",details:this.productSettings.postEffect,contextOverride:this._loggerContext})}__constructLineSegment(e,t,i){const a=[e,t],l=new bi().setFromPoints(a),h=new Ka(l,i);return h.castShadow=!1,h}__setupDimensionLines(){const e={color:new je().setHex(11776947).convertSRGBToLinear(),scale:1,dashSize:.02,gapSize:.02},t=new Fp(e),i=new Fp(e),a=new Fp(e),l=new se;this.__lengthLine=this.__constructLineSegment(l,l,t),this.__depthLine=this.__constructLineSegment(l,l,i),this.__heightLine=this.__constructLineSegment(l,l,a),this.__sceneHierarchy.dimensionLinesGrp.add(this.__lengthLine),this.__sceneHierarchy.dimensionLinesGrp.add(this.__depthLine),this.__sceneHierarchy.dimensionLinesGrp.add(this.__heightLine),this.setDimensionsVisibility(!1)}updateDimensionLines(e){this.__lengthLine.geometry?.setFromPoints([e.length.begin.worldPos,e.length.end.worldPos]),this.__depthLine.geometry?.setFromPoints([e.width.begin.worldPos,e.width.end.worldPos]),this.__heightLine.geometry?.setFromPoints([e.height.begin.worldPos,e.height.end.worldPos]),this.__lengthLine?.computeLineDistances(),this.__depthLine?.computeLineDistances(),this.__heightLine?.computeLineDistances()}frameUpdate(){this.__appWcRef.eventsManager.frameUpdated.fire()}repopulateHotspotIndicators(){this.__appWcRef.eventsManager.hotspotsUpdatedEvent.fire()}setDimensionsVisibility(e){this.__lengthLine.visible=e,this.__depthLine.visible=e,this.__heightLine.visible=e}async getSceneAsUsdzUrl(){const e=this.__sceneHierarchy.sceneStructure;this.printSceneHierarchy();const i=await new s1().parseAsync(e),a=new Blob([i],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(a)}async getSceneAsGlbUrl(){const e=new FN,t=new Fh,a=this.__sceneHierarchy.sceneStructure;this.printSceneHierarchy();const l={binary:!0,forceIndices:!0,trs:!1,onlyVisible:!0,embedImages:!0,maxTextureSize:1024},h=await t.parseAsync(a,l),d=await e.readBinary(new Uint8Array(h)),p=await this.optimizeGlb(d),m=await e.writeBinary(p);return await this.saveArrayBufferAsURL(m)}async optimizeGlb(e){const i=e.getRoot().listNodes();for(const a of i){a.setExtras({});const l=a.getName();(l==="GRP_ProxyMesh"||l==="GRP_LoadingPlaceholder")&&a.dispose()}return await e.transform(iO(),_O()),e}async saveArrayBufferAsURL(e){const t=new Blob([e],{type:"application/gltf-buffer"});return window.epigraph.logger.info({title:"Approx scene GLB size: "+t.size/1e6}),URL.createObjectURL(t)}__perFrameUpdate(){const e=this.__clock.getDelta();this.__contactShadows?.isEnabled()&&this.__contactShadows.reCalculate(),this.__appWcRef.postRenderFrameUpdateInEngine(e),this.__effectsComposer.render(),this.__tweenGroup.update(),requestAnimationFrame(this.__perFrameUpdate.bind(this))}__setupRenderers(){this.__mainRenderer=new df({antialias:this.productSettings.renderQuality.antiAlias,alpha:this.__appWcRef.transparentBackground});const e=this.__appWcRef.canvasSize.width||this.__appWcRef.getBoundingClientRect().width||300,t=this.__appWcRef.canvasSize.height||this.__appWcRef.getBoundingClientRect().height||150;this.__mainRenderer.setSize(e,t),this.__appWcRef.transparentBackground||this.__mainRenderer.setClearColor(this.productSettings.camera.backgroundColor),this.productSettings.screenshots.enabled&&(this.__screenshotRenderer=new df({antialias:this.productSettings.renderQuality.antiAlias,preserveDrawingBuffer:!0}),document.body.appendChild(this.__screenshotRenderer.domElement),this.__screenshotRenderer.domElement.style.display="none"),this.__textRenderer=new f1,this.__textRenderer.setSize(e,t),this.__textRenderer.domElement.style.position="absolute",this.__textRenderer.domElement.style.top="0px",this.__textRenderer.domElement.style.pointerEvents="none",document.body.appendChild(this.__textRenderer.domElement)}showTextRenderer(){this.__textRenderer.domElement.style.display="block"}hideTextRenderer(){this.__textRenderer.domElement.style.display="none"}__setupShadows(){switch(this.__mainRenderer.shadowMap.enabled=!0,this.productSettings.shadows.shadowType){case"contact":this.__mainRenderer.shadowMap.type=L0,this.__contactShadows||(this.__contactShadows=new PU({scene:this.__scene,sceneHierarchyToCastShadow:this.__sceneHierarchy.sceneStructure,targetRenderer:this.__mainRenderer,settings:this.productSettings.shadows.contactShadows})),this.__accumulativeShadows?.disable(),this.__contactShadows?.enable();break;case"accumulative":this.__mainRenderer.shadowMap.type=ES,this.__accumulativeShadows||(this.__accumulativeShadows=new iF({scene:this.__scene,targetRenderer:this.__mainRenderer,settings:this.productSettings.shadows.accumulativeShadows,appWcRef:this.__appWcRef})),this.__contactShadows?.disable(),this.__accumulativeShadows?.enable();break;case"none":this.__accumulativeShadows?.disable(),this.__contactShadows?.disable();break}}async setup(){this.__setupRenderers(),this.__canvas=this.__mainRenderer.domElement,await this._setupSceneHierarchy(),await this._setupLights({envMap:this.__defaultEnvMap}),this.__setupShadows(),this.__setupDimensionLines(),this.__setupEffectComposer();const e=this.__mainRenderer.capabilities.getMaxAnisotropy();e<this.__textureAnisotropyToUse&&(this.__textureAnisotropyToUse=e),this.__perFrameUpdate(),requestAnimationFrame(this.__perFrameUpdate.bind(this));const t={canvasHtmlElem:this.__canvas,renderer:this.__mainRenderer,screenshotRenderer:this.__screenshotRenderer??void 0},i=1;return this.mainRenderer.setPixelRatio(i),this.effectsComposer.setPixelRatio(i),this.__appWcRef.addEventListener(this.__appWcRef.eventsManager.experienceUpdatedEvent.name,()=>{this.__setupShadows()}),Promise.resolve(t)}}/*!
4200
4200
  * camera-controls
4201
4201
  * https://github.com/yomotsu/camera-controls
4202
4202
  * (c) 2017 @yomotsu
4203
4203
  * Released under the MIT License.
4204
- */const ni={LEFT:1,RIGHT:2,MIDDLE:4},_e=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),Io={NONE:0,IN:1,OUT:-1};function fa(o){return o.isPerspectiveCamera}function Cr(o){return o.isOrthographicCamera}const xr=Math.PI*2,Iv=Math.PI/2,x1=1e-5,Sc=Math.PI/180;function ss(o,e,t){return Math.max(e,Math.min(t,o))}function Qt(o,e=x1){return Math.abs(o)<e}function kt(o,e,t=x1){return Qt(o-e,t)}function Rv(o,e){return Math.round(o/e)*e}function Cc(o){return isFinite(o)?o:o<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Tc(o){return Math.abs(o)<Number.MAX_VALUE?o:o*(1/0)}function qu(o,e,t,i,a=1/0,l){i=Math.max(1e-4,i);const h=2/i,d=h*l,p=1/(1+d+.48*d*d+.235*d*d*d);let m=o-e;const A=e,_=a*i;m=ss(m,-_,_),e=o-m;const y=(t.value+h*m)*l;t.value=(t.value-h*y)*p;let w=e+(m+y)*p;return A-o>0==w>A&&(w=A,t.value=(w-A)/l),w}function Bv(o,e,t,i,a=1/0,l,h){i=Math.max(1e-4,i);const d=2/i,p=d*l,m=1/(1+p+.48*p*p+.235*p*p*p);let A=e.x,_=e.y,y=e.z,w=o.x-A,E=o.y-_,C=o.z-y;const T=A,x=_,P=y,I=a*i,R=I*I,D=w*w+E*E+C*C;if(D>R){const V=Math.sqrt(D);w=w/V*I,E=E/V*I,C=C/V*I}A=o.x-w,_=o.y-E,y=o.z-C;const G=(t.x+d*w)*l,U=(t.y+d*E)*l,H=(t.z+d*C)*l;t.x=(t.x-d*G)*m,t.y=(t.y-d*U)*m,t.z=(t.z-d*H)*m,h.x=A+(w+G)*m,h.y=_+(E+U)*m,h.z=y+(C+H)*m;const k=T-o.x,$=x-o.y,Q=P-o.z,Z=h.x-T,X=h.y-x,s=h.z-P;return k*Z+$*X+Q*s>0&&(h.x=T,h.y=x,h.z=P,t.x=(h.x-T)/l,t.y=(h.y-x)/l,t.z=(h.z-P)/l),h}function wm(o,e){e.set(0,0),o.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=o.length,e.y/=o.length}function Em(o,e){return Cr(o)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class sF{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const a=this._listeners[e];if(a!==void 0){const l=a.indexOf(t);l!==-1&&a.splice(l,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const a=i.slice(0);for(let l=0,h=a.length;l<h;l++)a[l].call(this,e)}}}var xm;const rF="3.1.0",ju=1/8,aF=/Mac/.test((xm=globalThis?.navigator)===null||xm===void 0?void 0:xm.platform);let rt,Pv,Wu,Sm,_n,ht,Rt,Ro,Mc,As,_s,pa,Lv,Dv,Cn,Bo,Po,Nv,Cm,Ov,Tm,Mm,Yu;class Ua extends sF{static install(e){rt=e.THREE,Pv=Object.freeze(new rt.Vector3(0,0,0)),Wu=Object.freeze(new rt.Vector3(0,1,0)),Sm=Object.freeze(new rt.Vector3(0,0,1)),_n=new rt.Vector2,ht=new rt.Vector3,Rt=new rt.Vector3,Ro=new rt.Vector3,Mc=new rt.Vector3,As=new rt.Vector3,_s=new rt.Vector3,pa=new rt.Vector3,Lv=new rt.Vector3,Dv=new rt.Vector3,Cn=new rt.Spherical,Bo=new rt.Spherical,Po=new rt.Box3,Nv=new rt.Box3,Cm=new rt.Sphere,Ov=new rt.Quaternion,Tm=new rt.Quaternion,Mm=new rt.Matrix4,Yu=new rt.Raycaster}static get ACTION(){return _e}set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=_e.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Io.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new rt.Vector3,this._focalOffsetVelocity=new rt.Vector3,this._zoomVelocity={value:0},this._truckInternal=(x,P,I,R)=>{let D,G;if(fa(this._camera)){const U=ht.copy(this._camera.position).sub(this._target),H=this._camera.getEffectiveFOV()*Sc,k=U.length()*Math.tan(H*.5);D=this.truckSpeed*x*k/this._elementRect.height,G=this.truckSpeed*P*k/this._elementRect.height}else if(Cr(this._camera)){const U=this._camera;D=this.truckSpeed*x*(U.right-U.left)/U.zoom/this._elementRect.width,G=this.truckSpeed*P*(U.top-U.bottom)/U.zoom/this._elementRect.height}else return;R?(I?this.setFocalOffset(this._focalOffsetEnd.x+D,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(D,0,!0),this.forward(-G,!0)):I?this.setFocalOffset(this._focalOffsetEnd.x+D,this._focalOffsetEnd.y+G,this._focalOffsetEnd.z,!0):this.truck(D,G,!0)},this._rotateInternal=(x,P)=>{const I=xr*this.azimuthRotateSpeed*x/this._elementRect.height,R=xr*this.polarRotateSpeed*P/this._elementRect.height;this.rotate(I,R,!0)},this._dollyInternal=(x,P,I)=>{const R=Math.pow(.95,-x*this.dollySpeed),D=this._sphericalEnd.radius,G=this._sphericalEnd.radius*R,U=ss(G,this.minDistance,this.maxDistance),H=U-G;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(G,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(H,!0),this._dollyToNoClamp(U,!0)):this._dollyToNoClamp(U,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?G:U)-D,this._dollyControlCoord.set(P,I)),this._lastDollyDirection=Math.sign(-x)},this._zoomInternal=(x,P,I)=>{const R=Math.pow(.95,x*this.dollySpeed),D=this._zoom,G=this._zoom*R;this.zoomTo(G,!0),this.dollyToCursor&&(this._changedZoom+=G-D,this._dollyControlCoord.set(P,I))},typeof rt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new rt.Quaternion().setFromUnitVectors(this._camera.up,Wu),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=_e.NONE,this._target=new rt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new rt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new rt.Spherical().setFromVector3(ht.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new rt.Vector3,new rt.Vector3,new rt.Vector3,new rt.Vector3],this._updateNearPlaneCorners(),this._boundary=new rt.Box3(new rt.Vector3(-1/0,-1/0,-1/0),new rt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new rt.Vector2,this.mouseButtons={left:_e.ROTATE,middle:_e.DOLLY,right:_e.TRUCK,wheel:fa(this._camera)?_e.DOLLY:Cr(this._camera)?_e.ZOOM:_e.NONE},this.touches={one:_e.TOUCH_ROTATE,two:fa(this._camera)?_e.TOUCH_DOLLY_TRUCK:Cr(this._camera)?_e.TOUCH_ZOOM_TRUCK:_e.NONE,three:_e.TOUCH_TRUCK};const i=new rt.Vector2,a=new rt.Vector2,l=new rt.Vector2,h=x=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const R=this._domElement.getBoundingClientRect(),D=x.clientX/R.width,G=x.clientY/R.height;if(D<this._interactiveArea.left||D>this._interactiveArea.right||G<this._interactiveArea.top||G>this._interactiveArea.bottom)return}const P=x.pointerType!=="mouse"?null:(x.buttons&ni.LEFT)===ni.LEFT?ni.LEFT:(x.buttons&ni.MIDDLE)===ni.MIDDLE?ni.MIDDLE:(x.buttons&ni.RIGHT)===ni.RIGHT?ni.RIGHT:null;if(P!==null){const R=this._findPointerByMouseButton(P);R&&this._disposePointer(R)}if((x.buttons&ni.LEFT)===ni.LEFT&&this._lockedPointer)return;const I={pointerId:x.pointerId,clientX:x.clientX,clientY:x.clientY,deltaX:0,deltaY:0,mouseButton:P};this._activePointers.push(I),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.addEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),this._isDragging=!0,y(x)},d=x=>{x.cancelable&&x.preventDefault();const P=x.pointerId,I=this._lockedPointer||this._findPointerById(P);if(I){if(I.clientX=x.clientX,I.clientY=x.clientY,I.deltaX=x.movementX,I.deltaY=x.movementY,this._state=0,x.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(x.buttons&ni.LEFT)===ni.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(x.buttons&ni.MIDDLE)===ni.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(x.buttons&ni.RIGHT)===ni.RIGHT&&(this._state=this._state|this.mouseButtons.right);w()}},p=x=>{const P=this._findPointerById(x.pointerId);if(!(P&&P===this._lockedPointer)){if(P&&this._disposePointer(P),x.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=_e.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=_e.NONE;E()}};let m=-1;const A=x=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===_e.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const G=this._domElement.getBoundingClientRect(),U=x.clientX/G.width,H=x.clientY/G.height;if(U<this._interactiveArea.left||U>this._interactiveArea.right||H<this._interactiveArea.top||H>this._interactiveArea.bottom)return}if(x.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===_e.ROTATE||this.mouseButtons.wheel===_e.TRUCK){const G=performance.now();m-G<1e3&&this._getClientRect(this._elementRect),m=G}const P=aF?-1:-3,I=x.deltaMode===1||x.ctrlKey?x.deltaY/P:x.deltaY/(P*10),R=this.dollyToCursor?(x.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,D=this.dollyToCursor?(x.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case _e.ROTATE:{this._rotateInternal(x.deltaX,x.deltaY),this._isUserControllingRotate=!0;break}case _e.TRUCK:{this._truckInternal(x.deltaX,x.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case _e.SCREEN_PAN:{this._truckInternal(x.deltaX,x.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case _e.OFFSET:{this._truckInternal(x.deltaX,x.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case _e.DOLLY:{this._dollyInternal(-I,R,D),this._isUserControllingDolly=!0;break}case _e.ZOOM:{this._zoomInternal(-I,R,D),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},_=x=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Ua.ACTION.NONE){const P=x instanceof PointerEvent?x.pointerId:0,I=this._findPointerById(P);I&&this._disposePointer(I),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p);return}x.preventDefault()}},y=x=>{if(!this._enabled)return;if(wm(this._activePointers,_n),this._getClientRect(this._elementRect),i.copy(_n),a.copy(_n),this._activePointers.length>=2){const I=_n.x-this._activePointers[1].clientX,R=_n.y-this._activePointers[1].clientY,D=Math.sqrt(I*I+R*R);l.set(0,D);const G=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,U=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;a.set(G,U)}if(this._state=0,!x)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in x&&x.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(x.buttons&ni.LEFT)===ni.LEFT&&(this._state=this._state|this.mouseButtons.left),(x.buttons&ni.MIDDLE)===ni.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(x.buttons&ni.RIGHT)===ni.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&_e.ZOOM)===_e.ZOOM||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},w=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,wm(this._activePointers,_n);const P=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,I=P?-P.deltaX:a.x-_n.x,R=P?-P.deltaY:a.y-_n.y;if(a.copy(_n),((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(I,R),this._isUserControllingRotate=!0),(this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.ZOOM)===_e.ZOOM){const D=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,G=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,U=this.dollyDragInverted?-1:1;(this._state&_e.DOLLY)===_e.DOLLY?(this._dollyInternal(U*R*ju,D,G),this._isUserControllingDolly=!0):(this._zoomInternal(U*R*ju,D,G),this._isUserControllingZoom=!0)}if((this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE){const D=_n.x-this._activePointers[1].clientX,G=_n.y-this._activePointers[1].clientY,U=Math.sqrt(D*D+G*G),H=l.y-U;l.set(0,U);const k=this.dollyToCursor?(a.x-this._elementRect.x)/this._elementRect.width*2-1:0,$=this.dollyToCursor?(a.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET?(this._dollyInternal(H*ju,k,$),this._isUserControllingDolly=!0):(this._zoomInternal(H*ju,k,$),this._isUserControllingZoom=!0)}((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(I,R,!1,!1),this._isUserControllingTruck=!0),((this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(I,R,!1,!0),this._isUserControllingTruck=!0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(I,R,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},E=()=>{wm(this._activePointers,_n),a.copy(_n),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",C),this._domElement.ownerDocument.addEventListener("pointerlockerror",T),this._domElement.ownerDocument.addEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),y())},this.unlockPointer=()=>{var x,P,I;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(x=this._domElement)===null||x===void 0||x.ownerDocument.exitPointerLock(),(P=this._domElement)===null||P===void 0||P.ownerDocument.removeEventListener("pointerlockchange",C),(I=this._domElement)===null||I===void 0||I.ownerDocument.removeEventListener("pointerlockerror",T),this.cancel()};const C=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},T=()=>{this.unlockPointer()};this._addAllEventListeners=x=>{this._domElement=x,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",h),this._domElement.addEventListener("pointercancel",p),this._domElement.addEventListener("wheel",A,{passive:!1}),this._domElement.addEventListener("contextmenu",_)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",h),this._domElement.removeEventListener("pointercancel",p),this._domElement.removeEventListener("wheel",A,{passive:!1}),this._domElement.removeEventListener("contextmenu",_),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))},this.cancel=()=>{this._state!==_e.NONE&&(this._state=_e.NONE,this._activePointers.length=0,E())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ss(e.width,0,1),this._interactiveArea.height=ss(e.height,0,1),this._interactiveArea.x=ss(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ss(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const a=ss(e,this.minAzimuthAngle,this.maxAzimuthAngle),l=ss(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=a,this._sphericalEnd.phi=l,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const h=!i||kt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&kt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(h)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0,this._dollyToNoClamp(ss(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const h=this._collisionTest(),d=kt(h,this._spherical.radius);if(!(i>e)&&d)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,h)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const l=!t||kt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(l)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Mc).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||kt(this._target.x,this._targetEnd.x,this.restThreshold)&&kt(this._target.y,this._targetEnd.y,this.restThreshold)&&kt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ss(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||kt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),As.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),As.multiplyScalar(e),_s.multiplyScalar(-t);const a=ht.copy(As).add(_s),l=Rt.copy(this._targetEnd).add(a);return this.moveTo(l.x,l.y,l.z,i)}forward(e,t=!1){ht.setFromMatrixColumn(this._camera.matrix,0),ht.crossVectors(this._camera.up,ht),ht.multiplyScalar(e);const i=Rt.copy(this._targetEnd).add(ht);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return ht.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ht.x,this._targetEnd.y+ht.y,this._targetEnd.z+ht.z,t)}moveTo(e,t,i,a=!1){this._isUserControllingTruck=!1;const l=ht.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,l,this.boundaryFriction),this._needsUpdate=!0,a||this._target.copy(this._targetEnd);const h=!a||kt(this._target.x,this._targetEnd.x,this.restThreshold)&&kt(this._target.y,this._targetEnd.y,this.restThreshold)&&kt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(h)}lookInDirectionOf(e,t,i,a=!1){const d=ht.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(d.x,d.y,d.z,a)}fitToBox(e,t,{cover:i=!1,paddingLeft:a=0,paddingRight:l=0,paddingBottom:h=0,paddingTop:d=0}={}){const p=[],m=e.isBox3?Po.copy(e):Po.setFromObject(e);m.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const A=Rv(this._sphericalEnd.theta,Iv),_=Rv(this._sphericalEnd.phi,Iv);p.push(this.rotateTo(A,_,t));const y=ht.setFromSpherical(this._sphericalEnd).normalize(),w=Ov.setFromUnitVectors(y,Sm),E=kt(Math.abs(y.y),1);E&&w.multiply(Tm.setFromAxisAngle(Wu,A)),w.multiply(this._yAxisUpSpaceInverse);const C=Nv.makeEmpty();Rt.copy(m.min).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setX(m.max.x).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setY(m.max.y).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setZ(m.min.z).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setZ(m.max.z).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setY(m.min.y).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setX(m.min.x).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).applyQuaternion(w),C.expandByPoint(Rt),C.min.x-=a,C.min.y-=h,C.max.x+=l,C.max.y+=d,w.setFromUnitVectors(Sm,y),E&&w.premultiply(Tm.invert()),w.premultiply(this._yAxisUpSpace);const T=C.getSize(ht),x=C.getCenter(Rt).applyQuaternion(w);if(fa(this._camera)){const P=this.getDistanceToFitBox(T.x,T.y,T.z,i);p.push(this.moveTo(x.x,x.y,x.z,t)),p.push(this.dollyTo(P,t)),p.push(this.setFocalOffset(0,0,0,t))}else if(Cr(this._camera)){const P=this._camera,I=P.right-P.left,R=P.top-P.bottom,D=i?Math.max(I/T.x,R/T.y):Math.min(I/T.x,R/T.y);p.push(this.moveTo(x.x,x.y,x.z,t)),p.push(this.zoomTo(D,t)),p.push(this.setFocalOffset(0,0,0,t))}return Promise.all(p)}fitToSphere(e,t){const i=[],l="isObject3D"in e?Ua.createBoundingSphere(e,Cm):Cm.copy(e);if(i.push(this.moveTo(l.center.x,l.center.y,l.center.z,t)),fa(this._camera)){const h=this.getDistanceToFitSphere(l.radius);i.push(this.dollyTo(h,t))}else if(Cr(this._camera)){const h=this._camera.right-this._camera.left,d=this._camera.top-this._camera.bottom,p=2*l.radius,m=Math.min(h/p,d/p);i.push(this.zoomTo(m,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,a,l,h,d=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0;const p=Rt.set(a,l,h),m=ht.set(e,t,i);this._targetEnd.copy(p),this._sphericalEnd.setFromVector3(m.sub(p).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,d||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!d||kt(this._target.x,this._targetEnd.x,this.restThreshold)&&kt(this._target.y,this._targetEnd.y,this.restThreshold)&&kt(this._target.z,this._targetEnd.z,this.restThreshold)&&kt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&kt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&kt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}lerp(e,t,i,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0;const l=ht.set(...e.target);if("spherical"in e)Cn.set(...e.spherical);else{const _=Rt.set(...e.position);Cn.setFromVector3(_.sub(l).applyQuaternion(this._yAxisUpSpace))}const h=Ro.set(...t.target);if("spherical"in t)Bo.set(...t.spherical);else{const _=Rt.set(...t.position);Bo.setFromVector3(_.sub(h).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(l.lerp(h,i));const d=Bo.theta-Cn.theta,p=Bo.phi-Cn.phi,m=Bo.radius-Cn.radius;this._sphericalEnd.set(Cn.radius+m*i,Cn.phi+p*i,Cn.theta+d*i),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!a||kt(this._target.x,this._targetEnd.x,this.restThreshold)&&kt(this._target.y,this._targetEnd.y,this.restThreshold)&&kt(this._target.z,this._targetEnd.z,this.restThreshold)&&kt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&kt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&kt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}lerpLookAt(e,t,i,a,l,h,d,p,m,A,_,y,w,E=!1){return this.lerp({position:[e,t,i],target:[a,l,h]},{position:[d,p,m],target:[A,_,y]},w,E)}setPosition(e,t,i,a=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,a)}setTarget(e,t,i,a=!1){const l=this.getPosition(ht),h=this.setLookAt(l.x,l.y,l.z,e,t,i,a);return this._sphericalEnd.phi=ss(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),h}setFocalOffset(e,t,i,a=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,a||this._focalOffset.copy(this._focalOffsetEnd);const l=!a||kt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&kt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&kt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(l)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),As.setFromMatrixColumn(this._camera.matrixWorldInverse,0),_s.setFromMatrixColumn(this._camera.matrixWorldInverse,1),pa.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const a=ht.set(e,t,i),l=a.distanceTo(this._camera.position),h=a.sub(this._camera.position);As.multiplyScalar(h.x),_s.multiplyScalar(h.y),pa.multiplyScalar(h.z),ht.copy(As).add(_s).add(pa),ht.z=ht.z+l,this.dollyTo(l,!1),this.setFocalOffset(-ht.x,ht.y,-ht.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,a){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new rt.Vector4,typeof e=="number"?this._viewport.set(e,t,i,a):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,a=!1){if(Em(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const l=e/t,h=this._camera.getEffectiveFOV()*Sc,d=this._camera.aspect;return((a?l>d:l<d)?t:e/d)*.5/Math.tan(h*.5)+i*.5}getDistanceToFitSphere(e){if(Em(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Sc,i=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,a=1<this._camera.aspect?t:i;return e/Math.sin(a*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new rt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%xr+xr)%xr,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=xr),this._spherical.theta+=xr*Math.round((this._sphericalEnd.theta-this._spherical.theta)/xr),this}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!kt(this._camera.up.x,this._cameraUp0.x)||!kt(this._camera.up.y,this._cameraUp0.y)||!kt(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const i=this.getPosition(ht);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Wu),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ht.subVectors(this._target,this._camera.position).normalize(),t=Rt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(ht);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,i=this._sphericalEnd.phi-this._spherical.phi,a=this._sphericalEnd.radius-this._spherical.radius,l=Lv.subVectors(this._targetEnd,this._target),h=Dv.subVectors(this._focalOffsetEnd,this._focalOffset),d=this._zoomEnd-this._zoom;if(Qt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const _=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=qu(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,_,1/0,e),this._needsUpdate=!0}if(Qt(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const _=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=qu(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,_,1/0,e),this._needsUpdate=!0}if(Qt(a))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const _=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=qu(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,_,this.maxSpeed,e),this._needsUpdate=!0}if(Qt(l.x)&&Qt(l.y)&&Qt(l.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const _=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Bv(this._target,this._targetEnd,this._targetVelocity,_,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Qt(h.x)&&Qt(h.y)&&Qt(h.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const _=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Bv(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,_,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Qt(d))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const _=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=qu(this._zoom,this._zoomEnd,this._zoomVelocity,_,1/0,e)}if(this.dollyToCursor){if(fa(this._camera)&&this._changedDolly!==0){const _=this._spherical.radius-this._lastDistance,y=this._camera,w=this._getCameraDirection(Mc),E=ht.copy(w).cross(y.up).normalize();E.lengthSq()===0&&(E.x=1);const C=Rt.crossVectors(E,w),T=this._sphericalEnd.radius*Math.tan(y.getEffectiveFOV()*Sc*.5),P=(this._sphericalEnd.radius-_-this._sphericalEnd.radius)/this._sphericalEnd.radius,I=Ro.copy(this._targetEnd).add(E.multiplyScalar(this._dollyControlCoord.x*T*y.aspect)).add(C.multiplyScalar(this._dollyControlCoord.y*T)),R=ht.copy(this._targetEnd).lerp(I,P),D=this._lastDollyDirection===Io.IN&&this._spherical.radius<=this.minDistance,G=this._lastDollyDirection===Io.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(D||G)){this._sphericalEnd.radius-=_,this._spherical.radius-=_;const H=Rt.copy(w).multiplyScalar(-_);R.add(H)}this._boundary.clampPoint(R,R);const U=Rt.subVectors(R,this._targetEnd);this._targetEnd.copy(R),this._target.add(U),this._changedDolly-=_,Qt(this._changedDolly)&&(this._changedDolly=0)}else if(Cr(this._camera)&&this._changedZoom!==0){const _=this._zoom-this._lastZoom,y=this._camera,w=ht.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(y.near+y.far)/(y.near-y.far)).unproject(y),E=Rt.set(0,0,-1).applyQuaternion(y.quaternion),C=Ro.copy(w).add(E.multiplyScalar(-w.dot(y.up))),x=-(this._zoom-_-this._zoom)/this._zoom,P=this._getCameraDirection(Mc),I=this._targetEnd.dot(P),R=ht.copy(this._targetEnd).lerp(C,x),D=R.dot(P),G=P.multiplyScalar(D-I);R.sub(G),this._boundary.clampPoint(R,R);const U=Rt.subVectors(R,this._targetEnd);this._targetEnd.copy(R),this._target.add(U),this._changedZoom-=_,Qt(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const p=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,p),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Qt(this._focalOffset.x)||!Qt(this._focalOffset.y)||!Qt(this._focalOffset.z))&&(As.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),pa.setFromMatrixColumn(this._camera.matrix,2),As.multiplyScalar(this._focalOffset.x),_s.multiplyScalar(-this._focalOffset.y),pa.multiplyScalar(this._focalOffset.z),ht.copy(As).add(_s).add(pa),this._camera.position.add(ht),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ht.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const A=this._needsUpdate;return A&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):A?(this.dispatchEvent({type:"update"}),Qt(t,this.restThreshold)&&Qt(i,this.restThreshold)&&Qt(a,this.restThreshold)&&Qt(l.x,this.restThreshold)&&Qt(l.y,this.restThreshold)&&Qt(l.z,this.restThreshold)&&Qt(h.x,this.restThreshold)&&Qt(h.y,this.restThreshold)&&Qt(h.z,this.restThreshold)&&Qt(d,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!A&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=A,this._needsUpdate=!1,A}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Cc(this.maxDistance),minZoom:this.minZoom,maxZoom:Cc(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Cc(this.maxPolarAngle),minAzimuthAngle:Cc(this.minAzimuthAngle),maxAzimuthAngle:Cc(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:ht.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const i=JSON.parse(e);this.enabled=i.enabled,this.minDistance=i.minDistance,this.maxDistance=Tc(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=Tc(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=Tc(i.maxPolarAngle),this.minAzimuthAngle=Tc(i.minAzimuthAngle),this.maxAzimuthAngle=Tc(i.maxAzimuthAngle),this.smoothTime=i.smoothTime,this.draggingSmoothTime=i.draggingSmoothTime,this.dollySpeed=i.dollySpeed,this.truckSpeed=i.truckSpeed,this.dollyToCursor=i.dollyToCursor,this._target0.fromArray(i.target0),this._position0.fromArray(i.position0),this._zoom0=i.zoom0,this._focalOffset0.fromArray(i.focalOffset0),this.moveTo(i.target[0],i.target[1],i.target[2],t),Cn.setFromVector3(ht.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Cn.theta,Cn.phi,t),this.dollyTo(Cn.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",rF),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const a=t.lengthSq();if(a===0)return e;const l=Rt.copy(t).add(e),d=this._boundary.clampPoint(l,Ro).sub(l),p=d.lengthSq();if(p===0)return e.add(t);if(p===a)return e;if(i===0)return e.add(t).add(d);{const m=1+i*p/t.dot(d);return e.add(Rt.copy(t).multiplyScalar(m)).add(d.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(fa(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*Sc,a=Math.tan(i*.5)*t,l=a*e.aspect;this._nearPlaneCorners[0].set(-l,-a,0),this._nearPlaneCorners[1].set(l,-a,0),this._nearPlaneCorners[2].set(l,a,0),this._nearPlaneCorners[3].set(-l,a,0)}else if(Cr(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,a=e.right*t,l=e.top*t,h=e.bottom*t;this._nearPlaneCorners[0].set(i,l,0),this._nearPlaneCorners[1].set(a,l,0),this._nearPlaneCorners[2].set(a,h,0),this._nearPlaneCorners[3].set(i,h,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Em(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(Mc);Mm.lookAt(Pv,i,this._camera.up);for(let a=0;a<4;a++){const l=Rt.copy(this._nearPlaneCorners[a]);l.applyMatrix4(Mm);const h=Ro.addVectors(this._target,l);Yu.set(h,i),Yu.far=this._spherical.radius+1;const d=Yu.intersectObjects(this.colliderMeshes);d.length!==0&&d[0].distance<e&&(e=d[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new rt.Sphere){const i=t,a=i.center;Po.makeEmpty(),e.traverseVisible(h=>{h.isMesh&&Po.expandByObject(h)}),Po.getCenter(a);let l=0;return e.traverseVisible(h=>{if(!h.isMesh)return;const d=h;if(!d.geometry)return;const p=d.geometry.clone();p.applyMatrix4(d.matrixWorld);const A=p.attributes.position;for(let _=0,y=A.count;_<y;_++)ht.fromBufferAttribute(A,_),l=Math.max(l,a.distanceToSquared(ht))}),i.radius=Math.sqrt(l),i}}class kv{constructor(e){this.__position=new se,this.__target=new se,this.setPosition(e.position.x,e.position.y,e.position.z),this.setTarget(e.target.x,e.target.y,e.target.z)}getPosition(){return this.__position}setPosition(e,t,i){this.__position.setX(e),this.__position.setY(t),this.__position.setZ(i)}getTarget(){return this.__target}setTarget(e,t,i){this.__target.setX(e),this.__target.setY(t),this.__target.setZ(i)}}class oF extends v1{constructor({appWcRef:e}){super({appWcRef:e}),this._loggerContext="CAMERA MANAGER",this.__cameras={},this.__mainRenderer={},this.__mainCameraControls={},this.__screenshotCameraControls={},this.__cameraDirection=new se,this.__cameraSpherical=new ul,this.__savedCameraState={position:new se,target:new se,focalLength:0}}get cameraActions(){return Ua.ACTION}getCameras(){return this.__cameras}get mainCameraControls(){return this.__mainCameraControls}get screenshotCameraControls(){return this.__screenshotCameraControls}getCurrentCameraTransforms(){const e=new se;this.__cameras.main.getWorldPosition(e);const t=new se;return this.__mainCameraControls.getTarget(t),{position:e,target:t,focalLength:this.__cameras.main.getFocalLength()}}getCurrentCameraRotation(){return{azimuthAngle:this.__mainCameraControls.azimuthAngle,polarAngle:this.__mainCameraControls.polarAngle,distance:this.__mainCameraControls.distance}}getCameraFocalLength(){return this.__cameras.main.getFocalLength()}setCameraFocalLength(e){this.__cameras.main.setFocalLength(e)}async fitCameraToSceneBounds(e=!0){const t=this._appWcRef.getSceneSphericalBoundsForCameraFocus();return await this.fitCameraToObject({objectToFocus:t,enableTransition:e})}__onMainCameraControlsControlStart(e){const t=this.__mainCameraControls,i=t.currentAction===t.mouseButtons?.right||t.currentAction===t.touches?.two;e.canPan&&i?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"pan"}):t.currentAction===t.mouseButtons?.left?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"rotate"}):this._appWcRef.eventsManager.cameraControlsStart.fire({type:null})}__onMainCameraControlsControlEnd(){this._appWcRef.eventsManager.inputEnd.fire()}saveCurrentCameraTransforms(){this.__mainCameraControls.getPosition(this.__savedCameraState.position),this.__mainCameraControls.getTarget(this.__savedCameraState.target),this.__savedCameraState.focalLength=this.getCameraFocalLength()}resetCurrentCameraTransformsToLastSavedState(e=!0){this.moveCameraToLocation({newCameraTransforms:this.__savedCameraState,transition:e})}setCameraZoomLimits({minDistance:e,maxDistance:t,skipCameraFit:i=!1}){const a=this._appWcRef.getSceneSphericalBoundsForCameraFocus().radius,l=a<=0?1:a;e&&(this.__mainCameraControls.minDistance=l*e),t&&(this.__mainCameraControls.maxDistance=l*t),i||this.fitCameraToSceneBounds()}enableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.ROTATE,this.__mainCameraControls.touches.one=this.cameraActions.TOUCH_ROTATE}disableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.NONE,this.__mainCameraControls.touches.one=this.cameraActions.NONE}enablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY_TRUCK,this.__mainCameraControls.mouseButtons.right=this.cameraActions.TRUCK}disablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.right=this.cameraActions.NONE}enableZoomControls(){this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.DOLLY}disableZoomControls(){this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.NONE,this.__mainCameraControls.touches.two=this.cameraActions.NONE}enableCameraZoomLimits(e,t=!1){this.setCameraZoomLimits({minDistance:e.minDistance??.5,maxDistance:e.maxDistance??5,skipCameraFit:t})}disableCameraZoomLimits(){this.setCameraZoomLimits({minDistance:-1/0,maxDistance:1/0})}enableCameraRotationLimits(e){this.__mainCameraControls.minPolarAngle=e.minPolarAngle??-1/0,this.__mainCameraControls.maxPolarAngle=e.maxPolarAngle??1/0,this.__mainCameraControls.minAzimuthAngle=e.minAzimuthAngle??-1/0,this.__mainCameraControls.maxAzimuthAngle=e.maxAzimuthAngle??1/0}disableCameraRotationLimits(){this.__mainCameraControls.minPolarAngle=-1/0,this.__mainCameraControls.maxPolarAngle=1/0,this.__mainCameraControls.minAzimuthAngle=-1/0,this.__mainCameraControls.maxAzimuthAngle=1/0}updateCameraSettings(e){this.enableRotationControls();const{canPan:t,canZoom:i}=e;i?this.enableZoomControls():this.disableZoomControls(),t?this.enablePanControls():this.disablePanControls(),this.__mainCameraControls.mouseButtons.middle=this.cameraActions.NONE,this.__mainCameraControls.enabled=!0,this.__cameras.main.setFocalLength(e.focalLength),this.__cameras.main.near=e.nearClip,this.__cameras.main.far=e.farClip,this.enableCameraZoomLimits(e),this.enableCameraRotationLimits(e),this._appWcRef.transparentBackground===!1&&(this.__mainRenderer.setClearColor(e.backgroundColor),this.__mainRenderer.setClearAlpha(e.backgroundAlpha))}normalizeAngle(e){const t=Math.PI*2;return Ms.euclideanModulo(e,t)}absoluteAngle(e,t){const i=Math.PI*2,a=e-t;return Ms.euclideanModulo(a+Math.PI,i)-Math.PI}async moveCameraToLocation({newCameraTransforms:e,freezeCamera:t=!1,transition:i=!0,targetCameraControlsRef:a=this.__mainCameraControls}){e instanceof kv||(e=new kv(e));const l=e.getPosition(),h=e.getTarget();a.enabled=!1,this.__cameraDirection.set(0,0,0),this.__cameraDirection.subVectors(l,h),this.__cameraDirection.normalize();const d=l.distanceTo(h);this.__cameraSpherical.setFromVector3(this.__cameraDirection);const p=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.theta),this.normalizeAngle(a.azimuthAngle)),m=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.phi),this.normalizeAngle(a.polarAngle));a.rotate(p,m,i),a.moveTo(h.x,h.y,h.z,i),a.dollyTo(d,i),t||(a.enabled=!0)}async rotateCameraToLocation({azimuthAngle:e,polarAngle:t,distance:i,transition:a=!0,targetCameraControlsRef:l=this.__mainCameraControls}){e&&l.rotateAzimuthTo(e,a),t&&l.rotatePolarTo(t,a),i&&l.dollyTo(i,a)}async fitCameraToObject({objectToFocus:e,enableTransition:t=!0}){return await this.__mainCameraControls.fitToSphere(e,t)}async wiggleCamera(){const e=this.__mainCameraControls.azimuthAngle,t=[0,.4,-.3,0];for(const i of t){if(!this._appWcRef.playInteractionPrompt)break;await this.__mainCameraControls.rotateAzimuthTo(e+i,!0)}}async setup({mainRenderer:e,screenshotRenderer:t,cameraSettings:i}){this.__mainRenderer=e,this.__cameras={main:new yi(75,window.innerWidth/window.innerHeight,.1,1e3),screenshot:new yi(75,window.innerWidth/window.innerHeight,.1,1e3)},this.__cameras.main.name="MainCamera",this.__cameras.screenshot.name="ScreenshotCamera",this.__cameras.main.position.setZ(100);const a={Vector2:He,Vector3:se,Vector4:Bt,Quaternion:zi,Matrix4:tt,Spherical:ul,Box3:vi,Sphere:vn,Raycaster:o_};Ua.install({THREE:a}),this.__mainCameraControls=new Ua(this.__cameras.main,e.domElement),this.__screenshotCameraControls=new Ua(this.__cameras.screenshot,t.domElement),await this.updateCameraSettings(i),this.__mainCameraControls.addEventListener("controlstart",()=>{this.__onMainCameraControlsControlStart(i)}),this.__mainCameraControls.addEventListener("controlend",()=>{this.__onMainCameraControlsControlEnd()}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraMoveToTransform.name,(l=>{l.detail.saveFirst&&this.saveCurrentCameraTransforms(),this.moveCameraToLocation({newCameraTransforms:l.detail.cameraTransforms})})),this._appWcRef.addEventListener(this._appWcRef.eventsManager.hotspotsVisibilityChanged.name,(l=>{const h=this.mainCameraControls,d=l.detail.visible?h.maxDistance+.3:h.maxDistance-.3;h.maxDistance=d}))}}const lF='@font-face{font-family:Helvetica Neue;src:url(https://asset.myepigraph.com/design-assets/fonts/HelveticaNeue/HelveticaNeue-Light.otf) format("opentype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:PPMori-Regular;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Regular.woff2) format("woff2");font-display:swap}@font-face{font-family:PPMori-Bold;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Bold.woff2) format("woff2");font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter-VariableFont_slnt_wght.ttf) format("truetype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter_18pt-Bold.ttf) format("truetype");font-weight:700;font-style:normal;font-display:swap}',cF={Color:{Black:{25:{$type:"color",$value:"rgba(0, 0, 0, 0.0000)"},50:{$type:"color",$value:"rgba(0, 0, 0, 0.0500)"},100:{$type:"color",$value:"rgba(0, 0, 0, 0.1000)"},200:{$type:"color",$value:"rgba(0, 0, 0, 0.2000)"},300:{$type:"color",$value:"rgba(0, 0, 0, 0.3000)"},400:{$type:"color",$value:"rgba(0, 0, 0, 0.4000)"},500:{$type:"color",$value:"rgba(0, 0, 0, 0.5000)"},600:{$type:"color",$value:"rgba(0, 0, 0, 0.6000)"},700:{$type:"color",$value:"rgba(0, 0, 0, 0.7000)"},800:{$type:"color",$value:"rgba(0, 0, 0, 0.8000)"},900:{$type:"color",$value:"rgba(0, 0, 0, 0.9000)"},1e3:{$type:"color",$value:"#000000"}},White:{25:{$type:"color",$value:"rgba(255, 255, 255, 0.0250)"},50:{$type:"color",$value:"rgba(255, 255, 255, 0.0500)"},100:{$type:"color",$value:"rgba(255, 255, 255, 0.1000)"},200:{$type:"color",$value:"rgba(255, 255, 255, 0.2000)"},300:{$type:"color",$value:"rgba(255, 255, 255, 0.3000)"},400:{$type:"color",$value:"rgba(255, 255, 255, 0.4000)"},500:{$type:"color",$value:"rgba(255, 255, 255, 0.5000)"},600:{$type:"color",$value:"rgba(255, 255, 255, 0.6000)"},700:{$type:"color",$value:"rgba(255, 255, 255, 0.7000)"},800:{$type:"color",$value:"rgba(255, 255, 255, 0.8000)"},900:{$type:"color",$value:"rgba(255, 255, 255, 0.9000)"},1e3:{$type:"color",$value:"#ffffff"}},Green:{100:{$type:"color",$value:"#ebffee"},200:{$type:"color",$value:"#cff7d3"},300:{$type:"color",$value:"#aff4c6"},400:{$type:"color",$value:"#85e0a3"},500:{$type:"color",$value:"#14ae5c"},600:{$type:"color",$value:"#009951"},700:{$type:"color",$value:"#008043"},800:{$type:"color",$value:"#02542d"},900:{$type:"color",$value:"#024023"},1e3:{$type:"color",$value:"#062d1b"}},Red:{100:{$type:"color",$value:"#fee9e7"},200:{$type:"color",$value:"#fdd3d0"},300:{$type:"color",$value:"#fcb3ad"},400:{$type:"color",$value:"#f4776a"},500:{$type:"color",$value:"#ec221f"},600:{$type:"color",$value:"#c00f0c"},700:{$type:"color",$value:"#900b09"},800:{$type:"color",$value:"#690807"},900:{$type:"color",$value:"#4d0b0a"},1e3:{$type:"color",$value:"#300603"}},Yellow:{100:{$type:"color",$value:"#fffbeb"},200:{$type:"color",$value:"#fff1c2"},300:{$type:"color",$value:"#ffe8a3"},400:{$type:"color",$value:"#e8b931"},500:{$type:"color",$value:"#e5a000"},600:{$type:"color",$value:"#bf6a02"},700:{$type:"color",$value:"#975102"},800:{$type:"color",$value:"#682d03"},900:{$type:"color",$value:"#522504"},1e3:{$type:"color",$value:"#401b01"}},Blue:{100:{$type:"color",$value:"#fbfdff"},200:{$type:"color",$value:"#eaf4ff"},300:{$type:"color",$value:"#d5ebff"},400:{$type:"color",$value:"#c0e1ff"},500:{$type:"color",$value:"#91d0ff"},600:{$type:"color",$value:"#0094d5"},700:{$type:"color",$value:"#00679b"},800:{$type:"color",$value:"#003a5a"},900:{$type:"color",$value:"#003a5a"},1e3:{$type:"color",$value:"#002133"}},Slate:{100:{$type:"color",$value:"#f5f5f5"},200:{$type:"color",$value:"#e3e3e3"},300:{$type:"color",$value:"#cdcdcd"},400:{$type:"color",$value:"#b2b2b2"},500:{$type:"color",$value:"#949494"},600:{$type:"color",$value:"#767676"},700:{$type:"color",$value:"#5a5a5a"},800:{$type:"color",$value:"#434343"},900:{$type:"color",$value:"#303030"},1e3:{$type:"color",$value:"#242424"}},Grey:{25:{$type:"color",$value:"#f5f5f5"},50:{$type:"color",$value:"#f2f2f2"},100:{$type:"color",$value:"#e6e6e6"},200:{$type:"color",$value:"#cccccc"},300:{$type:"color",$value:"#b3b3b3"},400:{$type:"color",$value:"#999999"},500:{$type:"color",$value:"#7b7b7b"},600:{$type:"color",$value:"#666666"},700:{$type:"color",$value:"#4d4d4d"},800:{$type:"color",$value:"#333333"},900:{$type:"color",$value:"#1a1a1a"},1e3:{$type:"color",$value:"#0d0d0d"}},GreyAlpha:{25:{$type:"color",$value:"rgba(248, 248, 248, 0.8000)"},100:{$type:"color",$value:"rgba(242, 242, 242, 0.8000)"},500:{$type:"color",$value:"rgba(204, 204, 204, 0.2000)"},700:{$type:"color",$value:"rgba(204, 204, 204, 0.6000)"},800:{$type:"color",$value:"rgba(186, 186, 186, 0.6000)"},900:{$type:"color",$value:"rgba(50, 50, 50, 0.9000)"},"05":{$type:"color",$value:"rgba(253, 253, 253, 0.8000)"}}},Unit:{Space:{0:{$type:"number",$value:"0px"},100:{$type:"number",$value:"4px"},150:{$type:"number",$value:"6px"},200:{$type:"number",$value:"8px"},300:{$type:"number",$value:"12px"},400:{$type:"number",$value:"16px"},500:{$type:"number",$value:"20px"},600:{$type:"number",$value:"24px"},800:{$type:"number",$value:"32px"},1e3:{$type:"number",$value:"40px"},1200:{$type:"number",$value:"48px"},1600:{$type:"number",$value:"64px"},2e3:{$type:"number",$value:"80px"},2400:{$type:"number",$value:"96px"},2800:{$type:"number",$value:"112px"},3200:{$type:"number",$value:"128px"},3600:{$type:"number",$value:"144px"},4e3:{$type:"number",$value:"160px"},4400:{$type:"number",$value:"176px"},4800:{$type:"number",$value:"192px"},5200:{$type:"number",$value:"208px"},5600:{$type:"number",$value:"224px"},6e3:{$type:"number",$value:"240px"},6400:{$type:"number",$value:"256px"},7200:{$type:"number",$value:"288px"},8e3:{$type:"number",$value:"320px"},9600:{$type:"number",$value:"384px"},"0125":{$type:"number",$value:"0.5px"},"025":{$type:"number",$value:"1px"},"0325":{$type:"number",$value:"1.5px"},"050":{$type:"number",$value:"2px"}},Stack:{100:{$type:"number",$value:"-4px"},200:{$type:"number",$value:"-8px"},300:{$type:"number",$value:"-12px"},400:{$type:"number",$value:"-16px"},800:{$type:"number",$value:"-32px"},1e3:{$type:"number",$value:"-40px"},1600:{$type:"number",$value:"-64px"},2400:{$type:"number",$value:"-96px"},3200:{$type:"number",$value:"-128px"},4e3:{$type:"number",$value:"-160px"},4800:{$type:"number",$value:"-192px"},5600:{$type:"number",$value:"-224px"},7200:{$type:"number",$value:"-288px"},9600:{$type:"number",$value:"-384px"},"0125":{$type:"number",$value:"-0.5px"},"025":{$type:"number",$value:"-1px"},"0325":{$type:"number",$value:"-1.5px"},"050":{$type:"number",$value:"-2px"},"075":{$type:"number",$value:"-3px"}},Size:{4:{$type:"number",$value:"4px"},6:{$type:"number",$value:"6px"},8:{$type:"number",$value:"8px"},10:{$type:"number",$value:"10px"},12:{$type:"number",$value:"12px"},14:{$type:"number",$value:"14px"},16:{$type:"number",$value:"16px"},18:{$type:"number",$value:"18px"},20:{$type:"number",$value:"20px"},22:{$type:"number",$value:"22px"},24:{$type:"number",$value:"24px"},28:{$type:"number",$value:"28px"},30:{$type:"number",$value:"30px"},32:{$type:"number",$value:"32px"},40:{$type:"number",$value:"40px"},48:{$type:"number",$value:"48px"},64:{$type:"number",$value:"64px"},80:{$type:"number",$value:"80px"},96:{$type:"number",$value:"96px"},112:{$type:"number",$value:"112px"},128:{$type:"number",$value:"128px"},144:{$type:"number",$value:"144px"},160:{$type:"number",$value:"160px"},176:{$type:"number",$value:"176px"},224:{$type:"number",$value:"224px"}},Resolution:{XxsmallScreenMin:{$type:"number",$value:"375px"},XsmallScreenMin:{$type:"number",$value:"480px"},SmallScreenMin:{$type:"number",$value:"576px"},MediumScreenMin:{$type:"number",$value:"768px"},LargeScreenMin:{$type:"number",$value:"992px"},XlargeScreenMin:{$type:"number",$value:"1200px"},XxlargeScreenMin:{$type:"number",$value:"1400px"},XxxsmallScreenMax:{$type:"number",$value:"374px"},XxsmallScreenMax:{$type:"number",$value:"479px"},XsmallScreenMax:{$type:"number",$value:"575px"},SmallScreenMax:{$type:"number",$value:"767px"},MediumScreenMax:{$type:"number",$value:"991px"},LargeScreenMax:{$type:"number",$value:"1199px"},XlargeScreenMax:{$type:"number",$value:"1399px"},XxlargeScreenMax:{$type:"number",$value:"1920px"}}},Font:{Family:{Main:{$type:"string",$value:"PP Mori"},Body:{$type:"string",$value:"Helvetica LT Pro"},Epigraph:{$type:"string",$value:"PP Mori"}}}},S1={Color:{Brand:{Base:{$type:"color",$value:"#335166",$web:"var(--color-brand-base)"},BaseSecondary:{$type:"color",$value:"#2b4354",$web:"var(--color-brand-base-secondary)"},BaseTertiary:{$type:"color",$value:"#202f3a",$web:"var(--color-brand-base-tertiary)"},Accent:{$type:"color",$value:"#4276cf",$web:"var(--color-brand-accent)"},AccentSecondary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-secondary)"},AccentTertiary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-tertiary)"},Light:{$type:"color",$value:"#f8fbf6",$web:"var(--color-brand-light)"},Dark:{$type:"color",$value:"#111b22",$web:"var(--color-brand-dark)"}}},Font:{Brand:{Heading:{$type:"string",$value:"Helvetica Neue",$web:"var(--font-brand-heading)"},Paragraph:{$type:"string",$value:"Inter",$web:"var(--font-brand-body)"}}},Unit:{Brand:{Radius:{$type:"number",$value:"4px",$web:"var(--unit-brand-radius)"}}}},Se={Color:{Surface:{Plain:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.100}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.50}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.25}"},ShadowSecondary:{$value:"{Primitives.Color.Black.200}"}},Fill:{Accent:{$value:"{BrandPrimitives.Color.Brand.Accent}"},AccentHover:{$value:"{BrandPrimitives.Color.Brand.AccentSecondary}"},AccentPress:{$value:"{BrandPrimitives.Color.Brand.AccentTertiary}"},Base:{$value:"{BrandPrimitives.Color.Brand.Base}"},BaseHover:{$value:"{BrandPrimitives.Color.Brand.BaseSecondary}"},BasePress:{$value:"{BrandPrimitives.Color.Brand.BaseTertiary}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.700}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.300}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.100}"},SubtlePrimary:{$value:"{Primitives.Color.GreyAlpha.100}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.25}"},DangerPrimary:{$value:"{Primitives.Color.Red.600}"},Disabled:{$value:"{Primitives.Color.Grey.200}"},HotspotSecondary:{$value:"{Primitives.Color.GreyAlpha.800}"}},Icon:{NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"}},Text:{Invert:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.700}"},Disabled:{$value:"{Primitives.Color.Grey.300}"}},Border:{AltContrast:{$value:"{BrandPrimitives.Color.Brand.Dark}"},SubtlePrimary:{$value:"{Primitives.Color.Grey.300}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.700}"}}},Size:{Text:{Small:{$value:"{Primitives.Unit.Size.16}"},Medium:{$value:"{Primitives.Unit.Size.18}"},Large:{$value:"{Primitives.Unit.Size.20}"}},Icon:{Small:{$value:"{Primitives.Unit.Size.20}"},Medium:{$value:"{Primitives.Unit.Size.24}"},Large:{$value:"{Primitives.Unit.Size.28}"}},Radius:{Medium:{$value:"{Primitives.Unit.Space.150}"},Full:{$value:"{Primitives.Unit.Space.6000}"}},Stroke:{Regular:{$value:"{Primitives.Unit.Space.025}"},Thick:{$value:"{Primitives.Unit.Space.050}"}},Shadow:{None:{$value:"{Primitives.Unit.Space.0}"},Xsmall:{$value:"{Primitives.Unit.Space.025}"},Small:{$value:"{Primitives.Unit.Space.0325}"}},Blur:{Small:{$value:"{Primitives.Unit.Space.100}"}}},Space:{Padding:{Small:{$value:"{Primitives.Unit.Space.300}"},Medium:{$value:"{Primitives.Unit.Space.400}"},Regular:{$value:"{Primitives.Unit.Space.600}"}},Gap:{Small:{$value:"{Primitives.Unit.Space.200}"},Regular:{$value:"{Primitives.Unit.Space.400}"},Xxlarge:{$value:"{Primitives.Unit.Space.800}"}}},Font:{Family:{CustomH:{$value:"{BrandPrimitives.Font.Brand.Heading}"},CustomP:{$value:"{BrandPrimitives.Font.Brand.Paragraph}"},Main:{$value:"Helvetica Neue"}},Tracking:{Normal:{$value:"{Primitives.Unit.Space.0}"}}}};function ye(o){const e=/\{Primitives\.(.*?)}/,t=String(o).match(e),i=/\{BrandPrimitives\.(.*?)}/,a=String(o).match(i);let l=o;if(t){const h=t[1].split(".");l=cF[h[0]][h[1]][h[2]].$value}else if(a){const h=a[1].split("."),d=S1[h[0]][h[1]][h[2]],p=d.$web;l=`${p.substring(0,p.length-1)}, ${d.$value})`}return un(l)}const M_={poweredByEpigraphFooterText:"https://asset.myepigraph.com/design-assets/icons/powered-by-epigraph.svg",splashScreenLogo:"https://asset.myepigraph.com/design-assets/icons/default-splash-screen-image.svg",sampleQrCode:"https://asset.myepigraph.com/design-assets/icons/sample-qr-code.png"};function hF(){const o={};for(const[e,t]of Object.entries(S1))for(const[i,a]of Object.entries(t))for(const[l,h]of Object.entries(a)){const d=`${e}${i}${l}`;o[d]={name:un(h.$web),defaultValue:h.$value,argType:{control:h.$type}}}return o}const uF=hF(),Dl={size:{name:"size",defaultValue:"small",argType:{options:["small","medium","large"],control:"select"}},theme:{name:"theme",defaultValue:"light",argType:{options:["light","dark"],control:"select"}},disabled:{name:"disabled",defaultValue:!1,argType:{control:"boolean"}}};var dF=Object.defineProperty,Xf=(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&&dF(e,t,a),a};const Jh=class C1 extends dl{constructor(){super(),this.epgOnClickEventName="epgonclick",this.disabled=!1,this.theme=Dl.theme.defaultValue.toString(),this.size=Dl.size.defaultValue.toString(),C1.ensureFontsAreLoaded()}static{this.styles=[ct`
4204
+ */const ni={LEFT:1,RIGHT:2,MIDDLE:4},_e=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),Io={NONE:0,IN:1,OUT:-1};function fa(o){return o.isPerspectiveCamera}function Cr(o){return o.isOrthographicCamera}const xr=Math.PI*2,Iv=Math.PI/2,x1=1e-5,Sc=Math.PI/180;function ss(o,e,t){return Math.max(e,Math.min(t,o))}function Qt(o,e=x1){return Math.abs(o)<e}function kt(o,e,t=x1){return Qt(o-e,t)}function Rv(o,e){return Math.round(o/e)*e}function Cc(o){return isFinite(o)?o:o<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Tc(o){return Math.abs(o)<Number.MAX_VALUE?o:o*(1/0)}function qu(o,e,t,i,a=1/0,l){i=Math.max(1e-4,i);const h=2/i,d=h*l,p=1/(1+d+.48*d*d+.235*d*d*d);let m=o-e;const A=e,_=a*i;m=ss(m,-_,_),e=o-m;const y=(t.value+h*m)*l;t.value=(t.value-h*y)*p;let w=e+(m+y)*p;return A-o>0==w>A&&(w=A,t.value=(w-A)/l),w}function Bv(o,e,t,i,a=1/0,l,h){i=Math.max(1e-4,i);const d=2/i,p=d*l,m=1/(1+p+.48*p*p+.235*p*p*p);let A=e.x,_=e.y,y=e.z,w=o.x-A,E=o.y-_,C=o.z-y;const T=A,x=_,P=y,I=a*i,R=I*I,D=w*w+E*E+C*C;if(D>R){const V=Math.sqrt(D);w=w/V*I,E=E/V*I,C=C/V*I}A=o.x-w,_=o.y-E,y=o.z-C;const G=(t.x+d*w)*l,U=(t.y+d*E)*l,H=(t.z+d*C)*l;t.x=(t.x-d*G)*m,t.y=(t.y-d*U)*m,t.z=(t.z-d*H)*m,h.x=A+(w+G)*m,h.y=_+(E+U)*m,h.z=y+(C+H)*m;const k=T-o.x,$=x-o.y,Q=P-o.z,Z=h.x-T,X=h.y-x,s=h.z-P;return k*Z+$*X+Q*s>0&&(h.x=T,h.y=x,h.z=P,t.x=(h.x-T)/l,t.y=(h.y-x)/l,t.z=(h.z-P)/l),h}function wm(o,e){e.set(0,0),o.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=o.length,e.y/=o.length}function Em(o,e){return Cr(o)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class sF{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const a=this._listeners[e];if(a!==void 0){const l=a.indexOf(t);l!==-1&&a.splice(l,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const a=i.slice(0);for(let l=0,h=a.length;l<h;l++)a[l].call(this,e)}}}var xm;const rF="3.1.0",ju=1/8,aF=/Mac/.test((xm=globalThis?.navigator)===null||xm===void 0?void 0:xm.platform);let rt,Pv,Wu,Sm,_n,ht,Rt,Ro,Mc,As,_s,pa,Lv,Dv,Cn,Bo,Po,Nv,Cm,Ov,Tm,Mm,Yu;class Ua extends sF{static install(e){rt=e.THREE,Pv=Object.freeze(new rt.Vector3(0,0,0)),Wu=Object.freeze(new rt.Vector3(0,1,0)),Sm=Object.freeze(new rt.Vector3(0,0,1)),_n=new rt.Vector2,ht=new rt.Vector3,Rt=new rt.Vector3,Ro=new rt.Vector3,Mc=new rt.Vector3,As=new rt.Vector3,_s=new rt.Vector3,pa=new rt.Vector3,Lv=new rt.Vector3,Dv=new rt.Vector3,Cn=new rt.Spherical,Bo=new rt.Spherical,Po=new rt.Box3,Nv=new rt.Box3,Cm=new rt.Sphere,Ov=new rt.Quaternion,Tm=new rt.Quaternion,Mm=new rt.Matrix4,Yu=new rt.Raycaster}static get ACTION(){return _e}set verticalDragToForward(e){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=_e.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Io.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new rt.Vector3,this._focalOffsetVelocity=new rt.Vector3,this._zoomVelocity={value:0},this._truckInternal=(x,P,I,R)=>{let D,G;if(fa(this._camera)){const U=ht.copy(this._camera.position).sub(this._target),H=this._camera.getEffectiveFOV()*Sc,k=U.length()*Math.tan(H*.5);D=this.truckSpeed*x*k/this._elementRect.height,G=this.truckSpeed*P*k/this._elementRect.height}else if(Cr(this._camera)){const U=this._camera;D=this.truckSpeed*x*(U.right-U.left)/U.zoom/this._elementRect.width,G=this.truckSpeed*P*(U.top-U.bottom)/U.zoom/this._elementRect.height}else return;R?(I?this.setFocalOffset(this._focalOffsetEnd.x+D,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(D,0,!0),this.forward(-G,!0)):I?this.setFocalOffset(this._focalOffsetEnd.x+D,this._focalOffsetEnd.y+G,this._focalOffsetEnd.z,!0):this.truck(D,G,!0)},this._rotateInternal=(x,P)=>{const I=xr*this.azimuthRotateSpeed*x/this._elementRect.height,R=xr*this.polarRotateSpeed*P/this._elementRect.height;this.rotate(I,R,!0)},this._dollyInternal=(x,P,I)=>{const R=Math.pow(.95,-x*this.dollySpeed),D=this._sphericalEnd.radius,G=this._sphericalEnd.radius*R,U=ss(G,this.minDistance,this.maxDistance),H=U-G;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(G,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(H,!0),this._dollyToNoClamp(U,!0)):this._dollyToNoClamp(U,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?G:U)-D,this._dollyControlCoord.set(P,I)),this._lastDollyDirection=Math.sign(-x)},this._zoomInternal=(x,P,I)=>{const R=Math.pow(.95,x*this.dollySpeed),D=this._zoom,G=this._zoom*R;this.zoomTo(G,!0),this.dollyToCursor&&(this._changedZoom+=G-D,this._dollyControlCoord.set(P,I))},typeof rt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new rt.Quaternion().setFromUnitVectors(this._camera.up,Wu),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=_e.NONE,this._target=new rt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new rt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new rt.Spherical().setFromVector3(ht.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new rt.Vector3,new rt.Vector3,new rt.Vector3,new rt.Vector3],this._updateNearPlaneCorners(),this._boundary=new rt.Box3(new rt.Vector3(-1/0,-1/0,-1/0),new rt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new rt.Vector2,this.mouseButtons={left:_e.ROTATE,middle:_e.DOLLY,right:_e.TRUCK,wheel:fa(this._camera)?_e.DOLLY:Cr(this._camera)?_e.ZOOM:_e.NONE},this.touches={one:_e.TOUCH_ROTATE,two:fa(this._camera)?_e.TOUCH_DOLLY_TRUCK:Cr(this._camera)?_e.TOUCH_ZOOM_TRUCK:_e.NONE,three:_e.TOUCH_TRUCK};const i=new rt.Vector2,a=new rt.Vector2,l=new rt.Vector2,h=x=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const R=this._domElement.getBoundingClientRect(),D=x.clientX/R.width,G=x.clientY/R.height;if(D<this._interactiveArea.left||D>this._interactiveArea.right||G<this._interactiveArea.top||G>this._interactiveArea.bottom)return}const P=x.pointerType!=="mouse"?null:(x.buttons&ni.LEFT)===ni.LEFT?ni.LEFT:(x.buttons&ni.MIDDLE)===ni.MIDDLE?ni.MIDDLE:(x.buttons&ni.RIGHT)===ni.RIGHT?ni.RIGHT:null;if(P!==null){const R=this._findPointerByMouseButton(P);R&&this._disposePointer(R)}if((x.buttons&ni.LEFT)===ni.LEFT&&this._lockedPointer)return;const I={pointerId:x.pointerId,clientX:x.clientX,clientY:x.clientY,deltaX:0,deltaY:0,mouseButton:P};this._activePointers.push(I),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.addEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),this._isDragging=!0,y(x)},d=x=>{x.cancelable&&x.preventDefault();const P=x.pointerId,I=this._lockedPointer||this._findPointerById(P);if(I){if(I.clientX=x.clientX,I.clientY=x.clientY,I.deltaX=x.movementX,I.deltaY=x.movementY,this._state=0,x.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(x.buttons&ni.LEFT)===ni.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(x.buttons&ni.MIDDLE)===ni.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(x.buttons&ni.RIGHT)===ni.RIGHT&&(this._state=this._state|this.mouseButtons.right);w()}},p=x=>{const P=this._findPointerById(x.pointerId);if(!(P&&P===this._lockedPointer)){if(P&&this._disposePointer(P),x.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=_e.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=_e.NONE;E()}};let m=-1;const A=x=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===_e.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const G=this._domElement.getBoundingClientRect(),U=x.clientX/G.width,H=x.clientY/G.height;if(U<this._interactiveArea.left||U>this._interactiveArea.right||H<this._interactiveArea.top||H>this._interactiveArea.bottom)return}if(x.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===_e.ROTATE||this.mouseButtons.wheel===_e.TRUCK){const G=performance.now();m-G<1e3&&this._getClientRect(this._elementRect),m=G}const P=aF?-1:-3,I=x.deltaMode===1||x.ctrlKey?x.deltaY/P:x.deltaY/(P*10),R=this.dollyToCursor?(x.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,D=this.dollyToCursor?(x.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case _e.ROTATE:{this._rotateInternal(x.deltaX,x.deltaY),this._isUserControllingRotate=!0;break}case _e.TRUCK:{this._truckInternal(x.deltaX,x.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case _e.SCREEN_PAN:{this._truckInternal(x.deltaX,x.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case _e.OFFSET:{this._truckInternal(x.deltaX,x.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case _e.DOLLY:{this._dollyInternal(-I,R,D),this._isUserControllingDolly=!0;break}case _e.ZOOM:{this._zoomInternal(-I,R,D),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},_=x=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Ua.ACTION.NONE){const P=x instanceof PointerEvent?x.pointerId:0,I=this._findPointerById(P);I&&this._disposePointer(I),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p);return}x.preventDefault()}},y=x=>{if(!this._enabled)return;if(wm(this._activePointers,_n),this._getClientRect(this._elementRect),i.copy(_n),a.copy(_n),this._activePointers.length>=2){const I=_n.x-this._activePointers[1].clientX,R=_n.y-this._activePointers[1].clientY,D=Math.sqrt(I*I+R*R);l.set(0,D);const G=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,U=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;a.set(G,U)}if(this._state=0,!x)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in x&&x.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(x.buttons&ni.LEFT)===ni.LEFT&&(this._state=this._state|this.mouseButtons.left),(x.buttons&ni.MIDDLE)===ni.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(x.buttons&ni.RIGHT)===ni.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&_e.ZOOM)===_e.ZOOM||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},w=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,wm(this._activePointers,_n);const P=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,I=P?-P.deltaX:a.x-_n.x,R=P?-P.deltaY:a.y-_n.y;if(a.copy(_n),((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(I,R),this._isUserControllingRotate=!0),(this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.ZOOM)===_e.ZOOM){const D=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,G=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,U=this.dollyDragInverted?-1:1;(this._state&_e.DOLLY)===_e.DOLLY?(this._dollyInternal(U*R*ju,D,G),this._isUserControllingDolly=!0):(this._zoomInternal(U*R*ju,D,G),this._isUserControllingZoom=!0)}if((this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE){const D=_n.x-this._activePointers[1].clientX,G=_n.y-this._activePointers[1].clientY,U=Math.sqrt(D*D+G*G),H=l.y-U;l.set(0,U);const k=this.dollyToCursor?(a.x-this._elementRect.x)/this._elementRect.width*2-1:0,$=this.dollyToCursor?(a.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET?(this._dollyInternal(H*ju,k,$),this._isUserControllingDolly=!0):(this._zoomInternal(H*ju,k,$),this._isUserControllingZoom=!0)}((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(I,R,!1,!1),this._isUserControllingTruck=!0),((this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(I,R,!1,!0),this._isUserControllingTruck=!0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(I,R,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},E=()=>{wm(this._activePointers,_n),a.copy(_n),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",C),this._domElement.ownerDocument.addEventListener("pointerlockerror",T),this._domElement.ownerDocument.addEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),y())},this.unlockPointer=()=>{var x,P,I;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(x=this._domElement)===null||x===void 0||x.ownerDocument.exitPointerLock(),(P=this._domElement)===null||P===void 0||P.ownerDocument.removeEventListener("pointerlockchange",C),(I=this._domElement)===null||I===void 0||I.ownerDocument.removeEventListener("pointerlockerror",T),this.cancel()};const C=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},T=()=>{this.unlockPointer()};this._addAllEventListeners=x=>{this._domElement=x,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",h),this._domElement.addEventListener("pointercancel",p),this._domElement.addEventListener("wheel",A,{passive:!1}),this._domElement.addEventListener("contextmenu",_)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",h),this._domElement.removeEventListener("pointercancel",p),this._domElement.removeEventListener("wheel",A,{passive:!1}),this._domElement.removeEventListener("contextmenu",_),this._domElement.ownerDocument.removeEventListener("pointermove",d,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))},this.cancel=()=>{this._state!==_e.NONE&&(this._state=_e.NONE,this._activePointers.length=0,E())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ss(e.width,0,1),this._interactiveArea.height=ss(e.height,0,1),this._interactiveArea.x=ss(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ss(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const a=ss(e,this.minAzimuthAngle,this.maxAzimuthAngle),l=ss(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=a,this._sphericalEnd.phi=l,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const h=!i||kt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&kt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(h)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0,this._dollyToNoClamp(ss(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const h=this._collisionTest(),d=kt(h,this._spherical.radius);if(!(i>e)&&d)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,h)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const l=!t||kt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(l)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Mc).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||kt(this._target.x,this._targetEnd.x,this.restThreshold)&&kt(this._target.y,this._targetEnd.y,this.restThreshold)&&kt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ss(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||kt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),As.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),As.multiplyScalar(e),_s.multiplyScalar(-t);const a=ht.copy(As).add(_s),l=Rt.copy(this._targetEnd).add(a);return this.moveTo(l.x,l.y,l.z,i)}forward(e,t=!1){ht.setFromMatrixColumn(this._camera.matrix,0),ht.crossVectors(this._camera.up,ht),ht.multiplyScalar(e);const i=Rt.copy(this._targetEnd).add(ht);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return ht.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ht.x,this._targetEnd.y+ht.y,this._targetEnd.z+ht.z,t)}moveTo(e,t,i,a=!1){this._isUserControllingTruck=!1;const l=ht.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,l,this.boundaryFriction),this._needsUpdate=!0,a||this._target.copy(this._targetEnd);const h=!a||kt(this._target.x,this._targetEnd.x,this.restThreshold)&&kt(this._target.y,this._targetEnd.y,this.restThreshold)&&kt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(h)}lookInDirectionOf(e,t,i,a=!1){const d=ht.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(d.x,d.y,d.z,a)}fitToBox(e,t,{cover:i=!1,paddingLeft:a=0,paddingRight:l=0,paddingBottom:h=0,paddingTop:d=0}={}){const p=[],m=e.isBox3?Po.copy(e):Po.setFromObject(e);m.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const A=Rv(this._sphericalEnd.theta,Iv),_=Rv(this._sphericalEnd.phi,Iv);p.push(this.rotateTo(A,_,t));const y=ht.setFromSpherical(this._sphericalEnd).normalize(),w=Ov.setFromUnitVectors(y,Sm),E=kt(Math.abs(y.y),1);E&&w.multiply(Tm.setFromAxisAngle(Wu,A)),w.multiply(this._yAxisUpSpaceInverse);const C=Nv.makeEmpty();Rt.copy(m.min).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setX(m.max.x).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setY(m.max.y).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setZ(m.min.z).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.min).setZ(m.max.z).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setY(m.min.y).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).setX(m.min.x).applyQuaternion(w),C.expandByPoint(Rt),Rt.copy(m.max).applyQuaternion(w),C.expandByPoint(Rt),C.min.x-=a,C.min.y-=h,C.max.x+=l,C.max.y+=d,w.setFromUnitVectors(Sm,y),E&&w.premultiply(Tm.invert()),w.premultiply(this._yAxisUpSpace);const T=C.getSize(ht),x=C.getCenter(Rt).applyQuaternion(w);if(fa(this._camera)){const P=this.getDistanceToFitBox(T.x,T.y,T.z,i);p.push(this.moveTo(x.x,x.y,x.z,t)),p.push(this.dollyTo(P,t)),p.push(this.setFocalOffset(0,0,0,t))}else if(Cr(this._camera)){const P=this._camera,I=P.right-P.left,R=P.top-P.bottom,D=i?Math.max(I/T.x,R/T.y):Math.min(I/T.x,R/T.y);p.push(this.moveTo(x.x,x.y,x.z,t)),p.push(this.zoomTo(D,t)),p.push(this.setFocalOffset(0,0,0,t))}return Promise.all(p)}fitToSphere(e,t){const i=[],l="isObject3D"in e?Ua.createBoundingSphere(e,Cm):Cm.copy(e);if(i.push(this.moveTo(l.center.x,l.center.y,l.center.z,t)),fa(this._camera)){const h=this.getDistanceToFitSphere(l.radius);i.push(this.dollyTo(h,t))}else if(Cr(this._camera)){const h=this._camera.right-this._camera.left,d=this._camera.top-this._camera.bottom,p=2*l.radius,m=Math.min(h/p,d/p);i.push(this.zoomTo(m,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,a,l,h,d=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0;const p=Rt.set(a,l,h),m=ht.set(e,t,i);this._targetEnd.copy(p),this._sphericalEnd.setFromVector3(m.sub(p).applyQuaternion(this._yAxisUpSpace)),this._needsUpdate=!0,d||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!d||kt(this._target.x,this._targetEnd.x,this.restThreshold)&&kt(this._target.y,this._targetEnd.y,this.restThreshold)&&kt(this._target.z,this._targetEnd.z,this.restThreshold)&&kt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&kt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&kt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}lerp(e,t,i,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Io.NONE,this._changedDolly=0;const l=ht.set(...e.target);if("spherical"in e)Cn.set(...e.spherical);else{const _=Rt.set(...e.position);Cn.setFromVector3(_.sub(l).applyQuaternion(this._yAxisUpSpace))}const h=Ro.set(...t.target);if("spherical"in t)Bo.set(...t.spherical);else{const _=Rt.set(...t.position);Bo.setFromVector3(_.sub(h).applyQuaternion(this._yAxisUpSpace))}this._targetEnd.copy(l.lerp(h,i));const d=Bo.theta-Cn.theta,p=Bo.phi-Cn.phi,m=Bo.radius-Cn.radius;this._sphericalEnd.set(Cn.radius+m*i,Cn.phi+p*i,Cn.theta+d*i),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!a||kt(this._target.x,this._targetEnd.x,this.restThreshold)&&kt(this._target.y,this._targetEnd.y,this.restThreshold)&&kt(this._target.z,this._targetEnd.z,this.restThreshold)&&kt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&kt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&kt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}lerpLookAt(e,t,i,a,l,h,d,p,m,A,_,y,w,E=!1){return this.lerp({position:[e,t,i],target:[a,l,h]},{position:[d,p,m],target:[A,_,y]},w,E)}setPosition(e,t,i,a=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,a)}setTarget(e,t,i,a=!1){const l=this.getPosition(ht),h=this.setLookAt(l.x,l.y,l.z,e,t,i,a);return this._sphericalEnd.phi=ss(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),h}setFocalOffset(e,t,i,a=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,a||this._focalOffset.copy(this._focalOffsetEnd);const l=!a||kt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&kt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&kt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(l)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),As.setFromMatrixColumn(this._camera.matrixWorldInverse,0),_s.setFromMatrixColumn(this._camera.matrixWorldInverse,1),pa.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const a=ht.set(e,t,i),l=a.distanceTo(this._camera.position),h=a.sub(this._camera.position);As.multiplyScalar(h.x),_s.multiplyScalar(h.y),pa.multiplyScalar(h.z),ht.copy(As).add(_s).add(pa),ht.z=ht.z+l,this.dollyTo(l,!1),this.setFocalOffset(-ht.x,ht.y,-ht.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,a){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new rt.Vector4,typeof e=="number"?this._viewport.set(e,t,i,a):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,a=!1){if(Em(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const l=e/t,h=this._camera.getEffectiveFOV()*Sc,d=this._camera.aspect;return((a?l>d:l<d)?t:e/d)*.5/Math.tan(h*.5)+i*.5}getDistanceToFitSphere(e){if(Em(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Sc,i=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,a=1<this._camera.aspect?t:i;return e/Math.sin(a*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new rt.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new rt.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){return this._sphericalEnd.theta=(this._sphericalEnd.theta%xr+xr)%xr,this._sphericalEnd.theta>Math.PI&&(this._sphericalEnd.theta-=xr),this._spherical.theta+=xr*Math.round((this._sphericalEnd.theta-this._spherical.theta)/xr),this}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!kt(this._camera.up.x,this._cameraUp0.x)||!kt(this._camera.up.y,this._cameraUp0.y)||!kt(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const i=this.getPosition(ht);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Wu),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ht.subVectors(this._target,this._camera.position).normalize(),t=Rt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(ht);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,i=this._sphericalEnd.phi-this._spherical.phi,a=this._sphericalEnd.radius-this._spherical.radius,l=Lv.subVectors(this._targetEnd,this._target),h=Dv.subVectors(this._focalOffsetEnd,this._focalOffset),d=this._zoomEnd-this._zoom;if(Qt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const _=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=qu(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,_,1/0,e),this._needsUpdate=!0}if(Qt(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const _=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=qu(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,_,1/0,e),this._needsUpdate=!0}if(Qt(a))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const _=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=qu(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,_,this.maxSpeed,e),this._needsUpdate=!0}if(Qt(l.x)&&Qt(l.y)&&Qt(l.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const _=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Bv(this._target,this._targetEnd,this._targetVelocity,_,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Qt(h.x)&&Qt(h.y)&&Qt(h.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const _=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Bv(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,_,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Qt(d))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const _=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=qu(this._zoom,this._zoomEnd,this._zoomVelocity,_,1/0,e)}if(this.dollyToCursor){if(fa(this._camera)&&this._changedDolly!==0){const _=this._spherical.radius-this._lastDistance,y=this._camera,w=this._getCameraDirection(Mc),E=ht.copy(w).cross(y.up).normalize();E.lengthSq()===0&&(E.x=1);const C=Rt.crossVectors(E,w),T=this._sphericalEnd.radius*Math.tan(y.getEffectiveFOV()*Sc*.5),P=(this._sphericalEnd.radius-_-this._sphericalEnd.radius)/this._sphericalEnd.radius,I=Ro.copy(this._targetEnd).add(E.multiplyScalar(this._dollyControlCoord.x*T*y.aspect)).add(C.multiplyScalar(this._dollyControlCoord.y*T)),R=ht.copy(this._targetEnd).lerp(I,P),D=this._lastDollyDirection===Io.IN&&this._spherical.radius<=this.minDistance,G=this._lastDollyDirection===Io.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(D||G)){this._sphericalEnd.radius-=_,this._spherical.radius-=_;const H=Rt.copy(w).multiplyScalar(-_);R.add(H)}this._boundary.clampPoint(R,R);const U=Rt.subVectors(R,this._targetEnd);this._targetEnd.copy(R),this._target.add(U),this._changedDolly-=_,Qt(this._changedDolly)&&(this._changedDolly=0)}else if(Cr(this._camera)&&this._changedZoom!==0){const _=this._zoom-this._lastZoom,y=this._camera,w=ht.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(y.near+y.far)/(y.near-y.far)).unproject(y),E=Rt.set(0,0,-1).applyQuaternion(y.quaternion),C=Ro.copy(w).add(E.multiplyScalar(-w.dot(y.up))),x=-(this._zoom-_-this._zoom)/this._zoom,P=this._getCameraDirection(Mc),I=this._targetEnd.dot(P),R=ht.copy(this._targetEnd).lerp(C,x),D=R.dot(P),G=P.multiplyScalar(D-I);R.sub(G),this._boundary.clampPoint(R,R);const U=Rt.subVectors(R,this._targetEnd);this._targetEnd.copy(R),this._target.add(U),this._changedZoom-=_,Qt(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const p=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,p),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Qt(this._focalOffset.x)||!Qt(this._focalOffset.y)||!Qt(this._focalOffset.z))&&(As.setFromMatrixColumn(this._camera.matrix,0),_s.setFromMatrixColumn(this._camera.matrix,1),pa.setFromMatrixColumn(this._camera.matrix,2),As.multiplyScalar(this._focalOffset.x),_s.multiplyScalar(-this._focalOffset.y),pa.multiplyScalar(this._focalOffset.z),ht.copy(As).add(_s).add(pa),this._camera.position.add(ht),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ht.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const A=this._needsUpdate;return A&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):A?(this.dispatchEvent({type:"update"}),Qt(t,this.restThreshold)&&Qt(i,this.restThreshold)&&Qt(a,this.restThreshold)&&Qt(l.x,this.restThreshold)&&Qt(l.y,this.restThreshold)&&Qt(l.z,this.restThreshold)&&Qt(h.x,this.restThreshold)&&Qt(h.y,this.restThreshold)&&Qt(h.z,this.restThreshold)&&Qt(d,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!A&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=A,this._needsUpdate=!1,A}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Cc(this.maxDistance),minZoom:this.minZoom,maxZoom:Cc(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Cc(this.maxPolarAngle),minAzimuthAngle:Cc(this.minAzimuthAngle),maxAzimuthAngle:Cc(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:ht.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const i=JSON.parse(e);this.enabled=i.enabled,this.minDistance=i.minDistance,this.maxDistance=Tc(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=Tc(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=Tc(i.maxPolarAngle),this.minAzimuthAngle=Tc(i.minAzimuthAngle),this.maxAzimuthAngle=Tc(i.maxAzimuthAngle),this.smoothTime=i.smoothTime,this.draggingSmoothTime=i.draggingSmoothTime,this.dollySpeed=i.dollySpeed,this.truckSpeed=i.truckSpeed,this.dollyToCursor=i.dollyToCursor,this._target0.fromArray(i.target0),this._position0.fromArray(i.position0),this._zoom0=i.zoom0,this._focalOffset0.fromArray(i.focalOffset0),this.moveTo(i.target[0],i.target[1],i.target[2],t),Cn.setFromVector3(ht.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Cn.theta,Cn.phi,t),this.dollyTo(Cn.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",rF),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const a=t.lengthSq();if(a===0)return e;const l=Rt.copy(t).add(e),d=this._boundary.clampPoint(l,Ro).sub(l),p=d.lengthSq();if(p===0)return e.add(t);if(p===a)return e;if(i===0)return e.add(t).add(d);{const m=1+i*p/t.dot(d);return e.add(Rt.copy(t).multiplyScalar(m)).add(d.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(fa(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*Sc,a=Math.tan(i*.5)*t,l=a*e.aspect;this._nearPlaneCorners[0].set(-l,-a,0),this._nearPlaneCorners[1].set(l,-a,0),this._nearPlaneCorners[2].set(l,a,0),this._nearPlaneCorners[3].set(-l,a,0)}else if(Cr(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,a=e.right*t,l=e.top*t,h=e.bottom*t;this._nearPlaneCorners[0].set(i,l,0),this._nearPlaneCorners[1].set(a,l,0),this._nearPlaneCorners[2].set(a,h,0),this._nearPlaneCorners[3].set(i,h,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Em(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(Mc);Mm.lookAt(Pv,i,this._camera.up);for(let a=0;a<4;a++){const l=Rt.copy(this._nearPlaneCorners[a]);l.applyMatrix4(Mm);const h=Ro.addVectors(this._target,l);Yu.set(h,i),Yu.far=this._spherical.radius+1;const d=Yu.intersectObjects(this.colliderMeshes);d.length!==0&&d[0].distance<e&&(e=d[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new rt.Sphere){const i=t,a=i.center;Po.makeEmpty(),e.traverseVisible(h=>{h.isMesh&&Po.expandByObject(h)}),Po.getCenter(a);let l=0;return e.traverseVisible(h=>{if(!h.isMesh)return;const d=h;if(!d.geometry)return;const p=d.geometry.clone();p.applyMatrix4(d.matrixWorld);const A=p.attributes.position;for(let _=0,y=A.count;_<y;_++)ht.fromBufferAttribute(A,_),l=Math.max(l,a.distanceToSquared(ht))}),i.radius=Math.sqrt(l),i}}class kv{constructor(e){this.__position=new se,this.__target=new se,this.setPosition(e.position.x,e.position.y,e.position.z),this.setTarget(e.target.x,e.target.y,e.target.z)}getPosition(){return this.__position}setPosition(e,t,i){this.__position.setX(e),this.__position.setY(t),this.__position.setZ(i)}getTarget(){return this.__target}setTarget(e,t,i){this.__target.setX(e),this.__target.setY(t),this.__target.setZ(i)}}class oF extends v1{constructor({appWcRef:e}){super({appWcRef:e}),this._loggerContext="CAMERA MANAGER",this.__cameras={},this.__mainRenderer={},this.__mainCameraControls={},this.__screenshotCameraControls={},this.__cameraDirection=new se,this.__cameraSpherical=new ul,this.__savedCameraState={position:new se,target:new se,focalLength:0}}get cameraActions(){return Ua.ACTION}getCameras(){return this.__cameras}get mainCameraControls(){return this.__mainCameraControls}get screenshotCameraControls(){return this.__screenshotCameraControls}getCurrentCameraTransforms(){const e=new se;this.__cameras.main.getWorldPosition(e);const t=new se;return this.__mainCameraControls.getTarget(t),{position:e,target:t,focalLength:this.__cameras.main.getFocalLength()}}getCurrentCameraRotation(){return{azimuthAngle:this.__mainCameraControls.azimuthAngle,polarAngle:this.__mainCameraControls.polarAngle,distance:this.__mainCameraControls.distance}}getCameraFocalLength(){return this.__cameras.main.getFocalLength()}setCameraFocalLength(e){this.__cameras.main.setFocalLength(e)}async fitCameraToSceneBounds(e=!0){const t=this._appWcRef.getSceneSphericalBoundsForCameraFocus();if(!(t.radius<=0))return await this.fitCameraToObject({objectToFocus:t,enableTransition:e})}__onMainCameraControlsControlStart(e){const t=this.__mainCameraControls,i=t.currentAction===t.mouseButtons?.right||t.currentAction===t.touches?.two;e.canPan&&i?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"pan"}):t.currentAction===t.mouseButtons?.left?this._appWcRef.eventsManager.cameraControlsStart.fire({type:"rotate"}):this._appWcRef.eventsManager.cameraControlsStart.fire({type:null})}__onMainCameraControlsControlEnd(){this._appWcRef.eventsManager.inputEnd.fire()}saveCurrentCameraTransforms(){this.__mainCameraControls.getPosition(this.__savedCameraState.position),this.__mainCameraControls.getTarget(this.__savedCameraState.target),this.__savedCameraState.focalLength=this.getCameraFocalLength()}resetCurrentCameraTransformsToLastSavedState(e=!0){this.moveCameraToLocation({newCameraTransforms:this.__savedCameraState,transition:e})}setCameraZoomLimits({minDistance:e,maxDistance:t,skipCameraFit:i=!1}){const a=this._appWcRef.getSceneSphericalBoundsForCameraFocus().radius,l=a<=0?1:a;e&&(this.__mainCameraControls.minDistance=l*e),t&&(this.__mainCameraControls.maxDistance=l*t),i||this.fitCameraToSceneBounds()}enableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.ROTATE,this.__mainCameraControls.touches.one=this.cameraActions.TOUCH_ROTATE}disableRotationControls(){this.__mainCameraControls.mouseButtons.left=this.cameraActions.NONE,this.__mainCameraControls.touches.one=this.cameraActions.NONE}enablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY_TRUCK,this.__mainCameraControls.mouseButtons.right=this.cameraActions.TRUCK}disablePanControls(){this.__mainCameraControls.touches.two=this.cameraActions.NONE,this.__mainCameraControls.mouseButtons.right=this.cameraActions.NONE}enableZoomControls(){this.__mainCameraControls.touches.two=this.cameraActions.TOUCH_DOLLY,this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.DOLLY}disableZoomControls(){this.__mainCameraControls.mouseButtons.wheel=this.cameraActions.NONE,this.__mainCameraControls.touches.two=this.cameraActions.NONE}enableCameraZoomLimits(e,t=!1){this.setCameraZoomLimits({minDistance:e.minDistance??.5,maxDistance:e.maxDistance??5,skipCameraFit:t})}disableCameraZoomLimits(){this.setCameraZoomLimits({minDistance:-1/0,maxDistance:1/0})}enableCameraRotationLimits(e){this.__mainCameraControls.minPolarAngle=e.minPolarAngle??-1/0,this.__mainCameraControls.maxPolarAngle=e.maxPolarAngle??1/0,this.__mainCameraControls.minAzimuthAngle=e.minAzimuthAngle??-1/0,this.__mainCameraControls.maxAzimuthAngle=e.maxAzimuthAngle??1/0}disableCameraRotationLimits(){this.__mainCameraControls.minPolarAngle=-1/0,this.__mainCameraControls.maxPolarAngle=1/0,this.__mainCameraControls.minAzimuthAngle=-1/0,this.__mainCameraControls.maxAzimuthAngle=1/0}updateCameraSettings(e){this.enableRotationControls();const{canPan:t,canZoom:i}=e;i?this.enableZoomControls():this.disableZoomControls(),t?this.enablePanControls():this.disablePanControls(),this.__mainCameraControls.mouseButtons.middle=this.cameraActions.NONE,this.__mainCameraControls.enabled=!0,this.__cameras.main.setFocalLength(e.focalLength),this.__cameras.main.near=e.nearClip,this.__cameras.main.far=e.farClip,this.enableCameraZoomLimits(e),this.enableCameraRotationLimits(e),this._appWcRef.transparentBackground===!1&&(this.__mainRenderer.setClearColor(e.backgroundColor),this.__mainRenderer.setClearAlpha(e.backgroundAlpha))}normalizeAngle(e){const t=Math.PI*2;return Ms.euclideanModulo(e,t)}absoluteAngle(e,t){const i=Math.PI*2,a=e-t;return Ms.euclideanModulo(a+Math.PI,i)-Math.PI}async moveCameraToLocation({newCameraTransforms:e,freezeCamera:t=!1,transition:i=!0,targetCameraControlsRef:a=this.__mainCameraControls}){e instanceof kv||(e=new kv(e));const l=e.getPosition(),h=e.getTarget();a.enabled=!1,this.__cameraDirection.set(0,0,0),this.__cameraDirection.subVectors(l,h),this.__cameraDirection.normalize();const d=l.distanceTo(h);this.__cameraSpherical.setFromVector3(this.__cameraDirection);const p=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.theta),this.normalizeAngle(a.azimuthAngle)),m=this.absoluteAngle(this.normalizeAngle(this.__cameraSpherical.phi),this.normalizeAngle(a.polarAngle));a.rotate(p,m,i),a.moveTo(h.x,h.y,h.z,i),a.dollyTo(d,i),t||(a.enabled=!0)}async rotateCameraToLocation({azimuthAngle:e,polarAngle:t,distance:i,transition:a=!0,targetCameraControlsRef:l=this.__mainCameraControls}){e&&l.rotateAzimuthTo(e,a),t&&l.rotatePolarTo(t,a),i&&l.dollyTo(i,a)}async fitCameraToObject({objectToFocus:e,enableTransition:t=!0}){return await this.__mainCameraControls.fitToSphere(e,t)}async wiggleCamera(){const e=this.__mainCameraControls.azimuthAngle,t=[0,.4,-.3,0];for(const i of t){if(!this._appWcRef.playInteractionPrompt)break;await this.__mainCameraControls.rotateAzimuthTo(e+i,!0)}}async setup({mainRenderer:e,screenshotRenderer:t,cameraSettings:i}){this.__mainRenderer=e,this.__cameras={main:new yi(75,window.innerWidth/window.innerHeight,.1,1e3),screenshot:new yi(75,window.innerWidth/window.innerHeight,.1,1e3)},this.__cameras.main.name="MainCamera",this.__cameras.screenshot.name="ScreenshotCamera",this.__cameras.main.position.setZ(100);const a={Vector2:He,Vector3:se,Vector4:Bt,Quaternion:zi,Matrix4:tt,Spherical:ul,Box3:vi,Sphere:vn,Raycaster:o_};Ua.install({THREE:a}),this.__mainCameraControls=new Ua(this.__cameras.main,e.domElement),this.__screenshotCameraControls=new Ua(this.__cameras.screenshot,t.domElement),await this.updateCameraSettings(i),this.__mainCameraControls.addEventListener("controlstart",()=>{this.__onMainCameraControlsControlStart(i)}),this.__mainCameraControls.addEventListener("controlend",()=>{this.__onMainCameraControlsControlEnd()}),this._appWcRef.addEventListener(this._appWcRef.eventsManager.cameraMoveToTransform.name,(l=>{l.detail.saveFirst&&this.saveCurrentCameraTransforms(),this.moveCameraToLocation({newCameraTransforms:l.detail.cameraTransforms})}))}}const lF='@font-face{font-family:Helvetica Neue;src:url(https://asset.myepigraph.com/design-assets/fonts/HelveticaNeue/HelveticaNeue-Light.otf) format("opentype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:PPMori-Regular;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Regular.woff2) format("woff2");font-display:swap}@font-face{font-family:PPMori-Bold;src:url(https://asset.myepigraph.com/design-assets/fonts/PPMori/PPMori-Bold.woff2) format("woff2");font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter-VariableFont_slnt_wght.ttf) format("truetype");font-weight:300;font-style:normal;font-display:swap}@font-face{font-family:Inter;src:url(https://asset.myepigraph.com/design-assets/fonts/Inter/Inter_18pt-Bold.ttf) format("truetype");font-weight:700;font-style:normal;font-display:swap}',cF={Color:{Black:{25:{$type:"color",$value:"rgba(0, 0, 0, 0.0000)"},50:{$type:"color",$value:"rgba(0, 0, 0, 0.0500)"},100:{$type:"color",$value:"rgba(0, 0, 0, 0.1000)"},200:{$type:"color",$value:"rgba(0, 0, 0, 0.2000)"},300:{$type:"color",$value:"rgba(0, 0, 0, 0.3000)"},400:{$type:"color",$value:"rgba(0, 0, 0, 0.4000)"},500:{$type:"color",$value:"rgba(0, 0, 0, 0.5000)"},600:{$type:"color",$value:"rgba(0, 0, 0, 0.6000)"},700:{$type:"color",$value:"rgba(0, 0, 0, 0.7000)"},800:{$type:"color",$value:"rgba(0, 0, 0, 0.8000)"},900:{$type:"color",$value:"rgba(0, 0, 0, 0.9000)"},1e3:{$type:"color",$value:"#000000"}},White:{25:{$type:"color",$value:"rgba(255, 255, 255, 0.0250)"},50:{$type:"color",$value:"rgba(255, 255, 255, 0.0500)"},100:{$type:"color",$value:"rgba(255, 255, 255, 0.1000)"},200:{$type:"color",$value:"rgba(255, 255, 255, 0.2000)"},300:{$type:"color",$value:"rgba(255, 255, 255, 0.3000)"},400:{$type:"color",$value:"rgba(255, 255, 255, 0.4000)"},500:{$type:"color",$value:"rgba(255, 255, 255, 0.5000)"},600:{$type:"color",$value:"rgba(255, 255, 255, 0.6000)"},700:{$type:"color",$value:"rgba(255, 255, 255, 0.7000)"},800:{$type:"color",$value:"rgba(255, 255, 255, 0.8000)"},900:{$type:"color",$value:"rgba(255, 255, 255, 0.9000)"},1e3:{$type:"color",$value:"#ffffff"}},Green:{100:{$type:"color",$value:"#ebffee"},200:{$type:"color",$value:"#cff7d3"},300:{$type:"color",$value:"#aff4c6"},400:{$type:"color",$value:"#85e0a3"},500:{$type:"color",$value:"#14ae5c"},600:{$type:"color",$value:"#009951"},700:{$type:"color",$value:"#008043"},800:{$type:"color",$value:"#02542d"},900:{$type:"color",$value:"#024023"},1e3:{$type:"color",$value:"#062d1b"}},Red:{100:{$type:"color",$value:"#fee9e7"},200:{$type:"color",$value:"#fdd3d0"},300:{$type:"color",$value:"#fcb3ad"},400:{$type:"color",$value:"#f4776a"},500:{$type:"color",$value:"#ec221f"},600:{$type:"color",$value:"#c00f0c"},700:{$type:"color",$value:"#900b09"},800:{$type:"color",$value:"#690807"},900:{$type:"color",$value:"#4d0b0a"},1e3:{$type:"color",$value:"#300603"}},Yellow:{100:{$type:"color",$value:"#fffbeb"},200:{$type:"color",$value:"#fff1c2"},300:{$type:"color",$value:"#ffe8a3"},400:{$type:"color",$value:"#e8b931"},500:{$type:"color",$value:"#e5a000"},600:{$type:"color",$value:"#bf6a02"},700:{$type:"color",$value:"#975102"},800:{$type:"color",$value:"#682d03"},900:{$type:"color",$value:"#522504"},1e3:{$type:"color",$value:"#401b01"}},Blue:{100:{$type:"color",$value:"#fbfdff"},200:{$type:"color",$value:"#eaf4ff"},300:{$type:"color",$value:"#d5ebff"},400:{$type:"color",$value:"#c0e1ff"},500:{$type:"color",$value:"#91d0ff"},600:{$type:"color",$value:"#0094d5"},700:{$type:"color",$value:"#00679b"},800:{$type:"color",$value:"#003a5a"},900:{$type:"color",$value:"#003a5a"},1e3:{$type:"color",$value:"#002133"}},Slate:{100:{$type:"color",$value:"#f5f5f5"},200:{$type:"color",$value:"#e3e3e3"},300:{$type:"color",$value:"#cdcdcd"},400:{$type:"color",$value:"#b2b2b2"},500:{$type:"color",$value:"#949494"},600:{$type:"color",$value:"#767676"},700:{$type:"color",$value:"#5a5a5a"},800:{$type:"color",$value:"#434343"},900:{$type:"color",$value:"#303030"},1e3:{$type:"color",$value:"#242424"}},Grey:{25:{$type:"color",$value:"#f5f5f5"},50:{$type:"color",$value:"#f2f2f2"},100:{$type:"color",$value:"#e6e6e6"},200:{$type:"color",$value:"#cccccc"},300:{$type:"color",$value:"#b3b3b3"},400:{$type:"color",$value:"#999999"},500:{$type:"color",$value:"#7b7b7b"},600:{$type:"color",$value:"#666666"},700:{$type:"color",$value:"#4d4d4d"},800:{$type:"color",$value:"#333333"},900:{$type:"color",$value:"#1a1a1a"},1e3:{$type:"color",$value:"#0d0d0d"}},GreyAlpha:{25:{$type:"color",$value:"rgba(248, 248, 248, 0.8000)"},100:{$type:"color",$value:"rgba(242, 242, 242, 0.8000)"},500:{$type:"color",$value:"rgba(204, 204, 204, 0.2000)"},700:{$type:"color",$value:"rgba(204, 204, 204, 0.6000)"},800:{$type:"color",$value:"rgba(186, 186, 186, 0.6000)"},900:{$type:"color",$value:"rgba(50, 50, 50, 0.9000)"},"05":{$type:"color",$value:"rgba(253, 253, 253, 0.8000)"}}},Unit:{Space:{0:{$type:"number",$value:"0px"},100:{$type:"number",$value:"4px"},150:{$type:"number",$value:"6px"},200:{$type:"number",$value:"8px"},300:{$type:"number",$value:"12px"},400:{$type:"number",$value:"16px"},500:{$type:"number",$value:"20px"},600:{$type:"number",$value:"24px"},800:{$type:"number",$value:"32px"},1e3:{$type:"number",$value:"40px"},1200:{$type:"number",$value:"48px"},1600:{$type:"number",$value:"64px"},2e3:{$type:"number",$value:"80px"},2400:{$type:"number",$value:"96px"},2800:{$type:"number",$value:"112px"},3200:{$type:"number",$value:"128px"},3600:{$type:"number",$value:"144px"},4e3:{$type:"number",$value:"160px"},4400:{$type:"number",$value:"176px"},4800:{$type:"number",$value:"192px"},5200:{$type:"number",$value:"208px"},5600:{$type:"number",$value:"224px"},6e3:{$type:"number",$value:"240px"},6400:{$type:"number",$value:"256px"},7200:{$type:"number",$value:"288px"},8e3:{$type:"number",$value:"320px"},9600:{$type:"number",$value:"384px"},"0125":{$type:"number",$value:"0.5px"},"025":{$type:"number",$value:"1px"},"0325":{$type:"number",$value:"1.5px"},"050":{$type:"number",$value:"2px"}},Stack:{100:{$type:"number",$value:"-4px"},200:{$type:"number",$value:"-8px"},300:{$type:"number",$value:"-12px"},400:{$type:"number",$value:"-16px"},800:{$type:"number",$value:"-32px"},1e3:{$type:"number",$value:"-40px"},1600:{$type:"number",$value:"-64px"},2400:{$type:"number",$value:"-96px"},3200:{$type:"number",$value:"-128px"},4e3:{$type:"number",$value:"-160px"},4800:{$type:"number",$value:"-192px"},5600:{$type:"number",$value:"-224px"},7200:{$type:"number",$value:"-288px"},9600:{$type:"number",$value:"-384px"},"0125":{$type:"number",$value:"-0.5px"},"025":{$type:"number",$value:"-1px"},"0325":{$type:"number",$value:"-1.5px"},"050":{$type:"number",$value:"-2px"},"075":{$type:"number",$value:"-3px"}},Size:{4:{$type:"number",$value:"4px"},6:{$type:"number",$value:"6px"},8:{$type:"number",$value:"8px"},10:{$type:"number",$value:"10px"},12:{$type:"number",$value:"12px"},14:{$type:"number",$value:"14px"},16:{$type:"number",$value:"16px"},18:{$type:"number",$value:"18px"},20:{$type:"number",$value:"20px"},22:{$type:"number",$value:"22px"},24:{$type:"number",$value:"24px"},28:{$type:"number",$value:"28px"},30:{$type:"number",$value:"30px"},32:{$type:"number",$value:"32px"},40:{$type:"number",$value:"40px"},48:{$type:"number",$value:"48px"},64:{$type:"number",$value:"64px"},80:{$type:"number",$value:"80px"},96:{$type:"number",$value:"96px"},112:{$type:"number",$value:"112px"},128:{$type:"number",$value:"128px"},144:{$type:"number",$value:"144px"},160:{$type:"number",$value:"160px"},176:{$type:"number",$value:"176px"},224:{$type:"number",$value:"224px"}},Resolution:{XxsmallScreenMin:{$type:"number",$value:"375px"},XsmallScreenMin:{$type:"number",$value:"480px"},SmallScreenMin:{$type:"number",$value:"576px"},MediumScreenMin:{$type:"number",$value:"768px"},LargeScreenMin:{$type:"number",$value:"992px"},XlargeScreenMin:{$type:"number",$value:"1200px"},XxlargeScreenMin:{$type:"number",$value:"1400px"},XxxsmallScreenMax:{$type:"number",$value:"374px"},XxsmallScreenMax:{$type:"number",$value:"479px"},XsmallScreenMax:{$type:"number",$value:"575px"},SmallScreenMax:{$type:"number",$value:"767px"},MediumScreenMax:{$type:"number",$value:"991px"},LargeScreenMax:{$type:"number",$value:"1199px"},XlargeScreenMax:{$type:"number",$value:"1399px"},XxlargeScreenMax:{$type:"number",$value:"1920px"}}},Font:{Family:{Main:{$type:"string",$value:"PP Mori"},Body:{$type:"string",$value:"Helvetica LT Pro"},Epigraph:{$type:"string",$value:"PP Mori"}}}},S1={Color:{Brand:{Base:{$type:"color",$value:"#335166",$web:"var(--color-brand-base)"},BaseSecondary:{$type:"color",$value:"#2b4354",$web:"var(--color-brand-base-secondary)"},BaseTertiary:{$type:"color",$value:"#202f3a",$web:"var(--color-brand-base-tertiary)"},Accent:{$type:"color",$value:"#4276cf",$web:"var(--color-brand-accent)"},AccentSecondary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-secondary)"},AccentTertiary:{$type:"color",$value:"#3761a8",$web:"var(--color-brand-accent-tertiary)"},Light:{$type:"color",$value:"#f8fbf6",$web:"var(--color-brand-light)"},Dark:{$type:"color",$value:"#111b22",$web:"var(--color-brand-dark)"}}},Font:{Brand:{Heading:{$type:"string",$value:"Helvetica Neue",$web:"var(--font-brand-heading)"},Paragraph:{$type:"string",$value:"Inter",$web:"var(--font-brand-body)"}}},Unit:{Brand:{Radius:{$type:"number",$value:"4px",$web:"var(--unit-brand-radius)"}}}},Se={Color:{Surface:{Plain:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.100}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.50}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.25}"},ShadowSecondary:{$value:"{Primitives.Color.Black.200}"}},Fill:{Accent:{$value:"{BrandPrimitives.Color.Brand.Accent}"},AccentHover:{$value:"{BrandPrimitives.Color.Brand.AccentSecondary}"},AccentPress:{$value:"{BrandPrimitives.Color.Brand.AccentTertiary}"},Base:{$value:"{BrandPrimitives.Color.Brand.Base}"},BaseHover:{$value:"{BrandPrimitives.Color.Brand.BaseSecondary}"},BasePress:{$value:"{BrandPrimitives.Color.Brand.BaseTertiary}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.700}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.300}"},NeutralTertiary:{$value:"{Primitives.Color.Grey.100}"},SubtlePrimary:{$value:"{Primitives.Color.GreyAlpha.100}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.25}"},DangerPrimary:{$value:"{Primitives.Color.Red.600}"},Disabled:{$value:"{Primitives.Color.Grey.200}"},HotspotSecondary:{$value:"{Primitives.Color.GreyAlpha.800}"}},Icon:{NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"}},Text:{Invert:{$value:"{Primitives.Color.White.1000}"},NeutralPrimary:{$value:"{Primitives.Color.Grey.800}"},NeutralSecondary:{$value:"{Primitives.Color.Grey.700}"},Disabled:{$value:"{Primitives.Color.Grey.300}"}},Border:{AltContrast:{$value:"{BrandPrimitives.Color.Brand.Dark}"},SubtlePrimary:{$value:"{Primitives.Color.Grey.300}"},SubtleSecondary:{$value:"{Primitives.Color.GreyAlpha.700}"}}},Size:{Text:{Small:{$value:"{Primitives.Unit.Size.16}"},Medium:{$value:"{Primitives.Unit.Size.18}"},Large:{$value:"{Primitives.Unit.Size.20}"}},Icon:{Small:{$value:"{Primitives.Unit.Size.20}"},Medium:{$value:"{Primitives.Unit.Size.24}"},Large:{$value:"{Primitives.Unit.Size.28}"}},Radius:{Medium:{$value:"{Primitives.Unit.Space.150}"},Full:{$value:"{Primitives.Unit.Space.6000}"}},Stroke:{Regular:{$value:"{Primitives.Unit.Space.025}"},Thick:{$value:"{Primitives.Unit.Space.050}"}},Shadow:{None:{$value:"{Primitives.Unit.Space.0}"},Xsmall:{$value:"{Primitives.Unit.Space.025}"},Small:{$value:"{Primitives.Unit.Space.0325}"}},Blur:{Small:{$value:"{Primitives.Unit.Space.100}"}}},Space:{Padding:{Small:{$value:"{Primitives.Unit.Space.300}"},Medium:{$value:"{Primitives.Unit.Space.400}"},Regular:{$value:"{Primitives.Unit.Space.600}"}},Gap:{Small:{$value:"{Primitives.Unit.Space.200}"},Regular:{$value:"{Primitives.Unit.Space.400}"},Xxlarge:{$value:"{Primitives.Unit.Space.800}"}}},Font:{Family:{CustomH:{$value:"{BrandPrimitives.Font.Brand.Heading}"},CustomP:{$value:"{BrandPrimitives.Font.Brand.Paragraph}"},Main:{$value:"Helvetica Neue"}},Tracking:{Normal:{$value:"{Primitives.Unit.Space.0}"}}}};function ye(o){const e=/\{Primitives\.(.*?)}/,t=String(o).match(e),i=/\{BrandPrimitives\.(.*?)}/,a=String(o).match(i);let l=o;if(t){const h=t[1].split(".");l=cF[h[0]][h[1]][h[2]].$value}else if(a){const h=a[1].split("."),d=S1[h[0]][h[1]][h[2]],p=d.$web;l=`${p.substring(0,p.length-1)}, ${d.$value})`}return un(l)}const M_={poweredByEpigraphFooterText:"https://asset.myepigraph.com/design-assets/icons/powered-by-epigraph.svg",splashScreenLogo:"https://asset.myepigraph.com/design-assets/icons/default-splash-screen-image.svg",sampleQrCode:"https://asset.myepigraph.com/design-assets/icons/sample-qr-code.png"};function hF(){const o={};for(const[e,t]of Object.entries(S1))for(const[i,a]of Object.entries(t))for(const[l,h]of Object.entries(a)){const d=`${e}${i}${l}`;o[d]={name:un(h.$web),defaultValue:h.$value,argType:{control:h.$type}}}return o}const uF=hF(),Dl={size:{name:"size",defaultValue:"small",argType:{options:["small","medium","large"],control:"select"}},theme:{name:"theme",defaultValue:"light",argType:{options:["light","dark"],control:"select"}},disabled:{name:"disabled",defaultValue:!1,argType:{control:"boolean"}}};var dF=Object.defineProperty,Xf=(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&&dF(e,t,a),a};const Jh=class C1 extends dl{constructor(){super(),this.epgOnClickEventName="epgonclick",this.disabled=!1,this.theme=Dl.theme.defaultValue.toString(),this.size=Dl.size.defaultValue.toString(),C1.ensureFontsAreLoaded()}static{this.styles=[ct`
4205
4205
  :host {
4206
4206
  font-family: ${ye(Se.Font.Family.Main.$value)};
4207
4207
  letter-spacing: 0.5px;
@@ -7068,7 +7068,7 @@ Arguments: [`+B+"]"}},s.fz.prototype={k(n){return"Unsupported operation: "+this.
7068
7068
  }
7069
7069
  }
7070
7070
  }
7071
- `]}updateActiveHotspotIndex(){this.activeHotspot&&(this.activeHotspotIndex=this.hotspotsOrder.indexOf(this.activeHotspot?.hotspotId))}static setupWebComponent(){window.customElements.get(Hd.webComponentName)||window.customElements.define(Hd.webComponentName,Hd)}firstUpdated(e){super.firstUpdated(e),this.__setupEventListeners()}updated(e){if(e.has("__cardsState")){const t=this.__currentCardsPerView,i=this.__cardsState===Wi.collapsed?1.2:1.03;if(Et.animateValue(t,i,500,a=>{this.__currentCardsPerView=a}),this?.cardsCarouselSwiperContainer?.swiper!==void 0){this.cardsCarouselSwiperContainer.swiper.allowTouchMove=this.__cardsState===Wi.collapsed;const a=this.cardsCarouselSwiperContainer.querySelectorAll("epg-card");for(const l of a)l.showPreviousButton=this.__cardsState===Wi.expanded&&!l.hasAttribute("is-first-hotspot"),l.showNextButton=this.__cardsState===Wi.expanded&&!l.hasAttribute("is-last-hotspot")}}this.cardsCarouselSwiperContainer?.swiper?.slideTo(this.activeHotspotIndex,400)}addHotspot(e,t=!0){const i=new Fv({config:e,appWcRef:this.appWcRef,hotspotManagerRef:this});this.hotspots.set(i.hotspotId,i);const a=this.appWcRef.sceneManager.sceneStructure.getEntityForAssetId(e.assetId);a&&a.addHotspot(i),t&&this.updateHotspotsOrder(Array.from(this.hotspots.keys()))}updateHotspot(e,t){const i=this.hotspots.get(e);if(!i){window.epigraph.logger.error({title:`Invalid hotspot ID: ${e}`});return}i.updateConfig(t),this.__resolveHotspotCardContents()}removeHotspot(e,t=!0){this.hotspots.delete(e),t&&this.updateHotspotsOrder(Array.from(this.hotspots.keys()))}stepHotspots(e){const t=this.activeHotspotIndex;if(t===null)return;const i=this.hotspotsOrder.length;let a=t;e==="next"?(a=t+1,a>=i&&(a=0)):e==="prev"&&(a=t-1,a<0&&(a=i-1));const l=this.hotspotsOrder[a];this.setActiveHotspot({hotspotId:l})}nextHotspot(){return this.stepHotspots("next"),this.appWcRef.eventsManager.hotspotNextEvent.fire({hotspot:this.activeHotspot}),this.activeHotspot}previousHotspot(){return this.stepHotspots("prev"),this.appWcRef.eventsManager.hotspotPreviousEvent.fire({hotspot:this.activeHotspot}),this.activeHotspot}openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i=!1}){this.appWcRef.playInteractionPrompt=!1,this.setActiveHotspot({hotspotId:e,state:t}),i||this.appWcRef.eventsManager.hotspotOpenEvent.fire({hotspot:this.activeHotspot});const a=new ir(!0,ir.PANEL_TYPE.HOTSPOT_PANEL,ir.TRIGGER_SOURCE.HOTSPOT,[]);this.appWcRef.epigraphAnalytics.sendEvent(a)}closeActiveHotspot(){const e=this.activeHotspot?.hotspotId;this.setActiveHotspot({hotspotId:null}),this.appWcRef.eventsManager.hotspotClosedEvent.fire({hotspotId:e});const t=new nr(!0,nr.PANEL_TYPE.HOTSPOT_PANEL,nr.TRIGGER_SOURCE.BUTTON,[]);this.appWcRef.epigraphAnalytics.sendEvent(t)}updateHotspotsOrder(e){this.hotspotsOrder=e}removeAllHotspots(){for(const e of this.hotspots.keys())this.removeHotspot(e)}setActiveHotspotByIndex(e){const t=this.hotspotsOrder[e];this.setActiveHotspot({hotspotId:t,state:this.__cardsState})}setActiveHotspot({hotspotId:e,state:t=this.__cardsState}){if(this.activeHotspot?.hotspotId===e)return;if(e===null){const a=!!this.activeHotspot;this.activeHotspot=void 0,this.updateActiveHotspotIndex(),a&&this.appWcRef.cameraManager.resetCurrentCameraTransformsToLastSavedState();return}this.enabled===!1&&(this.enabled=!0);const i=!this.activeHotspot;if(this.activeHotspot=this.hotspots.get(e),this.updateActiveHotspotIndex(),this.setActiveHotspotState(t),this.__resolveHotspotCardContents(),this.appWcRef.eventsManager.cameraMoveToTransform.fire({cameraTransforms:this.activeHotspot?.camera,saveFirst:i}),this.appWcRef.isPortraitOrientation){const a=this.appWcRef.cameraManager.mainCameraControls,l=new se;a.getTarget(l,!0);const h=new se;a.getPosition(h,!0),a.setLookAt(h.x-l.x,h.y,h.z-l.z,0,l.y,0,!0),a.setFocalOffset(0,.1,0,!0)}window.addEventListener("keydown",a=>{a.key==="Escape"&&this.closeActiveHotspot()},{once:!0})}expandCards(){this.__cardsState=Wi.expanded}collapseCards(){this.__cardsState=Wi.collapsed}setActiveHotspotState(e=Wi.collapsed){if(this.activeHotspot)switch(this.appWcRef.clientHeight<420&&(e=Wi.expanded),e){case Wi.collapsed:this.collapseCards();break;case Wi.expanded:this.expandCards();break}}__resolveHotspotCardContents(){this.__allCards=[];let e=0;const t=this.hotspots.size-1,i=this.hotspots.size>1,a=this.appWcRef.productSettings.hotspots.showNavigationButtons;for(const l of this.hotspots.values()){const h=e===0,d=e===t,p=Ee`
7071
+ `]}updateActiveHotspotIndex(){this.activeHotspot&&(this.activeHotspotIndex=this.hotspotsOrder.indexOf(this.activeHotspot?.hotspotId))}static setupWebComponent(){window.customElements.get(Hd.webComponentName)||window.customElements.define(Hd.webComponentName,Hd)}firstUpdated(e){super.firstUpdated(e),this.__setupEventListeners()}updated(e){if(e.has("__cardsState")){const t=this.__currentCardsPerView,i=this.__cardsState===Wi.collapsed?1.2:1.03;if(Et.animateValue(t,i,500,a=>{this.__currentCardsPerView=a}),this?.cardsCarouselSwiperContainer?.swiper!==void 0){this.cardsCarouselSwiperContainer.swiper.allowTouchMove=this.__cardsState===Wi.collapsed;const a=this.cardsCarouselSwiperContainer.querySelectorAll("epg-card");for(const l of a)l.showPreviousButton=this.__cardsState===Wi.expanded&&!l.hasAttribute("is-first-hotspot"),l.showNextButton=this.__cardsState===Wi.expanded&&!l.hasAttribute("is-last-hotspot")}}this.cardsCarouselSwiperContainer?.swiper?.slideTo(this.activeHotspotIndex,400)}addHotspot(e,t=!0){const i=new Fv({config:e,appWcRef:this.appWcRef,hotspotManagerRef:this});this.hotspots.set(i.hotspotId,i);const a=this.appWcRef.sceneManager.sceneStructure.getEntityForAssetId(e.assetId);a&&a.addHotspot(i),t&&this.updateHotspotsOrder(Array.from(this.hotspots.keys()))}updateHotspot(e,t){const i=this.hotspots.get(e);if(!i){window.epigraph.logger.error({title:`Invalid hotspot ID: ${e}`});return}i.updateConfig(t),this.__resolveHotspotCardContents()}removeHotspot(e,t=!0){this.hotspots.delete(e),t&&this.updateHotspotsOrder(Array.from(this.hotspots.keys()))}stepHotspots(e){const t=this.activeHotspotIndex;if(t===null)return;const i=this.hotspotsOrder.length;let a=t;e==="next"?(a=t+1,a>=i&&(a=0)):e==="prev"&&(a=t-1,a<0&&(a=i-1));const l=this.hotspotsOrder[a];this.setActiveHotspot({hotspotId:l})}nextHotspot(){return this.stepHotspots("next"),this.appWcRef.eventsManager.hotspotNextEvent.fire({hotspot:this.activeHotspot}),this.activeHotspot}previousHotspot(){return this.stepHotspots("prev"),this.appWcRef.eventsManager.hotspotPreviousEvent.fire({hotspot:this.activeHotspot}),this.activeHotspot}openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i=!1}){this.appWcRef.playInteractionPrompt=!1,this.setActiveHotspot({hotspotId:e,state:t}),i||this.appWcRef.eventsManager.hotspotOpenEvent.fire({hotspot:this.activeHotspot});const a=new ir(!0,ir.PANEL_TYPE.HOTSPOT_PANEL,ir.TRIGGER_SOURCE.HOTSPOT,[]);this.appWcRef.epigraphAnalytics.sendEvent(a)}closeActiveHotspot(){const e=this.activeHotspot?.hotspotId;this.setActiveHotspot({hotspotId:null}),this.appWcRef.eventsManager.hotspotClosedEvent.fire({hotspotId:e});const t=new nr(!0,nr.PANEL_TYPE.HOTSPOT_PANEL,nr.TRIGGER_SOURCE.BUTTON,[]);this.appWcRef.epigraphAnalytics.sendEvent(t)}updateHotspotsOrder(e){this.hotspotsOrder=e}removeAllHotspots(){for(const e of this.hotspots.keys())this.removeHotspot(e)}setActiveHotspotByIndex(e){const t=this.hotspotsOrder[e];this.setActiveHotspot({hotspotId:t,state:this.__cardsState})}setActiveHotspot({hotspotId:e,state:t=this.__cardsState}){if(this.activeHotspot?.hotspotId===e)return;if(e===null){const a=!!this.activeHotspot;this.activeHotspot=void 0,this.updateActiveHotspotIndex(),a&&this.appWcRef.cameraManager.resetCurrentCameraTransformsToLastSavedState(),this.appWcRef.isPortraitOrientation&&this.appWcRef.cameraManager.mainCameraControls.setFocalOffset(0,0,0,!0);return}this.enabled===!1&&(this.enabled=!0);const i=!this.activeHotspot;if(this.activeHotspot=this.hotspots.get(e),this.updateActiveHotspotIndex(),this.setActiveHotspotState(t),this.__resolveHotspotCardContents(),this.appWcRef.eventsManager.cameraMoveToTransform.fire({cameraTransforms:this.activeHotspot?.camera,saveFirst:i}),this.appWcRef.isPortraitOrientation){const a=this.appWcRef.cameraManager.mainCameraControls,l=new se;a.getTarget(l,!0);const h=new se;a.getPosition(h,!0),a.setLookAt(h.x-l.x,h.y,h.z-l.z,0,l.y,0,!0),a.setFocalOffset(0,.1,0,!0)}window.addEventListener("keydown",a=>{a.key==="Escape"&&this.closeActiveHotspot()},{once:!0})}expandCards(){this.__cardsState=Wi.expanded}collapseCards(){this.__cardsState=Wi.collapsed}setActiveHotspotState(e=Wi.collapsed){if(this.activeHotspot)switch(this.appWcRef.clientHeight<420&&(e=Wi.expanded),e){case Wi.collapsed:this.collapseCards();break;case Wi.expanded:this.expandCards();break}}__resolveHotspotCardContents(){this.__allCards=[];let e=0;const t=this.hotspots.size-1,i=this.hotspots.size>1,a=this.appWcRef.productSettings.hotspots.showNavigationButtons;for(const l of this.hotspots.values()){const h=e===0,d=e===t,p=Ee`
7072
7072
  <swiper-slide part="swiper-slide">
7073
7073
  <style>
7074
7074
  .expand-button {
@@ -8539,7 +8539,10 @@ void main() {
8539
8539
 
8540
8540
  .toolset.hide {
8541
8541
  opacity: 0;
8542
- pointer-events: none;
8542
+
8543
+ * {
8544
+ pointer-events: none;
8545
+ }
8543
8546
  }
8544
8547
 
8545
8548
  .toolset:first-child {
@@ -8570,11 +8573,11 @@ void main() {
8570
8573
  opacity: 0;
8571
8574
  pointer-events: none;
8572
8575
  }
8573
- `]}get timeElapsedSinceLoadBegin(){return parseFloat((performance.now()-this._loadTimeBegin).toFixed(2))}get epigraphAnalytics(){return this._epigraphAnalytics}get identifier(){return this._identifier}get identifierType(){return this._identifierType}get eventsManager(){return this._eventsManager}get canvasSize(){return this.__canvasSize}get loaders(){return this._loaders}get experienceData(){return this._experienceData}get sceneManager(){return this._sceneManager}get cameraManager(){return this._cameraManager}get hasSceneChanged(){return this.__hasSceneChanged}set hasSceneChanged(e){this.__hasSceneChanged=e}get renderEngine(){return this._renderEngine}get isDevEnv(){return this._isDevEnv}__showViewStateGrid(){this.renderEngine.scene.add(this.__viewStateGrid)}__hideViewStateGrid(){this.renderEngine.scene.remove(this.__viewStateGrid)}enterPickerState(){this.sessionState="hotspotPlacer",this.style.cursor="crosshair",this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.__hideViewStateGrid(),this.cameraManager.enableRotationControls(),this.cameraManager.enableZoomControls(),this.cameraManager.enablePanControls(),this.cameraManager.disableCameraZoomLimits(),this.cameraManager.disableCameraRotationLimits(),this.requestUpdate()}enterViewState(){const e=this.sessionState;this.sessionState="cameraUpdate",this.style.cursor="grab",this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hotspotsManager.style.opacity="0.25",this.__showViewStateGrid(),this.cameraManager.enableRotationControls(),this.cameraManager.enableZoomControls(),this.cameraManager.enablePanControls(),this.cameraManager.disableCameraZoomLimits(),this.cameraManager.disableCameraRotationLimits(),e==="hotspotPlacer"&&this.hotspotsManager.activeHotspot&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.hotspotsManager.activeHotspot.camera}),this.requestUpdate()}enterDefaultState(){this.sessionState="default",this.style.cursor="grab",this.hotspotsManager.style.opacity="1",this.__hideViewStateGrid(),this.cameraManager.updateCameraSettings(this.productSettings.camera),this.requestUpdate()}renderScreenshotCanvasFrame(){this.renderEngine.screenshotRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().screenshot)}onLoadFailed(e,t){this._eventsManager.appFailedEvent.fire(t);const i=this.timeElapsedSinceLoadBegin,a=new tb(!0,i,e);this._epigraphAnalytics.sendEvent(a),this.showSplashScreen()}getFirstNonProxyFromIntersections(e){let t=null;for(const i of e)if(!(!i?.object||i.object.userData.isProxyMesh===!0)){t=i;break}return t}__getIntersectionsWithScene(e,t){const i=new o_,a=new He;return a.x=e/this.canvasSize.width*2-1,a.y=-(t/this.canvasSize.height)*2+1,i.setFromCamera(a,this.cameraManager.getCameras().main),i.intersectObjects(this.renderEngine.sceneHierarchy.sceneStructure.rootEntity.children,!0)}getPositionOnMeshFromPoint(e,t){const i=this.__getIntersectionsWithScene(e,t);if(i.length>0){const a=this.getFirstNonProxyFromIntersections(i);return a===null?null:a.point}else return null}getIntersectionOnProductFromPoint(e,t){const i=this.__getIntersectionsWithScene(e,t);let a=null;if(i.length>0){const l=this.getFirstNonProxyFromIntersections(i);if(!l?.object)return null;l.object.traverseAncestors(h=>{if(h instanceof Va&&h.isRoot===!1){a={asset:{id:h.asset.id,name:h.asset.name},intersection:{point:l.point,normals:l.normal??null}};return}})}return a}getSceneSphericalBoundsForCameraFocus(){const e=this.sceneManager.currentSceneBounds;e.getCenter(this._boundingSphereCenter);const t=e.getBoundingSphere(new vn(this._boundingSphereCenter));if(this.dimensionsManager?.enabled){const i=this.canvasSize.height/this.canvasSize.width;t.radius+=i}return t}async getUsdzUrlForAr(){return this.__usdzBlobUrl=await this.renderEngine.getSceneAsUsdzUrl(),this.eventsManager.arModelReadyEvent.fire(this.__usdzBlobUrl),this.__usdzBlobUrl}async getGlbUrlForAr(){return this.__glbBlobUrl=await this.renderEngine.getSceneAsGlbUrl(),this.eventsManager.arModelReadyEvent.fire(this.__glbBlobUrl),this.__glbBlobUrl}async launchAR(){if(!this.isLoading)return await this.viewInYourSpaceManager.launchAR()}highlightEntityByAssetId(e){const t=this.sceneManager.sceneStructure.getEntityForAssetId(e);if(!t){window.epigraph.logger.error({title:`No asset found for ID: ${e}`});return}t.highlight()}unhighlightAllEntities(){for(const e of this.sceneManager.sceneStructure.getSceneEntities())e.unhighlight()}async spawnAssetInScene(e){const t=this.sceneManager.sceneStructure.getPossibleConnectionsForAssetInScene(e);if(t.length<=0)return Promise.resolve(void 0);const i=t[0];i.connect();const a=new Va(e);await a.initialize();const l=i.receiver,h=i.plug.clone();this.sceneManager.sceneStructure.add(h);const d=new se;l.getWorldPosition(d),h.position.set(d.x,d.y,d.z),h.attach(a);const p=new zi;return l.getWorldQuaternion(p),h.setRotationFromQuaternion(p),l.attach(a),h.removeFromParent(),Et.dispose3(h),this.eventsManager.structureChangedEvent.fire(),Promise.resolve(a)}async selectFinishForAssetName(e,t){const i=this._sceneManager.sceneStructure.getEntityForAssetName(t);return!i||!i.allFinishIds.includes(e)?!1:(await i.selectAssetFinish(e).catch(l=>(window.epigraph.logger.error({title:`Failed to select Finish: ${e} in Asset: ${t}`,details:l}),new x_(!1)))).success}showDimensions(){this.dimensionsManager.enabled=!0,this.areDimensionsActive=!0,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),this.cameraManager.fitCameraToSceneBounds()}hideDimensions(e=!1){this.dimensionsManager.enabled=!1,this.areDimensionsActive=!1,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),e||this.cameraManager.fitCameraToSceneBounds()}getDimensions(){const e=this.dimensionsManager.getCurrentDimensionsState(),t=this.dimensionsManager.dimensionsUnit;return{length:e.length.distance,width:e.width.distance,height:e.height.distance,unit:t}}printSceneHierarchy(){this.renderEngine.printSceneHierarchy()}showCameraAim(){this.cameraAimElemRef.classList.remove("hide")}hideCameraAim(){this.cameraAimElemRef.classList.add("hide")}showHelp(){this.isHelpVisible=!0}hideHelp(){this.isHelpVisible=!1}toggleHelp(){this.isHelpVisible=!this.isHelpVisible}showHotspots(){window.epigraph.logger.info({title:"Showing Hotspots"}),this.areHotspotsActive=!0,this.eventsManager.hotspotsVisibilityChanged.fire({visible:!0})}hideHotspots(){window.epigraph.logger.info({title:"Hiding Hotspots"}),this.areHotspotsActive=!1,this.eventsManager.hotspotsVisibilityChanged.fire({visible:!1})}toggleHotspots(){this.hotspotsManager.enabled?this.hideHotspots():this.showHotspots()}updateHotspotsOrder(e){this.hotspotsManager.updateHotspotsOrder(e)}openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i=!1}){this.hotspotsManager.openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i})}closeActiveHotspot(){this.hotspotsManager.closeActiveHotspot()}setActiveHotspotState(e){this.hotspotsManager.setActiveHotspotState(e)}nextHotspot(){return this.hotspotsManager.nextHotspot()}previousHotspot(){return this.hotspotsManager.previousHotspot()}getActiveHotspot(){return this.hotspotsManager.activeHotspot}areHotspotsVisible(){return this.hotspotsManager.enabled}getAllHotspots(){return Array.from(this.hotspotsManager.hotspots.values())}getAllHotspotIds(){return Array.from(this.hotspotsManager.hotspots.keys())}getHotspotById(e){return this.hotspotsManager.hotspots.get(e)}async __onPlayInteractionPrompt(e=2){this.showCameraInteractionPromptIndicator(),await Et.wait(800);for(let t=0;t<e;t++)this.cameraInteractionPromptIndicatorElemRef.classList.add("play-wiggle-animation"),await this.cameraManager.wiggleCamera();this.cameraInteractionPromptIndicatorElemRef.classList.remove("play-wiggle-animation"),this.hideCameraInteractionPromptIndicator(),this._isSceneInteractedWith||setTimeout(()=>{this.__onPlayInteractionPrompt()},3e3)}getAllAnimations(){const e=this.sceneManager.sceneStructure.getFirstEntity();return e?e.getAllAnimations():[]}getAllAnimationNames(){const e=this.sceneManager.sceneStructure.getFirstEntity();return e?e.getAllAnimationNames():[]}playAnimationByName({animationName:e,clampWhenFinished:t=!1,loop:i=!1,repetitions:a=1/0,reverse:l=!1}){if(!e)return;const h=this.getAllAnimationNames();if(!h.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:h});return}const d=h.indexOf(e),p=this.getAllAnimations()[d];return l?(p.timeScale=-1,p.fadeOut(this._animationFadeDurationInMiliseconds*.001)):(p.timeScale=1,p.fadeIn(this._animationFadeDurationInMiliseconds*.001)),p.setLoop(i?$a:xl,a),p.clampWhenFinished=t,p.enabled=!0,p.play(),this._activeAnimations.set(e,p),{animationName:e,targetAnimationAction:p}}stopAnimationByName(e){if(!e)return;const t=this.getAllAnimationNames();if(!t.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:t});return}const i=t.indexOf(e),a=this.getAllAnimations()[i];a.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{a.stop()},this._animationFadeDurationInMiliseconds),this._activeAnimations.delete(e)}pauseActiveAnimations(e){for(const t of this._activeAnimations.values())t.paused=!0,e!==void 0&&(t.weight=e)}resumeActiveAnimations(){for(const e of this._activeAnimations.values())e.paused=!1,e.weight=1}stopAllAnimations(){for(const[e,t]of this._activeAnimations.entries())t.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{t.stop(),this._activeAnimations.delete(e)},this._animationFadeDurationInMiliseconds)}postRenderFrameUpdateInEngine(e){try{this.cameraManager.mainCameraControls.update(e),this.debugManager&&this.debugManager.stats.update(),this.renderEngine.mainRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().main),this.renderEngine.textRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().main)}catch(t){return t}}getScreenPositionFromWorld(e){const t=new He,i=this.cameraManager.getCameras().main,a=this.renderEngine.canvas.clientWidth*.5,l=this.renderEngine.canvas.clientHeight*.5,d=e.clone().project(i);return t.x=(d.x+1)*a,t.y=-(d.y-1)*l,t}_renderAppCanvasContainer(){return this.featuresToEnable.viewer?Ee`
8576
+ `]}get timeElapsedSinceLoadBegin(){return parseFloat((performance.now()-this._loadTimeBegin).toFixed(2))}get epigraphAnalytics(){return this._epigraphAnalytics}get identifier(){return this._identifier}get identifierType(){return this._identifierType}get eventsManager(){return this._eventsManager}get canvasSize(){return this.__canvasSize}get loaders(){return this._loaders}get experienceData(){return this._experienceData}get sceneManager(){return this._sceneManager}get cameraManager(){return this._cameraManager}get hasSceneChanged(){return this.__hasSceneChanged}set hasSceneChanged(e){this.__hasSceneChanged=e}get renderEngine(){return this._renderEngine}get isDevEnv(){return this._isDevEnv}__showViewStateGrid(){this.renderEngine.scene.add(this.__viewStateGrid)}__hideViewStateGrid(){this.renderEngine.scene.remove(this.__viewStateGrid)}enterPickerState(){this.sessionState="hotspotPlacer",this.style.cursor="crosshair",this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.__hideViewStateGrid(),this.cameraManager.enableRotationControls(),this.cameraManager.enableZoomControls(),this.cameraManager.enablePanControls(),this.cameraManager.disableCameraZoomLimits(),this.cameraManager.disableCameraRotationLimits(),this.requestUpdate()}enterViewState(){const e=this.sessionState;this.sessionState="cameraUpdate",this.style.cursor="grab",this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hotspotsManager.style.opacity="0.25",this.__showViewStateGrid(),this.cameraManager.enableRotationControls(),this.cameraManager.enableZoomControls(),this.cameraManager.enablePanControls(),this.cameraManager.disableCameraZoomLimits(),this.cameraManager.disableCameraRotationLimits(),e==="hotspotPlacer"&&this.hotspotsManager.activeHotspot&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.hotspotsManager.activeHotspot.camera}),this.requestUpdate()}enterDefaultState(){this.sessionState="default",this.style.cursor="grab",this.hotspotsManager.style.opacity="1",this.__hideViewStateGrid(),this.cameraManager.updateCameraSettings(this.productSettings.camera),this.requestUpdate()}renderScreenshotCanvasFrame(){this.renderEngine.screenshotRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().screenshot)}onLoadFailed(e,t){this._eventsManager.appFailedEvent.fire(t);const i=this.timeElapsedSinceLoadBegin,a=new tb(!0,i,e);this._epigraphAnalytics.sendEvent(a),this.showSplashScreen()}getFirstNonProxyFromIntersections(e){let t=null;for(const i of e)if(!(!i?.object||i.object.userData.isProxyMesh===!0)){t=i;break}return t}__getIntersectionsWithScene(e,t){const i=new o_,a=new He;return a.x=e/this.canvasSize.width*2-1,a.y=-(t/this.canvasSize.height)*2+1,i.setFromCamera(a,this.cameraManager.getCameras().main),i.intersectObjects(this.renderEngine.sceneHierarchy.sceneStructure.rootEntity.children,!0)}getPositionOnMeshFromPoint(e,t){const i=this.__getIntersectionsWithScene(e,t);if(i.length>0){const a=this.getFirstNonProxyFromIntersections(i);return a===null?null:a.point}else return null}getIntersectionOnProductFromPoint(e,t){const i=this.__getIntersectionsWithScene(e,t);let a=null;if(i.length>0){const l=this.getFirstNonProxyFromIntersections(i);if(!l?.object)return null;l.object.traverseAncestors(h=>{if(h instanceof Va&&h.isRoot===!1){if(a!==null)return;a={asset:{id:h.asset.id,name:h.asset.name},intersection:{point:l.point,normals:l.normal??null}};return}})}return a}getSceneSphericalBoundsForCameraFocus(){const e=this.sceneManager.currentSceneBounds;e.getCenter(this._boundingSphereCenter);const t=e.getBoundingSphere(new vn(this._boundingSphereCenter));if(this.dimensionsManager?.enabled){const i=this.canvasSize.height/this.canvasSize.width;t.radius+=i}return t}async getUsdzUrlForAr(){return this.__usdzBlobUrl=await this.renderEngine.getSceneAsUsdzUrl(),this.eventsManager.arModelReadyEvent.fire(this.__usdzBlobUrl),this.__usdzBlobUrl}async getGlbUrlForAr(){return this.__glbBlobUrl=await this.renderEngine.getSceneAsGlbUrl(),this.eventsManager.arModelReadyEvent.fire(this.__glbBlobUrl),this.__glbBlobUrl}async launchAR(){if(!this.isLoading)return await this.viewInYourSpaceManager.launchAR()}highlightEntityByAssetId(e){const t=this.sceneManager.sceneStructure.getEntityForAssetId(e);if(!t){window.epigraph.logger.error({title:`No asset found for ID: ${e}`});return}t.highlight()}unhighlightAllEntities(){for(const e of this.sceneManager.sceneStructure.getSceneEntities())e.unhighlight()}async spawnAssetInScene(e){const t=this.sceneManager.sceneStructure.getPossibleConnectionsForAssetInScene(e);if(t.length<=0)return Promise.resolve(void 0);const i=t[0];i.connect();const a=new Va(e);await a.initialize();const l=i.receiver,h=i.plug.clone();this.sceneManager.sceneStructure.add(h);const d=new se;l.getWorldPosition(d),h.position.set(d.x,d.y,d.z),h.attach(a);const p=new zi;return l.getWorldQuaternion(p),h.setRotationFromQuaternion(p),l.attach(a),h.removeFromParent(),Et.dispose3(h),this.eventsManager.structureChangedEvent.fire(),Promise.resolve(a)}async selectFinishForAssetName(e,t){const i=this._sceneManager.sceneStructure.getEntityForAssetName(t);return!i||!i.allFinishIds.includes(e)?!1:(await i.selectAssetFinish(e).catch(l=>(window.epigraph.logger.error({title:`Failed to select Finish: ${e} in Asset: ${t}`,details:l}),new x_(!1)))).success}showDimensions(){this.dimensionsManager.enabled=!0,this.areDimensionsActive=!0,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),this.cameraManager.fitCameraToSceneBounds()}hideDimensions(e=!1){this.dimensionsManager.enabled=!1,this.areDimensionsActive=!1,this.renderEngine.setDimensionsVisibility(this.dimensionsManager.enabled),e||this.cameraManager.fitCameraToSceneBounds()}getDimensions(){const e=this.dimensionsManager.getCurrentDimensionsState(),t=this.dimensionsManager.dimensionsUnit;return{length:e.length.distance,width:e.width.distance,height:e.height.distance,unit:t}}printSceneHierarchy(){this.renderEngine.printSceneHierarchy()}showCameraAim(){this.cameraAimElemRef.classList.remove("hide")}hideCameraAim(){this.cameraAimElemRef.classList.add("hide")}showHelp(){this.isHelpVisible=!0}hideHelp(){this.isHelpVisible=!1}toggleHelp(){this.isHelpVisible=!this.isHelpVisible}showHotspots(){window.epigraph.logger.info({title:"Showing Hotspots"}),this.areHotspotsActive=!0,this.eventsManager.hotspotsVisibilityChanged.fire({visible:!0})}hideHotspots(){window.epigraph.logger.info({title:"Hiding Hotspots"}),this.areHotspotsActive=!1,this.eventsManager.hotspotsVisibilityChanged.fire({visible:!1})}toggleHotspots(){this.hotspotsManager.enabled?this.hideHotspots():this.showHotspots()}updateHotspotsOrder(e){this.hotspotsManager.updateHotspotsOrder(e)}openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i=!1}){this.hotspotsManager.openHotspot({hotspotId:e,state:t,skipHotspotOpenEvent:i})}closeActiveHotspot(){this.hotspotsManager.closeActiveHotspot()}setActiveHotspotState(e){this.hotspotsManager.setActiveHotspotState(e)}nextHotspot(){return this.hotspotsManager.nextHotspot()}previousHotspot(){return this.hotspotsManager.previousHotspot()}getActiveHotspot(){return this.hotspotsManager.activeHotspot}areHotspotsVisible(){return this.hotspotsManager.enabled}getAllHotspots(){return Array.from(this.hotspotsManager.hotspots.values())}getAllHotspotIds(){return Array.from(this.hotspotsManager.hotspots.keys())}getHotspotById(e){return this.hotspotsManager.hotspots.get(e)}async __onPlayInteractionPrompt(e=2){this.showCameraInteractionPromptIndicator(),await Et.wait(800);for(let t=0;t<e;t++)this.cameraInteractionPromptIndicatorElemRef.classList.add("play-wiggle-animation"),await this.cameraManager.wiggleCamera();this.cameraInteractionPromptIndicatorElemRef.classList.remove("play-wiggle-animation"),this.hideCameraInteractionPromptIndicator(),this._isSceneInteractedWith||setTimeout(()=>{this.__onPlayInteractionPrompt()},3e3)}getAllAnimations(){const e=this.sceneManager.sceneStructure.getFirstEntity();return e?e.getAllAnimations():[]}getAllAnimationNames(){const e=this.sceneManager.sceneStructure.getFirstEntity();return e?e.getAllAnimationNames():[]}playAnimationByName({animationName:e,clampWhenFinished:t=!1,loop:i=!1,repetitions:a=1/0,reverse:l=!1}){if(!e)return;const h=this.getAllAnimationNames();if(!h.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:h});return}const d=h.indexOf(e),p=this.getAllAnimations()[d];return l?(p.timeScale=-1,p.fadeOut(this._animationFadeDurationInMiliseconds*.001)):(p.timeScale=1,p.fadeIn(this._animationFadeDurationInMiliseconds*.001)),p.setLoop(i?$a:xl,a),p.clampWhenFinished=t,p.enabled=!0,p.play(),this._activeAnimations.set(e,p),{animationName:e,targetAnimationAction:p}}stopAnimationByName(e){if(!e)return;const t=this.getAllAnimationNames();if(!t.includes(e)){window.epigraph.logger.warn({title:`Invalid animation name: ${e}. Expand for a list of valid names`,details:t});return}const i=t.indexOf(e),a=this.getAllAnimations()[i];a.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{a.stop()},this._animationFadeDurationInMiliseconds),this._activeAnimations.delete(e)}pauseActiveAnimations(e){for(const t of this._activeAnimations.values())t.paused=!0,e!==void 0&&(t.weight=e)}resumeActiveAnimations(){for(const e of this._activeAnimations.values())e.paused=!1,e.weight=1}stopAllAnimations(){for(const[e,t]of this._activeAnimations.entries())t.fadeOut(this._animationFadeDurationInMiliseconds*.001),setTimeout(()=>{t.stop(),this._activeAnimations.delete(e)},this._animationFadeDurationInMiliseconds)}postRenderFrameUpdateInEngine(e){try{this.cameraManager.mainCameraControls.update(e),this.debugManager&&this.debugManager.stats.update(),this.renderEngine.mainRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().main),this.renderEngine.textRenderer.render(this.renderEngine.scene,this.cameraManager.getCameras().main)}catch(t){return t}}getScreenPositionFromWorld(e){const t=new He,i=this.cameraManager.getCameras().main,a=this.renderEngine.canvas.clientWidth*.5,l=this.renderEngine.canvas.clientHeight*.5,d=e.clone().project(i);return t.x=(d.x+1)*a,t.y=-(d.y-1)*l,t}_renderAppCanvasContainer(){return this.featuresToEnable.viewer?Ee`
8574
8577
  <div id="appCanvasContainer" class="app-canvas-container">
8575
8578
  <span id="cameraAimIndicator" class="camera-aim-indicator hide"></span>
8576
8579
  </div>
8577
- `:Ue}getWebComponentName(){return oh.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(tb.MODULE_FAILED_ERRORS.AUTHENTICATION_FAILED,{errorCode:tN.AuthenticationFailedError,message:e}),await this.disconnectedCallback()}async setupRenderEngine(){window.epigraph.logger.info({title:"Initiliazing Render Engine"}),this._renderEngine=new nF(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,a=500;i.style.transition=`opacity ${a/1e3}s ease-in-out`,i.style.opacity="0",setTimeout(()=>i.style.visibility="hidden",a)})}_sendAnalyticsEventsOnModuleLoadStart(){const e=new CM(!1);this._epigraphAnalytics.sendEvent(e)}_sendAnalyticsEventsOnModuleLoadFinish(){const e=this.timeElapsedSinceLoadBegin,t=new TM(!1,e);this._epigraphAnalytics.sendEvent(t);const i=window.epigraph.isSessionWebGL2Compatible();let a;this.viewInYourSpaceManager.canLaunchAr()?a=i?uc.SUPPORT_TYPE.AR_WEBGL2:uc.SUPPORT_TYPE.AR:a=i?uc.SUPPORT_TYPE.QR_WEBGL2:uc.SUPPORT_TYPE.QR;const l=new uc(a);this._epigraphAnalytics.sendEvent(l)}_onNewExperienceLoadStart(){this.isLoading=!0,this._loadingProgress=0,this._hideCustomViewInYourSpaceButton(),this.showSplashScreen(),this._sendAnalyticsEventsOnModuleLoadStart()}_onNewExperienceLoadFinish(){this._onSceneHierarchyUpdate(),this.isLoading=!1,this._showCustomViewInYourSpaceButton(),this._eventsManager.experienceUpdatedEvent.fire(),this._eventsManager.appReadyEvent.fire(),this.hideSplashScreen(),setTimeout(()=>{this.playInteractionPrompt=!0},1e3),this._sendAnalyticsEventsOnModuleLoadFinish()}_onDimensionsToolControlClick(e){e.stopPropagation(),e.preventDefault();const t=e.target;t.active?this.showDimensions():this.hideDimensions();const i=new mr(mr.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 mr(mr.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 Ee`
8580
+ `:Ue}getWebComponentName(){return oh.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(tb.MODULE_FAILED_ERRORS.AUTHENTICATION_FAILED,{errorCode:tN.AuthenticationFailedError,message:e}),await this.disconnectedCallback()}async setupRenderEngine(){window.epigraph.logger.info({title:"Initiliazing Render Engine"}),this._renderEngine=new nF(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,a=500;i.style.transition=`opacity ${a/1e3}s ease-in-out`,i.style.opacity="0",setTimeout(()=>i.style.visibility="hidden",a)})}_sendAnalyticsEventsOnModuleLoadStart(){const e=new CM(!1);this._epigraphAnalytics.sendEvent(e)}_sendAnalyticsEventsOnModuleLoadFinish(){const e=this.timeElapsedSinceLoadBegin,t=new TM(!1,e);this._epigraphAnalytics.sendEvent(t);const i=window.epigraph.isSessionWebGL2Compatible();let a;this.viewInYourSpaceManager.canLaunchAr()?a=i?uc.SUPPORT_TYPE.AR_WEBGL2:uc.SUPPORT_TYPE.AR:a=i?uc.SUPPORT_TYPE.QR_WEBGL2:uc.SUPPORT_TYPE.QR;const l=new uc(a);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.playInteractionPrompt=!0},1e3),this._sendAnalyticsEventsOnModuleLoadFinish()}_onDimensionsToolControlClick(e){e.stopPropagation(),e.preventDefault();const t=e.target;t.active?this.showDimensions():this.hideDimensions();const i=new mr(mr.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 mr(mr.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 Ee`
8578
8581
  <div id="appManagersContainer" class="app-managers-container">
8579
8582
  ${this._renderDimensionsManager()}
8580
8583
 
@@ -8695,7 +8698,7 @@ void main() {
8695
8698
  class="splash-screen"
8696
8699
  current-progress=${this._loadingProgress}
8697
8700
  ></epg-loader-scene>
8698
- `}async _resetSession(){this._autoGeneratedProxyMesh?.scale.set(1,1,1),this._autoGeneratedProxyMesh?.position.set(0,0,0),this._autoGeneratedProxyMesh?.updateMatrixWorld(),await this.renderEngine.emptyScene()}_setupEventListeners(){window.epigraph.logger.info({title:"Setting up event listeners for this app."}),this.addEventListener(this.eventsManager.sceneBoundsChanged.name,()=>{this.cameraManager.fitCameraToSceneBounds()}),this.addEventListener(this.eventsManager.structureNodeAddedEvent.name,()=>{this._onSceneHierarchyUpdate()}),this.addEventListener(this.eventsManager.experienceUpdatedEvent.name,()=>{this.renderEngine.accumulativeShadows&&!this.renderEngine.accumulativeShadows.camera&&(this.renderEngine.accumulativeShadows.camera=this.cameraManager.getCameras().main),this.renderEngine.accumulativeShadows?.reset(),this.renderEngine.contactShadows&&this.renderEngine.contactShadows.updateSettings(this._experienceData.productSettings.shadows.contactShadows),this.cameraManager.updateCameraSettings(this._experienceData.productSettings.camera),this.productSettings.camera.initial&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!0})}),this.addEventListener(this.eventsManager.dimensionsPositionChanged.name,this.__onDimensionsPositionChanged),this.addEventListener(this.eventsManager.cameraControlsStart.name,(e=>{switch(e.detail.type){case"rotate":(this.sessionState==="default"||this.sessionState==="cameraUpdate")&&(this.style.cursor="grabbing");break;case"pan":(this.sessionState==="default"||this.sessionState==="cameraUpdate")&&(this.style.cursor="move"),this.showCameraAim();break}this.hotspotsManager&&this.hotspotsManager.activeHotspot&&this.sessionState==="default"&&this.hotspotsManager.closeActiveHotspot()})),this.addEventListener(this.eventsManager.inputEnd.name,()=>{(this.sessionState==="default"||this.sessionState==="cameraUpdate")&&(this.style.cursor="grab"),this.hideCameraAim()}),this.addEventListener(this.eventsManager.hotspotOpenEvent.name,()=>{this.hideDimensions(!0)}),this.addEventListener(this.eventsManager.assetLoadProgress.name,(e=>{this._loadingProgress=e.detail.progress})),this.addEventListener(this.eventsManager.hotspotOpenEvent.name,(e=>{this._hasActiveHotspot=!0,this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)})),this.addEventListener(this.eventsManager.hotspotNextEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)})),this.addEventListener(this.eventsManager.hotspotPreviousEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)})),this.addEventListener(this.eventsManager.hotspotClosedEvent.name,(e=>{this._hasActiveHotspot=!1;const i=this.hotspotsManager.hotspots.get(e.detail.hotspotId)?.animation;if(i)for(const a of i){const l=a.loop,h=a.exit;l&&this.stopAnimationByName(l);let d;h?d=this.playAnimationByName({animationName:h}):d=this.playAnimationByName({animationName:a.entry,reverse:!0}),setTimeout(()=>{d?.targetAnimationAction.reset(),this._activeAnimations.delete(d?.animationName??"")},this._animationFadeDurationInMiliseconds)}})),this.appCanvasContainerElemRef.onpointerdown=e=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp(),this.eventsManager.inputStart.fire({event:e})},this.appCanvasContainerElemRef.onpointermove=e=>{this.eventsManager.inputMove.fire({event:e})},this.appCanvasContainerElemRef.onpointerup=e=>{this.eventsManager.inputEnd.fire({event:e})},this.appCanvasContainerElemRef.onpointerout=e=>{this.eventsManager.inputEnd.fire({event:e})},this.cameraManager.mainCameraControls.addEventListener("update",this._onCameraPositionUpdate.bind(this)),this.hotspotsManager?.addEventListener("pointerdown",()=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp()})}_onCameraPositionUpdate(){this.dimensionsManager?.enabled&&this.dimensionsManager.repopulateDimensionIndicators(),this.hotspotsManager?.enabled&&this.hotspotsManager.recalculateHotspotPositions()}_setupAutoGeneratedProxyContainers(){const e=new Wn,t=new wi({color:65280,opacity:.5,transparent:!0});this._autoGeneratedProxyMesh=new ot(e,t)}get productSettings(){return this._experienceData?this._experienceData.productSettings:this._defaultProductSettings.productSettings}async _setup(){window.epigraph.logger.table({title:"Setting up..."}),this._eventsManager=new CH(this),this._sceneManager=new zU(this),this._sceneManager.initialize(),await this._sceneManager.sceneStructure.setupRootEntity().catch(e=>{this.onLoadFailed(C0.SCENE_LOAD_ERROR,e)}),this._cameraManager=new oF({appWcRef:this}),this._cameraManager.initialize(),await this.setupRenderEngine(),await this._cameraManager.setup({mainRenderer:this.renderEngine.mainRenderer,screenshotRenderer:this.renderEngine.screenshotRenderer,cameraSettings:this.productSettings.camera}),this._setupAutoGeneratedProxyContainers(),this._setupEventListeners()}_resolveAnimationsOnHotspotEntry(e){this.stopAllAnimations();for(const t of e)this._activeAnimations.get(t.entry)||this.playAnimationByName({animationName:t.entry,clampWhenFinished:!0}),setTimeout(()=>{this._activeAnimations.delete(t.entry),this._activeAnimations.get(t.loop)?.loop||this.playAnimationByName({animationName:t.loop,loop:!0})},this._animationFadeDurationInMiliseconds)}_renderDimensionsManager(){let e=Ue;return this.featuresToEnable.dimensions&&(mF.setupWebComponent(),e=Ee`
8701
+ `}async _resetSession(){this._autoGeneratedProxyMesh?.scale.set(1,1,1),this._autoGeneratedProxyMesh?.position.set(0,0,0),this._autoGeneratedProxyMesh?.updateMatrixWorld(),await this.renderEngine.emptyScene()}_setupEventListeners(){window.epigraph.logger.info({title:"Setting up event listeners for this app."}),this.addEventListener(this.eventsManager.sceneBoundsChanged.name,()=>{this.cameraManager.fitCameraToSceneBounds()}),this.addEventListener(this.eventsManager.structureNodeAddedEvent.name,()=>{this._onSceneHierarchyUpdate()}),this.addEventListener(this.eventsManager.experienceUpdatedEvent.name,()=>{this.renderEngine.accumulativeShadows&&!this.renderEngine.accumulativeShadows.camera&&(this.renderEngine.accumulativeShadows.camera=this.cameraManager.getCameras().main),this.renderEngine.accumulativeShadows?.reset(),this.renderEngine.contactShadows&&this.renderEngine.contactShadows.updateSettings(this._experienceData.productSettings.shadows.contactShadows),this.cameraManager.updateCameraSettings(this._experienceData.productSettings.camera),this.productSettings.camera.initial&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!0})}),this.addEventListener(this.eventsManager.dimensionsPositionChanged.name,this.__onDimensionsPositionChanged),this.addEventListener(this.eventsManager.cameraControlsStart.name,(e=>{switch(e.detail.type){case"rotate":(this.sessionState==="default"||this.sessionState==="cameraUpdate")&&(this.style.cursor="grabbing");break;case"pan":(this.sessionState==="default"||this.sessionState==="cameraUpdate")&&(this.style.cursor="move"),this.showCameraAim();break}this.hotspotsManager&&this.hotspotsManager.activeHotspot&&this.sessionState==="default"&&this.hotspotsManager.closeActiveHotspot()})),this.addEventListener(this.eventsManager.inputEnd.name,()=>{(this.sessionState==="default"||this.sessionState==="cameraUpdate")&&(this.style.cursor="grab"),this.hideCameraAim()}),this.addEventListener(this.eventsManager.hotspotOpenEvent.name,()=>{this.hideDimensions(!0)}),this.addEventListener(this.eventsManager.assetLoadProgress.name,(e=>{this._loadingProgress=e.detail.progress})),this.addEventListener(this.eventsManager.hotspotOpenEvent.name,(e=>{this._hasActiveHotspot=!0,this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)})),this.addEventListener(this.eventsManager.hotspotNextEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)})),this.addEventListener(this.eventsManager.hotspotPreviousEvent.name,(e=>{this._resolveAnimationsOnHotspotEntry(e.detail.hotspot.animation)})),this.addEventListener(this.eventsManager.hotspotClosedEvent.name,(e=>{this._hasActiveHotspot=!1;const i=this.hotspotsManager.hotspots.get(e.detail.hotspotId)?.animation;if(i)for(const a of i){const l=a.loop,h=a.exit;l&&this.stopAnimationByName(l);let d;h?d=this.playAnimationByName({animationName:h}):d=this.playAnimationByName({animationName:a.entry,reverse:!0}),setTimeout(()=>{d?.targetAnimationAction.reset(),this._activeAnimations.delete(d?.animationName??"")},this._animationFadeDurationInMiliseconds)}})),this.appCanvasContainerElemRef.onpointerdown=e=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp(),this.eventsManager.inputStart.fire({event:e})},this.appCanvasContainerElemRef.onpointermove=e=>{this.eventsManager.inputMove.fire({event:e})},this.appCanvasContainerElemRef.onpointerup=e=>{this.eventsManager.inputEnd.fire({event:e})},this.appCanvasContainerElemRef.onpointerout=e=>{this.eventsManager.inputEnd.fire({event:e})},this.cameraManager.mainCameraControls.addEventListener("update",this._onCameraPositionUpdate.bind(this)),this.hotspotsManager?.addEventListener("pointerdown",()=>{this._isSceneInteractedWith=!0,this.playInteractionPrompt=!1,this.hideHelp()})}_onCameraPositionUpdate(){this.dimensionsManager?.enabled&&this.dimensionsManager.repopulateDimensionIndicators(),this.hotspotsManager?.enabled&&this.hotspotsManager.recalculateHotspotPositions()}_setupAutoGeneratedProxyContainers(){const e=new Wn,t=new wi({color:65280,opacity:.5,transparent:!0});this._autoGeneratedProxyMesh=new ot(e,t)}get productSettings(){return this._experienceData?this._experienceData.productSettings:this._defaultProductSettings.productSettings}async _setup(){window.epigraph.logger.table({title:"Setting up..."}),this._eventsManager=new CH(this),this._sceneManager=new zU(this),this._sceneManager.initialize(),await this._sceneManager.sceneStructure.setupRootEntity().catch(e=>{this.onLoadFailed(C0.SCENE_LOAD_ERROR,e)}),this._cameraManager=new oF({appWcRef:this}),this._cameraManager.initialize(),await this.setupRenderEngine(),await this._cameraManager.setup({mainRenderer:this.renderEngine.mainRenderer,screenshotRenderer:this.renderEngine.screenshotRenderer,cameraSettings:this.productSettings.camera}),this._setupAutoGeneratedProxyContainers(),this._setupEventListeners(),this._setupVisibilityObserver()}_resolveAnimationsOnHotspotEntry(e){this.stopAllAnimations();for(const t of e)this._activeAnimations.get(t.entry)||this.playAnimationByName({animationName:t.entry,clampWhenFinished:!0}),setTimeout(()=>{this._activeAnimations.delete(t.entry),this._activeAnimations.get(t.loop)?.loop||this.playAnimationByName({animationName:t.loop,loop:!0})},this._animationFadeDurationInMiliseconds)}_renderDimensionsManager(){let e=Ue;return this.featuresToEnable.dimensions&&(mF.setupWebComponent(),e=Ee`
8699
8702
  <dimensions-manager
8700
8703
  id="dimensionsManager"
8701
8704
  .appWcRef=${this}
@@ -8728,7 +8731,7 @@ void main() {
8728
8731
  <div class="view-in-your-space-button ${this._hasActiveHotspot?"hide":""}">
8729
8732
  <slot name=${c0.slotCustomViewInYourSpaceButton.name} @click=${this.launchAR}></slot>
8730
8733
  </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(!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`
8734
+ `}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(){if(!this.appCanvasContainerElemRef)return;const{width:e,height:t}=this.appCanvasContainerElemRef.getBoundingClientRect();if(!(e===0||t===0)){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()}_setupVisibilityObserver(){new IntersectionObserver(()=>{this.isAppReady&&(window.epigraph.logger.info({title:"Component became visible, re-calculating scene hierarchy.",contextOverride:this._loggerContext}),this._onSceneHierarchyUpdate(),this.productSettings.camera.initial&&this.cameraManager.moveCameraToLocation({newCameraTransforms:this.productSettings.camera.initial,transition:!0}))}).observe(this)}_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){let t=this.sceneManager.sceneStructure.getEntityForAssetId(e.assetId);if(!t){const a=this._experienceData.getAssetCollection().getAssetByName(e.asset);if(!a||(await a.load(),t=await this.spawnAssetInScene(a),!t))return Promise.reject(!1)}const i=e.finish;return i?(await t.selectAssetFinish(i),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
8735
  ${Et.getCustomStylesTemplate()}
8733
8736
 
8734
8737
  <epg-button-icon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/solutions",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-solutions.js",
6
6
  "files": [