@epigraph/configurator 1.7.6 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5084,7 +5084,7 @@ ${a.join(`
|
|
|
5084
5084
|
<!-- The overlay/backdrop in the background -->
|
|
5085
5085
|
<div class="drawerOverlay" id="drawerOverlay"></div>
|
|
5086
5086
|
</div>
|
|
5087
|
-
`;class FAe extends HTMLElement{#e=void 0;#i=void 0;#t=void 0;#r=void 0;#a=void 0;#o=void 0;#n=new CustomEvent("drawerClosed");#s="0%";constructor(){super(),this.attachShadow({mode:"open"}),this.#l()}#l(){this.shadowRoot.appendChild(CV.content.cloneNode(!0)),this.#e=this.shadowRoot.getElementById("drawerMainContainer"),this.#i=this.shadowRoot.getElementById("dragBar"),this.#t=this.shadowRoot.getElementById("drawerDialog"),this.#r=this.shadowRoot.getElementById("drawerOverlay"),this.#a=this.shadowRoot.getElementById("bottomDrawerContent"),this.#i.addEventListener("touchstart",e=>{this.#c(e)}),this.#i.addEventListener("touchmove",e=>{this.#u(e)}),this.#i.addEventListener("touchend",e=>{this.#f(e)}),this.#r.addEventListener("click",e=>{this.closeDrawer()})}#h(){this.#t.style.transform="translateY(100vh)"}connectedCallback(){this.#h()}disconnectedCallback(){this.#i.removeEventListener("touchstart",e=>{this.#c(e)}),this.#i.removeEventListener("touchmove",e=>{this.#u(e)}),this.#i.removeEventListener("touchend",e=>{this.#f(e)}),this.#r.removeEventListener("click",e=>{this.closeDrawer()})}static get observedAttributes(){return["open","initial-screen-coverage"]}attributeChangedCallback(e,t,n){switch(e){case"open":t!==n&&(n.toLowerCase()==="false"?(this.closeDrawer(),this.dispatchEvent(this.#n)):n.toLowerCase()==="true"&&this.openDrawer());break;case"initial-screen-coverage":t!==n&&(this.#s=n);break}}#c(e){this.#t.style.transition="none",this.#o=e.changedTouches[0].clientY}#u(e){let t=e.touches[0].clientY,n=window.screen.height-t,i=n/this.#t.clientHeight;n<=this.#t.clientHeight&&(this.#t.style.transform=`translate(0px, ${this.#t.clientHeight-n}px)`),this.#r.style.opacity=i}#f(e){e.changedTouches[0].clientY>=this.#o?this.closeDrawer():(this.#t.style.transition="transform 500ms ease-in-out",this.#t.style.transform="translateY(0%)",this.#a.style.height="100%")}openDrawer(){this.#e.style.opacity="1",this.#r.style.opacity="1",this.#t.style.transition="transform 500ms ease-in-out",this.#t.style.transform=`translateY(${this.#s})`,this.#a.style.height=`${100-parseInt(this.#s.replaceAll("%",""))}%`,this.#r.style.pointerEvents="all",this.setAttribute("open","true")}closeDrawer(){this.#r.style.opacity="0",this.#t.style.transition="transform 500ms ease-in-out",this.#t.style.transform=`translateY(${this.#t.clientHeight}px)`,this.#r.style.pointerEvents="none",this.setAttribute("open","false")}}window.customElements.define("bottom-drawer",FAe);const YS=({zIndex:r,open:e,setOpen:t,heading:n,inputValue:i,buttonText:a,inputPlaceholder:s,formFieldExists:o,dualOptions:l,modalText:u,onSubmit:f=()=>{},onCancel:h=()=>{},shareModal:p,loading:m})=>{Jt(S=>S.CORE_API),oe.useState(e);const[y,E]=oe.useState(""),[b,v]=oe.useState(m||null);oe.useEffect(()=>(v(m),()=>{}),[m]);function x(S){E(S.target.value)}return ne(fi,{children:ne("div",{className:e===!0?"uiModal open":"uiModal",children:[ne("div",{className:"modalDialog",children:[ne("div",{className:"modalCloseContainer",children:ne("button",{onClick:()=>{h(),t(!1)},children:ne("img",{src:Vr+"/Icon/X.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:69,columnNumber:15},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:63,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:62,columnNumber:11},globalThis),ne("h2",{className:"modalHeading",children:n},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:72,columnNumber:11},globalThis),u&&ne("p",{className:"modalText",children:u},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:73,columnNumber:25},globalThis),ne("div",{className:p?"shareModal":"noShareModal",children:b?ne("div",{className:"shareModalChildDiv",children:ne("img",{className:"shareModalLoaderImg",src:Vr+"/Animation/Loading.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:77,columnNumber:17},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:76,columnNumber:15},globalThis):ne(fi,{children:[o&&(i!==void 0?ne("input",{type:"text",value:i,readOnly:!0},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:86,columnNumber:21},globalThis):ne("input",{placeholder:s||"",type:"text",value:y,onChange:S=>{x(S)}},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:88,columnNumber:21},globalThis)),l?ne("div",{className:"UIModalButtonParentDiv",children:[ne("button",{role:"button",onClick:()=>{t(!1),f()},children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:100,columnNumber:21},globalThis),ne("button",{role:"button",onClick:()=>{t(!1),h()},className:"uiModalCancelButton",children:"Cancel"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:109,columnNumber:21},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:99,columnNumber:19},globalThis):ne("button",{role:"button",onClick:()=>{t(!1),f()},children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:121,columnNumber:19},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:83,columnNumber:15},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:74,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:61,columnNumber:9},globalThis),ne("div",{className:"modalOverlay"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:135,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:60,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:59,columnNumber:5},globalThis)};var dl="splide",MV=`data-${dl}`,Mx=1,zAe=2,ML=3,RL=4,IL=5,GAe={CREATED:Mx,MOUNTED:zAe,IDLE:ML,MOVING:RL,DESTROYED:IL},RV=10,HAe=20;function LT(r){r.length=0}function qR(r){return!NV(r)&&typeof r=="object"}function OJ(r){return Array.isArray(r)}function VAe(r){return typeof r=="function"}function yy(r){return typeof r=="string"}function IV(r){return typeof r>"u"}function NV(r){return r===null}function DV(r){return r instanceof HTMLElement}function wI(r){return OJ(r)?r:[r]}function My(r,e){wI(r).forEach(e)}function hU(r,e){return r.indexOf(e)>-1}function CR(r,e){return r.push(...wI(e)),r}var jAe=Array.prototype;function UT(r,e,t){return jAe.slice.call(r,e,t)}function QAe(r,e){return UT(r).filter(e)[0]}function Fx(r,e,t){r&&My(e,n=>{n&&r.classList[t?"add":"remove"](n)})}function Ay(r,e){Fx(r,yy(e)?e.split(" "):e,!0)}function fU(r,e){My(e,r.appendChild.bind(r))}function OV(r,e){My(r,t=>{const n=e.parentNode;n&&n.insertBefore(t,e)})}function PV(r,e){return DV(r)&&(r.msMatchesSelector||r.matches).call(r,e)}function PJ(r,e){return r?UT(r.children).filter(t=>PV(t,e)):[]}function Im(r,e){return e?PJ(r,e)[0]:r.firstElementChild}function ub(r,e,t){if(r){let n=Object.keys(r);n=t?n.reverse():n;for(let i=0;i<n.length;i++){const a=n[i];if(a!=="__proto__"&&e(r[a],a)===!1)break}}return r}function d4(r){return UT(arguments,1).forEach(e=>{ub(e,(t,n)=>{r[n]=e[n]})}),r}function rb(r,e){return ub(e,(t,n)=>{OJ(t)?r[n]=t.slice():qR(t)?r[n]=rb(qR(r[n])?r[n]:{},t):r[n]=t}),r}function kd(r,e){r&&My(e,t=>{r.removeAttribute(t)})}function ca(r,e,t){qR(e)?ub(e,(n,i)=>{ca(r,i,n)}):NV(t)?kd(r,e):r.setAttribute(e,String(t))}function $x(r,e,t){const n=document.createElement(r);return e&&(yy(e)?Ay(n,e):ca(n,e)),t&&fU(t,n),n}function Xu(r,e,t){if(IV(t))return getComputedStyle(r)[e];if(!NV(t)){const{style:n}=r;t=`${t}`,n[e]!==t&&(n[e]=t)}}function NL(r,e){Xu(r,"display",e)}function WAe(r){r.setActive&&r.setActive()||r.focus({preventScroll:!0})}function XR(r,e){return r.getAttribute(e)}function BY(r,e){return r&&r.classList.contains(e)}function nu(r){return r.getBoundingClientRect()}function BT(r){My(r,e=>{e&&e.parentNode&&e.parentNode.removeChild(e)})}function YAe(r,e){if(yy(e)){const t=$x("div",{style:`width: ${e}; position: absolute;`},r);e=nu(t).width,BT(t)}return e}function LJ(r){return Im(new DOMParser().parseFromString(r,"text/html").body)}function Kv(r,e){r.preventDefault(),e&&(r.stopPropagation(),r.stopImmediatePropagation())}function X0(r,e){return r&&r.querySelector(e)}function LV(r,e){return UT(r.querySelectorAll(e))}function $R(r,e){Fx(r,e,!1)}function Yv(r){return yy(r)?r:r?`${r}px`:""}function KR(r,e=""){if(!r)throw new Error(`[${dl}] ${e}`)}function p4(r){setTimeout(r)}var m4=()=>{};function kY(r){return requestAnimationFrame(r)}var{min:ZR,max:JR,floor:g4,ceil:eI,abs:Zu}=Math;function qAe(r,e,t){return Zu(r-e)<t}function MR(r,e,t,n){const i=ZR(e,t),a=JR(e,t);return n?i<r&&r<a:i<=r&&r<=a}function dR(r,e,t){const n=ZR(e,t),i=JR(e,t);return ZR(JR(n,r),i)}function FY(r){return+(r>0)-+(r<0)}function UJ(r,e){return My(e,t=>{r=r.replace("%s",`${t}`)}),r}function UV(r){return r<10?`0${r}`:`${r}`}var zY={};function XAe(r){return`${r}${UV(zY[r]=(zY[r]||0)+1)}`}function $Ae(){let r={};function e(o,l,u,f=RV){s(o,(h,p)=>{r[h]=r[h]||[],CR(r[h],{_event:h,_callback:l,_namespace:p,_priority:f,_key:u}).sort((m,y)=>m._priority-y._priority)})}function t(o,l){s(o,(u,f)=>{const h=r[u];r[u]=h&&h.filter(p=>p._key?p._key!==l:l||p._namespace!==f)})}function n(o){ub(r,(l,u)=>{t(u,o)})}function i(o){(r[o]||[]).forEach(l=>{l._callback.apply(l,UT(arguments,1))})}function a(){r={}}function s(o,l){wI(o).join(" ").split(" ").forEach(u=>{const f=u.split(".");l(f[0],f[1])})}return{on:e,off:t,offBy:n,emit:i,destroy:a}}var Vd="mounted",v4="ready",jm="move",mT="moved",BJ="shifted",BV="click",kJ="active",FJ="inactive",zJ="visible",GJ="hidden",HJ="slide:keydown",Ka="refresh",Yl="updated",xb="resize",kV="resized",VJ="repositioned",jJ="drag",QJ="dragging",WJ="dragged",FV="scroll",kT="scrolled",zV="destroy",YJ="arrows:mounted",qJ="arrows:updated",XJ="pagination:mounted",$J="pagination:updated",GV="navigation:mounted",KJ="autoplay:play",ZJ="autoplay:playing",JJ="autoplay:pause",HV="lazyload:loaded";function ms(r){const{event:e}=r,t={};let n=[];function i(f,h,p){e.on(f,h,t,p)}function a(f){e.off(f,t)}function s(f,h,p,m){l(f,h,(y,E)=>{n.push([y,E,p,m]),y.addEventListener(E,p,m)})}function o(f,h,p){l(f,h,(m,y)=>{n=n.filter(E=>E[0]===m&&E[1]===y&&(!p||E[2]===p)?(m.removeEventListener(y,E[2],E[3]),!1):!0)})}function l(f,h,p){My(f,m=>{m&&h.split(" ").forEach(p.bind(null,m))})}function u(){n=n.filter(f=>o(f[0],f[1])),e.offBy(t)}return e.on(zV,u,t),{on:i,off:a,emit:e.emit,bind:s,unbind:o,destroy:u}}function VV(r,e,t,n){const{now:i}=Date;let a,s=0,o,l=!0,u=0;function f(){if(!l){const v=i()-a;if(v>=r?(s=1,a=i()):s=v/r,t&&t(s),s===1&&(e(),n&&++u>=n))return p();kY(f)}}function h(v){!v&&y(),a=i()-(v?s*r:0),l=!1,kY(f)}function p(){l=!0}function m(){a=i(),s=0,t&&t(s)}function y(){cancelAnimationFrame(o),s=0,o=0,l=!0}function E(v){r=v}function b(){return l}return{start:h,rewind:m,pause:p,cancel:y,set:E,isPaused:b}}function KAe(r){let e=r;function t(i){e=i}function n(i){return hU(wI(i),e)}return{set:t,is:n}}function eee(r,e){let t;function n(){t||(t=VV(e||0,()=>{r.apply(this,arguments),t=null},null,1),t.start())}return n}function ZAe(r,e,t){const n=eee(f);let i,a,s;function o(){try{rb(t,JSON.parse(XR(r.root,MV)))}catch(m){KR(!1,m.message)}i=rb({},t);const{breakpoints:p}=t;if(p){const m=t.mediaQuery==="min";a=Object.keys(p).sort((y,E)=>m?+E-+y:+y-+E).map(y=>[y,matchMedia(`(${m?"min":"max"}-width:${y}px)`)]),f()}}function l(){a&&addEventListener("resize",n)}function u(p){p&&removeEventListener("resize",n)}function f(){const p=QAe(a,m=>m[1].matches)||[];p[0]!==s&&h(s=p[0])}function h(p){const m=t.breakpoints[p]||i;m.destroy?(r.options=i,r.destroy(m.destroy==="completely")):(r.state.is(IL)&&(u(!0),r.mount()),r.options=m)}return{setup:o,mount:l,destroy:u}}var GY="rtl",jV="ttb",JAe={marginRight:["marginBottom","marginLeft"],autoWidth:["autoHeight"],fixedWidth:["fixedHeight"],paddingLeft:["paddingTop","paddingRight"],paddingRight:["paddingBottom","paddingLeft"],width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:["ArrowUp","ArrowRight"],ArrowRight:["ArrowDown","ArrowLeft"]};function e0e(r,e,t){function n(a,s){const{direction:o}=t,l=o===GY&&!s?1:o===jV?0:-1;return JAe[a][l]||a}function i(a){return a*(t.direction===GY?1:-1)}return{resolve:n,orient:i}}var C2=dl,t0e=`${dl}__slider`,n0e=`${dl}__track`,i0e=`${dl}__list`,dU=`${dl}__slide`,tee=`${dU}--clone`,r0e=`${dU}__container`,nee=`${dl}__arrows`,QV=`${dl}__arrow`,iee=`${QV}--prev`,ree=`${QV}--next`,aee=`${dl}__pagination`,a0e=`${aee}__page`,see=`${dl}__progress`,s0e=`${see}__bar`,o0e=`${dl}__autoplay`,l0e=`${dl}__play`,c0e=`${dl}__pause`,u0e=`${dl}__spinner`,h0e="is-initialized",gT="is-active",oee="is-prev",lee="is-next",y4="is-visible",A4="is-loading",f0e=[gT,y4,oee,lee,A4],d0e={slide:dU,clone:tee,arrows:nee,arrow:QV,prev:iee,next:ree,pagination:aee,page:a0e,spinner:u0e};function p0e(r,e,t){const{on:n}=ms(r),{root:i}=r,a={},s=[];let o,l,u,f;function h(){b(),v(),Ay(i,o=S())}function p(){n(Ka,y,RV-2),n(Yl,E)}function m(){[i,u,f].forEach(_=>{kd(_,"style")}),LT(s),$R(i,o)}function y(){m(),h()}function E(){$R(i,o),Ay(i,o=S())}function b(){l=Im(i,`.${t0e}`),u=X0(i,`.${n0e}`),f=Im(u,`.${i0e}`),KR(u&&f,"A track/list element is missing."),CR(s,PJ(f,`.${dU}:not(.${tee})`));const _=x(`.${o0e}`),w=x(`.${nee}`);d4(a,{root:i,slider:l,track:u,list:f,slides:s,arrows:w,autoplay:_,prev:X0(w,`.${iee}`),next:X0(w,`.${ree}`),bar:X0(x(`.${see}`),`.${s0e}`),play:X0(_,`.${l0e}`),pause:X0(_,`.${c0e}`)})}function v(){const _=i.id||XAe(dl);i.id=_,u.id=u.id||`${_}-track`,f.id=f.id||`${_}-list`}function x(_){return Im(i,_)||Im(l,_)}function S(){return[`${C2}--${t.type}`,`${C2}--${t.direction}`,t.drag&&`${C2}--draggable`,t.isNavigation&&`${C2}--nav`,gT]}return d4(a,{setup:h,mount:p,destroy:m})}var pU="role",vT="aria-controls",DL="aria-current",yT="aria-label",cee="aria-hidden",tI="tabindex",m0e="disabled",uee="aria-orientation",OL=[pU,vT,DL,yT,cee,uee,tI,m0e],CI="slide",FT="loop",mU="fade";function g0e(r,e,t,n){const{on:i,emit:a,bind:s,destroy:o}=ms(r),{Components:l,root:u,options:f}=r,{isNavigation:h,updateOnMove:p}=f,{resolve:m}=l.Direction,y=XR(n,"style"),E=t>-1,b=Im(n,`.${r0e}`),v=f.focusableNodes&&LV(n,f.focusableNodes);let x;function S(){E||(n.id=`${u.id}-slide${UV(e+1)}`),s(n,"click keydown",j=>{a(j.type==="click"?BV:HJ,z,j)}),i([Ka,VJ,BJ,mT,kT],N),i(GV,w),p&&i(jm,R)}function _(){x=!0,o(),$R(n,f0e),kd(n,OL),ca(n,"style",y)}function w(){const j=E?t:e,Q=UJ(f.i18n.slideX,j+1),H=r.splides.map(K=>K.splide.root.id).join(" ");ca(n,yT,Q),ca(n,vT,H),ca(n,pU,"menuitem"),L(k())}function R(){x||N()}function N(){if(!x){const{index:j}=r;L(k()),I(F()),Fx(n,oee,e===j-1),Fx(n,lee,e===j+1)}}function L(j){j!==BY(n,gT)&&(Fx(n,gT,j),h&&ca(n,DL,j||null),a(j?kJ:FJ,z))}function I(j){const Q=!j&&(!k()||E);ca(n,cee,Q||null),ca(n,tI,!Q&&f.slideFocus?0:null),v&&v.forEach(H=>{ca(H,tI,Q?-1:null)}),j!==BY(n,y4)&&(Fx(n,y4,j),a(j?zJ:GJ,z))}function D(j,Q,H){Xu(H&&b||n,j,Q)}function k(){const{index:j}=r;return j===e||f.cloneStatus&&j===t}function F(){if(r.is(mU))return k();const j=nu(l.Elements.track),Q=nu(n),H=m("left"),K=m("right");return g4(j[H])<=eI(Q[H])&&g4(Q[K])<=eI(j[K])}function U(j,Q){let H=Zu(j-e);return!E&&(f.rewind||r.is(FT))&&(H=ZR(H,r.length-H)),H<=Q}const z={index:e,slideIndex:t,slide:n,container:b,isClone:E,mount:S,destroy:_,update:N,style:D,isWithin:U};return z}function v0e(r,e,t){const{on:n,emit:i,bind:a}=ms(r),{slides:s,list:o}=e.Elements,l=[];function u(){f(),n(Ka,p),n([Vd,Ka],()=>{l.sort((D,k)=>D.index-k.index)})}function f(){s.forEach((D,k)=>{y(D,k,-1)})}function h(){_(D=>{D.destroy()}),LT(l)}function p(){h(),f()}function m(){_(D=>{D.update()})}function y(D,k,F){const U=g0e(r,k,F,D);U.mount(),l.push(U)}function E(D){return D?w(k=>!k.isClone):l}function b(D){const{Controller:k}=e,F=k.toIndex(D),U=k.hasFocus()?1:t.perPage;return w(z=>MR(z.index,F,F+U-1))}function v(D){return w(D)[0]}function x(D,k){My(D,F=>{if(yy(F)&&(F=LJ(F)),DV(F)){const U=s[k];U?OV(F,U):fU(o,F),Ay(F,t.classes.slide),N(F,i.bind(null,xb))}}),i(Ka)}function S(D){BT(w(D).map(k=>k.slide)),i(Ka)}function _(D,k){E(k).forEach(D)}function w(D){return l.filter(VAe(D)?D:k=>yy(D)?PV(k.slide,D):hU(wI(D),k.index))}function R(D,k,F){_(U=>{U.style(D,k,F)})}function N(D,k){const F=LV(D,"img");let{length:U}=F;U?F.forEach(z=>{a(z,"load error",()=>{--U||k()})}):k()}function L(D){return D?s.length:l.length}function I(){return l.length>t.perPage}return{mount:u,destroy:h,update:m,register:y,get:E,getIn:b,getAt:v,add:x,remove:S,forEach:_,filter:w,style:R,getLength:L,isEnough:I}}function y0e(r,e,t){const{on:n,bind:i,emit:a}=ms(r),{Slides:s}=e,{resolve:o}=e.Direction,{root:l,track:u,list:f}=e.Elements,{getAt:h}=s;let p,m;function y(){E(),i(window,"resize load",eee(a.bind(this,xb))),n([Yl,Ka],E),n(xb,b)}function E(){m=null,p=t.direction===jV,Xu(l,"maxWidth",Yv(t.width)),Xu(u,o("paddingLeft"),x(!1)),Xu(u,o("paddingRight"),x(!0)),b()}function b(){const z=nu(l);(!m||m.width!==z.width||m.height!==z.height)&&(Xu(u,"height",S()),s.style(o("marginRight"),Yv(t.gap)),s.style("width",w()||null),v(),m=z,a(kV))}function v(){s.style("height",R()||null,!0)}function x(z){const{padding:j}=t,Q=o(z?"right":"left");return j&&Yv(j[Q]||(qR(j)?0:j))||"0px"}function S(){let z="";return p&&(z=_(),KR(z,"height or heightRatio is missing."),z=`calc(${z} - ${x(!1)} - ${x(!0)})`),z}function _(){return Yv(t.height||nu(f).width*t.heightRatio)}function w(){return t.autoWidth?"":Yv(t.fixedWidth)||(p?"":N())}function R(){return Yv(t.fixedHeight)||(p?t.autoHeight?"":N():_())}function N(){const z=Yv(t.gap);return`calc((100%${z&&` + ${z}`})/${t.perPage||1}${z&&` - ${z}`})`}function L(){return nu(f)[o("width")]}function I(z,j){const Q=h(z||0);return Q?nu(Q.slide)[o("width")]+(j?0:F()):0}function D(z,j){const Q=h(z);if(Q){const H=nu(Q.slide)[o("right")],K=nu(f)[o("left")];return Zu(H-K)+(j?0:F())}return 0}function k(){return D(r.length-1,!0)-D(-1,!0)}function F(){const z=h(0);return z&&parseFloat(Xu(z.slide,o("marginRight")))||0}function U(z){return parseFloat(Xu(u,o(`padding${z?"Right":"Left"}`)))||0}return{mount:y,listSize:L,slideSize:I,sliderSize:k,totalSize:D,getPadding:U}}function A0e(r,e,t){const{on:n,emit:i}=ms(r),{Elements:a,Slides:s}=e,{resolve:o}=e.Direction,l=[];let u;function f(){h(),n(Ka,m),n([Yl,xb],y)}function h(){(u=v())&&(E(u),i(xb))}function p(){BT(l),LT(l)}function m(){p(),h()}function y(){u<v()&&i(Ka)}function E(x){const S=s.get().slice(),{length:_}=S;if(_){for(;S.length<x;)CR(S,S);CR(S.slice(-x),S.slice(0,x)).forEach((w,R)=>{const N=R<x,L=b(w.slide,R);N?OV(L,S[0].slide):fU(a.list,L),CR(l,L),s.register(L,R-x+(N?0:_),w.index)})}}function b(x,S){const _=x.cloneNode(!0);return Ay(_,t.classes.clone),_.id=`${r.root.id}-clone${UV(S+1)}`,_}function v(){let{clones:x}=t;if(!r.is(FT))x=0;else if(!x){const S=YAe(a.list,t[o("fixedWidth")]);x=(S&&eI(nu(a.track)[o("width")]/S)||t[o("autoWidth")]&&r.length||t.perPage)*(t.drag?(t.flickMaxPages||1)+1:2)}return x}return{mount:f,destroy:p}}function b0e(r,e,t){const{on:n,emit:i}=ms(r),{slideSize:a,getPadding:s,totalSize:o,listSize:l,sliderSize:u}=e.Layout,{resolve:f,orient:h}=e.Direction,{list:p,track:m}=e.Elements;let y;function E(){y=e.Transition,n([Vd,kV,Yl,Ka],v)}function b(){kd(p,"style")}function v(){z()||(e.Scroll.cancel(),S(r.index),i(VJ))}function x(Q,H,K,J){if(!z()){const{set:W}=r.state,V=D();Q!==H&&(y.cancel(),_(R(V,Q>H),!0)),W(RL),i(jm,H,K,Q),y.start(H,()=>{W(ML),i(mT,H,K,Q),t.trimSpace==="move"&&Q!==K&&V===D()?e.Controller.go(Q>K?">":"<",!1,J):J&&J()})}}function S(Q){_(I(Q,!0))}function _(Q,H){if(!r.is(mU)){const K=H?Q:w(Q);p.style.transform=`translate${f("X")}(${K}px)`,Q!==K&&i(BJ)}}function w(Q){if(r.is(FT)){const H=h(Q-D()),K=j(!1,Q)&&H<0,J=j(!0,Q)&&H>0;(K||J)&&(Q=R(Q,J))}return Q}function R(Q,H){const K=Q-U(H),J=u();return Q-=h(J*(eI(Zu(K)/J)||1))*(H?1:-1),Q}function N(){_(D()),y.cancel()}function L(Q){const H=e.Slides.get();let K=0,J=1/0;for(let W=0;W<H.length;W++){const V=H[W].index,$=Zu(I(V,!0)-Q);if($<=J)J=$,K=V;else break}return K}function I(Q,H){const K=h(o(Q-1)-F(Q));return H?k(K):K}function D(){const Q=f("left");return nu(p)[Q]-nu(m)[Q]+h(s(!1))}function k(Q){return t.trimSpace&&r.is(CI)&&(Q=dR(Q,0,h(u()-l()))),Q}function F(Q){const{focus:H}=t;return H==="center"?(l()-a(Q,!0))/2:+H*a(Q)||0}function U(Q){return I(Q?e.Controller.getEnd():0,!!t.trimSpace)}function z(){return r.state.is(RL)&&t.waitForTransition}function j(Q,H){H=IV(H)?D():H;const K=Q!==!0&&h(H)<h(U(!1)),J=Q!==!1&&h(H)>h(U(!0));return K||J}return{mount:E,destroy:b,move:x,jump:S,translate:_,shift:R,cancel:N,toIndex:L,toPosition:I,getPosition:D,getLimit:U,isBusy:z,exceededLimit:j}}function _0e(r,e,t){const{on:n}=ms(r),{Move:i}=e,{getPosition:a,getLimit:s}=i,{isEnough:o,getLength:l}=e.Slides,u=r.is(FT),f=r.is(CI);let h=t.start||0,p=h,m,y,E;function b(){v(),n([Yl,Ka],v,RV-1)}function v(){m=l(!0),y=t.perMove,E=t.perPage,h=dR(h,0,m-1)}function x(H,K,J){const W=_(H);if(t.useScroll)S(W,!0,!0,t.speed,J);else{const V=D(W);V>-1&&!i.isBusy()&&(K||V!==h)&&(z(V),i.move(W,V,p,J))}}function S(H,K,J,W,V){const $=K?H:U(H);e.Scroll.scroll(K||J?i.toPosition($,!0):H,W,()=>{z(i.toIndex(i.getPosition())),V&&V()})}function _(H){let K=h;if(yy(H)){const[,J,W]=H.match(/([+\-<>])(\d+)?/)||[];J==="+"||J==="-"?K=L(h+ +`${J}${+W||1}`,h,!0):J===">"?K=W?k(+W):w(!0):J==="<"&&(K=R(!0))}else K=u?H:dR(H,0,I());return K}function w(H){return N(!1,H)}function R(H){return N(!0,H)}function N(H,K){const J=y||(Q()?1:E),W=L(h+J*(H?-1:1),h);return W===-1&&f&&!qAe(a(),s(!H),1)?H?0:I():K?W:D(W)}function L(H,K,J){if(o()){const W=I();H<0||H>W?MR(0,H,K,!0)||MR(W,K,H,!0)?H=k(F(H)):u?H=y||Q()?H:H<0?-(m%E||E):m:t.rewind?H=H<0?W:0:H=-1:!J&&H!==K&&(H=y?H:k(F(K)+(H<K?-1:1)))}else H=-1;return H}function I(){let H=m-E;return(Q()||u&&y)&&(H=m-1),JR(H,0)}function D(H){return u?o()?H%m+(H<0?m:0):-1:H}function k(H){return dR(Q()?H:E*H,0,I())}function F(H){return Q()||(H=MR(H,m-E,m-1)?m-1:H,H=g4(H/E)),H}function U(H){const K=i.toIndex(H);return f?dR(K,0,I()):K}function z(H){H!==h&&(p=h,h=H)}function j(H){return H?p:h}function Q(){return!IV(t.focus)||t.isNavigation}return{mount:b,go:x,scroll:S,getNext:w,getPrev:R,getAdjacent:N,getEnd:I,setIndex:z,getIndex:j,toIndex:k,toPage:F,toDest:U,hasFocus:Q}}var E0e="http://www.w3.org/2000/svg",S0e="m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z",M2=40;function x0e(r,e,t){const{on:n,bind:i,emit:a}=ms(r),{classes:s,i18n:o}=t,{Elements:l,Controller:u}=e;let f=l.arrows,h=l.prev,p=l.next,m;const y={};function E(){b(),n(Yl,b)}function b(){if(t.arrows&&(!h||!p)&&S(),h&&p)if(y.prev)NL(f,t.arrows===!1?"none":"");else{const{id:R}=l.track;ca(h,vT,R),ca(p,vT,R),y.prev=h,y.next=p,x(),a(YJ,h,p)}}function v(){m?BT(f):(kd(h,OL),kd(p,OL))}function x(){const{go:R}=u;n([Vd,mT,Yl,Ka,kT],w),i(p,"click",()=>{R(">",!0)}),i(h,"click",()=>{R("<",!0)})}function S(){f=$x("div",s.arrows),h=_(!0),p=_(!1),m=!0,fU(f,[h,p]),OV(f,Im(t.arrows==="slider"&&l.slider||r.root))}function _(R){const N=`<button class="${s.arrow} ${R?s.prev:s.next}" type="button"><svg xmlns="${E0e}" viewBox="0 0 ${M2} ${M2}" width="${M2}" height="${M2}"><path d="${t.arrowPath||S0e}" />`;return LJ(N)}function w(){const R=r.index,N=u.getPrev(),L=u.getNext(),I=N>-1&&R<N?o.last:o.prev,D=L>-1&&R>L?o.first:o.next;h.disabled=N<0,p.disabled=L<0,ca(h,yT,I),ca(p,yT,D),a(qJ,h,p,N,L)}return{arrows:y,mount:E,destroy:v}}var T0e=`${MV}-interval`;function w0e(r,e,t){const{on:n,bind:i,emit:a}=ms(r),s=VV(t.interval,r.go.bind(r,">"),x),{isPaused:o}=s,{Elements:l}=e;let u,f,h;function p(){const{autoplay:_}=t;_&&(m(!0),m(!1),y(),_!=="pause"&&E())}function m(_){const w=_?"pause":"play",R=l[w];R&&(ca(R,vT,l.track.id),ca(R,yT,t.i18n[w]),i(R,"click",_?b:E))}function y(){const{root:_}=l;t.pauseOnHover&&i(_,"mouseenter mouseleave",w=>{u=w.type==="mouseenter",v()}),t.pauseOnFocus&&i(_,"focusin focusout",w=>{f=w.type==="focusin",v()}),n([jm,FV,Ka],s.rewind),n(jm,S)}function E(){o()&&e.Slides.isEnough()&&(s.start(!t.resetProgress),f=u=h=!1,a(KJ))}function b(_=!0){o()||(s.pause(),a(JJ)),h=_}function v(){h||(!u&&!f?E():b(!1))}function x(_){const{bar:w}=l;w&&Xu(w,"width",`${_*100}%`),a(ZJ,_)}function S(){const _=e.Slides.getAt(r.index);s.set(_&&+XR(_.slide,T0e)||t.interval)}return{mount:p,destroy:s.cancel,play:E,pause:b,isPaused:o}}function C0e(r,e,t){const{on:n}=ms(r);function i(){t.cover&&(n(HV,(l,u)=>{o(!0,l,u)}),n([Vd,Yl,Ka],s.bind(null,!0)))}function a(){s(!1)}function s(l){e.Slides.forEach(u=>{const f=Im(u.container||u.slide,"img");f&&f.src&&o(l,f,u)})}function o(l,u,f){f.style("background",l?`center/cover no-repeat url("${u.src}")`:"",!0),NL(u,l?"none":"")}return{mount:i,destroy:a}}var M0e=10,R0e=600,I0e=.6,N0e=1.5,D0e=800;function O0e(r,e,t){const{on:n,emit:i}=ms(r),{Move:a}=e,{getPosition:s,getLimit:o,exceededLimit:l}=a;let u,f;function h(){n(jm,b),n([Yl,Ka],v)}function p(S,_,w,R){const N=s();let L=1;_=_||E(Zu(S-N)),f=w,b(),u=VV(_,y,I=>{const D=s(),F=(N+(S-N)*x(I)-s())*L;a.translate(D+F),r.is(CI)&&!R&&l()&&(L*=I0e,Zu(F)<M0e&&m(l(!1)))},1),i(FV),u.start()}function m(S){p(o(!S),R0e,null,!0)}function y(){const S=s(),_=a.toIndex(S);MR(_,0,r.length-1)||a.translate(a.shift(S,_>0),!0),f&&f(),i(kT)}function E(S){return JR(S/N0e,D0e)}function b(){u&&u.cancel()}function v(){u&&!u.isPaused()&&(b(),y())}function x(S){const{easingFunc:_}=t;return _?_(S):1-Math.pow(1-S,4)}return{mount:h,destroy:b,scroll:p,cancel:v}}var Rx={passive:!1,capture:!0},P0e=5,HY=200,L0e="touchstart mousedown",cz="touchmove mousemove",uz="touchend touchcancel mouseup";function U0e(r,e,t){const{on:n,emit:i,bind:a,unbind:s}=ms(r),{Move:o,Scroll:l,Controller:u}=e,{track:f}=e.Elements,{resolve:h,orient:p}=e.Direction,{getPosition:m,exceededLimit:y}=o;let E,b,v,x,S,_,w=!1,R,N,L;function I(){a(f,cz,m4,Rx),a(f,uz,m4,Rx),a(f,L0e,k,Rx),a(f,"click",j,{capture:!0}),a(f,"dragstart",Kv),n([Vd,Yl],D)}function D(){const{drag:ue}=t;pe(!ue),S=ue==="free"}function k(ue){if(!N){const{noDrag:ce}=t,ye=$(ue),Se=!ce||!PV(ue.target,ce);R=!1,Se&&(ye||!ue.button)&&(o.isBusy()?Kv(ue,!0):(L=ye?f:window,v=null,x=null,a(L,cz,F,Rx),a(L,uz,U,Rx),o.cancel(),l.cancel(),z(ue)))}}function F(ue){if(x||i(jJ),x=ue,ue.cancelable){const ce=J(ue)-J(b);if(_){o.translate(E+V(ce));const ye=W(ue)-W(b)>HY,Se=w!==(w=y());(ye||Se)&&z(ue),i(QJ),R=!0,Kv(ue)}else{let{dragMinThreshold:ye}=t;ye=qR(ye)?ye:{mouse:0,touch:+ye||10},_=Zu(ce)>($(ue)?ye.touch:ye.mouse),Q()&&Kv(ue)}}}function U(ue){s(L,cz,F),s(L,uz,U);const{index:ce}=r;if(x){if(_||ue.cancelable&&Q()){const ye=H(ue),Se=K(ye);S?u.scroll(Se):r.is(mU)?u.go(ce+p(FY(ye))):u.go(u.toDest(Se),!0),Kv(ue)}i(WJ)}else!S&&m()!==o.toPosition(ce)&&u.go(ce,!0);_=!1}function z(ue){v=b,b=ue,E=m()}function j(ue){!N&&R&&Kv(ue,!0)}function Q(){const ue=Zu(J(x)-J(b)),ce=Zu(J(x,!0)-J(b,!0));return ue>ce}function H(ue){if(r.is(FT)||!w){const ce=b===x&&v||b,ye=J(x)-J(ce),Se=W(ue)-W(ce),Ie=W(ue)-W(x)<HY;if(Se&&Ie)return ye/Se}return 0}function K(ue){return m()+FY(ue)*ZR(Zu(ue)*(t.flickPower||600),S?1/0:e.Layout.listSize()*(t.flickMaxPages||1))}function J(ue,ce){return($(ue)?ue.touches[0]:ue)[`page${h(ce?"Y":"X")}`]}function W(ue){return ue.timeStamp}function V(ue){return ue/(w&&r.is(CI)?P0e:1)}function $(ue){return typeof TouchEvent<"u"&&ue instanceof TouchEvent}function re(){return _}function pe(ue){N=ue}return{mount:I,disable:pe,isDragging:re}}var B0e=["Left","Right","Up","Down"],VY="keydown";function k0e(r,e,t){const{on:n,bind:i,unbind:a}=ms(r),{root:s}=r,{resolve:o}=e.Direction;let l,u;function f(){h(),n(Yl,E),n(jm,y)}function h(){const{keyboard:v}=t;v&&(v==="focused"?(l=s,ca(s,tI,0)):l=window,i(l,VY,b))}function p(){a(l,VY),DV(l)&&kd(l,tI)}function m(v){u=v}function y(){const v=u;u=!0,p4(()=>{u=v})}function E(){p(),h()}function b(v){if(!u){const{key:x}=v,S=hU(B0e,x)?`Arrow${x}`:x;S===o("ArrowLeft")?r.go("<"):S===o("ArrowRight")&&r.go(">")}}return{mount:f,destroy:p,disable:m}}var PL=`${MV}-lazy`,b4=`${PL}-srcset`,F0e=`[${PL}], [${b4}]`;function z0e(r,e,t){const{on:n,off:i,bind:a,emit:s}=ms(r),o=t.lazyLoad==="sequential";let l=[],u=0;function f(){t.lazyLoad&&(p(),n(Ka,h),o||n([Vd,Ka,mT,kT],y))}function h(){m(),p()}function p(){e.Slides.forEach(x=>{LV(x.slide,F0e).forEach(S=>{const _=XR(S,PL),w=XR(S,b4);if(_!==S.src||w!==S.srcset){const R=t.classes.spinner,N=S.parentElement,L=Im(N,`.${R}`)||$x("span",R,N);ca(L,pU,"presentation"),l.push({_img:S,_Slide:x,src:_,srcset:w,_spinner:L}),!S.src&&NL(S,"none")}})}),o&&v()}function m(){u=0,l=[]}function y(){l=l.filter(x=>{const S=t.perPage*((t.preloadPages||1)+1)-1;return x._Slide.isWithin(r.index,S)?E(x):!0}),l.length||i(mT)}function E(x){const{_img:S}=x;Ay(x._Slide.slide,A4),a(S,"load error",_=>{b(x,_.type==="error")}),["srcset","src"].forEach(_=>{x[_]&&(ca(S,_,x[_]),kd(S,_==="src"?PL:b4))})}function b(x,S){const{_Slide:_}=x;$R(_.slide,A4),S||(BT(x._spinner),NL(x._img,""),s(HV,x._img,_),s(xb)),o&&v()}function v(){u<l.length&&E(l[u++])}return{mount:f,destroy:m}}function G0e(r,e,t){const{on:n,emit:i,bind:a,unbind:s}=ms(r),{Slides:o,Elements:l,Controller:u}=e,{hasFocus:f,getIndex:h}=u,p=[];let m;function y(){E(),n([Yl,Ka],E),n([jm,kT],_)}function E(){b(),t.pagination&&o.isEnough()&&(v(),i(XJ,{list:m,items:p},S(r.index)),_())}function b(){m&&(BT(m),p.forEach(w=>{s(w.button,"click")}),LT(p),m=null)}function v(){const{length:w}=r,{classes:R,i18n:N,perPage:L}=t,I=t.pagination==="slider"&&l.slider||l.root,D=f()?w:eI(w/L);m=$x("ul",R.pagination,I);for(let k=0;k<D;k++){const F=$x("li",null,m),U=$x("button",{class:R.page,type:"button"},F),z=o.getIn(k).map(Q=>Q.slide.id),j=!f()&&L>1?N.pageX:N.slideX;a(U,"click",x.bind(null,k)),ca(U,vT,z.join(" ")),ca(U,yT,UJ(j,k+1)),p.push({li:F,button:U,page:k})}}function x(w){u.go(`>${w}`,!0,()=>{const R=o.getAt(u.toIndex(w));R&&WAe(R.slide)})}function S(w){return p[u.toPage(w)]}function _(){const w=S(h(!0)),R=S(h());w&&($R(w.button,gT),kd(w.button,DL)),R&&(Ay(R.button,gT),ca(R.button,DL,!0)),i($J,{list:m,items:p},w,R)}return{items:p,mount:y,destroy:b,getAt:S,update:_}}var H0e=[" ","Enter","Spacebar"];function V0e(r,e,t){const{list:n}=e.Elements,i=[];function a(){r.splides.forEach(m=>{!m.isParent&&l(m.splide)}),t.isNavigation&&u()}function s(){kd(n,OL),i.forEach(m=>{m.destroy()}),LT(i)}function o(){s(),a()}function l(m){[r,m].forEach(y=>{const E=ms(y),b=y===r?m:r;E.on(jm,(v,x,S)=>{b.go(b.is(FT)?S:v)}),i.push(E)})}function u(){const m=ms(r),{on:y}=m;y(BV,h),y(HJ,p),y([Vd,Yl],f),ca(n,pU,"menu"),i.push(m),m.emit(GV,r.splides)}function f(){ca(n,uee,t.direction!==jV?"horizontal":null)}function h(m){r.go(m.index)}function p(m,y){hU(H0e,y.key)&&(h(m),Kv(y))}return{mount:a,destroy:s,remount:o}}function j0e(r,e,t){const{bind:n}=ms(r);function i(){t.wheel&&n(e.Elements.track,"wheel",a,Rx)}function a(o){if(o.cancelable){const{deltaY:l}=o;if(l){const u=l<0;r.go(u?"<":">"),s(u)&&Kv(o)}}}function s(o){return!t.releaseWheel||r.state.is(RL)||e.Controller.getAdjacent(o)!==-1}return{mount:i}}var Q0e=Object.freeze({__proto__:null,Options:ZAe,Direction:e0e,Elements:p0e,Slides:v0e,Layout:y0e,Clones:A0e,Move:b0e,Controller:_0e,Arrows:x0e,Autoplay:w0e,Cover:C0e,Scroll:O0e,Drag:U0e,Keyboard:k0e,LazyLoad:z0e,Pagination:G0e,Sync:V0e,Wheel:j0e}),W0e={prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay"},jY={type:"slide",speed:400,waitForTransition:!0,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,keyboard:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",slideFocus:!0,trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",classes:d0e,i18n:W0e};function Y0e(r,e,t){const{on:n}=ms(r);function i(){n([Vd,Ka],()=>{p4(()=>{e.Slides.style("transition",`opacity ${t.speed}ms ${t.easing}`)})})}function a(s,o){const{track:l}=e.Elements;Xu(l,"height",Yv(nu(l).height)),p4(()=>{o(),Xu(l,"height","")})}return{mount:i,start:a,cancel:m4}}function q0e(r,e,t){const{bind:n}=ms(r),{Move:i,Controller:a}=e,{list:s}=e.Elements;let o;function l(){n(s,"transitionend",m=>{m.target===s&&o&&(f(),o())})}function u(m,y){const E=i.toPosition(m,!0),b=i.getPosition(),v=h(m);Zu(E-b)>=1&&v>=1?(p(`transform ${v}ms ${t.easing}`),i.translate(E,!0),o=y):(i.jump(m),y())}function f(){p("")}function h(m){const{rewindSpeed:y}=t;if(r.is(CI)&&y){const E=a.getIndex(!0),b=a.getEnd();if(E===0&&m>=b||E>=b&&m===0)return y}return t.speed}function p(m){Xu(s,"transition",m)}return{mount:l,start:u,cancel:f}}var hee=class{constructor(r,e){this.event=$Ae(),this.Components={},this.state=KAe(Mx),this.splides=[],this._options={},this._Extensions={};const t=yy(r)?X0(document,r):r;KR(t,`${t} is invalid.`),this.root=t,rb(jY,hee.defaults),rb(rb(this._options,jY),e||{})}mount(r,e){const{state:t,Components:n}=this;KR(t.is([Mx,IL]),"Already mounted!"),t.set(Mx),this._Components=n,this._Transition=e||this._Transition||(this.is(mU)?Y0e:q0e),this._Extensions=r||this._Extensions;const i=d4({},Q0e,this._Extensions,{Transition:this._Transition});return ub(i,(a,s)=>{const o=a(this,n,this._options);n[s]=o,o.setup&&o.setup()}),ub(n,a=>{a.mount&&a.mount()}),this.emit(Vd),Ay(this.root,h0e),t.set(ML),this.emit(v4),this}sync(r){return this.splides.push({splide:r}),r.splides.push({splide:this,isParent:!0}),this.state.is(ML)&&(this._Components.Sync.remount(),r.Components.Sync.remount()),this}go(r){return this._Components.Controller.go(r),this}on(r,e){return this.event.on(r,e,null,HAe),this}off(r){return this.event.off(r),this}emit(r){return this.event.emit(r,...UT(arguments,1)),this}add(r,e){return this._Components.Slides.add(r,e),this}remove(r){return this._Components.Slides.remove(r),this}is(r){return this._options.type===r}refresh(){return this.emit(Ka),this}destroy(r=!0){const{event:e,state:t}=this;return t.is(Mx)?e.on(v4,this.destroy.bind(this,r),this):(ub(this._Components,n=>{n.destroy&&n.destroy(r)},!0),e.emit(zV),e.destroy(),r&<(this.splides),t.set(IL)),this}get options(){return this._options}set options(r){const{_options:e}=this;rb(e,r),this.state.is(Mx)||this.emit(Yl,e)}get length(){return this._Components.Slides.getLength(!0)}get index(){return this._Components.Controller.getIndex()}},WV=hee;WV.defaults={};WV.STATES=GAe;var X0e=[[Vd,"onMounted"],[v4,"onReady"],[jm,"onMove"],[mT,"onMoved"],[BV,"onClick"],[kJ,"onActive"],[FJ,"onInactive"],[zJ,"onVisible"],[GJ,"onHidden"],[Ka,"onRefresh"],[Yl,"onUpdated"],[xb,"onResize"],[kV,"onResized"],[jJ,"onDrag"],[QJ,"onDragging"],[WJ,"onDragged"],[FV,"onScroll"],[kT,"onScrolled"],[zV,"onDestroy"],[YJ,"onArrowsMounted"],[qJ,"onArrowsUpdated"],[XJ,"onPaginationMounted"],[$J,"onPaginationUpdated"],[GV,"onNavigationMounted"],[KJ,"onAutoplayPlay"],[ZJ,"onAutoplayPlaying"],[JJ,"onAutoplayPause"],[HV,"onLazyLoadLoaded"]];function fee(...r){return r.filter(Boolean).join(" ")}function LL(r){return r!==null&&typeof r=="object"}function _4(r,e){if(Array.isArray(r)&&Array.isArray(e))return r.length===e.length&&!r.some((t,n)=>!_4(t,e[n]));if(LL(r)&&LL(e)){const t=Object.keys(r),n=Object.keys(e);return t.length===n.length&&!t.some(i=>!Object.prototype.hasOwnProperty.call(e,i)||!_4(r[i],e[i]))}return r===e}function $0e(r,e){return r.length===e.length&&!r.some((t,n)=>t!==e[n])}function K0e(r,e){if(r){const t=Object.keys(r);for(let n=0;n<t.length;n++){const i=t[n];if(i!=="__proto__"&&e(r[i],i)===!1)break}}return r}function E4(r,e){const t=r;return K0e(e,(n,i)=>{Array.isArray(n)?t[i]=n.slice():LL(n)?t[i]=E4(LL(t[i])?t[i]:{},n):t[i]=n}),t}var dee=class extends Xa.Component{constructor(){super(...arguments),this.splideRef=Xa.createRef(),this.slides=[]}componentDidMount(){const{options:r,Extensions:e,Transition:t}=this.props,{current:n}=this.splideRef;n&&(this.splide=new WV(n,r),this.bind(this.splide),this.splide.mount(e,t),this.options=E4({},r||{}),this.slides=this.getSlides())}componentWillUnmount(){this.splide&&(this.splide.destroy(),this.splide=void 0),this.options=void 0,this.slides.length=0}componentDidUpdate(){if(!this.splide)return;const{options:r}=this.props;r&&!_4(this.options,r)&&(this.splide.options=r,this.options=E4({},r));const e=this.getSlides();$0e(this.slides,e)||(this.splide.refresh(),this.slides=e)}sync(r){var e;(e=this.splide)==null||e.sync(r)}go(r){var e;(e=this.splide)==null||e.go(r)}getSlides(){var r;if(this.splide){const e=(r=this.splide.Components.Elements)==null?void 0:r.list.children;return e&&Array.prototype.slice.call(e)||[]}return[]}bind(r){X0e.forEach(([e,t])=>{const n=this.props[t];typeof n=="function"&&r.on(e,(...i)=>{n(r,...i)})})}renderTrack(){return Xa.createElement("div",{className:"splide__track"},Xa.createElement("ul",{className:"splide__list"},this.props.children))}render(){const{id:r,className:e,hasSliderWrapper:t,hasAutoplayProgress:n,hasAutoplayControls:i,playButtonLabel:a="Play",pauseButtonLabel:s="Pause",renderControls:o}=this.props;return Xa.createElement("div",{id:r,className:fee("splide",e),ref:this.splideRef},t?Xa.createElement("div",{className:"splide__slider"},this.renderTrack()):this.renderTrack(),n&&Xa.createElement("div",{className:"splide__progress"},Xa.createElement("div",{className:"splide__progress__bar"})),i&&Xa.createElement("div",{className:"splide__autoplay"},Xa.createElement("button",{className:"splide__play"},a),Xa.createElement("button",{className:"splide__pause"},s)),o&&o())}},pee=({children:r,className:e,...t})=>Xa.createElement("li",{className:fee("splide__slide",e),...t},r);/*!
|
|
5087
|
+
`;class FAe extends HTMLElement{#e=void 0;#i=void 0;#n=void 0;#r=void 0;#a=void 0;#s=void 0;#l=new CustomEvent("drawerClosed");#o="0%";constructor(){super(),this.attachShadow({mode:"open"}),this.#t()}#t(){this.shadowRoot.appendChild(CV.content.cloneNode(!0)),this.#e=this.shadowRoot.getElementById("drawerMainContainer"),this.#i=this.shadowRoot.getElementById("dragBar"),this.#n=this.shadowRoot.getElementById("drawerDialog"),this.#r=this.shadowRoot.getElementById("drawerOverlay"),this.#a=this.shadowRoot.getElementById("bottomDrawerContent"),this.#i.addEventListener("touchstart",e=>{this.#c(e)}),this.#i.addEventListener("touchmove",e=>{this.#u(e)}),this.#i.addEventListener("touchend",e=>{this.#h(e)}),this.#r.addEventListener("click",e=>{this.closeDrawer()})}#f(){this.#n.style.transform="translateY(100vh)"}connectedCallback(){this.#f()}disconnectedCallback(){this.#i.removeEventListener("touchstart",e=>{this.#c(e)}),this.#i.removeEventListener("touchmove",e=>{this.#u(e)}),this.#i.removeEventListener("touchend",e=>{this.#h(e)}),this.#r.removeEventListener("click",e=>{this.closeDrawer()})}static get observedAttributes(){return["open","initial-screen-coverage"]}attributeChangedCallback(e,t,n){switch(e){case"open":t!==n&&(n.toLowerCase()==="false"?(this.closeDrawer(),this.dispatchEvent(this.#l)):n.toLowerCase()==="true"&&this.openDrawer());break;case"initial-screen-coverage":t!==n&&(this.#o=n);break}}#c(e){this.#n.style.transition="none",this.#s=e.changedTouches[0].clientY}#u(e){let t=e.touches[0].clientY,n=window.screen.height-t,i=n/this.#n.clientHeight;n<=this.#n.clientHeight&&(this.#n.style.transform=`translate(0px, ${this.#n.clientHeight-n}px)`),this.#r.style.opacity=i}#h(e){e.changedTouches[0].clientY>=this.#s?this.closeDrawer():(this.#n.style.transition="transform 500ms ease-in-out",this.#n.style.transform="translateY(0%)",this.#a.style.height="100%")}openDrawer(){this.#e.style.opacity="1",this.#r.style.opacity="1",this.#n.style.transition="transform 500ms ease-in-out",this.#n.style.transform=`translateY(${this.#o})`,this.#a.style.height=`${100-parseInt(this.#o.replaceAll("%",""))}%`,this.#r.style.pointerEvents="all",this.setAttribute("open","true")}closeDrawer(){this.#r.style.opacity="0",this.#n.style.transition="transform 500ms ease-in-out",this.#n.style.transform=`translateY(${this.#n.clientHeight}px)`,this.#r.style.pointerEvents="none",this.setAttribute("open","false")}}window.customElements.define("bottom-drawer",FAe);const YS=({zIndex:r,open:e,setOpen:t,heading:n,inputValue:i,buttonText:a,inputPlaceholder:s,formFieldExists:o,dualOptions:l,modalText:u,onSubmit:f=()=>{},onCancel:h=()=>{},shareModal:p,loading:m})=>{Jt(S=>S.CORE_API),oe.useState(e);const[y,E]=oe.useState(""),[b,v]=oe.useState(m||null);oe.useEffect(()=>(v(m),()=>{}),[m]);function x(S){E(S.target.value)}return ne(fi,{children:ne("div",{className:e===!0?"uiModal open":"uiModal",children:[ne("div",{className:"modalDialog",children:[ne("div",{className:"modalCloseContainer",children:ne("button",{onClick:()=>{h(),t(!1)},children:ne("img",{src:Vr+"/Icon/X.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:69,columnNumber:15},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:63,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:62,columnNumber:11},globalThis),ne("h2",{className:"modalHeading",children:n},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:72,columnNumber:11},globalThis),u&&ne("p",{className:"modalText",children:u},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:73,columnNumber:25},globalThis),ne("div",{className:p?"shareModal":"noShareModal",children:b?ne("div",{className:"shareModalChildDiv",children:ne("img",{className:"shareModalLoaderImg",src:Vr+"/Animation/Loading.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:77,columnNumber:17},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:76,columnNumber:15},globalThis):ne(fi,{children:[o&&(i!==void 0?ne("input",{type:"text",value:i,readOnly:!0},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:86,columnNumber:21},globalThis):ne("input",{placeholder:s||"",type:"text",value:y,onChange:S=>{x(S)}},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:88,columnNumber:21},globalThis)),l?ne("div",{className:"UIModalButtonParentDiv",children:[ne("button",{role:"button",onClick:()=>{t(!1),f()},children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:100,columnNumber:21},globalThis),ne("button",{role:"button",onClick:()=>{t(!1),h()},className:"uiModalCancelButton",children:"Cancel"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:109,columnNumber:21},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:99,columnNumber:19},globalThis):ne("button",{role:"button",onClick:()=>{t(!1),f()},children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:121,columnNumber:19},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:83,columnNumber:15},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:74,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:61,columnNumber:9},globalThis),ne("div",{className:"modalOverlay"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:135,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:60,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/UIModal.js",lineNumber:59,columnNumber:5},globalThis)};var dl="splide",MV=`data-${dl}`,Mx=1,zAe=2,ML=3,RL=4,IL=5,GAe={CREATED:Mx,MOUNTED:zAe,IDLE:ML,MOVING:RL,DESTROYED:IL},RV=10,HAe=20;function LT(r){r.length=0}function qR(r){return!NV(r)&&typeof r=="object"}function OJ(r){return Array.isArray(r)}function VAe(r){return typeof r=="function"}function yy(r){return typeof r=="string"}function IV(r){return typeof r>"u"}function NV(r){return r===null}function DV(r){return r instanceof HTMLElement}function wI(r){return OJ(r)?r:[r]}function My(r,e){wI(r).forEach(e)}function hU(r,e){return r.indexOf(e)>-1}function CR(r,e){return r.push(...wI(e)),r}var jAe=Array.prototype;function UT(r,e,t){return jAe.slice.call(r,e,t)}function QAe(r,e){return UT(r).filter(e)[0]}function Fx(r,e,t){r&&My(e,n=>{n&&r.classList[t?"add":"remove"](n)})}function Ay(r,e){Fx(r,yy(e)?e.split(" "):e,!0)}function fU(r,e){My(e,r.appendChild.bind(r))}function OV(r,e){My(r,t=>{const n=e.parentNode;n&&n.insertBefore(t,e)})}function PV(r,e){return DV(r)&&(r.msMatchesSelector||r.matches).call(r,e)}function PJ(r,e){return r?UT(r.children).filter(t=>PV(t,e)):[]}function Im(r,e){return e?PJ(r,e)[0]:r.firstElementChild}function ub(r,e,t){if(r){let n=Object.keys(r);n=t?n.reverse():n;for(let i=0;i<n.length;i++){const a=n[i];if(a!=="__proto__"&&e(r[a],a)===!1)break}}return r}function d4(r){return UT(arguments,1).forEach(e=>{ub(e,(t,n)=>{r[n]=e[n]})}),r}function rb(r,e){return ub(e,(t,n)=>{OJ(t)?r[n]=t.slice():qR(t)?r[n]=rb(qR(r[n])?r[n]:{},t):r[n]=t}),r}function kd(r,e){r&&My(e,t=>{r.removeAttribute(t)})}function ca(r,e,t){qR(e)?ub(e,(n,i)=>{ca(r,i,n)}):NV(t)?kd(r,e):r.setAttribute(e,String(t))}function $x(r,e,t){const n=document.createElement(r);return e&&(yy(e)?Ay(n,e):ca(n,e)),t&&fU(t,n),n}function Xu(r,e,t){if(IV(t))return getComputedStyle(r)[e];if(!NV(t)){const{style:n}=r;t=`${t}`,n[e]!==t&&(n[e]=t)}}function NL(r,e){Xu(r,"display",e)}function WAe(r){r.setActive&&r.setActive()||r.focus({preventScroll:!0})}function XR(r,e){return r.getAttribute(e)}function BY(r,e){return r&&r.classList.contains(e)}function nu(r){return r.getBoundingClientRect()}function BT(r){My(r,e=>{e&&e.parentNode&&e.parentNode.removeChild(e)})}function YAe(r,e){if(yy(e)){const t=$x("div",{style:`width: ${e}; position: absolute;`},r);e=nu(t).width,BT(t)}return e}function LJ(r){return Im(new DOMParser().parseFromString(r,"text/html").body)}function Kv(r,e){r.preventDefault(),e&&(r.stopPropagation(),r.stopImmediatePropagation())}function X0(r,e){return r&&r.querySelector(e)}function LV(r,e){return UT(r.querySelectorAll(e))}function $R(r,e){Fx(r,e,!1)}function Yv(r){return yy(r)?r:r?`${r}px`:""}function KR(r,e=""){if(!r)throw new Error(`[${dl}] ${e}`)}function p4(r){setTimeout(r)}var m4=()=>{};function kY(r){return requestAnimationFrame(r)}var{min:ZR,max:JR,floor:g4,ceil:eI,abs:Zu}=Math;function qAe(r,e,t){return Zu(r-e)<t}function MR(r,e,t,n){const i=ZR(e,t),a=JR(e,t);return n?i<r&&r<a:i<=r&&r<=a}function dR(r,e,t){const n=ZR(e,t),i=JR(e,t);return ZR(JR(n,r),i)}function FY(r){return+(r>0)-+(r<0)}function UJ(r,e){return My(e,t=>{r=r.replace("%s",`${t}`)}),r}function UV(r){return r<10?`0${r}`:`${r}`}var zY={};function XAe(r){return`${r}${UV(zY[r]=(zY[r]||0)+1)}`}function $Ae(){let r={};function e(o,l,u,f=RV){s(o,(h,p)=>{r[h]=r[h]||[],CR(r[h],{_event:h,_callback:l,_namespace:p,_priority:f,_key:u}).sort((m,y)=>m._priority-y._priority)})}function t(o,l){s(o,(u,f)=>{const h=r[u];r[u]=h&&h.filter(p=>p._key?p._key!==l:l||p._namespace!==f)})}function n(o){ub(r,(l,u)=>{t(u,o)})}function i(o){(r[o]||[]).forEach(l=>{l._callback.apply(l,UT(arguments,1))})}function a(){r={}}function s(o,l){wI(o).join(" ").split(" ").forEach(u=>{const f=u.split(".");l(f[0],f[1])})}return{on:e,off:t,offBy:n,emit:i,destroy:a}}var Vd="mounted",v4="ready",jm="move",mT="moved",BJ="shifted",BV="click",kJ="active",FJ="inactive",zJ="visible",GJ="hidden",HJ="slide:keydown",Ka="refresh",Yl="updated",xb="resize",kV="resized",VJ="repositioned",jJ="drag",QJ="dragging",WJ="dragged",FV="scroll",kT="scrolled",zV="destroy",YJ="arrows:mounted",qJ="arrows:updated",XJ="pagination:mounted",$J="pagination:updated",GV="navigation:mounted",KJ="autoplay:play",ZJ="autoplay:playing",JJ="autoplay:pause",HV="lazyload:loaded";function ms(r){const{event:e}=r,t={};let n=[];function i(f,h,p){e.on(f,h,t,p)}function a(f){e.off(f,t)}function s(f,h,p,m){l(f,h,(y,E)=>{n.push([y,E,p,m]),y.addEventListener(E,p,m)})}function o(f,h,p){l(f,h,(m,y)=>{n=n.filter(E=>E[0]===m&&E[1]===y&&(!p||E[2]===p)?(m.removeEventListener(y,E[2],E[3]),!1):!0)})}function l(f,h,p){My(f,m=>{m&&h.split(" ").forEach(p.bind(null,m))})}function u(){n=n.filter(f=>o(f[0],f[1])),e.offBy(t)}return e.on(zV,u,t),{on:i,off:a,emit:e.emit,bind:s,unbind:o,destroy:u}}function VV(r,e,t,n){const{now:i}=Date;let a,s=0,o,l=!0,u=0;function f(){if(!l){const v=i()-a;if(v>=r?(s=1,a=i()):s=v/r,t&&t(s),s===1&&(e(),n&&++u>=n))return p();kY(f)}}function h(v){!v&&y(),a=i()-(v?s*r:0),l=!1,kY(f)}function p(){l=!0}function m(){a=i(),s=0,t&&t(s)}function y(){cancelAnimationFrame(o),s=0,o=0,l=!0}function E(v){r=v}function b(){return l}return{start:h,rewind:m,pause:p,cancel:y,set:E,isPaused:b}}function KAe(r){let e=r;function t(i){e=i}function n(i){return hU(wI(i),e)}return{set:t,is:n}}function eee(r,e){let t;function n(){t||(t=VV(e||0,()=>{r.apply(this,arguments),t=null},null,1),t.start())}return n}function ZAe(r,e,t){const n=eee(f);let i,a,s;function o(){try{rb(t,JSON.parse(XR(r.root,MV)))}catch(m){KR(!1,m.message)}i=rb({},t);const{breakpoints:p}=t;if(p){const m=t.mediaQuery==="min";a=Object.keys(p).sort((y,E)=>m?+E-+y:+y-+E).map(y=>[y,matchMedia(`(${m?"min":"max"}-width:${y}px)`)]),f()}}function l(){a&&addEventListener("resize",n)}function u(p){p&&removeEventListener("resize",n)}function f(){const p=QAe(a,m=>m[1].matches)||[];p[0]!==s&&h(s=p[0])}function h(p){const m=t.breakpoints[p]||i;m.destroy?(r.options=i,r.destroy(m.destroy==="completely")):(r.state.is(IL)&&(u(!0),r.mount()),r.options=m)}return{setup:o,mount:l,destroy:u}}var GY="rtl",jV="ttb",JAe={marginRight:["marginBottom","marginLeft"],autoWidth:["autoHeight"],fixedWidth:["fixedHeight"],paddingLeft:["paddingTop","paddingRight"],paddingRight:["paddingBottom","paddingLeft"],width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:["ArrowUp","ArrowRight"],ArrowRight:["ArrowDown","ArrowLeft"]};function e0e(r,e,t){function n(a,s){const{direction:o}=t,l=o===GY&&!s?1:o===jV?0:-1;return JAe[a][l]||a}function i(a){return a*(t.direction===GY?1:-1)}return{resolve:n,orient:i}}var C2=dl,t0e=`${dl}__slider`,n0e=`${dl}__track`,i0e=`${dl}__list`,dU=`${dl}__slide`,tee=`${dU}--clone`,r0e=`${dU}__container`,nee=`${dl}__arrows`,QV=`${dl}__arrow`,iee=`${QV}--prev`,ree=`${QV}--next`,aee=`${dl}__pagination`,a0e=`${aee}__page`,see=`${dl}__progress`,s0e=`${see}__bar`,o0e=`${dl}__autoplay`,l0e=`${dl}__play`,c0e=`${dl}__pause`,u0e=`${dl}__spinner`,h0e="is-initialized",gT="is-active",oee="is-prev",lee="is-next",y4="is-visible",A4="is-loading",f0e=[gT,y4,oee,lee,A4],d0e={slide:dU,clone:tee,arrows:nee,arrow:QV,prev:iee,next:ree,pagination:aee,page:a0e,spinner:u0e};function p0e(r,e,t){const{on:n}=ms(r),{root:i}=r,a={},s=[];let o,l,u,f;function h(){b(),v(),Ay(i,o=S())}function p(){n(Ka,y,RV-2),n(Yl,E)}function m(){[i,u,f].forEach(_=>{kd(_,"style")}),LT(s),$R(i,o)}function y(){m(),h()}function E(){$R(i,o),Ay(i,o=S())}function b(){l=Im(i,`.${t0e}`),u=X0(i,`.${n0e}`),f=Im(u,`.${i0e}`),KR(u&&f,"A track/list element is missing."),CR(s,PJ(f,`.${dU}:not(.${tee})`));const _=x(`.${o0e}`),w=x(`.${nee}`);d4(a,{root:i,slider:l,track:u,list:f,slides:s,arrows:w,autoplay:_,prev:X0(w,`.${iee}`),next:X0(w,`.${ree}`),bar:X0(x(`.${see}`),`.${s0e}`),play:X0(_,`.${l0e}`),pause:X0(_,`.${c0e}`)})}function v(){const _=i.id||XAe(dl);i.id=_,u.id=u.id||`${_}-track`,f.id=f.id||`${_}-list`}function x(_){return Im(i,_)||Im(l,_)}function S(){return[`${C2}--${t.type}`,`${C2}--${t.direction}`,t.drag&&`${C2}--draggable`,t.isNavigation&&`${C2}--nav`,gT]}return d4(a,{setup:h,mount:p,destroy:m})}var pU="role",vT="aria-controls",DL="aria-current",yT="aria-label",cee="aria-hidden",tI="tabindex",m0e="disabled",uee="aria-orientation",OL=[pU,vT,DL,yT,cee,uee,tI,m0e],CI="slide",FT="loop",mU="fade";function g0e(r,e,t,n){const{on:i,emit:a,bind:s,destroy:o}=ms(r),{Components:l,root:u,options:f}=r,{isNavigation:h,updateOnMove:p}=f,{resolve:m}=l.Direction,y=XR(n,"style"),E=t>-1,b=Im(n,`.${r0e}`),v=f.focusableNodes&&LV(n,f.focusableNodes);let x;function S(){E||(n.id=`${u.id}-slide${UV(e+1)}`),s(n,"click keydown",j=>{a(j.type==="click"?BV:HJ,z,j)}),i([Ka,VJ,BJ,mT,kT],N),i(GV,w),p&&i(jm,R)}function _(){x=!0,o(),$R(n,f0e),kd(n,OL),ca(n,"style",y)}function w(){const j=E?t:e,Q=UJ(f.i18n.slideX,j+1),H=r.splides.map(K=>K.splide.root.id).join(" ");ca(n,yT,Q),ca(n,vT,H),ca(n,pU,"menuitem"),L(k())}function R(){x||N()}function N(){if(!x){const{index:j}=r;L(k()),I(F()),Fx(n,oee,e===j-1),Fx(n,lee,e===j+1)}}function L(j){j!==BY(n,gT)&&(Fx(n,gT,j),h&&ca(n,DL,j||null),a(j?kJ:FJ,z))}function I(j){const Q=!j&&(!k()||E);ca(n,cee,Q||null),ca(n,tI,!Q&&f.slideFocus?0:null),v&&v.forEach(H=>{ca(H,tI,Q?-1:null)}),j!==BY(n,y4)&&(Fx(n,y4,j),a(j?zJ:GJ,z))}function D(j,Q,H){Xu(H&&b||n,j,Q)}function k(){const{index:j}=r;return j===e||f.cloneStatus&&j===t}function F(){if(r.is(mU))return k();const j=nu(l.Elements.track),Q=nu(n),H=m("left"),K=m("right");return g4(j[H])<=eI(Q[H])&&g4(Q[K])<=eI(j[K])}function U(j,Q){let H=Zu(j-e);return!E&&(f.rewind||r.is(FT))&&(H=ZR(H,r.length-H)),H<=Q}const z={index:e,slideIndex:t,slide:n,container:b,isClone:E,mount:S,destroy:_,update:N,style:D,isWithin:U};return z}function v0e(r,e,t){const{on:n,emit:i,bind:a}=ms(r),{slides:s,list:o}=e.Elements,l=[];function u(){f(),n(Ka,p),n([Vd,Ka],()=>{l.sort((D,k)=>D.index-k.index)})}function f(){s.forEach((D,k)=>{y(D,k,-1)})}function h(){_(D=>{D.destroy()}),LT(l)}function p(){h(),f()}function m(){_(D=>{D.update()})}function y(D,k,F){const U=g0e(r,k,F,D);U.mount(),l.push(U)}function E(D){return D?w(k=>!k.isClone):l}function b(D){const{Controller:k}=e,F=k.toIndex(D),U=k.hasFocus()?1:t.perPage;return w(z=>MR(z.index,F,F+U-1))}function v(D){return w(D)[0]}function x(D,k){My(D,F=>{if(yy(F)&&(F=LJ(F)),DV(F)){const U=s[k];U?OV(F,U):fU(o,F),Ay(F,t.classes.slide),N(F,i.bind(null,xb))}}),i(Ka)}function S(D){BT(w(D).map(k=>k.slide)),i(Ka)}function _(D,k){E(k).forEach(D)}function w(D){return l.filter(VAe(D)?D:k=>yy(D)?PV(k.slide,D):hU(wI(D),k.index))}function R(D,k,F){_(U=>{U.style(D,k,F)})}function N(D,k){const F=LV(D,"img");let{length:U}=F;U?F.forEach(z=>{a(z,"load error",()=>{--U||k()})}):k()}function L(D){return D?s.length:l.length}function I(){return l.length>t.perPage}return{mount:u,destroy:h,update:m,register:y,get:E,getIn:b,getAt:v,add:x,remove:S,forEach:_,filter:w,style:R,getLength:L,isEnough:I}}function y0e(r,e,t){const{on:n,bind:i,emit:a}=ms(r),{Slides:s}=e,{resolve:o}=e.Direction,{root:l,track:u,list:f}=e.Elements,{getAt:h}=s;let p,m;function y(){E(),i(window,"resize load",eee(a.bind(this,xb))),n([Yl,Ka],E),n(xb,b)}function E(){m=null,p=t.direction===jV,Xu(l,"maxWidth",Yv(t.width)),Xu(u,o("paddingLeft"),x(!1)),Xu(u,o("paddingRight"),x(!0)),b()}function b(){const z=nu(l);(!m||m.width!==z.width||m.height!==z.height)&&(Xu(u,"height",S()),s.style(o("marginRight"),Yv(t.gap)),s.style("width",w()||null),v(),m=z,a(kV))}function v(){s.style("height",R()||null,!0)}function x(z){const{padding:j}=t,Q=o(z?"right":"left");return j&&Yv(j[Q]||(qR(j)?0:j))||"0px"}function S(){let z="";return p&&(z=_(),KR(z,"height or heightRatio is missing."),z=`calc(${z} - ${x(!1)} - ${x(!0)})`),z}function _(){return Yv(t.height||nu(f).width*t.heightRatio)}function w(){return t.autoWidth?"":Yv(t.fixedWidth)||(p?"":N())}function R(){return Yv(t.fixedHeight)||(p?t.autoHeight?"":N():_())}function N(){const z=Yv(t.gap);return`calc((100%${z&&` + ${z}`})/${t.perPage||1}${z&&` - ${z}`})`}function L(){return nu(f)[o("width")]}function I(z,j){const Q=h(z||0);return Q?nu(Q.slide)[o("width")]+(j?0:F()):0}function D(z,j){const Q=h(z);if(Q){const H=nu(Q.slide)[o("right")],K=nu(f)[o("left")];return Zu(H-K)+(j?0:F())}return 0}function k(){return D(r.length-1,!0)-D(-1,!0)}function F(){const z=h(0);return z&&parseFloat(Xu(z.slide,o("marginRight")))||0}function U(z){return parseFloat(Xu(u,o(`padding${z?"Right":"Left"}`)))||0}return{mount:y,listSize:L,slideSize:I,sliderSize:k,totalSize:D,getPadding:U}}function A0e(r,e,t){const{on:n,emit:i}=ms(r),{Elements:a,Slides:s}=e,{resolve:o}=e.Direction,l=[];let u;function f(){h(),n(Ka,m),n([Yl,xb],y)}function h(){(u=v())&&(E(u),i(xb))}function p(){BT(l),LT(l)}function m(){p(),h()}function y(){u<v()&&i(Ka)}function E(x){const S=s.get().slice(),{length:_}=S;if(_){for(;S.length<x;)CR(S,S);CR(S.slice(-x),S.slice(0,x)).forEach((w,R)=>{const N=R<x,L=b(w.slide,R);N?OV(L,S[0].slide):fU(a.list,L),CR(l,L),s.register(L,R-x+(N?0:_),w.index)})}}function b(x,S){const _=x.cloneNode(!0);return Ay(_,t.classes.clone),_.id=`${r.root.id}-clone${UV(S+1)}`,_}function v(){let{clones:x}=t;if(!r.is(FT))x=0;else if(!x){const S=YAe(a.list,t[o("fixedWidth")]);x=(S&&eI(nu(a.track)[o("width")]/S)||t[o("autoWidth")]&&r.length||t.perPage)*(t.drag?(t.flickMaxPages||1)+1:2)}return x}return{mount:f,destroy:p}}function b0e(r,e,t){const{on:n,emit:i}=ms(r),{slideSize:a,getPadding:s,totalSize:o,listSize:l,sliderSize:u}=e.Layout,{resolve:f,orient:h}=e.Direction,{list:p,track:m}=e.Elements;let y;function E(){y=e.Transition,n([Vd,kV,Yl,Ka],v)}function b(){kd(p,"style")}function v(){z()||(e.Scroll.cancel(),S(r.index),i(VJ))}function x(Q,H,K,J){if(!z()){const{set:W}=r.state,V=D();Q!==H&&(y.cancel(),_(R(V,Q>H),!0)),W(RL),i(jm,H,K,Q),y.start(H,()=>{W(ML),i(mT,H,K,Q),t.trimSpace==="move"&&Q!==K&&V===D()?e.Controller.go(Q>K?">":"<",!1,J):J&&J()})}}function S(Q){_(I(Q,!0))}function _(Q,H){if(!r.is(mU)){const K=H?Q:w(Q);p.style.transform=`translate${f("X")}(${K}px)`,Q!==K&&i(BJ)}}function w(Q){if(r.is(FT)){const H=h(Q-D()),K=j(!1,Q)&&H<0,J=j(!0,Q)&&H>0;(K||J)&&(Q=R(Q,J))}return Q}function R(Q,H){const K=Q-U(H),J=u();return Q-=h(J*(eI(Zu(K)/J)||1))*(H?1:-1),Q}function N(){_(D()),y.cancel()}function L(Q){const H=e.Slides.get();let K=0,J=1/0;for(let W=0;W<H.length;W++){const V=H[W].index,$=Zu(I(V,!0)-Q);if($<=J)J=$,K=V;else break}return K}function I(Q,H){const K=h(o(Q-1)-F(Q));return H?k(K):K}function D(){const Q=f("left");return nu(p)[Q]-nu(m)[Q]+h(s(!1))}function k(Q){return t.trimSpace&&r.is(CI)&&(Q=dR(Q,0,h(u()-l()))),Q}function F(Q){const{focus:H}=t;return H==="center"?(l()-a(Q,!0))/2:+H*a(Q)||0}function U(Q){return I(Q?e.Controller.getEnd():0,!!t.trimSpace)}function z(){return r.state.is(RL)&&t.waitForTransition}function j(Q,H){H=IV(H)?D():H;const K=Q!==!0&&h(H)<h(U(!1)),J=Q!==!1&&h(H)>h(U(!0));return K||J}return{mount:E,destroy:b,move:x,jump:S,translate:_,shift:R,cancel:N,toIndex:L,toPosition:I,getPosition:D,getLimit:U,isBusy:z,exceededLimit:j}}function _0e(r,e,t){const{on:n}=ms(r),{Move:i}=e,{getPosition:a,getLimit:s}=i,{isEnough:o,getLength:l}=e.Slides,u=r.is(FT),f=r.is(CI);let h=t.start||0,p=h,m,y,E;function b(){v(),n([Yl,Ka],v,RV-1)}function v(){m=l(!0),y=t.perMove,E=t.perPage,h=dR(h,0,m-1)}function x(H,K,J){const W=_(H);if(t.useScroll)S(W,!0,!0,t.speed,J);else{const V=D(W);V>-1&&!i.isBusy()&&(K||V!==h)&&(z(V),i.move(W,V,p,J))}}function S(H,K,J,W,V){const $=K?H:U(H);e.Scroll.scroll(K||J?i.toPosition($,!0):H,W,()=>{z(i.toIndex(i.getPosition())),V&&V()})}function _(H){let K=h;if(yy(H)){const[,J,W]=H.match(/([+\-<>])(\d+)?/)||[];J==="+"||J==="-"?K=L(h+ +`${J}${+W||1}`,h,!0):J===">"?K=W?k(+W):w(!0):J==="<"&&(K=R(!0))}else K=u?H:dR(H,0,I());return K}function w(H){return N(!1,H)}function R(H){return N(!0,H)}function N(H,K){const J=y||(Q()?1:E),W=L(h+J*(H?-1:1),h);return W===-1&&f&&!qAe(a(),s(!H),1)?H?0:I():K?W:D(W)}function L(H,K,J){if(o()){const W=I();H<0||H>W?MR(0,H,K,!0)||MR(W,K,H,!0)?H=k(F(H)):u?H=y||Q()?H:H<0?-(m%E||E):m:t.rewind?H=H<0?W:0:H=-1:!J&&H!==K&&(H=y?H:k(F(K)+(H<K?-1:1)))}else H=-1;return H}function I(){let H=m-E;return(Q()||u&&y)&&(H=m-1),JR(H,0)}function D(H){return u?o()?H%m+(H<0?m:0):-1:H}function k(H){return dR(Q()?H:E*H,0,I())}function F(H){return Q()||(H=MR(H,m-E,m-1)?m-1:H,H=g4(H/E)),H}function U(H){const K=i.toIndex(H);return f?dR(K,0,I()):K}function z(H){H!==h&&(p=h,h=H)}function j(H){return H?p:h}function Q(){return!IV(t.focus)||t.isNavigation}return{mount:b,go:x,scroll:S,getNext:w,getPrev:R,getAdjacent:N,getEnd:I,setIndex:z,getIndex:j,toIndex:k,toPage:F,toDest:U,hasFocus:Q}}var E0e="http://www.w3.org/2000/svg",S0e="m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z",M2=40;function x0e(r,e,t){const{on:n,bind:i,emit:a}=ms(r),{classes:s,i18n:o}=t,{Elements:l,Controller:u}=e;let f=l.arrows,h=l.prev,p=l.next,m;const y={};function E(){b(),n(Yl,b)}function b(){if(t.arrows&&(!h||!p)&&S(),h&&p)if(y.prev)NL(f,t.arrows===!1?"none":"");else{const{id:R}=l.track;ca(h,vT,R),ca(p,vT,R),y.prev=h,y.next=p,x(),a(YJ,h,p)}}function v(){m?BT(f):(kd(h,OL),kd(p,OL))}function x(){const{go:R}=u;n([Vd,mT,Yl,Ka,kT],w),i(p,"click",()=>{R(">",!0)}),i(h,"click",()=>{R("<",!0)})}function S(){f=$x("div",s.arrows),h=_(!0),p=_(!1),m=!0,fU(f,[h,p]),OV(f,Im(t.arrows==="slider"&&l.slider||r.root))}function _(R){const N=`<button class="${s.arrow} ${R?s.prev:s.next}" type="button"><svg xmlns="${E0e}" viewBox="0 0 ${M2} ${M2}" width="${M2}" height="${M2}"><path d="${t.arrowPath||S0e}" />`;return LJ(N)}function w(){const R=r.index,N=u.getPrev(),L=u.getNext(),I=N>-1&&R<N?o.last:o.prev,D=L>-1&&R>L?o.first:o.next;h.disabled=N<0,p.disabled=L<0,ca(h,yT,I),ca(p,yT,D),a(qJ,h,p,N,L)}return{arrows:y,mount:E,destroy:v}}var T0e=`${MV}-interval`;function w0e(r,e,t){const{on:n,bind:i,emit:a}=ms(r),s=VV(t.interval,r.go.bind(r,">"),x),{isPaused:o}=s,{Elements:l}=e;let u,f,h;function p(){const{autoplay:_}=t;_&&(m(!0),m(!1),y(),_!=="pause"&&E())}function m(_){const w=_?"pause":"play",R=l[w];R&&(ca(R,vT,l.track.id),ca(R,yT,t.i18n[w]),i(R,"click",_?b:E))}function y(){const{root:_}=l;t.pauseOnHover&&i(_,"mouseenter mouseleave",w=>{u=w.type==="mouseenter",v()}),t.pauseOnFocus&&i(_,"focusin focusout",w=>{f=w.type==="focusin",v()}),n([jm,FV,Ka],s.rewind),n(jm,S)}function E(){o()&&e.Slides.isEnough()&&(s.start(!t.resetProgress),f=u=h=!1,a(KJ))}function b(_=!0){o()||(s.pause(),a(JJ)),h=_}function v(){h||(!u&&!f?E():b(!1))}function x(_){const{bar:w}=l;w&&Xu(w,"width",`${_*100}%`),a(ZJ,_)}function S(){const _=e.Slides.getAt(r.index);s.set(_&&+XR(_.slide,T0e)||t.interval)}return{mount:p,destroy:s.cancel,play:E,pause:b,isPaused:o}}function C0e(r,e,t){const{on:n}=ms(r);function i(){t.cover&&(n(HV,(l,u)=>{o(!0,l,u)}),n([Vd,Yl,Ka],s.bind(null,!0)))}function a(){s(!1)}function s(l){e.Slides.forEach(u=>{const f=Im(u.container||u.slide,"img");f&&f.src&&o(l,f,u)})}function o(l,u,f){f.style("background",l?`center/cover no-repeat url("${u.src}")`:"",!0),NL(u,l?"none":"")}return{mount:i,destroy:a}}var M0e=10,R0e=600,I0e=.6,N0e=1.5,D0e=800;function O0e(r,e,t){const{on:n,emit:i}=ms(r),{Move:a}=e,{getPosition:s,getLimit:o,exceededLimit:l}=a;let u,f;function h(){n(jm,b),n([Yl,Ka],v)}function p(S,_,w,R){const N=s();let L=1;_=_||E(Zu(S-N)),f=w,b(),u=VV(_,y,I=>{const D=s(),F=(N+(S-N)*x(I)-s())*L;a.translate(D+F),r.is(CI)&&!R&&l()&&(L*=I0e,Zu(F)<M0e&&m(l(!1)))},1),i(FV),u.start()}function m(S){p(o(!S),R0e,null,!0)}function y(){const S=s(),_=a.toIndex(S);MR(_,0,r.length-1)||a.translate(a.shift(S,_>0),!0),f&&f(),i(kT)}function E(S){return JR(S/N0e,D0e)}function b(){u&&u.cancel()}function v(){u&&!u.isPaused()&&(b(),y())}function x(S){const{easingFunc:_}=t;return _?_(S):1-Math.pow(1-S,4)}return{mount:h,destroy:b,scroll:p,cancel:v}}var Rx={passive:!1,capture:!0},P0e=5,HY=200,L0e="touchstart mousedown",cz="touchmove mousemove",uz="touchend touchcancel mouseup";function U0e(r,e,t){const{on:n,emit:i,bind:a,unbind:s}=ms(r),{Move:o,Scroll:l,Controller:u}=e,{track:f}=e.Elements,{resolve:h,orient:p}=e.Direction,{getPosition:m,exceededLimit:y}=o;let E,b,v,x,S,_,w=!1,R,N,L;function I(){a(f,cz,m4,Rx),a(f,uz,m4,Rx),a(f,L0e,k,Rx),a(f,"click",j,{capture:!0}),a(f,"dragstart",Kv),n([Vd,Yl],D)}function D(){const{drag:ue}=t;pe(!ue),S=ue==="free"}function k(ue){if(!N){const{noDrag:ce}=t,ye=$(ue),Se=!ce||!PV(ue.target,ce);R=!1,Se&&(ye||!ue.button)&&(o.isBusy()?Kv(ue,!0):(L=ye?f:window,v=null,x=null,a(L,cz,F,Rx),a(L,uz,U,Rx),o.cancel(),l.cancel(),z(ue)))}}function F(ue){if(x||i(jJ),x=ue,ue.cancelable){const ce=J(ue)-J(b);if(_){o.translate(E+V(ce));const ye=W(ue)-W(b)>HY,Se=w!==(w=y());(ye||Se)&&z(ue),i(QJ),R=!0,Kv(ue)}else{let{dragMinThreshold:ye}=t;ye=qR(ye)?ye:{mouse:0,touch:+ye||10},_=Zu(ce)>($(ue)?ye.touch:ye.mouse),Q()&&Kv(ue)}}}function U(ue){s(L,cz,F),s(L,uz,U);const{index:ce}=r;if(x){if(_||ue.cancelable&&Q()){const ye=H(ue),Se=K(ye);S?u.scroll(Se):r.is(mU)?u.go(ce+p(FY(ye))):u.go(u.toDest(Se),!0),Kv(ue)}i(WJ)}else!S&&m()!==o.toPosition(ce)&&u.go(ce,!0);_=!1}function z(ue){v=b,b=ue,E=m()}function j(ue){!N&&R&&Kv(ue,!0)}function Q(){const ue=Zu(J(x)-J(b)),ce=Zu(J(x,!0)-J(b,!0));return ue>ce}function H(ue){if(r.is(FT)||!w){const ce=b===x&&v||b,ye=J(x)-J(ce),Se=W(ue)-W(ce),Ie=W(ue)-W(x)<HY;if(Se&&Ie)return ye/Se}return 0}function K(ue){return m()+FY(ue)*ZR(Zu(ue)*(t.flickPower||600),S?1/0:e.Layout.listSize()*(t.flickMaxPages||1))}function J(ue,ce){return($(ue)?ue.touches[0]:ue)[`page${h(ce?"Y":"X")}`]}function W(ue){return ue.timeStamp}function V(ue){return ue/(w&&r.is(CI)?P0e:1)}function $(ue){return typeof TouchEvent<"u"&&ue instanceof TouchEvent}function re(){return _}function pe(ue){N=ue}return{mount:I,disable:pe,isDragging:re}}var B0e=["Left","Right","Up","Down"],VY="keydown";function k0e(r,e,t){const{on:n,bind:i,unbind:a}=ms(r),{root:s}=r,{resolve:o}=e.Direction;let l,u;function f(){h(),n(Yl,E),n(jm,y)}function h(){const{keyboard:v}=t;v&&(v==="focused"?(l=s,ca(s,tI,0)):l=window,i(l,VY,b))}function p(){a(l,VY),DV(l)&&kd(l,tI)}function m(v){u=v}function y(){const v=u;u=!0,p4(()=>{u=v})}function E(){p(),h()}function b(v){if(!u){const{key:x}=v,S=hU(B0e,x)?`Arrow${x}`:x;S===o("ArrowLeft")?r.go("<"):S===o("ArrowRight")&&r.go(">")}}return{mount:f,destroy:p,disable:m}}var PL=`${MV}-lazy`,b4=`${PL}-srcset`,F0e=`[${PL}], [${b4}]`;function z0e(r,e,t){const{on:n,off:i,bind:a,emit:s}=ms(r),o=t.lazyLoad==="sequential";let l=[],u=0;function f(){t.lazyLoad&&(p(),n(Ka,h),o||n([Vd,Ka,mT,kT],y))}function h(){m(),p()}function p(){e.Slides.forEach(x=>{LV(x.slide,F0e).forEach(S=>{const _=XR(S,PL),w=XR(S,b4);if(_!==S.src||w!==S.srcset){const R=t.classes.spinner,N=S.parentElement,L=Im(N,`.${R}`)||$x("span",R,N);ca(L,pU,"presentation"),l.push({_img:S,_Slide:x,src:_,srcset:w,_spinner:L}),!S.src&&NL(S,"none")}})}),o&&v()}function m(){u=0,l=[]}function y(){l=l.filter(x=>{const S=t.perPage*((t.preloadPages||1)+1)-1;return x._Slide.isWithin(r.index,S)?E(x):!0}),l.length||i(mT)}function E(x){const{_img:S}=x;Ay(x._Slide.slide,A4),a(S,"load error",_=>{b(x,_.type==="error")}),["srcset","src"].forEach(_=>{x[_]&&(ca(S,_,x[_]),kd(S,_==="src"?PL:b4))})}function b(x,S){const{_Slide:_}=x;$R(_.slide,A4),S||(BT(x._spinner),NL(x._img,""),s(HV,x._img,_),s(xb)),o&&v()}function v(){u<l.length&&E(l[u++])}return{mount:f,destroy:m}}function G0e(r,e,t){const{on:n,emit:i,bind:a,unbind:s}=ms(r),{Slides:o,Elements:l,Controller:u}=e,{hasFocus:f,getIndex:h}=u,p=[];let m;function y(){E(),n([Yl,Ka],E),n([jm,kT],_)}function E(){b(),t.pagination&&o.isEnough()&&(v(),i(XJ,{list:m,items:p},S(r.index)),_())}function b(){m&&(BT(m),p.forEach(w=>{s(w.button,"click")}),LT(p),m=null)}function v(){const{length:w}=r,{classes:R,i18n:N,perPage:L}=t,I=t.pagination==="slider"&&l.slider||l.root,D=f()?w:eI(w/L);m=$x("ul",R.pagination,I);for(let k=0;k<D;k++){const F=$x("li",null,m),U=$x("button",{class:R.page,type:"button"},F),z=o.getIn(k).map(Q=>Q.slide.id),j=!f()&&L>1?N.pageX:N.slideX;a(U,"click",x.bind(null,k)),ca(U,vT,z.join(" ")),ca(U,yT,UJ(j,k+1)),p.push({li:F,button:U,page:k})}}function x(w){u.go(`>${w}`,!0,()=>{const R=o.getAt(u.toIndex(w));R&&WAe(R.slide)})}function S(w){return p[u.toPage(w)]}function _(){const w=S(h(!0)),R=S(h());w&&($R(w.button,gT),kd(w.button,DL)),R&&(Ay(R.button,gT),ca(R.button,DL,!0)),i($J,{list:m,items:p},w,R)}return{items:p,mount:y,destroy:b,getAt:S,update:_}}var H0e=[" ","Enter","Spacebar"];function V0e(r,e,t){const{list:n}=e.Elements,i=[];function a(){r.splides.forEach(m=>{!m.isParent&&l(m.splide)}),t.isNavigation&&u()}function s(){kd(n,OL),i.forEach(m=>{m.destroy()}),LT(i)}function o(){s(),a()}function l(m){[r,m].forEach(y=>{const E=ms(y),b=y===r?m:r;E.on(jm,(v,x,S)=>{b.go(b.is(FT)?S:v)}),i.push(E)})}function u(){const m=ms(r),{on:y}=m;y(BV,h),y(HJ,p),y([Vd,Yl],f),ca(n,pU,"menu"),i.push(m),m.emit(GV,r.splides)}function f(){ca(n,uee,t.direction!==jV?"horizontal":null)}function h(m){r.go(m.index)}function p(m,y){hU(H0e,y.key)&&(h(m),Kv(y))}return{mount:a,destroy:s,remount:o}}function j0e(r,e,t){const{bind:n}=ms(r);function i(){t.wheel&&n(e.Elements.track,"wheel",a,Rx)}function a(o){if(o.cancelable){const{deltaY:l}=o;if(l){const u=l<0;r.go(u?"<":">"),s(u)&&Kv(o)}}}function s(o){return!t.releaseWheel||r.state.is(RL)||e.Controller.getAdjacent(o)!==-1}return{mount:i}}var Q0e=Object.freeze({__proto__:null,Options:ZAe,Direction:e0e,Elements:p0e,Slides:v0e,Layout:y0e,Clones:A0e,Move:b0e,Controller:_0e,Arrows:x0e,Autoplay:w0e,Cover:C0e,Scroll:O0e,Drag:U0e,Keyboard:k0e,LazyLoad:z0e,Pagination:G0e,Sync:V0e,Wheel:j0e}),W0e={prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay"},jY={type:"slide",speed:400,waitForTransition:!0,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,keyboard:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",slideFocus:!0,trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",classes:d0e,i18n:W0e};function Y0e(r,e,t){const{on:n}=ms(r);function i(){n([Vd,Ka],()=>{p4(()=>{e.Slides.style("transition",`opacity ${t.speed}ms ${t.easing}`)})})}function a(s,o){const{track:l}=e.Elements;Xu(l,"height",Yv(nu(l).height)),p4(()=>{o(),Xu(l,"height","")})}return{mount:i,start:a,cancel:m4}}function q0e(r,e,t){const{bind:n}=ms(r),{Move:i,Controller:a}=e,{list:s}=e.Elements;let o;function l(){n(s,"transitionend",m=>{m.target===s&&o&&(f(),o())})}function u(m,y){const E=i.toPosition(m,!0),b=i.getPosition(),v=h(m);Zu(E-b)>=1&&v>=1?(p(`transform ${v}ms ${t.easing}`),i.translate(E,!0),o=y):(i.jump(m),y())}function f(){p("")}function h(m){const{rewindSpeed:y}=t;if(r.is(CI)&&y){const E=a.getIndex(!0),b=a.getEnd();if(E===0&&m>=b||E>=b&&m===0)return y}return t.speed}function p(m){Xu(s,"transition",m)}return{mount:l,start:u,cancel:f}}var hee=class{constructor(r,e){this.event=$Ae(),this.Components={},this.state=KAe(Mx),this.splides=[],this._options={},this._Extensions={};const t=yy(r)?X0(document,r):r;KR(t,`${t} is invalid.`),this.root=t,rb(jY,hee.defaults),rb(rb(this._options,jY),e||{})}mount(r,e){const{state:t,Components:n}=this;KR(t.is([Mx,IL]),"Already mounted!"),t.set(Mx),this._Components=n,this._Transition=e||this._Transition||(this.is(mU)?Y0e:q0e),this._Extensions=r||this._Extensions;const i=d4({},Q0e,this._Extensions,{Transition:this._Transition});return ub(i,(a,s)=>{const o=a(this,n,this._options);n[s]=o,o.setup&&o.setup()}),ub(n,a=>{a.mount&&a.mount()}),this.emit(Vd),Ay(this.root,h0e),t.set(ML),this.emit(v4),this}sync(r){return this.splides.push({splide:r}),r.splides.push({splide:this,isParent:!0}),this.state.is(ML)&&(this._Components.Sync.remount(),r.Components.Sync.remount()),this}go(r){return this._Components.Controller.go(r),this}on(r,e){return this.event.on(r,e,null,HAe),this}off(r){return this.event.off(r),this}emit(r){return this.event.emit(r,...UT(arguments,1)),this}add(r,e){return this._Components.Slides.add(r,e),this}remove(r){return this._Components.Slides.remove(r),this}is(r){return this._options.type===r}refresh(){return this.emit(Ka),this}destroy(r=!0){const{event:e,state:t}=this;return t.is(Mx)?e.on(v4,this.destroy.bind(this,r),this):(ub(this._Components,n=>{n.destroy&&n.destroy(r)},!0),e.emit(zV),e.destroy(),r&<(this.splides),t.set(IL)),this}get options(){return this._options}set options(r){const{_options:e}=this;rb(e,r),this.state.is(Mx)||this.emit(Yl,e)}get length(){return this._Components.Slides.getLength(!0)}get index(){return this._Components.Controller.getIndex()}},WV=hee;WV.defaults={};WV.STATES=GAe;var X0e=[[Vd,"onMounted"],[v4,"onReady"],[jm,"onMove"],[mT,"onMoved"],[BV,"onClick"],[kJ,"onActive"],[FJ,"onInactive"],[zJ,"onVisible"],[GJ,"onHidden"],[Ka,"onRefresh"],[Yl,"onUpdated"],[xb,"onResize"],[kV,"onResized"],[jJ,"onDrag"],[QJ,"onDragging"],[WJ,"onDragged"],[FV,"onScroll"],[kT,"onScrolled"],[zV,"onDestroy"],[YJ,"onArrowsMounted"],[qJ,"onArrowsUpdated"],[XJ,"onPaginationMounted"],[$J,"onPaginationUpdated"],[GV,"onNavigationMounted"],[KJ,"onAutoplayPlay"],[ZJ,"onAutoplayPlaying"],[JJ,"onAutoplayPause"],[HV,"onLazyLoadLoaded"]];function fee(...r){return r.filter(Boolean).join(" ")}function LL(r){return r!==null&&typeof r=="object"}function _4(r,e){if(Array.isArray(r)&&Array.isArray(e))return r.length===e.length&&!r.some((t,n)=>!_4(t,e[n]));if(LL(r)&&LL(e)){const t=Object.keys(r),n=Object.keys(e);return t.length===n.length&&!t.some(i=>!Object.prototype.hasOwnProperty.call(e,i)||!_4(r[i],e[i]))}return r===e}function $0e(r,e){return r.length===e.length&&!r.some((t,n)=>t!==e[n])}function K0e(r,e){if(r){const t=Object.keys(r);for(let n=0;n<t.length;n++){const i=t[n];if(i!=="__proto__"&&e(r[i],i)===!1)break}}return r}function E4(r,e){const t=r;return K0e(e,(n,i)=>{Array.isArray(n)?t[i]=n.slice():LL(n)?t[i]=E4(LL(t[i])?t[i]:{},n):t[i]=n}),t}var dee=class extends Xa.Component{constructor(){super(...arguments),this.splideRef=Xa.createRef(),this.slides=[]}componentDidMount(){const{options:r,Extensions:e,Transition:t}=this.props,{current:n}=this.splideRef;n&&(this.splide=new WV(n,r),this.bind(this.splide),this.splide.mount(e,t),this.options=E4({},r||{}),this.slides=this.getSlides())}componentWillUnmount(){this.splide&&(this.splide.destroy(),this.splide=void 0),this.options=void 0,this.slides.length=0}componentDidUpdate(){if(!this.splide)return;const{options:r}=this.props;r&&!_4(this.options,r)&&(this.splide.options=r,this.options=E4({},r));const e=this.getSlides();$0e(this.slides,e)||(this.splide.refresh(),this.slides=e)}sync(r){var e;(e=this.splide)==null||e.sync(r)}go(r){var e;(e=this.splide)==null||e.go(r)}getSlides(){var r;if(this.splide){const e=(r=this.splide.Components.Elements)==null?void 0:r.list.children;return e&&Array.prototype.slice.call(e)||[]}return[]}bind(r){X0e.forEach(([e,t])=>{const n=this.props[t];typeof n=="function"&&r.on(e,(...i)=>{n(r,...i)})})}renderTrack(){return Xa.createElement("div",{className:"splide__track"},Xa.createElement("ul",{className:"splide__list"},this.props.children))}render(){const{id:r,className:e,hasSliderWrapper:t,hasAutoplayProgress:n,hasAutoplayControls:i,playButtonLabel:a="Play",pauseButtonLabel:s="Pause",renderControls:o}=this.props;return Xa.createElement("div",{id:r,className:fee("splide",e),ref:this.splideRef},t?Xa.createElement("div",{className:"splide__slider"},this.renderTrack()):this.renderTrack(),n&&Xa.createElement("div",{className:"splide__progress"},Xa.createElement("div",{className:"splide__progress__bar"})),i&&Xa.createElement("div",{className:"splide__autoplay"},Xa.createElement("button",{className:"splide__play"},a),Xa.createElement("button",{className:"splide__pause"},s)),o&&o())}},pee=({children:r,className:e,...t})=>Xa.createElement("li",{className:fee("splide__slide",e),...t},r);/*!
|
|
5088
5088
|
* Splide.js
|
|
5089
5089
|
* Version : 3.6.12
|
|
5090
5090
|
* License : MIT
|
|
@@ -9193,7 +9193,7 @@ Check the render method of %s.`,Ct(Go)||"Unknown"));var ge=kf(Y,ae);ge.payload={
|
|
|
9193
9193
|
* Released under the MIT License.
|
|
9194
9194
|
*/const Jn={LEFT:1,RIGHT:2,MIDDLE:4},Et=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Ax={NONE:0,IN:1,OUT:-1};function z0(r){return r.isPerspectiveCamera}function qv(r){return r.isOrthographicCamera}const bx=Math.PI*2,w$=Math.PI/2,pie=1e-5,ZM=Math.PI/180;function bd(r,e,t){return Math.max(e,Math.min(t,r))}function Gr(r,e=pie){return Math.abs(r)<e}function dr(r,e,t=pie){return Gr(r-e,t)}function C$(r,e){return Math.round(r/e)*e}function JM(r){return isFinite(r)?r:r<0?-Number.MAX_VALUE:Number.MAX_VALUE}function eR(r){return Math.abs(r)<Number.MAX_VALUE?r:r*(1/0)}function _P(r,e,t,n,i=1/0,a){n=Math.max(1e-4,n);const s=2/n,o=s*a,l=1/(1+o+.48*o*o+.235*o*o*o);let u=r-e;const f=e,h=i*n;u=bd(u,-h,h),e=r-u;const p=(t.value+s*u)*a;t.value=(t.value-s*p)*l;let m=e+(u+p)*l;return f-r>0==m>f&&(m=f,t.value=(m-f)/a),m}function M$(r,e,t,n,i=1/0,a,s){n=Math.max(1e-4,n);const o=2/n,l=o*a,u=1/(1+l+.48*l*l+.235*l*l*l);let f=e.x,h=e.y,p=e.z,m=r.x-f,y=r.y-h,E=r.z-p;const b=f,v=h,x=p,S=i*n,_=S*S,w=m*m+y*y+E*E;if(w>_){const j=Math.sqrt(w);m=m/j*S,y=y/j*S,E=E/j*S}f=r.x-m,h=r.y-y,p=r.z-E;const R=(t.x+o*m)*a,N=(t.y+o*y)*a,L=(t.z+o*E)*a;t.x=(t.x-o*R)*u,t.y=(t.y-o*N)*u,t.z=(t.z-o*L)*u,s.x=f+(m+R)*u,s.y=h+(y+N)*u,s.z=p+(E+L)*u;const I=b-r.x,D=v-r.y,k=x-r.z,F=s.x-b,U=s.y-v,z=s.z-x;return I*F+D*U+k*z>0&&(s.x=b,s.y=v,s.z=x,t.x=(s.x-b)/a,t.y=(s.y-v)/a,t.z=(s.z-x)/a),s}function oG(r,e){e.set(0,0),r.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=r.length,e.y/=r.length}function lG(r,e){return qv(r)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class WLe{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const a=i.indexOf(t);a!==-1&&i.splice(a,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let a=0,s=i.length;a<s;a++)i[a].call(this,e)}}}const YLe="2.7.0",EP=1/8,mie=typeof window<"u",qLe=mie&&/Mac/.test(navigator.platform),XLe=!(mie&&"PointerEvent"in window);let jn,R$,SP,cG,dc,yi,rr,_x,tR,vd,yd,G0,I$,N$,Vu,nR,Ex,D$,uG,O$,hG,fG,xP,dG=class UH extends WLe{static install(e){jn=e.THREE,R$=Object.freeze(new jn.Vector3(0,0,0)),SP=Object.freeze(new jn.Vector3(0,1,0)),cG=Object.freeze(new jn.Vector3(0,0,1)),dc=new jn.Vector2,yi=new jn.Vector3,rr=new jn.Vector3,_x=new jn.Vector3,tR=new jn.Vector3,vd=new jn.Vector3,yd=new jn.Vector3,G0=new jn.Vector3,I$=new jn.Vector3,N$=new jn.Vector3,Vu=new jn.Spherical,nR=new jn.Spherical,Ex=new jn.Box3,D$=new jn.Box3,uG=new jn.Sphere,O$=new jn.Quaternion,hG=new jn.Quaternion,fG=new jn.Matrix4,xP=new jn.Raycaster}static get ACTION(){return Et}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.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=Et.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._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=Ax.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new jn.Vector3,this._focalOffsetVelocity=new jn.Vector3,this._zoomVelocity={value:0},this._truckInternal=(_,w,R)=>{let N,L;if(z0(this._camera)){const I=yi.copy(this._camera.position).sub(this._target),D=this._camera.getEffectiveFOV()*ZM,k=I.length()*Math.tan(D*.5);N=this.truckSpeed*_*k/this._elementRect.height,L=this.truckSpeed*w*k/this._elementRect.height}else if(qv(this._camera)){const I=this._camera;N=_*(I.right-I.left)/I.zoom/this._elementRect.width,L=w*(I.top-I.bottom)/I.zoom/this._elementRect.height}else return;this.verticalDragToForward?(R?this.setFocalOffset(this._focalOffsetEnd.x+N,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(N,0,!0),this.forward(-L,!0)):R?this.setFocalOffset(this._focalOffsetEnd.x+N,this._focalOffsetEnd.y+L,this._focalOffsetEnd.z,!0):this.truck(N,L,!0)},this._rotateInternal=(_,w)=>{const R=bx*this.azimuthRotateSpeed*_/this._elementRect.height,N=bx*this.polarRotateSpeed*w/this._elementRect.height;this.rotate(R,N,!0)},this._dollyInternal=(_,w,R)=>{const N=Math.pow(.95,-_*this.dollySpeed),L=this._sphericalEnd.radius,I=this._sphericalEnd.radius*N,D=jn.MathUtils.clamp(I,this.minDistance,this.maxDistance),k=D-I;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(I,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(k,!0),this._dollyToNoClamp(D,!0)):this._dollyToNoClamp(D,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?I:D)-L,this._dollyControlCoord.set(w,R)),this._lastDollyDirection=Math.sign(-_)},this._zoomInternal=(_,w,R)=>{const N=Math.pow(.95,_*this.dollySpeed),L=this._zoom,I=this._zoom*N;this.zoomTo(I,!0),this.dollyToCursor&&(this._changedZoom+=I-L,this._dollyControlCoord.set(w,R))},typeof jn>"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 jn.Quaternion().setFromUnitVectors(this._camera.up,SP),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=Et.NONE,this._target=new jn.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new jn.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new jn.Spherical().setFromVector3(yi.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 jn.Vector3,new jn.Vector3,new jn.Vector3,new jn.Vector3],this._updateNearPlaneCorners(),this._boundary=new jn.Box3(new jn.Vector3(-1/0,-1/0,-1/0),new jn.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 jn.Vector2,this.mouseButtons={left:Et.ROTATE,middle:Et.DOLLY,right:Et.TRUCK,wheel:z0(this._camera)?Et.DOLLY:qv(this._camera)?Et.ZOOM:Et.NONE},this.touches={one:Et.TOUCH_ROTATE,two:z0(this._camera)?Et.TOUCH_DOLLY_TRUCK:qv(this._camera)?Et.TOUCH_ZOOM_TRUCK:Et.NONE,three:Et.TOUCH_TRUCK};const n=new jn.Vector2,i=new jn.Vector2,a=new jn.Vector2,s=_=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const N=this._domElement.getBoundingClientRect(),L=_.clientX/N.width,I=_.clientY/N.height;if(L<this._interactiveArea.left||L>this._interactiveArea.right||I<this._interactiveArea.top||I>this._interactiveArea.bottom)return}const w=_.pointerType!=="mouse"?null:(_.buttons&Jn.LEFT)===Jn.LEFT?Jn.LEFT:(_.buttons&Jn.MIDDLE)===Jn.MIDDLE?Jn.MIDDLE:(_.buttons&Jn.RIGHT)===Jn.RIGHT?Jn.RIGHT:null;if(w!==null){const N=this._findPointerByMouseButton(w);N&&this._disposePointer(N)}if((_.buttons&Jn.LEFT)===Jn.LEFT&&this._lockedPointer)return;const R={pointerId:_.pointerId,clientX:_.clientX,clientY:_.clientY,deltaX:0,deltaY:0,mouseButton:w};this._activePointers.push(R),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",f),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",f),this._isDragging=!0,E(_)},o=_=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const N=this._domElement.getBoundingClientRect(),L=_.clientX/N.width,I=_.clientY/N.height;if(L<this._interactiveArea.left||L>this._interactiveArea.right||I<this._interactiveArea.top||I>this._interactiveArea.bottom)return}const w=(_.buttons&Jn.LEFT)===Jn.LEFT?Jn.LEFT:(_.buttons&Jn.MIDDLE)===Jn.MIDDLE?Jn.MIDDLE:(_.buttons&Jn.RIGHT)===Jn.RIGHT?Jn.RIGHT:null;if(w!==null){const N=this._findPointerByMouseButton(w);N&&this._disposePointer(N)}const R={pointerId:1,clientX:_.clientX,clientY:_.clientY,deltaX:0,deltaY:0,mouseButton:(_.buttons&Jn.LEFT)===Jn.LEFT?Jn.LEFT:(_.buttons&Jn.MIDDLE)===Jn.LEFT?Jn.MIDDLE:(_.buttons&Jn.RIGHT)===Jn.LEFT?Jn.RIGHT:null};this._activePointers.push(R),this._domElement.ownerDocument.removeEventListener("mousemove",u),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.addEventListener("mousemove",u),this._domElement.ownerDocument.addEventListener("mouseup",h),this._isDragging=!0,E(_)},l=_=>{_.cancelable&&_.preventDefault();const w=_.pointerId,R=this._lockedPointer||this._findPointerById(w);if(R){if(R.clientX=_.clientX,R.clientY=_.clientY,R.deltaX=_.movementX,R.deltaY=_.movementY,this._state=0,_.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&&(_.buttons&Jn.LEFT)===Jn.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(_.buttons&Jn.MIDDLE)===Jn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(_.buttons&Jn.RIGHT)===Jn.RIGHT&&(this._state=this._state|this.mouseButtons.right);b()}},u=_=>{const w=this._lockedPointer||this._findPointerById(1);w&&(w.clientX=_.clientX,w.clientY=_.clientY,w.deltaX=_.movementX,w.deltaY=_.movementY,this._state=0,(this._lockedPointer||(_.buttons&Jn.LEFT)===Jn.LEFT)&&(this._state=this._state|this.mouseButtons.left),(_.buttons&Jn.MIDDLE)===Jn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(_.buttons&Jn.RIGHT)===Jn.RIGHT&&(this._state=this._state|this.mouseButtons.right),b())},f=_=>{const w=this._findPointerById(_.pointerId);if(!(w&&w===this._lockedPointer)){if(w&&this._disposePointer(w),_.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=Et.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=Et.NONE;v()}},h=()=>{const _=this._findPointerById(1);_&&_===this._lockedPointer||(_&&this._disposePointer(_),this._state=Et.NONE,v())};let p=-1;const m=_=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===Et.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const I=this._domElement.getBoundingClientRect(),D=_.clientX/I.width,k=_.clientY/I.height;if(D<this._interactiveArea.left||D>this._interactiveArea.right||k<this._interactiveArea.top||k>this._interactiveArea.bottom)return}if(_.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===Et.ROTATE||this.mouseButtons.wheel===Et.TRUCK){const I=performance.now();p-I<1e3&&this._getClientRect(this._elementRect),p=I}const w=qLe?-1:-3,R=_.deltaMode===1?_.deltaY/w:_.deltaY/(w*10),N=this.dollyToCursor?(_.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(_.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case Et.ROTATE:{this._rotateInternal(_.deltaX,_.deltaY),this._isUserControllingRotate=!0;break}case Et.TRUCK:{this._truckInternal(_.deltaX,_.deltaY,!1),this._isUserControllingTruck=!0;break}case Et.OFFSET:{this._truckInternal(_.deltaX,_.deltaY,!0),this._isUserControllingOffset=!0;break}case Et.DOLLY:{this._dollyInternal(-R,N,L),this._isUserControllingDolly=!0;break}case Et.ZOOM:{this._zoomInternal(-R,N,L),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},y=_=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===UH.ACTION.NONE){const w=_ instanceof PointerEvent?_.pointerId:(_ instanceof MouseEvent,0),R=this._findPointerById(w);R&&this._disposePointer(R),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",f),this._domElement.ownerDocument.removeEventListener("mousemove",u),this._domElement.ownerDocument.removeEventListener("mouseup",h);return}_.preventDefault()}},E=_=>{if(!this._enabled)return;if(oG(this._activePointers,dc),this._getClientRect(this._elementRect),n.copy(dc),i.copy(dc),this._activePointers.length>=2){const R=dc.x-this._activePointers[1].clientX,N=dc.y-this._activePointers[1].clientY,L=Math.sqrt(R*R+N*N);a.set(0,L);const I=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,D=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(I,D)}if(this._state=0,!_)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in _&&_.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&&(_.buttons&Jn.LEFT)===Jn.LEFT&&(this._state=this._state|this.mouseButtons.left),(_.buttons&Jn.MIDDLE)===Jn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(_.buttons&Jn.RIGHT)===Jn.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&Et.ROTATE)===Et.ROTATE||(this._state&Et.TOUCH_ROTATE)===Et.TOUCH_ROTATE||(this._state&Et.TOUCH_DOLLY_ROTATE)===Et.TOUCH_DOLLY_ROTATE||(this._state&Et.TOUCH_ZOOM_ROTATE)===Et.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&Et.TRUCK)===Et.TRUCK||(this._state&Et.TOUCH_TRUCK)===Et.TOUCH_TRUCK||(this._state&Et.TOUCH_DOLLY_TRUCK)===Et.TOUCH_DOLLY_TRUCK||(this._state&Et.TOUCH_ZOOM_TRUCK)===Et.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&Et.DOLLY)===Et.DOLLY||(this._state&Et.TOUCH_DOLLY)===Et.TOUCH_DOLLY||(this._state&Et.TOUCH_DOLLY_TRUCK)===Et.TOUCH_DOLLY_TRUCK||(this._state&Et.TOUCH_DOLLY_OFFSET)===Et.TOUCH_DOLLY_OFFSET||(this._state&Et.TOUCH_DOLLY_ROTATE)===Et.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&Et.ZOOM)===Et.ZOOM||(this._state&Et.TOUCH_ZOOM)===Et.TOUCH_ZOOM||(this._state&Et.TOUCH_ZOOM_TRUCK)===Et.TOUCH_ZOOM_TRUCK||(this._state&Et.TOUCH_ZOOM_OFFSET)===Et.TOUCH_ZOOM_OFFSET||(this._state&Et.TOUCH_ZOOM_ROTATE)===Et.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&Et.OFFSET)===Et.OFFSET||(this._state&Et.TOUCH_OFFSET)===Et.TOUCH_OFFSET||(this._state&Et.TOUCH_DOLLY_OFFSET)===Et.TOUCH_DOLLY_OFFSET||(this._state&Et.TOUCH_ZOOM_OFFSET)===Et.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},b=()=>{if(!this._enabled)return;oG(this._activePointers,dc);const w=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,R=w?-w.deltaX:i.x-dc.x,N=w?-w.deltaY:i.y-dc.y;if(i.copy(dc),((this._state&Et.ROTATE)===Et.ROTATE||(this._state&Et.TOUCH_ROTATE)===Et.TOUCH_ROTATE||(this._state&Et.TOUCH_DOLLY_ROTATE)===Et.TOUCH_DOLLY_ROTATE||(this._state&Et.TOUCH_ZOOM_ROTATE)===Et.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(R,N),this._isUserControllingRotate=!0),(this._state&Et.DOLLY)===Et.DOLLY||(this._state&Et.ZOOM)===Et.ZOOM){const L=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,I=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,D=this.dollyDragInverted?-1:1;(this._state&Et.DOLLY)===Et.DOLLY?(this._dollyInternal(D*N*EP,L,I),this._isUserControllingDolly=!0):(this._zoomInternal(D*N*EP,L,I),this._isUserControllingZoom=!0)}if((this._state&Et.TOUCH_DOLLY)===Et.TOUCH_DOLLY||(this._state&Et.TOUCH_ZOOM)===Et.TOUCH_ZOOM||(this._state&Et.TOUCH_DOLLY_TRUCK)===Et.TOUCH_DOLLY_TRUCK||(this._state&Et.TOUCH_ZOOM_TRUCK)===Et.TOUCH_ZOOM_TRUCK||(this._state&Et.TOUCH_DOLLY_OFFSET)===Et.TOUCH_DOLLY_OFFSET||(this._state&Et.TOUCH_ZOOM_OFFSET)===Et.TOUCH_ZOOM_OFFSET||(this._state&Et.TOUCH_DOLLY_ROTATE)===Et.TOUCH_DOLLY_ROTATE||(this._state&Et.TOUCH_ZOOM_ROTATE)===Et.TOUCH_ZOOM_ROTATE){const L=dc.x-this._activePointers[1].clientX,I=dc.y-this._activePointers[1].clientY,D=Math.sqrt(L*L+I*I),k=a.y-D;a.set(0,D);const F=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,U=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&Et.TOUCH_DOLLY)===Et.TOUCH_DOLLY||(this._state&Et.TOUCH_DOLLY_ROTATE)===Et.TOUCH_DOLLY_ROTATE||(this._state&Et.TOUCH_DOLLY_TRUCK)===Et.TOUCH_DOLLY_TRUCK||(this._state&Et.TOUCH_DOLLY_OFFSET)===Et.TOUCH_DOLLY_OFFSET?(this._dollyInternal(k*EP,F,U),this._isUserControllingDolly=!0):(this._zoomInternal(k*EP,F,U),this._isUserControllingZoom=!0)}((this._state&Et.TRUCK)===Et.TRUCK||(this._state&Et.TOUCH_TRUCK)===Et.TOUCH_TRUCK||(this._state&Et.TOUCH_DOLLY_TRUCK)===Et.TOUCH_DOLLY_TRUCK||(this._state&Et.TOUCH_ZOOM_TRUCK)===Et.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(R,N,!1),this._isUserControllingTruck=!0),((this._state&Et.OFFSET)===Et.OFFSET||(this._state&Et.TOUCH_OFFSET)===Et.TOUCH_OFFSET||(this._state&Et.TOUCH_DOLLY_OFFSET)===Et.TOUCH_DOLLY_OFFSET||(this._state&Et.TOUCH_ZOOM_OFFSET)===Et.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(R,N,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},v=()=>{oG(this._activePointers,dc),i.copy(dc),(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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",u),this._domElement.ownerDocument.removeEventListener("pointerup",f),this._domElement.ownerDocument.removeEventListener("mouseup",h),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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",f),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",x),this._domElement.ownerDocument.addEventListener("pointerlockerror",S),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",f),E())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",x),this._domElement.ownerDocument.removeEventListener("pointerlockerror",S))};const x=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},S=()=>{this.unlockPointer()};this._addAllEventListeners=_=>{this._domElement=_,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",s),XLe&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",f),this._domElement.addEventListener("wheel",m,{passive:!1}),this._domElement.addEventListener("contextmenu",y)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",s),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",f),this._domElement.removeEventListener("wheel",m,{passive:!1}),this._domElement.removeEventListener("contextmenu",y),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",u),this._domElement.ownerDocument.removeEventListener("pointerup",f),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.removeEventListener("pointerlockchange",x),this._domElement.ownerDocument.removeEventListener("pointerlockerror",S))},this.cancel=()=>{this._state!==Et.NONE&&(this._state=Et.NONE,this._activePointers.length=0,v())},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=bd(e.width,0,1),this._interactiveArea.height=bd(e.height,0,1),this._interactiveArea.x=bd(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=bd(e.x,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}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,n=!1){this._isUserControllingRotate=!1;const i=bd(e,this.minAzimuthAngle,this.maxAzimuthAngle),a=bd(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=a,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const s=!n||dr(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&dr(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(s)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Ax.NONE,this._changedDolly=0,this._dollyToNoClamp(bd(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const s=this._collisionTest(),o=dr(s,this._spherical.radius);if(!(n>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,s)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const a=!t||dr(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(a)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(tR).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||dr(this._target.x,this._targetEnd.x,this.restThreshold)&&dr(this._target.y,this._targetEnd.y,this.restThreshold)&&dr(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=bd(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||dr(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),vd.setFromMatrixColumn(this._camera.matrix,0),yd.setFromMatrixColumn(this._camera.matrix,1),vd.multiplyScalar(e),yd.multiplyScalar(-t);const i=yi.copy(vd).add(yd),a=rr.copy(this._targetEnd).add(i);return this.moveTo(a.x,a.y,a.z,n)}forward(e,t=!1){yi.setFromMatrixColumn(this._camera.matrix,0),yi.crossVectors(this._camera.up,yi),yi.multiplyScalar(e);const n=rr.copy(this._targetEnd).add(yi);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return yi.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+yi.x,this._targetEnd.y+yi.y,this._targetEnd.z+yi.z,t)}moveTo(e,t,n,i=!1){this._isUserControllingTruck=!1;const a=yi.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,a,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const s=!i||dr(this._target.x,this._targetEnd.x,this.restThreshold)&&dr(this._target.y,this._targetEnd.y,this.restThreshold)&&dr(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}lookInDirectionOf(e,t,n,i=!1){const o=yi.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(o.x,o.y,o.z,i)}fitToBox(e,t,{cover:n=!1,paddingLeft:i=0,paddingRight:a=0,paddingBottom:s=0,paddingTop:o=0}={}){const l=[],u=e.isBox3?Ex.copy(e):Ex.setFromObject(e);u.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const f=C$(this._sphericalEnd.theta,w$),h=C$(this._sphericalEnd.phi,w$);l.push(this.rotateTo(f,h,t));const p=yi.setFromSpherical(this._sphericalEnd).normalize(),m=O$.setFromUnitVectors(p,cG),y=dr(Math.abs(p.y),1);y&&m.multiply(hG.setFromAxisAngle(SP,f)),m.multiply(this._yAxisUpSpaceInverse);const E=D$.makeEmpty();rr.copy(u.min).applyQuaternion(m),E.expandByPoint(rr),rr.copy(u.min).setX(u.max.x).applyQuaternion(m),E.expandByPoint(rr),rr.copy(u.min).setY(u.max.y).applyQuaternion(m),E.expandByPoint(rr),rr.copy(u.max).setZ(u.min.z).applyQuaternion(m),E.expandByPoint(rr),rr.copy(u.min).setZ(u.max.z).applyQuaternion(m),E.expandByPoint(rr),rr.copy(u.max).setY(u.min.y).applyQuaternion(m),E.expandByPoint(rr),rr.copy(u.max).setX(u.min.x).applyQuaternion(m),E.expandByPoint(rr),rr.copy(u.max).applyQuaternion(m),E.expandByPoint(rr),E.min.x-=i,E.min.y-=s,E.max.x+=a,E.max.y+=o,m.setFromUnitVectors(cG,p),y&&m.premultiply(hG.invert()),m.premultiply(this._yAxisUpSpace);const b=E.getSize(yi),v=E.getCenter(rr).applyQuaternion(m);if(z0(this._camera)){const x=this.getDistanceToFitBox(b.x,b.y,b.z,n);l.push(this.moveTo(v.x,v.y,v.z,t)),l.push(this.dollyTo(x,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(qv(this._camera)){const x=this._camera,S=x.right-x.left,_=x.top-x.bottom,w=n?Math.max(S/b.x,_/b.y):Math.min(S/b.x,_/b.y);l.push(this.moveTo(v.x,v.y,v.z,t)),l.push(this.zoomTo(w,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],a=e instanceof jn.Sphere?uG.copy(e):UH.createBoundingSphere(e,uG);if(n.push(this.moveTo(a.center.x,a.center.y,a.center.z,t)),z0(this._camera)){const s=this.getDistanceToFitSphere(a.radius);n.push(this.dollyTo(s,t))}else if(qv(this._camera)){const s=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*a.radius,u=Math.min(s/l,o/l);n.push(this.zoomTo(u,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,i,a,s,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ax.NONE,this._changedDolly=0;const l=rr.set(i,a,s),u=yi.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(u.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const f=!o||dr(this._target.x,this._targetEnd.x,this.restThreshold)&&dr(this._target.y,this._targetEnd.y,this.restThreshold)&&dr(this._target.z,this._targetEnd.z,this.restThreshold)&&dr(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&dr(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&dr(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(f)}lerpLookAt(e,t,n,i,a,s,o,l,u,f,h,p,m,y=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ax.NONE,this._changedDolly=0;const E=yi.set(i,a,s),b=rr.set(e,t,n);Vu.setFromVector3(b.sub(E).applyQuaternion(this._yAxisUpSpace));const v=_x.set(f,h,p),x=rr.set(o,l,u);nR.setFromVector3(x.sub(v).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(E.lerp(v,m));const S=nR.theta-Vu.theta,_=nR.phi-Vu.phi,w=nR.radius-Vu.radius;this._sphericalEnd.set(Vu.radius+w*m,Vu.phi+_*m,Vu.theta+S*m),this.normalizeRotations(),this._needsUpdate=!0,y||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const R=!y||dr(this._target.x,this._targetEnd.x,this.restThreshold)&&dr(this._target.y,this._targetEnd.y,this.restThreshold)&&dr(this._target.z,this._targetEnd.z,this.restThreshold)&&dr(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&dr(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&dr(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(R)}setPosition(e,t,n,i=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,n,i=!1){const a=this.getPosition(yi),s=this.setLookAt(a.x,a.y,a.z,e,t,n,i);return this._sphericalEnd.phi=bd(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),s}setFocalOffset(e,t,n,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const a=!i||dr(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&dr(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&dr(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),vd.setFromMatrixColumn(this._camera.matrixWorldInverse,0),yd.setFromMatrixColumn(this._camera.matrixWorldInverse,1),G0.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=yi.set(e,t,n),a=i.distanceTo(this._camera.position),s=i.sub(this._camera.position);vd.multiplyScalar(s.x),yd.multiplyScalar(s.y),G0.multiplyScalar(s.z),yi.copy(vd).add(yd).add(G0),yi.z=yi.z+a,this.dollyTo(a,!1),this.setFocalOffset(-yi.x,yi.y,-yi.z,!1),this.moveTo(e,t,n,!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,n,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new jn.Vector4,typeof e=="number"?this._viewport.set(e,t,n,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,i=!1){if(lG(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const a=e/t,s=this._camera.getEffectiveFOV()*ZM,o=this._camera.aspect;return((i?a>o:a<o)?t:e/o)*.5/Math.tan(s*.5)+n*.5}getDistanceToFitSphere(e){if(lG(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*ZM,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,i=1<this._camera.aspect?t:n;return e/Math.sin(i*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new jn.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new jn.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof jn.Spherical?e:new jn.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new jn.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%bx,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=bx),this._spherical.theta+=bx*Math.round((this._sphericalEnd.theta-this._spherical.theta)/bx)}reset(e=!1){if(!dr(this._camera.up.x,this._cameraUp0.x)||!dr(this._camera.up.y,this._cameraUp0.y)||!dr(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(yi);this.updateCameraUp(),this.setPosition(n.x,n.y,n.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,SP),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=yi.subVectors(this._target,this._camera.position).normalize(),t=rr.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e),this._camera.updateMatrixWorld();const n=this.getPosition(yi);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,n=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,a=I$.subVectors(this._targetEnd,this._target),s=N$.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(Gr(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=_P(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,h,1/0,e),this._needsUpdate=!0}if(Gr(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const h=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=_P(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,h,1/0,e),this._needsUpdate=!0}if(Gr(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const h=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=_P(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,h,this.maxSpeed,e),this._needsUpdate=!0}if(Gr(a.x)&&Gr(a.y)&&Gr(a.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const h=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;M$(this._target,this._targetEnd,this._targetVelocity,h,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Gr(s.x)&&Gr(s.y)&&Gr(s.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const h=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;M$(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,h,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Gr(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const h=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=_P(this._zoom,this._zoomEnd,this._zoomVelocity,h,1/0,e)}if(this.dollyToCursor){if(z0(this._camera)&&this._changedDolly!==0){const h=this._spherical.radius-this._lastDistance,p=this._camera,m=this._getCameraDirection(tR),y=yi.copy(m).cross(p.up).normalize();y.lengthSq()===0&&(y.x=1);const E=rr.crossVectors(y,m),b=this._sphericalEnd.radius*Math.tan(p.getEffectiveFOV()*ZM*.5),x=(this._sphericalEnd.radius-h-this._sphericalEnd.radius)/this._sphericalEnd.radius,S=_x.copy(this._targetEnd).add(y.multiplyScalar(this._dollyControlCoord.x*b*p.aspect)).add(E.multiplyScalar(this._dollyControlCoord.y*b)),_=yi.copy(this._targetEnd).lerp(S,x),w=this._lastDollyDirection===Ax.IN&&this._spherical.radius<=this.minDistance,R=this._lastDollyDirection===Ax.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(w||R)){this._sphericalEnd.radius-=h,this._spherical.radius-=h;const L=rr.copy(m).multiplyScalar(-h);_.add(L)}this._boundary.clampPoint(_,_);const N=rr.subVectors(_,this._targetEnd);this._targetEnd.copy(_),this._target.add(N),this._changedDolly-=h,Gr(this._changedDolly)&&(this._changedDolly=0)}else if(qv(this._camera)&&this._changedZoom!==0){const h=this._zoom-this._lastZoom,p=this._camera,m=yi.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(p.near+p.far)/(p.near-p.far)).unproject(p),y=rr.set(0,0,-1).applyQuaternion(p.quaternion),E=_x.copy(m).add(y.multiplyScalar(-m.dot(p.up))),v=-(this._zoom-h-this._zoom)/this._zoom,x=this._getCameraDirection(tR),S=this._targetEnd.dot(x),_=yi.copy(this._targetEnd).lerp(E,v),w=_.dot(x),R=x.multiplyScalar(w-S);_.sub(R),this._boundary.clampPoint(_,_);const N=rr.subVectors(_,this._targetEnd);this._targetEnd.copy(_),this._target.add(N),this._changedZoom-=h,Gr(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0);const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Gr(this._focalOffset.x)||!Gr(this._focalOffset.y)||!Gr(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),vd.setFromMatrixColumn(this._camera.matrix,0),yd.setFromMatrixColumn(this._camera.matrix,1),G0.setFromMatrixColumn(this._camera.matrix,2),vd.multiplyScalar(this._focalOffset.x),yd.multiplyScalar(-this._focalOffset.y),G0.multiplyScalar(this._focalOffset.z),yi.copy(vd).add(yd).add(G0),this._camera.position.add(yi)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),yi.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const f=this._needsUpdate;return f&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):f?(this.dispatchEvent({type:"update"}),Gr(t,this.restThreshold)&&Gr(n,this.restThreshold)&&Gr(i,this.restThreshold)&&Gr(a.x,this.restThreshold)&&Gr(a.y,this.restThreshold)&&Gr(a.z,this.restThreshold)&&Gr(s.x,this.restThreshold)&&Gr(s.y,this.restThreshold)&&Gr(s.z,this.restThreshold)&&Gr(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!f&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=f,this._needsUpdate=!1,f}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:JM(this.maxDistance),minZoom:this.minZoom,maxZoom:JM(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:JM(this.maxPolarAngle),minAzimuthAngle:JM(this.minAzimuthAngle),maxAzimuthAngle:JM(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:yi.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 n=JSON.parse(e);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=eR(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=eR(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=eR(n.maxPolarAngle),this.minAzimuthAngle=eR(n.minAzimuthAngle),this.maxAzimuthAngle=eR(n.maxAzimuthAngle),this.smoothTime=n.smoothTime,this.draggingSmoothTime=n.draggingSmoothTime,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this.verticalDragToForward=n.verticalDragToForward,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._zoom0=n.zoom0,this._focalOffset0.fromArray(n.focalOffset0),this.moveTo(n.target[0],n.target[1],n.target[2],t),Vu.setFromVector3(yi.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Vu.theta,Vu.phi,t),this.dollyTo(Vu.radius,t),this.zoomTo(n.zoom,t),this.setFocalOffset(n.focalOffset[0],n.focalOffset[1],n.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",YLe),this._addAllEventListeners(e)}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,n){const i=t.lengthSq();if(i===0)return e;const a=rr.copy(t).add(e),o=this._boundary.clampPoint(a,_x).sub(a),l=o.lengthSq();if(l===0)return e.add(t);if(l===i)return e;if(n===0)return e.add(t).add(o);{const u=1+n*l/t.dot(o);return e.add(rr.copy(t).multiplyScalar(u)).add(o.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(z0(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*ZM,i=Math.tan(n*.5)*t,a=i*e.aspect;this._nearPlaneCorners[0].set(-a,-i,0),this._nearPlaneCorners[1].set(a,-i,0),this._nearPlaneCorners[2].set(a,i,0),this._nearPlaneCorners[3].set(-a,i,0)}else if(qv(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,i=e.right*t,a=e.top*t,s=e.bottom*t;this._nearPlaneCorners[0].set(n,a,0),this._nearPlaneCorners[1].set(i,a,0),this._nearPlaneCorners[2].set(i,s,0),this._nearPlaneCorners[3].set(n,s,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||lG(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(tR);fG.lookAt(R$,n,this._camera.up);for(let i=0;i<4;i++){const a=rr.copy(this._nearPlaneCorners[i]);a.applyMatrix4(fG);const s=_x.addVectors(this._target,a);xP.set(s,n),xP.far=this._spherical.radius+1;const o=xP.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[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 n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_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 jn.Sphere){const n=t,i=n.center;Ex.makeEmpty(),e.traverseVisible(s=>{s.isMesh&&Ex.expandByObject(s)}),Ex.getCenter(i);let a=0;return e.traverseVisible(s=>{if(!s.isMesh)return;const o=s,l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const f=l.attributes.position;for(let h=0,p=f.count;h<p;h++)yi.fromBufferAttribute(f,h),a=Math.max(a,i.distanceToSquared(yi))}),n.radius=Math.sqrt(a),n}};const $Le=oe.forwardRef((r,e)=>{oe.useMemo(()=>{dG.install({THREE:dI}),Y6({CameraControlsImpl:dG})},[]);const{camera:t,domElement:n,makeDefault:i,onStart:a,onEnd:s,onChange:o,regress:l,...u}=r,f=fs(w=>w.camera),h=fs(w=>w.gl),p=fs(w=>w.invalidate),m=fs(w=>w.events),y=fs(w=>w.setEvents),E=fs(w=>w.set),b=fs(w=>w.get),v=fs(w=>w.performance),x=t||f,S=n||m.connected||h.domElement,_=oe.useMemo(()=>new dG(x),[x]);return Zm((w,R)=>{_.enabled&&_.update(R)},-1),oe.useEffect(()=>(_.connect(S),()=>void _.disconnect()),[S,_]),oe.useEffect(()=>{const w=L=>{p(),l&&v.regress(),o&&o(L)},R=L=>{a&&a(L)},N=L=>{s&&s(L)};return _.addEventListener("update",w),_.addEventListener("controlstart",R),_.addEventListener("controlend",N),_.addEventListener("control",w),_.addEventListener("transitionstart",w),_.addEventListener("wake",w),()=>{_.removeEventListener("update",w),_.removeEventListener("controlstart",R),_.removeEventListener("controlend",N),_.removeEventListener("control",w),_.removeEventListener("transitionstart",w),_.removeEventListener("wake",w)}},[_,a,s,p,y,l,o]),oe.useEffect(()=>{if(i){const w=b().controls;return E({controls:_}),()=>E({controls:w})}},[i,_]),oe.createElement("primitive",zd({ref:e,object:_},u))});function KLe(r,e){const t=oe.useRef(),[n]=oe.useState(()=>e?e instanceof Ei?{current:e}:e:t),[i]=oe.useState(()=>new wne(void 0)),a=oe.useRef({}),[s]=oe.useState(()=>{const o={};return r.forEach(l=>Object.defineProperty(o,l.name,{enumerable:!0,get(){if(n.current)return a.current[l.name]||(a.current[l.name]=i.clipAction(l,n.current))}})),{ref:n,clips:r,actions:o,names:r.map(l=>l.name),mixer:i}});return Zm((o,l)=>i.update(l)),oe.useEffect(()=>{const o=n.current;return()=>{a.current={},Object.values(s.actions).forEach(l=>{o&&i.uncacheAction(l,o)})}},[r]),oe.useEffect(()=>()=>{i.stopAllAction()},[i]),s}function ZLe(r,e){const t=r+"Geometry";return oe.forwardRef(({args:n,children:i,...a},s)=>{const o=oe.useRef(null);return oe.useImperativeHandle(s,()=>o.current),oe.useLayoutEffect(()=>void e?.(o.current)),oe.createElement("mesh",zd({ref:o},a),oe.createElement(t,{attach:"geometry",args:n}),i)})}const gie=ZLe("box"),_d=1e-5;function JLe(r,e,t){const n=new dy,i=t-_d;return n.absarc(_d,_d,_d,-Math.PI/2,-Math.PI,!0),n.absarc(_d,e-i*2,_d,Math.PI,Math.PI/2,!0),n.absarc(r-i*2,e-i*2,_d,Math.PI/2,0,!0),n.absarc(r-i*2,_d,_d,0,-Math.PI/2,!0),n}const bm=oe.forwardRef(function({args:[e=1,t=1,n=1]=[],radius:i=.05,steps:a=1,smoothness:s=4,creaseAngle:o=.4,children:l,...u},f){const h=oe.useMemo(()=>JLe(e,t,i),[e,t,i]),p=oe.useMemo(()=>({depth:n-i*2,bevelEnabled:!0,bevelSegments:s*2,steps:a,bevelSize:i-_d,bevelThickness:i,curveSegments:s}),[n,i,s]),m=oe.useRef();return oe.useLayoutEffect(()=>{m.current&&(m.current.center(),QPe(m.current,o))},[h,p]),oe.createElement("mesh",zd({ref:f},u),oe.createElement("extrudeGeometry",{ref:m,args:[h,p]}),l)}),pG={sunset:"venice/venice_sunset_1k.hdr",dawn:"kiara/kiara_1_dawn_1k.hdr",night:"dikhololo/dikhololo_night_1k.hdr",warehouse:"empty-wharehouse/empty_warehouse_01_1k.hdr",forest:"forrest-slope/forest_slope_1k.hdr",apartment:"lebombo/lebombo_1k.hdr",studio:"studio-small-3/studio_small_03_1k.hdr",city:"potsdamer-platz/potsdamer_platz_1k.hdr",park:"rooitou/rooitou_park_1k.hdr",lobby:"st-fagans/st_fagans_interior_1k.hdr"},eUe="https://market-assets.fra1.cdn.digitaloceanspaces.com/market-assets/hdris/";function vie({files:r=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"],path:e="",preset:t=void 0,encoding:n=void 0,extensions:i}={}){if(t){if(!(t in pG))throw new Error("Preset must be one of: "+Object.keys(pG).join(", "));r=pG[t],e=eUe}const a=Array.isArray(r),o=$6(a?dne:VLe,a?[r]:r,u=>{u.setPath(e),i&&i(u)}),l=a?o[0]:o;return l.mapping=a?Qm:AT,l.encoding=n??a?cf:II,l}const tUe=r=>r.current&&r.current.isScene,nUe=r=>tUe(r)?r.current:r;function n8(r,e,t,n,i=0){const a=nUe(e||t),s=a.background,o=a.environment,l=a.backgroundBlurriness||0;return r!=="only"&&(a.environment=n),r&&(a.background=n),r&&a.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=i),()=>{r!=="only"&&(a.environment=o),r&&(a.background=s),r&&a.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=l)}}function i8({scene:r,background:e=!1,blur:t,map:n}){const i=fs(a=>a.scene);return oe.useLayoutEffect(()=>{if(n)return n8(e,r,i,n,t)},[i,r,n,e,t]),null}function yie({background:r=!1,scene:e,blur:t,...n}){const i=vie(n),a=fs(s=>s.scene);return oe.useLayoutEffect(()=>n8(r,e,a,i,t),[i,r,e,a,t]),null}function iUe({children:r,near:e=1,far:t=1e3,resolution:n=256,frames:i=1,map:a,background:s=!1,blur:o,scene:l,files:u,path:f,preset:h=void 0,extensions:p}){const m=fs(S=>S.gl),y=fs(S=>S.scene),E=oe.useRef(null),[b]=oe.useState(()=>new Rb),v=oe.useMemo(()=>{const S=new v6(n);return S.texture.type=nf,S},[n]);oe.useLayoutEffect(()=>(i===1&&E.current.update(m,b),n8(s,l,y,v.texture,o)),[r,b,v.texture,l,y,s,i,m]);let x=1;return Zm(()=>{(i===1/0||x<i)&&(E.current.update(m,b),x++)}),oe.createElement(oe.Fragment,null,vPe(oe.createElement(oe.Fragment,null,r,oe.createElement("cubeCamera",{ref:E,args:[e,t,v]}),u||h?oe.createElement(yie,{background:!0,files:u,preset:h,path:f,extensions:p}):a?oe.createElement(i8,{background:!0,map:a,extensions:p}):null),b))}function rUe(r){var e,t,n,i;const a=vie(r),s=r.map||a;oe.useMemo(()=>Y6({GroundProjectedEnvImpl:oLe}),[]);const o=oe.useMemo(()=>[s],[s]),l=(e=r.ground)==null?void 0:e.height,u=(t=r.ground)==null?void 0:t.radius,f=(n=(i=r.ground)==null?void 0:i.scale)!==null&&n!==void 0?n:1e3;return oe.createElement(oe.Fragment,null,oe.createElement(i8,zd({},r,{map:s})),oe.createElement("groundProjectedEnvImpl",{args:o,scale:f,height:l,radius:u}))}function aUe(r){return r.ground?oe.createElement(rUe,r):r.map?oe.createElement(i8,r):r.children?oe.createElement(iUe,r):oe.createElement(yie,r)}const sUe=oe.forwardRef(({scale:r=10,frames:e=1/0,opacity:t=1,width:n=1,height:i=1,blur:a=1,far:s=10,resolution:o=512,smooth:l=!0,color:u="#000000",depthWrite:f=!1,renderOrder:h,...p},m)=>{const y=oe.useRef(null),E=fs(U=>U.scene),b=fs(U=>U.gl),v=oe.useRef(null);n=n*(Array.isArray(r)?r[0]:r||1),i=i*(Array.isArray(r)?r[1]:r||1);const[x,S,_,w,R,N,L]=oe.useMemo(()=>{const U=new hu(o,o),z=new hu(o,o);z.texture.generateMipmaps=U.texture.generateMipmaps=!1;const j=new Bb(n,i).rotateX(Math.PI/2),Q=new ka(j),H=new RU;H.depthTest=H.depthWrite=!1,H.onBeforeCompile=W=>{W.uniforms={...W.uniforms,ucolor:{value:new Yt(u)}},W.fragmentShader=W.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
|
|
9195
9195
|
void main() {
|
|
9196
|
-
`),W.fragmentShader=W.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const K=new _c(GLe),J=new _c(HLe);return J.depthTest=K.depthTest=!1,[U,j,H,Q,K,J,z]},[o,n,i,r,u]),I=U=>{w.visible=!0,w.material=R,R.uniforms.tDiffuse.value=x.texture,R.uniforms.h.value=U*1/256,b.setRenderTarget(L),b.render(w,v.current),w.material=N,N.uniforms.tDiffuse.value=L.texture,N.uniforms.v.value=U*1/256,b.setRenderTarget(x),b.render(w,v.current),w.visible=!1};let D=0,k,F;return Zm(()=>{v.current&&(e===1/0||D<e)&&(D++,k=E.background,F=E.overrideMaterial,y.current.visible=!1,E.background=null,E.overrideMaterial=_,b.setRenderTarget(x),b.render(E,v.current),I(a),l&&I(a*.4),b.setRenderTarget(null),y.current.visible=!0,E.overrideMaterial=F,E.background=k)}),oe.useImperativeHandle(m,()=>y.current,[]),oe.createElement("group",zd({"rotation-x":Math.PI/2},p,{ref:y}),oe.createElement("mesh",{renderOrder:h,geometry:S,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},oe.createElement("meshBasicMaterial",{transparent:!0,map:x.texture,"map-encoding":b.outputEncoding,opacity:t,depthWrite:f})),oe.createElement("orthographicCamera",{ref:v,args:[-n/2,n/2,i/2,-i/2,0,s]}))}),oUe={}.VITE_APP_ENV,lUe=!1;let cUe=!1,MT;const Gt=new MJ("CORE");oUe==="staging"?(Gt.setCurrentMode(YR.Staging),MT="https://storage.googleapis.com/epigraph-configurator"):(Gt.setCurrentMode(YR.Release),MT="https://storage.googleapis.com/epigraph-configurator");Gt.info({title:"test"});const P$=99999,uUe=99999;let nt=null;function hUe(r){nt=r,nt.disableAnalyticsEvents=cUe}const Aie=`${MT}/projects-asset-data`,fUe=`${Aie}/generic`;let dUe="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?moduleID=",BH="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe/saveConfig",kH="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?configID=",Om="https://storage.googleapis.com/gsc-epigraph-design/product-assets";function pUe(r){const e=r.SAVE_CONFIG_ENDPOINT;BH=e||BH;const t=r.FETCH_CONFIG_ENDPOINT;kH=t||kH;const n=r.PUBLIC_DESIGN_ASSETS_ENDPOINT;Om=n||Om;const i=r.ASSETS_SOURCE_ROOT;MT=i||MT}const kl=Object.freeze({info:{id:"info",level:1e3,src:Om+"/Icon/Info.svg",color:"#2E6CDF",cssClass:"alert-info",background:"#D3E0F8",filter:"invert(39%) sepia(41%) saturate(5002%) hue-rotate(208deg) brightness(91%) contrast(92%)"},warn:{id:"warn",level:3e3,src:Om+"/Icon/Warning.svg",color:"#E2B236",cssClass:"alert-warn",background:"#F9EED2",filter:"invert(83%) sepia(67%) saturate(1578%) hue-rotate(328deg) brightness(93%) contrast(90%)"},error:{id:"error",level:4e3,src:Om+"/Icon/Block.svg",color:"#D0342C",cssClass:"alert-error",background:"#F6D7D5",filter:"invert(24%) sepia(96%) saturate(1914%) hue-rotate(349deg) brightness(95%) contrast(81%)"},success:{id:"success",level:2e3,src:Om+"/Icon/CheckCircle.svg",color:"#65BC6C",cssClass:"alert-success",background:"#DBF0DD",filter:"invert(74%) sepia(3%) saturate(5600%) hue-rotate(75deg) brightness(90%) contrast(90%)"}}),Js=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),eo={GRAB:"grab",POINTER:"pointer",BLOCKED:"blocked",GRABBING:"grabbing",MOVE:"move"},mUe=r=>{const e=[],t=new Set;for(const n of r){let i=n,a=0;for(;t.has(i);)i=n+"."+ ++a;t.add(i),e.push(i)}return e},gUe=(r,e)=>{const t={};for(const n of r.mappings)for(const i of n.variants)t[e[i]]={material:null,gltfMaterialIndex:n.material};return t},TP=r=>r.material!==void 0&&r.userData&&r.userData.variantMaterials,bie=(r,e,t)=>{t(r,e);for(let n=0;n<r.children.length;n++)bie(r.children[n],e.children[n],t)},L$=(r,e)=>{e.userData.variantMaterials!==void 0&&(r.userData.variantMaterials=Object.assign({},e.userData.variantMaterials)),e.userData.originalMaterial!==void 0&&(r.userData.originalMaterial=e.userData.originalMaterial)};class vUe{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,n=t.json;if(!n.extensions||!n.extensions[this.name])return null;const a=n.extensions[this.name].variants||[],s=mUe(a.map(u=>u.name));for(const u of e.scenes)u.traverse(f=>{const h=t.associations.get(f);if(!h||h.meshes===void 0||h.primitives===void 0)return;const y=n.meshes[h.meshes].primitives[h.primitives].extensions;!y||!y[this.name]||(f.userData.variantMaterials=gUe(y[this.name],s))});e.userData.variants=s,e.functions=e.functions||{};const o=async(u,f,h)=>{u.userData.originalMaterial||(u.userData.originalMaterial=u.material);const p=u.material;let m=null;if(f===null||!u.userData.variantMaterials[f])u.material=u.userData.originalMaterial,t.associations.has(u.material)&&(m=t.associations.get(u.material).index);else{const y=u.userData.variantMaterials[f];y.material?(u.material=y.material,y.gltfMaterialIndex!==void 0&&(m=y.gltfMaterialIndex)):(m=y.gltfMaterialIndex,u.material=await t.getDependency("material",m),t.assignFinalMaterial(u),y.material=u.material)}h!==null&&h(u,p,m)},l=u=>{const f=u.material,h=u.userData.variantMaterials,p=[];for(const m in h){const y=h[m];if(y.material)continue;const E=y.gltfMaterialIndex;p.push(t.getDependency("material",E).then(b=>{u.material=b,t.assignFinalMaterial(u),h[m].material=u.material}))}return Promise.all(p).then(()=>{u.material=f})};e.functions.selectVariant=(u,f,h=!0,p=null)=>{const m=[];return h?u.traverse(y=>TP(y)&&m.push(o(y,f,p))):TP(u)&&m.push(o(u,f,p)),Promise.all(m)},e.functions.ensureLoadVariants=(u,f=!0)=>{const h=[];return f?u.traverse(p=>TP(p)&&h.push(l(p))):TP(u)&&h.push(l(u)),Promise.all(h)},e.functions.copyVariantMaterials=(u,f,h=!0)=>{h?bie(u,f,(p,m)=>L$(p,m)):L$(u,f)}}}var r8=new jLe;r8.setDecoderPath(`${MT}/external-libs/draco/`);r8.setDecoderConfig({type:"js"});const Mo=Do((r,e)=>({assets:{items:{}},actions:{async loadAsset(t,n=!1){const{assets:i}=e();let a,s;if(i.items[t]){const h=n?i.items[t].proxy:i.items[t];if(h.isLoaded)return i.items[t];if(h.errorLoading)throw Error((n?"Proxy ":"Model ")+"Loading failed for: "+t,t)}else i.items[t]={isLoaded:!1,errorLoading:!1,proxy:{isLoaded:!1,errorLoading:!1}};const o=Ln.getState().productData[t];if(!o)throw Error("Data doesn't exists for "+t,t);if(n?(a=i.items[t].proxy,s=nt.getResolvedAssetUrl(o.colliderProxyGLTF)):(a=i.items[t],s=nt.getResolvedAssetUrl(o.gltfURL)),!a||!s)return null;const l=new lLe;l.register(h=>new vUe(h)),l.setDRACOLoader(r8);async function u(h){const p=h.loaded/h.total*100;a.progress=p}const f=await l.loadAsync(s,u).catch(h=>{throw a.isLoaded=!1,a.errorLoading=!0,a.error=h,Gt.info(s),Error("Couldn't load "+t,t)});return a.data=f,a.isLoaded=!0,i.items[t]},IsAssetLoaded(t){const{assets:n}=e();return n.items.hasOwnProperty(t)?n.items[t].isLoaded:!1},IsProxyLoaded(t){const{assets:n}=e();return n.items.hasOwnProperty(t)&&n.items[t].hasOwnProperty(proxy)?n.items[t].proxy.isLoaded:!1}}}));var jv=null,Qv=[];const gr=Do((r,e)=>({ghostData:null,ghostsTransform:[],ghostVisibility:!0,ghostParentRef:null,ghostMaterial:null,actions:{spawnGhostsForSkuID:async(t,n=!1,i)=>{const{ghostData:a,ghostsTransform:s}=e();if(a!==null||s.length>0){Gt.info("ghosts are already spawned for: "+a.skuID);return}return await new Promise(async(l,u)=>{let f={};const h=()=>{l(f)};nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Ghost_Loaded,h,{once:!0});const p=Ln.getState().productData,m=ln.getState().attachmentSystem.currentStructure;if(jv=m.getFirstNodeByCategoryID(p[t].categoryID),p[t].replace&&jv){if(t==jv.skuID)return;const{transforms:E,connectablePlugs:b}=m.findGhostTransformForReplacement(t,jv);if(E==null&&b==null){Gt.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+t});return}f.transforms=E,f.newNodes=[jv],f.connectablePlugs=b,f.addItemOrSwap=["replace"],jv.setModelVisibility(!1)}else{const{transforms:E,newNodes:b,connectablePlugs:v}=m.findGhostTransforms(t,n);let x=E,S=v,_=b,w=[];for(let R=0;R<E.length;R++)w.push("add");if(p[t].swappable&&!Je.getState().dragging){Qv=m.getNodesByCategoryID(p[t].categoryID);for(let R=0;R<Qv.length;R++){const N=m.findGhostTransformForReplacement(t,Qv[R]);N.transforms&&(x.push(N.transforms[0]),S.push(N.connectablePlugs[0]),_.push(Qv[R]),w.push("replace"),Qv[R].setModelVisibility(!1))}}f.transforms=x,f.newNodes=_,f.connectablePlugs=S,f.addItemOrSwap=w}if(f.transforms.length<=0)return;const y=await Mo.getState().actions.loadAsset(t,!0);r({ghostsTransform:f.transforms,ghostData:{proxyScene:y.proxy.data.scene,skuID:t,newNodes:f.newNodes,addItemOrSwap:f.addItemOrSwap,connectablePlugs:f.connectablePlugs,count:i||f.transforms.length}})})},clearAllGhosts:()=>{if(jv&&jv.setModelVisibility(!0),Qv)for(let t=0;t<Qv.length;t++)Qv[t].setModelVisibility(!0);r({ghostVisibility:!0,ghostData:null,ghostsTransform:[]})}}})),Cr=Do((r,e)=>({manualControl:!1,sourcePos:null,destPos:new ve(0,0,0),interpolationFactor:0,duration:0,focusPointPosition:new ve(0,0,0),canCameraRotate:!0,sendCameraDetailsTrigger:!1,viewPointPosition:new ve(0,0,0),boundsMargin:0,userDragging:!1,disableAutoRotate:!1,cameraSettings:{truckSpeed:1,fov:35,dollySpeed:1,initialViewPointPosition:new ve(20,15,50),canZoom:!1,canPan:!1,minZoom:1,maxZoom:3,canAutoRotate:!1,autoRotateSpeed:.5,minPolarAngle:0,maxPolarAngle:180,clearColour:"white",zoomingMultiplier:0},actions:{triggerFetchingCamera:()=>{r(t=>({sendCameraDetailsTrigger:!t.sendCameraDetailsTrigger}))},setCameraSettings:t=>{const{cameraSettings:n}=e();Je.getState().isMobile===!0&&t.zoomingMultiplier_mobile!==void 0?t.zoomingMultiplier=t.zoomingMultiplier_mobile:t.zoomingMultiplier_desktop!==void 0&&(t.zoomingMultiplier=t.zoomingMultiplier_desktop),Object.keys(t).map(a=>n[a]=t[a]),r({cameraSettings:{...n},viewPointPosition:FH(n.initialViewPointPosition)})}}})),hi=Do((r,e)=>({activeHotspotData:null,lastActiveHotspotData:null,isAnyHotspotActive:!1,hotspotsVisibility:!1,hotspotsTempVisibility:!0,hotspotsHealthCheck:!0,hotspotsSpawned:{},visitedHotspotsID:[],hotspotSpawnedForCategoryIDs:[],actions:{clearAllHotspots:()=>r({isAnyHotspotActive:!1,activeHotspotData:null,lastActiveHotspotData:null,hotspotsSpawned:{}}),removeHotspotForItem(t){const{hotspotsSpawned:n}=e();Object.keys(n).map(i=>{n[i].itemData.guid==t.itemData.guid&&delete n[i]}),r({hotspotsSpawned:{...n}})},checkHotspotHealth(){const{hotspotsHealthCheck:t}=e();r({hotspotsHealthCheck:!t})},toggleHotspotVisibility(){const{hotspotsVisibility:t}=e();r({hotspotsVisibility:!t})},switchHotspotsVisibility(t,n=!1){r(n===!0?{hotspotsTempVisibility:t}:{hotspotsVisibility:t})},clickHotspot(t,n,i,a=!1){const{activeHotspotData:s}=e();r({lastActiveHotspotData:s}),AUe(t,n,i);let l=Wt.getState().itemsSpawned[i].itemData.skuID;a===!1&&(nt.fireEvent(nt.EVENTS.SCENE.Hotspot_Enter,{hotspotAbsID:EUe(l,t)}),nt.fireEvent(nt.EVENTS.UI.UtilityMenu_Hide))},exitHotspot(t=!1){const{activeHotspotData:n}=e();n&&(r({lastActiveHotspotData:n}),yUe(),t===!1&&(nt.fireEvent(nt.EVENTS.SCENE.Hotspot_Exit,n),nt.fireEvent(nt.EVENTS.UI.UtilityMenu_Show)))}}}));function yUe(){hi.setState({activeHotspotData:null}),hi.setState({isAnyHotspotActive:!1}),Je.getState().actions.triggerAutoFocus()}function AUe(r,e,t){let n=hi.getState();const a=Wt.getState().itemsSpawned;let s=n.visitedHotspotsID;const o=a[t].hotspotsData.filter(w=>w.hotspotID==r);if(!o||o.length<=0)return;const l=o[0],u=a[t].itemData.skuID+"_"+r;let h=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(t),p=new ve(0,0,0);h&&h.ref&&h.ref.getWorldPosition(p);let m=new $i().identity();h&&h.ref&&h.ref.getWorldQuaternion(m);let y=l.focusPointTransform;Gt.info(y);let E=FH(y);E.applyQuaternion(m);let b=l.viewPointTransform,v=FH(b);v.applyQuaternion(m);let x=B$(Vx(E),Vx(p)),S=B$(Vx(v),Vx(p));Cr.setState({sourcePos:null,manualControl:!1,focusPointPosition:x,destPos:S,viewPointPosition:S,duration:1e3}),hi.setState({activeHotspotData:{hotspotData:{guid:e,...l},itemData:{...a[t],guid:t},domID:"rd_"+u},isAnyHotspotActive:!0}),s.includes(u)||(s.push(u),hi.setState({visitedIDs:{...s}}))}const Wt=Do((r,e)=>({variantChangeAlert:!1,removeItems:[],removeItemTrigger:!1,itemsSpawned:{},itemsCount:0,modelLoadedAlert:0,lastDeletedItemData:null,lastDeletedItemsData:[],hoveredItemRef:{},collidersRef:[],filteredCollidersRef:[],selectedItemData:null,busy:!1,actions:{triggerModelLoaded:()=>r(t=>({modelLoadedAlert:t.modelLoadedAlert+1})),triggerRemoveItem:()=>r(t=>({removeItemTrigger:!t.removeItemTrigger})),addToRemoveItems:t=>{const{removeItems:n}=e();n.push(t)},switchToVariant:async(t,n,i=!1)=>{const{itemsSpawned:a,variantChangeAlert:s}=e(),o=Ln.getState().categoryData,l=a[t.guid].itemData.clonedScene;var f=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(t.guid);Mo.getState().assets.items[t.skuID].data||o.geometryVariants&&o.geometryVariants.map(m=>{m.productsInCategory.map(y=>{let E=!1;y.products.map(b=>{b==t.skuID&&(E=!0)}),E&&y.products.map(b=>{const v=Mo.getState().assets.items[b].data;v&&(Mo.getState().assets.items[t.skuID].data=v)})})});const p=Mo.getState().assets.items[t.skuID].data;p&&(await p.functions.selectVariant(l,n),i?(f.overrideVariant=n,nt.fireEvent(nt.EVENTS.SCENE.MaterialOverrides_Exists,!0)):f.currentVariant=n,r({variantChangeAlert:!s}))},clearAllItems:()=>{r({itemsSpawned:{},itemsCount:0,lastDeletedItemsData:[],hoveredItemRef:[],collidersRef:[],filteredCollidersRef:[],selectedItemData:null})},setItemsSpawned:t=>{r({itemsSpawned:t,itemsCount:Object.keys(t).length})},setHoveredItemRef:t=>r({hoveredItemRef:t}),setCollidersRef:t=>{r({collidersRef:t});let n=[];for(var i=0;i<t.length;i++)t[i].current&&n.push(t[i]);Wt.setState({filteredCollidersRef:[...n]})},setSelectedItemData:t=>{const{selectedItemData:n,hoveredItemRef:i,actions:a}=e();n&&(delete i[n.itemData.guid],a.setHoveredItemRef({...i})),r({selectedItemData:{...t}}),Je.getState().actions.triggerAutoFocus(),hi.getState().actions.switchHotspotsVisibility(!1,!0),Cr.setState({canCameraRotate:!1})},deselectItem:()=>{const{selectedItemData:t}=e();t&&nt.fireEvent(nt.EVENTS.UI.ContextMenu_Hide,t),r(()=>({selectedItemData:null})),Je.getState().actions.triggerAutoFocus(),hi.getState().actions.switchHotspotsVisibility(!0,!0),Cr.setState({canCameraRotate:!0}),Wt.getState().actions.setHoveredItemRef({})},removeItemByGUID:async t=>{const{itemsSpawned:n,actions:i}=e();if(n.hasOwnProperty(t))return new Promise(async(a,s)=>{i.addToRemoveItems(t),i.triggerRemoveItem();const o=l=>{t===l.data.itemData.guid&&a(t)};nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Item_Removed,o,{once:!0})})},addItemBySkuID:async(t,n=0,i=!1,a)=>{r({busy:!0});const{actions:s,itemsSpawned:o}=e(),l=Ln.getState().productData,u=Ln.getState().hotspotsData,f=ln.getState().attachmentSystem;let h=!0;const p=await new Promise(async(E,b)=>{if(s.deselectItem(),!l[t]){Gt.warn({title:`Product not found: ${t}`}),nt.alert({alertMsg:t+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),h=!1,b(t+": product not found!");return}const v=[...gr.getState().ghostsTransform],x={...gr.getState().ghostData};if(gr.getState().actions.clearAllGhosts(),v.length<=0){nt.alert({alertMsg:"Unable to add item to configuration",alertTime:6e3,alertType:"warn",alertLabel:"Action Unavailable"}),h=!1,b("No available connections for this product to attach to");return}const S=_=>{t===_.data&&E(x.newNodes[n].guid)};if(nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Model_Loaded,S,{once:!0}),x.addItemOrSwap[n]=="replace")await bUe(o,x.skuID,v[n],x.newNodes[n]);else{const _=x.newNodes[n];_.isDependent=i;let w=!0;if(l[x.skuID].hasOwnProperty("disableInteraction")){const I=l[x.skuID].disableInteraction;(I==!0||I==!1)&&(w=!I)}(a==!0||a==!1)&&(w=a),_.isInteractive=w;const{position:R,rotation:N}=v[n];_.transform={position:R,rotation:N},f.currentStructure.addNode(_),f.currentStructure.connectPlugs(x.connectablePlugs[n]);const L=await Mo.getState().actions.loadAsset(x.skuID,!0);Gt.info("GHOST NEW NODE: ",_),o[_.guid]={itemData:{proxyScene:L.proxy.data.scene,guid:x.newNodes[n].guid,...l[x.skuID],position:R,rotation:N,hasItemLoaded:!1,isDependent:i,isInteractive:w},hotspotsData:u[x.skuID],hotspotSpawned:!1},await gc(1),s.setItemsSpawned({...o})}}).catch(E=>{Gt.error({title:E}),h=!1});if(h===!1)return r({busy:!1}),p;const m=f.getCartItems();m&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,m);const y=l[t]?.plugs;if(y){for(const E of y){const b=E?.dependencySku;if(!b)continue;Gt.info(`Found a dependency: ${b} on the plug: ${E.name}`);let v=!0;l[b]&&l[b].hasOwnProperty("ignoreSpawningCollisionAsDependency")&&(v=l[b].ignoreSpawningCollisionAsDependency),E.hasOwnProperty("ignoreSpawningCollision")&&(v=E.ignoreSpawningCollision);let x=Je.getState().sceneSettings.ignoreSpawningCollision;l[b].hasOwnProperty("ignoreSpawningCollision")&&(x=l[b].ignoreSpawningCollision),l[b].ignoreSpawningCollision=v;const S=await gr.getState().actions.spawnGhostsForSkuID(b,v);if(l[b].ignoreSpawningCollision=x,!S)continue;const _=f.currentStructure.getNodeByGUID(p),w=_.getPlugByName(E.name)?.guid,R=E?.isDependencySkuInteractive?E.isDependencySkuInteractive===1:!1,N=S.connectablePlugs;let L=!1;for(let I=0;I<S.connectablePlugs.length;I++){if(N[I].receiverPlug.guid!==w)continue;L=!0;const D=await s.addItemBySkuID(b,I,!0,R);D!==null&&_.addMyDependenciesGUID(D)}L||gr.getState().actions.clearAllGhosts()}gr.getState().actions.clearAllGhosts()}return r({busy:!1}),p},async addItemWithTransform(t,n,i,a=!0){return new Promise(async(s,o)=>{const{actions:l,itemsSpawned:u}=e();l.deselectItem();const f=Ln.getState().productData,h=Ln.getState().hotspotsData;if(!f[n]){nt.alert({alertMsg:n+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"});return}const{position:p,rotation:m}=t;u[i]!=null&&(hi.getState().actions.removeHotspotForItem({...u[i]}),delete u[i]);const y=b=>{n==b.data&&s(i)};nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Model_Loaded,y,{once:!0});const E=await Mo.getState().actions.loadAsset(n,!0);E!=null&&(await gc(1),u[i]={itemData:{proxyScene:E.proxy.data.scene,guid:i,...f[n],position:p,rotation:m,hasItemLoaded:!1,isInteractive:a},hotspotsData:h[n],hotspotSpawned:!1},r({itemsSpawned:{...u}}))})},async replaceGUIDItemBySKUID(t,n){const{itemsSpawned:i}=e(),a=Ln.getState().productData,s=Ln.getState().hotspotsData,o=ln.getState().attachmentSystem.currentStructure,l=o.getNodeByGUID(t);return l.isReplaceableWithSkuId(n)?(await new Promise(async(f,h)=>{hi.getState().actions.removeHotspotForItem({...i[t]}),delete i[t],l.update(n);const p=y=>{n===y.data&&f(!0)};nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Model_Loaded,p,{once:!0});const m=await Mo.getState().actions.loadAsset(n,!0);await gc(1),i[t]={itemData:{proxyScene:m.proxy.data.scene,guid:t,...a[n],position:l.transform.position,rotation:l.transform.rotation,hasItemLoaded:!1},hotspotsData:s[n],hotspotSpawned:!1},Wt.setState({itemsSpawned:{...i}})}),o.recalculateStructureFromNode(l.whichNodeAreWeAttachedTo()),ln.getState().actions.toggleStructureUpdated(),!0):!1}}}));async function bUe(r,e,t,n){const{position:i,rotation:a}=t,s=Ln.getState().productData,o=Ln.getState().hotspotsData,l=ln.getState().attachmentSystem.currentStructure;return new Promise(async(u,f)=>{const h=async()=>{const p=await Mo.getState().actions.loadAsset(e,!0);r[n.guid]={itemData:{proxyScene:p.proxy.data.scene,guid:n.guid,...s[e],position:i,rotation:a,hasItemLoaded:!1},hotspotsData:o[e],hotspotSpawned:!1},Gt.warn({title:"SWITCHING VARIANT: ",details:n.currentVariant}),n.currentVariant=n.currentVariant,n.transform=t,Wt.setState({itemsSpawned:{...r}}),l.recalculateStructureFromNode(n),ln.getState().actions.toggleStructureUpdated(),u(n.guid)};hi.getState().actions.removeHotspotForItem({...r[n.guid]}),delete r[n.guid],n.update(e),nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Model_Removed,h,{once:!0})})}const Gd=Do((r,e)=>({inventoryData:{},actions:{getInventoryInfo:()=>{const{inventoryData:t}=e();return t},updateInventoryForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(i=>{let a=t[i];Object.keys(a).map(s=>{n.updateInventoryForProduct(i,s,a[s].inventory)})}),n.refreshInventory(Wt.getState().itemsSpawned)},updateInventoryForProduct:(t,n,i)=>{const{inventoryData:a}=e();let s=a[t],o=s[n];!s||!o||(o.inventory=i)},_clearInScene:()=>{const{inventoryData:t}=e();Object.keys(t).map(n=>{const i=t[n];Object.keys(i).map(a=>{i[a].inScene=[]})})},refreshInventory:t=>{if(!t)return;Gt.info({title:"Refreshing Inventory"});const{actions:n,inventoryData:i}=e();n._clearInScene();const a=ln.getState().attachmentSystem;if(a===null)return;const s=a.currentStructure;if(s===null)return;Object.keys(t).map(f=>{const h=s.getNodeByGUID(f);if(!h)return;const p=h.overrideVariant?h.overrideVariant:h.currentVariant;if(!p)return;const m=i[h.skuID];if(!m||!m[p].inScene)return;m[p].inScene.push(f),Je.getState().sceneSettings.disableCart===!0?h.inStock={variantName:p,newValue:!0}:m[p].inScene.length>m[p].inventory?h.inStock={variantName:p,newValue:!1}:h.inStock={variantName:p,newValue:!0}});let o=!1;Object.keys(i).map(f=>{const h=i[f];Object.keys(h).map(p=>{h[p].countAvailable=h[p].inventory-h[p].inScene.length,h[p].countAvailable<0?(h[p].countUnavailable=h[p].countAvailable*-1,h[p].countAvailable=0,o=!0):h[p].countUnavailable=0})});const l={alertMsg:"Some items selected are out of stock",alertTime:3e3,alertType:"warn",alertLabel:"Stock Alert",alertId:"outOfStock"},u=SUe(Je.getState().persistantAlertData,l);o===!1&&u===!0&&nt.removePersistantAlert(),nt.fireEvent(nt.EVENTS.SCENE.Inventory_Updated,i)}}})),Je=Do((r,e)=>({hoveredGhostIndex:-1,itemDraggedSkuID:null,builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!0,configurationLoaded:!0,preconfigurationLoaded:!1,cursorParentRef:null,glContext:null,canvasTooltipText:"",canvasSize:{width:600,height:600},boundData:null,showDimensions:!1,autoFocusTrigger:0,cameraActive:!1,autoFocusRef:null,alertData:{},persistantAlertData:null,alertQueue:[],alertSettings:null,draggingOnDropCollisionData:null,multipleTouchDetected:!1,isMobile:!1,isTouchDevice:!1,isTablet:!1,isDesktop:!0,isLandscape:!1,sceneSettings:{swappableRoot:!0,preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,sceneScaleUnit:"ft",currency:"$",disableDragDrop:!1,ignoreSpawningCollision:!1,disableCollider:!1,disableContextMenu:!1,ghostColor:{r:250,g:50,b:0,a:.75},ghostAsWireframe:!1,draggableUI:!1,outOfStock_EmissiveColor:{r:250,g:50,b:0},outOfStock_EmissiveIntensity:.002,defaultConfigurationID:null,emptySceneText:"Empty Scene",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,textSettings:{cartQuantityText:"Qty",reviewButtonText:"Review",cartHeadingText:"Review Products",buildTabHeadingText:"Build",colorTabHeadingText:"Color",featuresTabHeadingText:"Features",tooltipEmptySceneText:"-Add items to the scene-",tooltipInstructionText:"-Drag to rotate the camera-"},variantsTabOrder:{color:{enabled:!0,priority:1},geometryVariants:{enabled:!0,priority:2}},boundingBoxLeeway:.9,contactShadowVisibility:!0,measurementPrecision:2,disableAlerts:!1,focusCameraOnGhosts:!0,alertLevel:0,alertControl:{itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0}},actions:{popFromAlertQueue:()=>{const{alertQueue:t}=e();return t.shift(),r({alertQueue:t}),t},addToAlertQueue:t=>{const{alertQueue:n}=e();return n.push(t),r({alertQueue:n}),n},getDeviceState:()=>{const{isDesktop:t,isMobile:n,isTablet:i,isTouchDevice:a,isLandscape:s}=e();return{isDesktop:t,isMobile:n,isTablet:i,isTouchDevice:a,isLandscape:s}},enableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!1,Gd.getState().actions.refreshInventory(Wt.getState().itemsSpawned),nt.fireEvent(nt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!0,Gd.getState().actions.refreshInventory(Wt.getState().itemsSpawned),nt.fireEvent(nt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:t}=e();return t},sendAlert:t=>{r({alertData:{...t}})},switchCursor(t){const{cursorParentRef:n}=e();if(!n)return;let i="";switch(t){default:case eo.GRAB:i="grabCursor";break;case eo.GRABBING:i="grabbingCursor";break;case eo.BLOCKED:i="blockedCursor";break;case eo.POINTER:i="pointerCursor";break;case eo.MOVE:i="moveCursor";break}for(let a=0;a<n.classList.length;a++)n.classList[a].includes("Cursor")&&n.classList.remove(n.classList[a]);n.classList.add(i)},setAlertSettings:t=>{r({alertSettings:t})},async completeDropItem(){const t=ln.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:i,attachedChildrenGuids:a,collidingStatus:s,intersectingGhostObject:o,initPosition:l,initRotation:u,detachedPlugs:f,attachedNodesToCurrentNode:h}=n;nt.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[E,b]of a.entries())s[E]===!0&&await Wt.getState().actions.removeItemByGUID(b);const p=o.userData;let m=i.getPlugByName(p.incomingPlugName),y=t.currentStructure.getPlugByGUID(p.receiverPlugGUID);i.ref.position.set(o.position.x,o.position.y,o.position.z),i.ref.setRotationFromEuler(o.rotation),i.transform={position:o.position,rotation:o.quaternion},t.currentStructure.connectPlugs({incomingPlug:m,receiverPlug:y}),gr.getState().actions.clearAllGhosts(),Wt.getState().actions.deselectItem(),h.map(E=>{i.ref.parent.attach(E.ref)}),ln.getState().actions.updateFittingSkuIds()},revertDropItem(){const t=ln.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:i,attachedChildrenGuids:a,collidingStatus:s,intersectingGhostObject:o,initPosition:l,initRotation:u,detachedPlugs:f,attachedNodesToCurrentNode:h}=n;nt.alert({alertMsg:"Position of item"+i.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const p=f.neighbourDetachedPlugs;p&&(f.neighbourNode.detachNodeFromReceiver(),t.currentStructure.connectPlugs({incomingPlug:p.incomingPlug,receiverPlug:p.receiverPlug}));let m=f.rootDetachedPlugs.incomingPlug,y=f.rootDetachedPlugs.receiverPlug;i.ref.position.set(l.x,l.y,l.z),i.ref.setRotationFromEuler(u);let E=new $i().identity();i.ref.getWorldQuaternion(E),i.transform={position:l,rotation:E},t.currentStructure.connectPlugs({incomingPlug:m,receiverPlug:y}),gr.getState().actions.clearAllGhosts(),Wt.getState().actions.deselectItem(),h.map(b=>{i.ref.parent.attach(b.ref)}),ln.getState().actions.updateFittingSkuIds()},setCoreSettings:t=>{const{sceneSettings:n,isMobile:i,isTouchDevice:a,isLandscape:s,actions:o}=e(),l=i===!0?"mobile":"desktop",u=["showSave","showShare","showReset","showDimension","showHotspots","showViewInYourSpace","showContextMenu","draggableUI","textSettings","variantsTabOrder"];for(const f of u)if(f==="draggableUI"){const p=`${f}_${s===!1&&a===!0?"mobile":"desktop"}`;t[p]!==void 0&&(n[f]=t[p])}else if(f==="textSettings"||f==="variantsTabOrder"){if(t.hasOwnProperty(f)){let h=n[f];Object.keys(h).map(p=>{let m=t[f];m.hasOwnProperty(p)||(m[p]=h[p])})}}else{const h=`${f}_${l}`;if(t[h]!==void 0){let p=`${f}Btn`;f=="showContextMenu"&&(p=`${f}`),n[p]=t[h]}}t.disableCart===!0&&o.disableCart(),Object.keys(t).map(f=>n[f]=t[f]),r({sceneSettings:{...n,ghostThreeColor:{r:n.ghostColor.r/255,g:n.ghostColor.g/255,b:n.ghostColor.b/255,a:n.ghostColor.a/255}}})},triggerAutoFocus:(t=null)=>r(n=>({autoFocusRef:t,autoFocusTrigger:n.autoFocusTrigger+1})),requestNewScreenshot:async()=>new Promise((t,n)=>{Gt.info("Taking a screenshot");const{glContext:i}=e();if(i.preserveDrawingBuffer===!1)Gt.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),n({success:!1,imageData:null});else{Gt.info("Downloading the screenshot");const a=i.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");t({success:!0,imageData:a})}})}})),_Ue="rd",U$="_";function EUe(r,e){return`${_Ue}${U$}${r}${U$}${e}`}async function gc(r){return Gt.info({title:`Waiting for ${r}ms`}),new Promise((e,t)=>{setTimeout(()=>{e(!0)},r)})}function SUe(r,e){if(r===null||e===null)return!1;for(let t in r)if(r.hasOwnProperty(t)&&e.hasOwnProperty(t)&&r[t]!==e[t])return!1;return Object.keys(r).length===Object.keys(e).length}const xUe=r=>{const e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)};return fetch(BH,e)},TUe=function(){let r=!1;return function(e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(r=!0)}(navigator.userAgent||navigator.vendor||window.opera),r};function wUe(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function CUe(){const r=navigator.userAgent.toLowerCase(),e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(r);return e||wUe()}function MUe(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function _ie(r){let e={data:null,report:"",success:!1};try{const n=await(await fetch(r)).text();e.data=JSON.parse(n),e.success=!0,e.report="Successfully fetched JSON data."}catch(t){e.report=t,nt.alert({alertMsg:"",alertTime:5e3,alertType:"warn",alertLabel:"Preload Failed"})}return e}const B$=(r,e)=>new ve(r[0]+e[0],r[1]+e[1],r[2]+e[2]),Vx=r=>[r.x,r.y,r.z],FH=r=>new ve(r[0],r[1],r[2]),RUe=(r,e=!0)=>{let t=[];const n=Je.getState().sceneSettings.outOfStock_EmissiveColor,i=Je.getState().sceneSettings.outOfStock_EmissiveIntensity;return r.traverse(a=>{a.isMesh&&(a.material.userData.cloned?a.material.userData.inStock!==e&&(e?(a.material.emissive.set(new Yt(255,255,255)),a.material.emissiveIntensity=0):(a.material.emissive.set(new Yt(n.r,n.g,n.b)),a.material.emissiveIntensity=i),a.material.userData.inStock=e):(a.material=a.material.clone(),a.material.userData.inStock=e,a.material.userData.cloned=!0,e?(a.material.emissive.set(new Yt(255,255,255)),a.material.emissiveIntensity=0):(a.material.emissive.set(new Yt(n.r,n.g,n.b)),a.material.emissiveIntensity=i)),t.push(a))}),t},k$=(r,e)=>{let t=0,n=[];for(let i=0;i<r.length;i++){const a=r[i];e(a)?r[t++]=a:n.push(r[i])}return r.length=t,n},XL=r=>r*Math.PI/180,IUe=r=>{if(!r)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(r))return r;let n=r;return n=n.replaceAll("<@all-projects@>",Aie),n=n.replaceAll("<@generic-project@>",fUe),n};function mG(r){var e=r.toString(16);return e.length==1?"0"+e:e}function F$(r,e,t){return"#"+mG(r)+mG(e)+mG(t)}var $L={},z$={get exports(){return $L},set exports(r){$L=r}},G$=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(G$){var H$=new Uint8Array(16);z$.exports=function(){return G$(H$),H$}}else{var V$=new Array(16);z$.exports=function(){for(var e=0,t;e<16;e++)e&3||(t=Math.random()*4294967296),V$[e]=t>>>((e&3)<<3)&255;return V$}}var Eie=[];for(var wP=0;wP<256;++wP)Eie[wP]=(wP+256).toString(16).substr(1);function NUe(r,e){var t=e||0,n=Eie;return[n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]]].join("")}var Sie=NUe,DUe=$L,OUe=Sie,j$,gG,vG=0,yG=0;function PUe(r,e,t){var n=e&&t||0,i=e||[];r=r||{};var a=r.node||j$,s=r.clockseq!==void 0?r.clockseq:gG;if(a==null||s==null){var o=DUe();a==null&&(a=j$=[o[0]|1,o[1],o[2],o[3],o[4],o[5]]),s==null&&(s=gG=(o[6]<<8|o[7])&16383)}var l=r.msecs!==void 0?r.msecs:new Date().getTime(),u=r.nsecs!==void 0?r.nsecs:yG+1,f=l-vG+(u-yG)/1e4;if(f<0&&r.clockseq===void 0&&(s=s+1&16383),(f<0||l>vG)&&r.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");vG=l,yG=u,gG=s,l+=122192928e5;var h=((l&268435455)*1e4+u)%4294967296;i[n++]=h>>>24&255,i[n++]=h>>>16&255,i[n++]=h>>>8&255,i[n++]=h&255;var p=l/4294967296*1e4&268435455;i[n++]=p>>>8&255,i[n++]=p&255,i[n++]=p>>>24&15|16,i[n++]=p>>>16&255,i[n++]=s>>>8|128,i[n++]=s&255;for(var m=0;m<6;++m)i[n+m]=a[m];return e||OUe(i)}var LUe=PUe,UUe=$L,BUe=Sie;function kUe(r,e,t){var n=e&&t||0;typeof r=="string"&&(e=r==="binary"?new Array(16):null,r=null),r=r||{};var i=r.random||(r.rng||UUe)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e)for(var a=0;a<16;++a)e[n+a]=i[a];return e||BUe(i)}var FUe=kUe,zUe=LUe,xie=FUe,a8=xie;a8.v1=zUe;a8.v4=xie;var Tie=a8;class zH{constructor(e,t,n=null){this._attachedPlug=null,this._name=e.name,this._acceptedPlugTypes=e.acceptedPlugTypes,this._type=e.type,this._affectedNodes=e.affectedNodes,this._weight=e.weight,this._connectsToPlugTypes=e.connectsToPlugTypes,this._node=t,this._guid=Tie.v4(),this._isOpen=!0,this._isReceiverPlug=!1,this._attachedPlugGUID=null,n&&(this._guid=n.guid,this._isOpen=n.isOpen,this._isReceiverPlug=n.isReceiverPlug,this._attachedPlugGUID=n.attachedPlugGUID)}export(){return this.isOpen?null:{guid:this._guid,isOpen:this._isOpen,attachedPlugGUID:this._attachedPlugGUID,isReceiverPlug:this._isReceiverPlug}}get node(){return this._node}get attachedPlug(){return this._attachedPlug}set attachedPlug(e){this._attachedPlug=e}get type(){return this._type}get weight(){return this._weight}get affectedNodes(){return this._affectedNodes}get guid(){return this._guid}get isReceiverPlug(){return this._isReceiverPlug}get name(){return this._name}get acceptedPlugTypes(){return this._acceptedPlugTypes}set acceptedPlugTypes(e){this._acceptedPlugTypes=e}get connectsToPlugTypes(){return this._connectsToPlugTypes}set connectsToPlugTypes(e){this._connectsToPlugTypes=e}get isOpen(){return this._isOpen}attachPlug(e,t=!1){if(this._attachedPlug=e,this._attachedPlugGUID=e.guid,this._isOpen=!1,this._isReceiverPlug=t,t&&e.type!==""&&e.type==this._type)switch(e.type){default:case"weighted_hider":this._weight>e.weight?e.node.hideNodes(e.affectedNodes)||nt.coreWCRef.addEventListener(e.node.guid+":refLoaded",function(){e.node.hideNodes(e.affectedNodes)},{once:!0}):this._weight<e.weight&&(this._node.hideNodes(this._affectedNodes)||nt.coreWCRef.addEventListener(this._node.guid+":refLoaded",function(){this._node.hideNodes(this._affectedNodes)},{once:!0}));break}t&&(this._node.isEndNode=!1)}openPlug(){if(this._isReceiverPlug&&this._attachedPlug.type!==""&&this._attachedPlug.type==this._type)switch(this._attachedPlug.type){default:case"weighted_hider":this._weight>this._attachedPlug.weight?this._attachedPlug.node.showNodes(this._attachedPlug.affectedNodes):this._weight<this._attachedPlug.weight&&this._node.showNodes(this._affectedNodes);break}this._attachedPlug=null,this._attachedPlugGUID=null,this._isOpen=!0,this._isReceiverPlug&&(this._isReceiverPlug=!1,this._node.checkIfEndNode())}canAttachToPlug(e){for(let t=0;t<this._connectsToPlugTypes.length;t++)if(e._acceptedPlugTypes.includes(this._connectsToPlugTypes[t]))return!0;return!1}}let vR=class{#e="default";#i=!1;#t=!1;#r=!0;#a={};#o=!1;#n={};#s=[];constructor(e,t=null,n,i){let a=Ln.getState().productData;this._plugs=[],this._skuID=e,this._ref=null,this._transform=null,this.#e="default",this._overrideVariant=null,this._followsParent=a[e].followsParent,this._categoryID=a[e].categoryID,this._replace=a[e].replace,this._swappable=a[e].swappable,this._price=this.#l(),this.#i=a[e]?.ignoreInCart,t?(this._guid=t.guid,this._isEndNode=t.isEndNode,this._overrideVariant=t.overrideVariant,this.generatePlugsWithData(e,t.plugs)):(this._guid=Tie.v4(),this._isEndNode=!0,this.generatePlugsForNode(e)),n&&Object.keys(n).map(s=>{if(a[e].looks&&a[e].looks.includes(s)){this.#e=s;return}})}updateGeometryVariant(e,t){const i=Ln.getState().categoryData.geometryVariants;let a=null;if(i.map(f=>{f.id==e&&(a=f)}),!a)return;const s=a.productsInCategory,l=a.variants[t].productsToSwitch,u=Wt.getState().itemsSpawned;s.map(f=>{f.products.map(h=>{this.skuID===h&&f.products.map(p=>{l.map(m=>{if(m==p){const y=Ln.getState().actions.getProductDataById(m);this.skuID=y.skuID;const E=u[this.guid];E&&E.itemData&&Object.keys(y).map(b=>{E.itemData[b]=y[b]}),this.hideNodes(y.geometriesToHide),this.showNodes(y.geometriesToShow),this.updatePricing(),this.resetInStock(),Gd.getState().actions.refreshInventory(u)}})})})})}resetInStock(){this.#a={},this.#o=!0}setInStockForRef(e){if(!this.ref)return!1;let t=this.ref.getObjectByName("GRP_RenderGeometry");return t?(t.inStock=e,!0):!1}set inStock({variantName:e,newValue:t}){if(this.#a[e]&&this.#a[e]==t||(this.#a[e]=t,e!==this.#e&&this.#o===!1))return;const n=()=>{this.setInStockForRef(t)};n()||nt.coreWCRef.addEventListener(this.guid+":refLoaded",n,{once:!0})}get myDependenciesGUID(){return this.#s}set myDependenciesGUID(e){this.#s=e}addMyDependenciesGUID(e){this.#s.push(e)}get isDependent(){return this.#t}set isDependent(e){this.#t=e}get isInteractive(){return this.#r}set isInteractive(e){this.#r=e}update(e){this._skuID=e;const t=Ln.getState().productData,n=t[e]?.plugs;if(this.ignoreInCart=t[e].ignoreInCart,!!n)for(let i=0;i<this._plugs.length;i++)for(let a=0;a<n.length;a++)this._plugs[i].name==n[a].name&&(this._plugs[i].acceptedPlugTypes=n[a].acceptedPlugTypes,this._plugs[i].connectsToPlugTypes=n[a].connectsToPlugTypes)}export(){let e={};for(var t=0;t<this._plugs.length;t++){let n=this._plugs[t].export();n&&(e[this._plugs[t].name]=n)}return{skuID:this._skuID,guid:this._guid,isEndNode:this._isEndNode,plugs:e,overrideVariant:this._overrideVariant}}get node(){return this}get swappable(){return this._swappable}get replace(){return this._replace}get ignoreInCart(){return this.#i}set ignoreInCart(e){this.#i=e}get canRotate(){let e=!0;if(!this._isEndNode){const s=this.whichNodesAreAttachedToUs();if(s.length>0){let o=!0;if(s.map(l=>{l.followsParent===!1&&(o=!1)}),!o)return!1}}let t=!1;for(var n=0;n<this.plugs.length;n++)if(!this.plugs[n].isOpen&&this.plugs[n].attachedPlug.isReceiverPlug){const s=this.plugs[n].attachedPlug.acceptedPlugTypes;for(var i=0;i<this.plugs.length;i++)if(n!=i)for(var a=0;a<this.plugs[i].connectsToPlugTypes.length;a++)s.includes(this.plugs[i].connectsToPlugTypes[a])&&(t=!0)}return e=t,e}hideNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");return e.map(i=>{if(t){const a=t.getObjectByName(i);a&&(a.visible=!1)}if(n){const a=n.getObjectByName(i);a&&(a.visible=!1)}}),!0}showNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");e.map(i=>{if(t){const a=t.getObjectByName(i);a&&(a.visible=!0)}if(n){const a=n.getObjectByName(i);a&&(a.visible=!0)}})}canConnectToPlugType(e){let t=!1;return this._plugs.map(n=>{n.connectsToPlugTypes.map(i=>{i==e&&(t=!0)})}),t}isConnectedToSkuID(e){let t=!1;return this._plugs.map(n=>{n.isOpen||n.attachedPlug.node.skuID==e&&(t=!0)}),t}get isConnectedToRoot(){return this.isConnectedToSkuID("Root")}swapRoot(){if(!this.canSwapRoot)return;const t=ln.getState().attachmentSystem.currentStructure,n=this.whichNodesAreAttachedToUs();let i=null;n.map(u=>{u.followsParent===!1&&(i=u)});const a=i.detachNodeFromReceiver();let s=null;this._plugs.map(u=>{u.isOpen||u.attachedPlug.node.skuID=="Root"&&(s=u.attachedPlug)});const o=this.detachNodeFromReceiver();let l=null;return i.plugs.map(u=>{u.connectsToPlugTypes.includes("root")&&(l=u)}),t.connectPlugs({incomingPlug:l,receiverPlug:s}),{neighbourDetachedPlugs:a,rootDetachedPlugs:o,neighbourNode:i}}get canSwapRoot(){if(Je.getState().sceneSettings.swappableRoot===!1)return!1;let e=!1;if(this.isConnectedToRoot&&!this._isEndNode){const n=this.whichNodesAreAttachedToUs();let i=0,a=null;n.map(s=>{s.followsParent===!1&&(i++,a=s)}),i==1?a.canConnectToPlugType("root")&&(e=!0):i>0&&(e=!1)}return e}get canDrag(){let e=!0;return this._isEndNode||(this.whichNodesAreAttachedToUs().map(n=>{n.followsParent===!1&&(e=!1)}),e||(e=this.canSwapRoot)),e}get followsParent(){return this._followsParent}set followsParent(e){this._followsParent=e}get currentVariant(){return this.#e==="default"?Ln.getState().actions.getProductDataById(this._skuID).lookDetails.default.id:this.#e}get price(){return this._price}set price(e){this._price=e}updatePricing(){this._price=this.#l()}#l(){let t=Ln.getState().actions.getProductDataById(this._skuID).lookDetails[this.#e]?.price;return t||(t=0),t}set currentVariant(e){this.#e=e,this._price=this.#l()}get overrideVariant(){return this._overrideVariant}set overrideVariant(e){this._overrideVariant=e,this.#e=this._overrideVariant,this._price=this.#l()}get guid(){return this._guid}get skuID(){return this._skuID}set skuID(e){this._skuID=e}get plugs(){return this._plugs}get ref(){return this._ref}set ref(e){this._ref=e;let t=new CustomEvent(this._guid+":refLoaded",{bubbles:!0,cancelable:!1,composed:!0});const n=ln.getState().attachmentSystem;n.globalGeometryVariants&&Object.keys(n.globalGeometryVariants).map(i=>{this.updateGeometryVariant(i,n.globalGeometryVariants[i])}),t.data={},nt.coreWCRef?nt.coreWCRef.dispatchEvent(t):Gt.warn({title:"core web component not found!"})}get isEndNode(){return this._isEndNode}set isEndNode(e){this._isEndNode=e}get categoryID(){return this._categoryID}get transform(){return this._transform}set transform(e){this._transform=e}setModelVisibility(e){e?this._ref?.scale.set(1,1,1):this._ref.scale.set(0,0,0)}checkIfEndNode(){let e=!0;for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&(e=!1);this.isEndNode=e}whichNodesAreAttachedToUs(){var e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&e.push(this._plugs[t].attachedPlug.node);return e}whichPlugsAreAttachedToUs(){var e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&e.push({receiverPlug:this._plugs[t],incomingPlug:this._plugs[t].attachedPlug});return e}whichNodeAreWeAttachedTo(){var e=null;for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&(e=this._plugs[t].attachedPlug.node);return e}isReplaceableWithSkuId(e){const n=Ln.getState().productData[e]?.plugs;let i=0;if(!n)return!1;for(let a=0;a<this._plugs.length;a++)for(let s=0;s<n.length;s++)this._plugs[a].name==n[s].name&&i++;return i==this._plugs.length}whichPlugAreWeAttachedUsing(){for(let e=0;e<this._plugs.length;e++)if(!this._plugs[e].isOpen&&this._plugs[e].attachedPlug.isReceiverPlug)return this._plugs[e]}whichPlugAreWeAttachedTo(){for(let e=0;e<this._plugs.length;e++)if(!this._plugs[e].isOpen&&this._plugs[e].attachedPlug.isReceiverPlug)return this._plugs[e].attachedPlug}getPlugWhichCanConnectToType(e){for(const t of this._plugs)if(t.connectsToPlugTypes.includes(e))return t;return null}getOpenPlugsWeCanAttachFrom(){let e=[];if(this.whichNodeAreWeAttachedTo())return e;for(let t=0;t<this._plugs.length;t++)this.plugs[t].isOpen&&this.plugs[t].connectsToPlugTypes.length>0&&e.push(this._plugs[t]);return e}getOpenPlugsFromNode(){let e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isOpen&&this._plugs[t].acceptedPlugTypes.length>0&&e.push(this._plugs[t]);return e}generatePlugsForNode(e){this._plugs=[];let t=Ln.getState().productData[e]?.plugs;if(t)for(var n=0;n<t.length;n++){const i=new zH(t[n],this);this._plugs.push(i)}}generatePlugsWithData(e,t){let n=Ln.getState().productData[e]?.plugs;if(n)for(var i=0;i<n.length;i++){const a=new zH(n[i],this,t[n[i].name]);this._plugs.push(a)}}detachNodeFromReceiver(){for(var e=0;e<this.plugs.length;e++)if(!this.plugs[e].isOpen&&this.plugs[e].attachedPlug.isReceiverPlug){const t={incomingPlug:this.plugs[e],receiverPlug:this.plugs[e].attachedPlug};return this.plugs[e].attachedPlug.openPlug(),this.plugs[e].openPlug(),t}}detachNodeCompletely(){for(var e=0;e<this._plugs.length;e++)this._plugs[e].isOpen||(this._plugs[e].attachedPlug.openPlug(),this._plugs[e].openPlug())}getPlugByName(e){for(var t=0;t<this._plugs.length;t++)if(this._plugs[t].name==e)return this._plugs[t];return null}getPlugByGUID(e){for(var t=0;t<this._plugs.length;t++)if(this._plugs[t].guid==e)return this._plugs[t];return null}removeNode(){for(var e=0;e<this._plugs.length;e++)this._plugs[e].isOpen||(this._plugs[e].attachedPlug.isReceiverPlug?this._plugs[e].attachedPlug.openPlug():Wt.getState().actions.addToRemoveItems(this._plugs[e].attachedPlug.node.guid))}};class Q${#e=!1;constructor(e=null,t,n){if(this._nodes=[],this._rootNode=null,Gt.info({title:"preloadNodes",details:e}),e){Gt.info({title:"PRELOAD Length-----------------:"+e.length});for(var i=0;i<e.length;i++){Gt.info({title:"FOUND PRELOAD-----------------"});let a=e[i].skuID,s=new vR(a,e[i],t,n);a=="Root"&&(this._rootNode=s),this._nodes.push(s)}this.resolvePlugConnections(e)}else{const a=new vR("Root",null,t,n);this._rootNode=a,this._nodes.push(a)}Wt.getState().actions.addItemWithTransform({position:new ve(0,0,0),rotation:new $i().identity()},"Root",this._rootNode.guid,!1),this._boundingBoxLeeway=Je.getState().sceneSettings.boundingBoxLeeway}get nodes(){return this._nodes}get rootNode(){return this._rootNode}updatePricing(){for(let e=0;e<this._nodes.length;e++)this._nodes[e].updatePricing()}getCurrentItemsInReplaceableCategory(){let e={};for(const t of this._nodes)t.replace&&(e[t.categoryID]=t.skuID);return e}recalculateStructureFromNode(e){for(let t=0;t<e.plugs.length;t++)if(!e.plugs[t].isOpen&&e.plugs[t].isReceiverPlug){const n=e.plugs[t].attachedPlug.node,i={receiverPlug:e.plugs[t],incomingPlug:e.plugs[t].attachedPlug};if(i){const a=this.findItemTransform(i);a&&(n.ref.position.set(a.position.x,a.position.y,a.position.z),n.ref.setRotationFromQuaternion(a.rotation),n.transform={position:a.position,rotation:a.rotation})}this.recalculateStructureFromNode(n)}}rotateNode(e){const t=this.getNodeByGUID(e);let n=null,i=null;for(let o=0;o<t.plugs.length;o++)if(!i&&!t.plugs[o].isOpen&&t.plugs[o].attachedPlug.isReceiverPlug){const l=t.plugs[o].attachedPlug.acceptedPlugTypes;i=t.plugs[o].attachedPlug;let u=[];for(let f=o+1;f<t.plugs.length;f++)u.push(t.plugs[f]);for(let f=0;f<o;f++)u.push(t.plugs[f]);for(let f=0;f<u.length;f++)for(let h=0;h<u[f].connectsToPlugTypes.length;h++)l.includes(u[f].connectsToPlugTypes[h])&&(n=u[f])}if(!n)return;t.detachNodeFromReceiver();const{position:a,rotation:s}=this.findItemTransform({receiverPlug:i,incomingPlug:n});t.ref.position.set(a.x,a.y,a.z),t.ref.setRotationFromQuaternion(s),t.transform={position:t.ref.position,rotation:s},this.connectPlugs({receiverPlug:i,incomingPlug:n}),this.recalculateStructureFromNode(t)}async load(){await this.respawnItems()}materialOverrideExists(){let e=!1;return this.nodes.map(t=>{if(t.overrideVariant)return e=!0,!0}),e}findGhostTransformForReplacement(e,t){const n=ln.getState().attachmentSystem,i=t.whichPlugAreWeAttachedTo(),a=t.whichPlugAreWeAttachedUsing(),o=new vR(e,null,n.globalVariants,n.globalGeometryVariants).getPlugByName(a.name);if(!o)return{transforms:null,connectablePlugs:null};const l={incomingPlug:o,receiverPlug:i};let u=[],f=this.findItemTransform(l);if(!f)return{transforms:u,connectablePlugs:l};let{position:h,rotation:p}=f;return h&&p&&u.push({position:h,rotation:p,incomingPlugName:l.incomingPlug.name,receiverPlugName:l.receiverPlug.name,incomingPlugGUID:l.incomingPlug.guid,receiverPlugGUID:l.receiverPlug.guid}),{transforms:u,connectablePlugs:l}}findGhostTransforms(e,t){const n=this.getOpenPlugs();if(n.length<=0)return{transforms:[]};const i=ln.getState().attachmentSystem,a=Ln.getState().productData,s=new vR(e,null,i.globalVariants,i.globalGeometryVariants),o=this.getConnectablePlugs(s,n);let l=[];if(o.length<=0)return{transforms:[]};let u=[];for(let h=0;h<o.length;h++){let p=this.findItemTransform(o[h]);if(!p)continue;let{position:m,rotation:y}=p;if(m&&y){let E=t;Array.isArray(t)===!0&&(E=!1),a[e].hasOwnProperty("ignoreSpawningCollision")&&(E=a[e].ignoreSpawningCollision),(E?!1:this.isColliding(s.skuID,p,o[h].receiverPlug,t))||(u.push({position:m,rotation:y,incomingPlugName:o[h].incomingPlug.name,receiverPlugName:o[h].receiverPlug.name,incomingPlugGUID:o[h].incomingPlug.guid,receiverPlugGUID:o[h].receiverPlug.guid}),l.push(o[h]))}}let f=[];for(let h=0;h<u.length;h++)f.push(s);return{transforms:u,newNodes:f,connectablePlugs:l}}resolvePlugConnections(e){for(let t=0;t<e.length;t++)Object.keys(e[t].plugs).map(n=>{let i=e[t].plugs[n].guid,a=this.getPlugInNodesByGUID(i);if(!a||a.attachedPlug)return;let s=e[t].plugs[n].attachedPlugGUID,o=this.getPlugInNodesByGUID(s);o&&(o.attachedPlug||(a.attachPlug(o,e[t].plugs[n].isReceiverPlug),o.attachPlug(a,!e[t].plugs[n].isReceiverPlug)))});Gt.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let e=[this.rootNode];for(let t=0;t<e.length;t++){let i=e[t].whichPlugsAreAttachedToUs();for(let a=0;a<i.length;a++){let s=this.findItemTransformForPreload(i[a],i[a].receiverPlug.node.transform);s?await Wt.getState().actions.addItemWithTransform(s,i[a].incomingPlug.node.skuID,i[a].incomingPlug.node.guid):Gt.warn({title:"Problem finding plug transform! "+i[a].name}),i[a].incomingPlug.node.transform=s,e.push(i[a].incomingPlug.node)}}nt.fireEvent(nt.EVENTS.SCENE.SavedConfiguration_Loaded),Je.getState().actions.triggerAutoFocus(),hi.getState().actions.checkHotspotHealth()}getPlugInNodesByGUID(e){for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t].getPlugByGUID(e);if(n)return n}return null}export(){let e=[];for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t].export();n&&e.push(n)}return e}async clear(){return new Promise(async(e,t)=>{!this._rootNode&&this._rootNode.isEndNode&&e(!0);let n=this._rootNode.whichNodeAreWeAttachedTo();this.#e=!0,nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Scene_Cleared,i=>e(i.data),{once:!0}),n?nt.removeItemByGUID(n.guid,!0):(await gc(500),e(!0))})}getNodeByGUID(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e)return this._nodes[t];return null}getPlugByGUID(e){for(const t of this._nodes){const n=t.getPlugByGUID(e);if(n)return n}return null}findItemTransformForPreload(e,t){let{receiverPlug:n,incomingPlug:i}=e,a=n,s=i;if(a.node.skuID=="Root")return this.findItemTransformRoot(e);let o=null,l=null,u=new Ei,f=Mo.getState().assets.items[a.node.skuID].proxy.data.scene.clone();u.add(f);let{position:h,rotation:p}=t;if(f.position.set(h.x,h.y,h.z),f.setRotationFromQuaternion(p),l=f,!l||(o=l.getObjectByName(a.name),!o))return;let m=new ve(0,0,0);o.getWorldPosition(m);let y=new $i().identity();o.getWorldQuaternion(y);let E=new Ei;o.add(E);let b=Mo.getState().assets.items[s.node.skuID].proxy.data.scene.clone();b.position.set(m.x,m.y,m.z),b.applyQuaternion(y);let v=new ve;v.copy(f.up).applyQuaternion(l.quaternion);let x=new ve;x.copy(b.up).applyQuaternion(y),x.negate();let S=new $i().setFromUnitVectors(v,x);v.round(),x.round();let _=v.dot(x);_!==1&&_!==-1&&b.applyQuaternion(S);let w=b.getObjectByName(s.name),R=new $i().identity();w.getWorldQuaternion(R);let N=new ve(0,1,0);N.applyQuaternion(R);let L=new ve(0,1,0);L.applyQuaternion(y),L.negate();let I=new $i().setFromUnitVectors(N,L);if(N.round(),L.round(),N.dot(L)!==-1)b.applyQuaternion(I);else{let j=new ve(0,1,0),Q=L.dot(j);if(Q!==1&&Q!==-1)b.rotateOnAxis(j,Math.PI);else{let H=new ve(0,0,1),K=L.dot(H);if(K!==1&&K!==-1)b.rotateOnAxis(H,Math.PI);else{let J=new ve(1,0,0),W=L.dot(J);W!==1&&W!==-1&&b.rotateOnAxis(J,Math.PI)}}}let k=b.getObjectByName(s.name),F=new ve(k.position.x,k.position.y,k.position.z);b.translateX(-F.x),b.translateY(-F.y),b.translateZ(-F.z);let U=new ve(0,0,0);b.getWorldPosition(U);let z=new $i().identity();return b.getWorldQuaternion(z),b=null,{position:U,rotation:z}}findItemTransformRoot(e){let{receiverPlug:t,incomingPlug:n}=e,i=n;const a=new Ei;let s=a,o=new ve(0,0,0);s.getWorldPosition(o);let l=new $i().identity(),u=new Ei;u.position.set(0,0,0),a.add(u);let f=Mo.getState().assets.items[i.node.skuID].proxy.data.scene.clone();u.attach(f),f.translateX(o.x),f.translateY(o.y),f.translateZ(o.z);let h=f.getObjectByName(i.name),p=new $i().identity();h.getWorldQuaternion(p);const m=new ve(0,1,0);m.applyQuaternion(p);const y=new ve(0,1,0);y.applyQuaternion(l);const E=y.angleTo(m),b=new ve(0,0,0);b.crossVectors(y,m),b.round(),b.length()!==0&&f.rotateOnAxis(b,E);var v=new Wn().extractRotation(f.matrixWorld);let x=new ve(h.position.x,h.position.y,h.position.z);x.applyMatrix4(v),f.translateX(-x.x),f.translateY(-x.y),f.translateZ(-x.z);let S=new ve(0,0,0);f.getWorldPosition(S);let _=new $i().identity();return f.getWorldQuaternion(_),u.remove(f),u=null,f=null,{position:S,rotation:_}}findItemTransform(e){let{receiverPlug:t,incomingPlug:n}=e,i=t,a=n;if(i.node.skuID=="Root")return this.findItemTransformRoot(e);const s=i.node.transform;if(!s)return;const o=Mo.getState().assets.items[i.node.skuID].proxy.data.scene.clone(),l=new Ei;l.position.set(s.position.x,s.position.y,s.position.z),l.setRotationFromQuaternion(s.rotation),l.add(o);let u=l.getObjectByName(""+i.name);if(!u){Gt.error({title:"Plug: "+i.name+" doesn't exist in "+i.node.skuID});return}let f=new ve(0,1,0);u.getWorldPosition(f);let h=new $i().identity();u.getWorldQuaternion(h);let p=Mo.getState().assets.items[a.node.skuID].proxy.data.scene.clone();p.position.set(f.x,f.y,f.z),p.applyQuaternion(h);let m=new ve;m.copy(o.up).applyQuaternion(l.quaternion);let y=new ve;y.copy(p.up).applyQuaternion(h),y.negate();let E=new $i().setFromUnitVectors(m,y);m.round(),y.round();let b=m.dot(y);b!==1&&b!==-1&&p.applyQuaternion(E);let v=p.getObjectByName(a.name);if(!v){Gt.error({title:"Plug: "+a.name+" doesn't exist in "+a.node.skuID});return}let x=new $i().identity();v.getWorldQuaternion(x);let S=new ve(0,1,0);S.applyQuaternion(x);let _=new ve(0,1,0);_.applyQuaternion(h),_.negate();let w=new $i().setFromUnitVectors(S,_);if(S.round(),_.round(),S.dot(_)!==-1)p.applyQuaternion(w);else{let k=new ve(0,1,0),F=_.dot(k);if(F!==1&&F!==-1)p.rotateOnAxis(k,Math.PI);else{let U=new ve(0,0,1),z=_.dot(U);if(z!==1&&z!==-1)p.rotateOnAxis(U,Math.PI);else{let j=new ve(1,0,0),Q=_.dot(j);Q!==1&&Q!==-1&&p.rotateOnAxis(j,Math.PI)}}}let N=p.getObjectByName(a.name),L=new ve(N.position.x,N.position.y,N.position.z);p.translateX(-L.x),p.translateY(-L.y),p.translateZ(-L.z);let I=new ve(0,0,0);p.getWorldPosition(I);let D=new $i().identity();return p.getWorldQuaternion(D),l.remove(o),p=null,{position:I,rotation:D}}getSpawningRequirementForSkuID(e){let t=[];const n=Ln.getState().productData,i=n[e];if(!i)return t;const a=[];return i.plugs.map(s=>{s.connectsToPlugTypes.map(o=>{a.push(o)})}),Object.keys(n).map(s=>{for(let o=0;o<n[s].plugs.length;o++){const l=n[s].plugs[o].acceptedPlugTypes;for(let u=0;u<l.length;u++)a.map(f=>{f==l[u]&&!t.includes(s)&&t.push(s)})}}),t}getConnectablePlugs(e,t){let n=[],i=e.getOpenPlugsWeCanAttachFrom();for(let a=0;a<i.length;a++)for(let s=0;s<t.length;s++){let o=!1;for(let u=0;u<n.length;u++)if(n[u].receiverPlug.guid==t[s].guid){o=!0;break}if(o)continue;i[a].canAttachToPlug(t[s])&&n.push({incomingPlug:i[a],receiverPlug:t[s]})}return n}getOpenPlugs(){let e=[];return this._nodes.map(t=>{let n=t.getOpenPlugsFromNode();e=e.concat(n)}),e}checkCollisionforGUID(e){if(Je.getState().sceneSettings.disableCollider)return!1;const t=Wt.getState().itemsSpawned,n=Ln.getState().productData;if(!t[e])return!1;const a=this.getNodeByGUID(e);if(!a||!a.ref||n[a.skuID].disableCollider)return!1;const s={position:a.ref.position,rotation:a.ref.rotation},o=a.whichPlugAreWeAttachedTo();return o==null?!1:this.isColliding(a.skuID,s,o,[])}isColliding(e,{position:t,rotation:n},i,a=[]){const s=Mo.getState().assets.items[e].proxy.data.scene,o=Ln.getState().productData;if(!s)return!1;let l=s.clone();l.position.set(t.x,t.y,t.z),l.setRotationFromQuaternion(n);let u=new fl().setFromObject(l);var f=new ve;u.getCenter(f);let h=new Ei;h.position.set(f.x,f.y,f.z),h.attach(l),h.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),u=new fl().setFromObject(h);const p=[];if(this._nodes.forEach(y=>{i.node.guid!=y.guid&&(Array.isArray(a)===!0&&a.includes(y.guid)||y.ref&&((o[y.skuID].hasOwnProperty("disableCollider")?o[y.skuID].disableCollider:Je.getState().sceneSettings.disableCollider)||p.push(y.ref)))}),p.length<=0)return!1;let m=!1;return p.forEach(y=>{if(m)return;let E=new fl().setFromObject(y);if(u.intersectsBox(E)){m=!0;return}}),h.clear(),l=null,h=null,u=null,m}boxOverlapPercent(e,t){if(e.containsBox(t)||t.containsBox(e))return 100;if(!(e.min.x<t.max.x||t.min.x<e.max.x))return 0;let n=new ve(0,0,0);e.getSize(n),n.x*n.y*n.z;let i=new ve(0,0,0);t.getSize(i),i.x*i.y*i.z}checkInsideOutCollision(e,t,n){let i=t.position.clone(),a=new Float32Array(n.attributes.position.array),s=a.length/3;for(let o=0;o<s;o++){let l=new ve(a[o*3],a[o*3+1],a[o*3+2]),u=l.add(t.position);u=l.applyQuaternion(t.quaternion);let f=u.sub(t.position);const p=new xy(i,f.clone().normalize()).intersectObjects(e),m=p.length>0,y=p[0].distance<f.length();if(m&&y)return!0}return!1}addNode(e){this._nodes.push(e)}getFirstNodeByCategoryID(e){for(var t=0;t<this._nodes.length;t++)if(this._nodes[t]._categoryID==e)return this._nodes[t];return null}getNodesBySKUID(e){let t=[];for(var n=0;n<this._nodes.length;n++)this._nodes[n].skuID==e&&t.push(this._nodes[n]);return t}getNodesByCategoryID(e){let t=[];for(var n=0;n<this._nodes.length;n++)this._nodes[n]._categoryID==e&&t.push(this._nodes[n]);return t}connectPlugs({incomingPlug:e,receiverPlug:t}){e.attachPlug(t,!1),t.attachPlug(e,!0),ln.getState().actions.toggleStructureUpdated()}removeNodeByGUID(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e){this._nodes[t].removeNode(),this._nodes.splice(t,1);break}this._nodes.length==1&&this.#e&&nt.fireEvent(nt.EVENTS.SCENE.Scene_Cleared,!0),ln.getState().actions.updateFittingSkuIds(),ln.getState().actions.toggleStructureUpdated()}removeNodeFromStructure(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e.guid){this._nodes.splice(t,1);break}ln.getState().actions.toggleStructureUpdated()}}class GUe{constructor(){this._globalVariants={},this._globalGeometryVariants={},Ln.getState().categoryData.geometryVariants.map(e=>{this._globalGeometryVariants[e.id]=e.defaultVariant}),Ln.getState().categoryData.color.map(e=>{this._globalVariants[e.id]=e.defaultLook}),this._currentStructure=new Q$(null,this._globalVariants,this._globalGeometryVariants);for(const[e,t]of Object.entries(this._globalVariants))this.switchGlobalVariant(e,t);for(const[e,t]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(e,t)}get globalGeometryVariants(){return this._globalGeometryVariants}get globalVariants(){return this._globalVariants}get currentStructure(){return this._currentStructure}getClientProductId(e,t){let n;return n=Ln.getState()?.productData[e]?.lookDetails[t],n?.clientProductId?n?.clientProductId:""}getCartItems(){let e=[];const t=Gd.getState().inventoryData;this.currentStructure.nodes.map(a=>{if(a.skuID=="Root"||a.ignoreInCart===!0)return;let s=!1;if(e.map(u=>{const f=t[u.skuID];if(u.skuID==a.skuID&&u.currentVariant==a.currentVariant){u.count++,u.countAvailable=f[a.currentVariant].countAvailable,u.countUnavailable=f[a.currentVariant].countUnavailable,u.price=a.price*u.count,s=!0;return}}),s===!0)return;let o={};o.skuID=a.skuID,o.currentVariant=a.currentVariant,o.clientProductId=this.getClientProductId(o.skuID,o.currentVariant),o.count=1;const l=t[o.skuID];o.price=a.price,o.countAvailable=l[a.currentVariant].countAvailable,o.countUnavailable=l[a.currentVariant].countUnavailable,e.push(o)});let n=0;for(const a of e)n=n+a.price;return{cartItems:e,details:{total:n.toFixed(2)}}}getFittingSKUIDs(){const e=Ln.getState().productData;if(!this.currentStructure)return;let t=this.currentStructure.nodes,n=[],i=[],a=[],s=[];if(t.map(l=>{s.push(l.skuID),l.plugs.map(u=>{if(!u.isOpen){u.attachedPlug.node.replace&&u.acceptedPlugTypes.map(f=>{i.includes(f)||i.push(f)});return}u.acceptedPlugTypes.map(f=>{n.includes(f)||n.push(f)})})}),n.length<=0&&i.length<=0)return[];Object.keys(e).map(l=>{!e[l].plugs||a.includes(l)||e[l].plugs.map(u=>{a.includes(l)||u.connectsToPlugTypes.map(f=>{if(!a.includes(l)){if(i.includes(f)){if(!s.includes(l)){let h=!1,p=this.currentStructure.getFirstNodeByCategoryID(e[l].categoryID),m=!1;p?.plugs.map(y=>{!y.isOpen&&y.isReceiverPlug&&(m=!0,e[l].plugs.map(E=>{E.name==y.name&&y.attachedPlug.connectsToPlugTypes.map(b=>{E.acceptedPlugTypes.includes(b)&&(h=!0)})}))}),(h||!m)&&a.push(l)}}else if(n.includes(f)){const h=this.currentStructure.getFirstNodeByCategoryID(e[l].categoryID);if(h&&h.replace)return;a.push(l)}}})})});let o=[];return a.map(l=>{if(o.includes(l))return;if(e[l].replace){o.push(l);return}const{transforms:u,newNodes:f,connectablePlugs:h}=this.currentStructure.findGhostTransforms(l,Je.getState().sceneSettings.ignoreSpawningCollision);u.length>0&&o.push(l)}),o.map(l=>{e[l].replace}),o}async removeAllVariantOverrides(){let e=this._currentStructure.nodes,t=Ln.getState().productData,n=Wt.getState().itemsSpawned;await e.map(async i=>{if(!i.overrideVariant||(i.overrideVariant=null,!t[i.skuID].looks))return;let a=null;Object.keys(this._globalVariants).map(s=>{t[i.skuID].looks.includes(this._globalVariants[s])&&a==null&&(a=this._globalVariants[s])}),a&&await Wt.getState().actions.switchToVariant(n[i.guid].itemData,a)}),nt.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),nt.fireEvent(nt.EVENTS.SCENE.MaterialOverrides_Exists,!1)}async switchGlobalGeometryVariant(e,t){const i=Ln.getState().categoryData.geometryVariants;let a=null;if(i.map(p=>{p.id==e&&(a=p)}),!a)return;const s=a.productsInCategory,l=a.variants[t].productsToSwitch,u=Wt.getState().itemsSpawned;let f=Ln.getState().categoryData;l.map(p=>{s.map(m=>{let y=!1;m.products.map(E=>{p==E&&(y=!0)}),y&&f.build.map(E=>{m.products.map(b=>{E.skus.map((v,x)=>{E.skus[x]==b&&(E.skus[x]=p)})})})})}),this._currentStructure.nodes.map(p=>{s.map(m=>{m.products.map(y=>{p.skuID==y&&p.ref!==null&&m.products.map(E=>{l.map(b=>{if(b==E){const v=Ln.getState().actions.getProductDataById(b);p.hideNodes(v.geometriesToHide),p.showNodes(v.geometriesToShow),p.skuID=b;const x=u[p.guid];x&&x.itemData&&Object.keys(v).map(S=>{x.itemData[S]=v[S]}),p.resetInStock(),p.updatePricing()}})})})})}),this._globalGeometryVariants[e]=t,hi.getState().actions.checkHotspotHealth(),Gd.getState().actions.refreshInventory(u),Ln.setState({categoryData:f}),nt.fireEvent(nt.EVENTS.SCENE.CategoryData_Updated,f),nt.fireEvent(nt.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const h=this.getCartItems();h&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,h)}async switchGlobalVariant(e,t){this._globalVariants[e]=t;const n=Wt.getState().actions;let i=Wt.getState().itemsSpawned;for(let l=0;l<Object.keys(i).length;l++){let u=i[Object.keys(i)[l]];if(u.itemData.looks&&u.itemData.looks.includes(t)){let f=this._currentStructure.getNodeByGUID(u.itemData.guid);f&&!f.overrideVariant&&await n.switchToVariant(u.itemData,t)}}const a=Ln.getState().lookData;tT.getState().actions.processLookEnvMapOverride(t);const s=e;Object.keys(i).length>0&&nt.alert({alertMsg:s.charAt(0).toUpperCase()+s.slice(1)+" was successfully switched to "+a[t].label+".",alertTime:3e3,alertType:"success",alertLabel:`${s} Changed`,alertId:"materialVariantChanged"}),nt.fireEvent(nt.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),Wt.setState({variantChangeAlert:!Wt.getState().variantChangeAlert});const o=this.getCartItems();o&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,o)}async#e(e){if(!e)return;Gt.info({title:"Structure to load",details:e}),delete this._currentStructure,this._globalVariants={...e.globalVariants},this._globalGeometryVariants=e.globalGeometryVariants?{...e.globalGeometryVariants}:{};const t=[...e.structure];this._currentStructure=new Q$(t,this._globalVariants,this._globalGeometryVariants);for(const[n,i]of Object.entries(this._globalVariants))this.switchGlobalVariant(n,i);for(const[n,i]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(n,i);Gt.info({title:"Structure Loading..."}),await this._currentStructure.load(),Gt.info({title:"Structure Loaded."})}async loadStructure(e){e&&(nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Show),Je.setState({configurationLoaded:!1}),await gc(500),await this._currentStructure.clear(),await this.#e(e),Je.getState().preconfigurationLoaded?nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Hide):Je.setState({preconfigurationLoaded:!0}),Je.setState({configurationLoaded:!0}),ln.getState().actions.toggleStructureUpdated())}export(){return{structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Show),this._currentStructure.clear(),nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Hide)}async restart(){Gt.warn({title:"Restarting the Scene!!"}),Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem(),nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Show),await gc(500),await this._currentStructure.clear();const e=ln.getState().defaultConfig;await this.#e(e),ln.getState().actions.toggleStructureUpdated(),Je.setState({configurationLoaded:!0}),nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Hide)}}const wie=Do((r,e)=>({attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async()=>{const{actions:t,defaultConfig:n}=e(),i=await new GUe;r({attachmentSystem:i}),t.updateFittingSkuIds(),t.toggleStructureUpdated()},loadSavedStructureFromConfigID:async t=>{const n=await _ie(kH+t);return n.success===!1?null:n.data},loadDefaultStructure:async()=>{const{actions:t,defaultConfig:n,attachmentSystem:i}=e();await t.loadStructure(n)},updateFittingSkuIds:()=>{const t=wie.getState().attachmentSystem.getFittingSKUIDs();t&&nt.fireEvent(nt.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:t})},toggleStructureUpdated:()=>{const{attachmentSystem:t}=e();r(i=>({structureUpdated:!i.structureUpdated})),nt.fireEvent(nt.EVENTS.SCENE.ReplaceableCategory_Updated,t.currentStructure.getCurrentItemsInReplaceableCategory());const n=t.getCartItems();n&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,n)},loadStructure:async t=>{const{attachmentSystem:n}=e();n&&Je.getState().configurationLoaded!==!1&&await n.loadStructure(t)},export:()=>{const{attachmentSystem:t}=e();if(t)return t.export()}}})),ln=wie,HUe=Do((r,e)=>({productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:{},actions:{getCurrentPricingInfo:()=>{const{productData:t}=e();let n={};return Object.keys(t).map(i=>{if(i.toLowerCase()==="root")return;let a=t[i].lookDetails,s={};Object.keys(a).map(o=>{o!="default"&&(s[o]=a[o].price)}),n[i]=s}),n},updatePricingForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(i=>{let a=t[i];Object.keys(a).map(s=>{n.updatePricingForProduct(i,s,a[s])})})},updatePricingForProduct:(t,n,i)=>{const{productData:a}=e();let s=a[t];if(!s||!s.lookDetails)return;let o=s.lookDetails[n];if(!o)return;o.price=i,ln.getState().attachmentSystem.currentStructure.getNodesBySKUID(t).map(f=>f.updatePricing())},setProductData:t=>{let n={};t&&Object.keys(t).map(i=>{const a=t[i];if(a.skuID=i,a.skuID.toLowerCase()==="root"){a.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},a.defaultVariant="default";return}if(a?.lookDetails){const s=a.lookDetails;let o=Object.keys(a.lookDetails);if(o.includes("default")){const u=o.indexOf("default");o.splice(u,1)}a.looks=o,Object.keys(a.lookDetails).map(u=>{let f=a.lookDetails[u];f.inventory===void 0&&(f.inventory=P$),f.price===void 0&&(f.price=uUe),n[i]={...n[i],[u]:{inventory:P$,inScene:[]}}});let l=a?.defaultVariant;l||(Gt.warn({title:`No defaultVariant set for ${a.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),l=Object.keys(a.lookDetails).sort()[0],Gt.warn({title:"Auto resolved default look ID: "+l})),o.includes(l)?(a.lookDetails.default=s[l],a.lookDetails.default.id=l):(Gt.error({title:`Default look [ ${l} ] doesn't exist for: ${i}. Please make sure to select a default variant in Input Data for this project`}),a.lookDetails.default=null)}}),Gt.info("PRODUCT DATA: ",t),Gd.setState({inventoryData:n}),r({productData:t})},setCategoryData:t=>{const{productData:n}=e();t.geometryVariants!==void 0&&t.geometryVariants.map(i=>{i.defaultVariant===void 0&&Object.keys(i.variants).length>0&&(i.defaultVariant=Object.keys(i.variants)[0])}),t.color!==void 0&&t.color.map(i=>{(i.defaultLook===void 0&&i.looks.length>0||!i.looks.includes(i.defaultLook))&&(i.defaultLook=i.looks[0])}),r({categoryData:t}),t.build!==void 0&&t.build.map(i=>{i.skus.map(a=>{n[a].categoryID=i.categoryID,n[a].categoryLabel=i.label,n[a].swappable=i.swappable?i.swappable:!1,n[a].replace=i.replace})})},getProductDataById:t=>{const{productData:n}=e();let i=null;return n[t]&&(i=n[t]),i},setLookData:t=>r({lookData:t}),setHotspotsData:t=>{const{categoryData:n,productData:i}=e();n.geometryVariants&&Object.keys(t).map(a=>{t[a].map(s=>{s.geometryVariantID&&n.geometryVariants.map(o=>{Object.keys(o.variants).map(l=>{s.geometryVariantID==l&&o.productsInCategory.map(u=>{let f=null;u.products.map(h=>{t.hasOwnProperty(h)&&(f=t[h])}),u.products.map(h=>{t.hasOwnProperty(h)||(t[h]=f)})})})})})}),r({hotspotsData:t})},setEndpoints:t=>{r({endpoints:t}),pUe(t)},setAssetsData:t=>r({assetsData:t})}})),Ln=HUe,VUe=Do((r,e)=>({defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:t=>{r(n=>({envMapUrl:t}))},processLookEnvMapOverride:t=>{const{envMapUrl:n,defaultEnvMapUrl:i,actions:a}=e(),s=Ln.getState().lookData[t],o=s?.envMapOverride;if(!s||!o){a.setEnvLightMap(i);return}if(o===n){Gt.info(`New Env Map Url is the same as the current ${o}`);return}a.setEnvLightMap(o)}}})),tT=VUe,jUe=()=>{const[r,e]=oe.useState(!1),t=Ln(s=>s),n=tT(s=>s),[i,a]=oe.useState(1);return oe.useEffect(()=>{const s=t.assetsData,o=s?.sceneMoodSettings?.envMap;o&&(tT.setState({defaultEnvMapUrl:o}),n.actions.setEnvLightMap(o)),n.envMapUrl===""&&n.actions.setEnvLightMap(tT.getState().defaultEnvMapUrl);const l=s?.sceneMoodSettings?.ambientLightIntensity;l!==void 0&&a(l),e(!0)},[]),oe.useEffect(()=>{r!==!1&&(Gt.groupCollapsed("SCENE LIGHTING INFO:"),Gt.table({title:"Scene Lights",details:{"Environment Map":n.envMapUrl,"Ambient Light Intensity":i}}),Gt.groupEnd())},[r]),ne(fi,{children:r===!0&&ne("group",{name:"GRP_LIGHTS",children:[ne("ambientLight",{intensity:i},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:70,columnNumber:11},globalThis),ne(aUe,{background:!1,files:nt.getResolvedAssetUrl(n.envMapUrl)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:71,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:69,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:67,columnNumber:5},globalThis)};function QUe(r,e,t){return Math.max(e,Math.min(r,t))}const ea={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function W$(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function Y$(r,e,t,n=.15){return n===0?QUe(r,e,t):r<e?-W$(e-r,t-e,n)+e:r>t?+W$(r-t,t-e,n)+t:r}function WUe(r,[e,t],[n,i]){const[[a,s],[o,l]]=r;return[Y$(e,a,s,n),Y$(t,o,l,i)]}function us(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function q$(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ta(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?q$(Object(t),!0).forEach(function(n){us(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):q$(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Cie={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function X$(r){return r?r[0].toUpperCase()+r.slice(1):""}const YUe=["enter","leave"];function qUe(r=!1,e){return r&&!YUe.includes(e)}function XUe(r,e="",t=!1){const n=Cie[r],i=n&&n[e]||e;return"on"+X$(r)+X$(i)+(qUe(t,i)?"Capture":"")}const $Ue=["gotpointercapture","lostpointercapture"];function KUe(r){let e=r.substring(2).toLowerCase();const t=!!~e.indexOf("passive");t&&(e=e.replace("passive",""));const n=$Ue.includes(e)?"capturecapture":"capture",i=!!~e.indexOf(n);return i&&(e=e.replace("capture","")),{device:e,capture:i,passive:t}}function ZUe(r,e=""){const t=Cie[r],n=t&&t[e]||e;return r+n}function rB(r){return"touches"in r}function Mie(r){return rB(r)?"touch":"pointerType"in r?r.pointerType:"mouse"}function JUe(r){return Array.from(r.touches).filter(e=>{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function eBe(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Rie(r){return rB(r)?eBe(r)[0]:r}function GH(r,e){const t=e.clientX-r.clientX,n=e.clientY-r.clientY,i=(e.clientX+r.clientX)/2,a=(e.clientY+r.clientY)/2,s=Math.hypot(t,n);return{angle:-(Math.atan2(t,n)*180)/Math.PI,distance:s,origin:[i,a]}}function tBe(r){return JUe(r).map(e=>e.identifier)}function $$(r,e){const[t,n]=Array.from(r.touches).filter(i=>e.includes(i.identifier));return GH(t,n)}function AG(r){const e=Rie(r);return rB(r)?e.identifier:e.pointerId}function RT(r){const e=Rie(r);return[e.clientX,e.clientY]}const K$=40,Z$=800;function Iie(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=K$,t*=K$):n===2&&(e*=Z$,t*=Z$),[e,t]}function nBe(r){var e,t;const{scrollX:n,scrollY:i,scrollLeft:a,scrollTop:s}=r.currentTarget;return[(e=n??a)!==null&&e!==void 0?e:0,(t=i??s)!==null&&t!==void 0?t:0]}function iBe(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:a}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:a})}return e}function KL(r,...e){return typeof r=="function"?r(...e):r}function rBe(){}function aBe(...r){return r.length===0?rBe:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function J$(r,e){return Object.assign({},e,r||{})}const sBe=32;class Nie{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?KL(n.from,t):t.offset,t.offset=t.lastOffset),t.startTime=t.timeStamp=e.timeStamp}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let a=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,iBe(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,a=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const R=t._delta.map(Math.abs);ea.addTo(t._distance,R)}this.axisIntent&&this.axisIntent(e);const[s,o]=t._movement,[l,u]=n.threshold,{_step:f,values:h}=t;if(n.hasCustomTransform?(f[0]===!1&&(f[0]=Math.abs(s)>=l&&h[0]),f[1]===!1&&(f[1]=Math.abs(o)>=u&&h[1])):(f[0]===!1&&(f[0]=Math.abs(s)>=l&&Math.sign(s)*l),f[1]===!1&&(f[1]=Math.abs(o)>=u&&Math.sign(o)*u)),t.intentional=f[0]!==!1||f[1]!==!1,!t.intentional)return;const p=[0,0];if(n.hasCustomTransform){const[R,N]=h;p[0]=f[0]!==!1?R-f[0]:0,p[1]=f[1]!==!1?N-f[1]:0}else p[0]=f[0]!==!1?s-f[0]:0,p[1]=f[1]!==!1?o-f[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(p);const m=t.offset,y=t._active&&!t._blocked||t.active;y&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=KL(n.bounds,t)),this.setup&&this.setup()),t.movement=p,this.computeOffset()));const[E,b]=t.offset,[[v,x],[S,_]]=t._bounds;t.overflow=[E<v?-1:E>x?1:0,b<S?-1:b>_?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const w=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=WUe(t._bounds,t.offset,w),t.delta=ea.sub(t.offset,m),this.computeMovement(),y&&(!t.last||a>sBe)){t.delta=ea.sub(t.offset,m);const R=t.delta.map(Math.abs);ea.addTo(t.distance,R),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&a>0&&(t.velocity=[R[0]/a,R[1]/a])}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(Ta(Ta(Ta({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function oBe([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class jI extends Nie{constructor(...e){super(...e),us(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=ea.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=ea.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Mie(e)]:n.axisThreshold;t.axis=oBe(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const lBe=r=>r,eK=.15,Die={enabled(r=!0){return r},eventOptions(r,e,t){return Ta(Ta({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[eK,eK];case!1:return[0,0];default:return ea.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return ea.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||lBe},threshold(r){return ea.toVector(r,0)}},cBe=0,zb=Ta(Ta({},Die),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=cBe){return r},bounds(r={}){if(typeof r=="function")return a=>zb.bounds(r(a));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),CP=10,tK={ArrowRight:(r=1)=>[CP*r,0],ArrowLeft:(r=1)=>[-CP*r,0],ArrowUp:(r=1)=>[0,-CP*r],ArrowDown:(r=1)=>[0,CP*r]};class uBe extends jI{constructor(...e){super(...e),us(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=zb.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=AG(e),n._pointerActive=!0,this.computeValues(RT(e)),this.computeInitial(),t.preventScrollAxis&&Mie(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive||t.type===e.type&&e.timeStamp===t.timeStamp)return;const i=AG(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const a=RT(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=ea.sub(a,t._values),this.computeValues(a)),ea.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=AG(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[a,s]=t._distance;if(t.tap=a<=n.tapsThreshold&&s<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[o,l]=t.direction,[u,f]=t.velocity,[h,p]=t.movement,[m,y]=n.swipe.velocity,[E,b]=n.swipe.distance,v=n.swipe.duration;t.elapsedTime<v&&(Math.abs(u)>m&&Math.abs(h)>E&&(t.swipe[0]=o),Math.abs(f)>y&&Math.abs(p)>b&&(t.swipe[1]=l))}this.emit()}pointerClick(e){this.state.tap||(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,hBe(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=tK[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(i),n._keyboardActive=!0,ea.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in tK&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this)),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function hBe(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const QI=typeof window<"u"&&window.document&&window.document.createElement;function fBe(){return QI&&"ontouchstart"in window}function nK(){return fBe()||QI&&window.navigator.maxTouchPoints>1}function dBe(){return QI&&"onpointerdown"in window}function pBe(){return QI&&"exitPointerLock"in window.document}function mBe(){try{return"constructor"in GestureEvent}catch{return!1}}const $u={isBrowser:QI,gesture:mBe(),touch:nK(),touchscreen:nK(),pointer:dBe(),pointerLock:pBe()},gBe=250,vBe=180,yBe=.5,ABe=50,bBe=250,iK={mouse:0,touch:0,pen:8},_Be=Ta(Ta({},zb),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&$u.pointerLock,$u.touch&&t?"touch":this.pointerLock?"mouse":$u.pointer&&!i?"pointer":$u.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?gBe:void 0,!(!$u.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1}={}}){return this.pointerButtons=n,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const a=ea.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,a},swipe({velocity:r=yBe,distance:e=ABe,duration:t=bBe}={}){return{velocity:this.transform(ea.toVector(r)),distance:this.transform(ea.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return vBe;case!1:return 0;default:return r}},axisThreshold(r){return r?Ta(Ta({},iK),r):iK}}),EBe=30,SBe=100;class xBe extends Nie{constructor(...e){super(...e),us(this,"ingKey","pinching"),us(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:n}=this.state;e==="wheel"?this.state.offset=ea.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,n]=e._movement;if(!e.axis){const i=Math.abs(t)*EBe-Math.abs(n);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(a=>n.has(a))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);const i=$$(e,t._touchIds);this.pinchStart(e,i)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,n=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(n.keys()).every(s=>i.has(s))||(n.size<2&&n.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const a=GH(...Array.from(n.values()));this.pinchStart(e,a)}pinchStart(e,t){const n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=$$(e,this.state._touchIds);this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const n=GH(...Array.from(t.values()));this.pinchMove(e,n)}pinchMove(e,t){const n=this.state,i=n._values[1],a=t.angle-i;let s=0;Math.abs(a)>270&&(s+=Math.sign(a)),this.computeValues([t.distance,t.angle-360*s]),n.origin=t.origin,n.turns=s,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=ea.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&!e[t]||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const n=this.state;n._delta=[-Iie(e)[1]/SBe*n.offset[0],0],ea.addTo(n._movement,n._delta),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t?(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this))):e("wheel","",this.wheel.bind(this),{passive:!1})}}const TBe=Ta(Ta({},Die),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!$u.touch&&$u.gesture)return"gesture";if($u.touch&&n)return"touch";if($u.touchscreen){if($u.pointer)return"pointer";if($u.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=s=>{const o=J$(KL(t,s),{min:-1/0,max:1/0});return[o.min,o.max]},a=s=>{const o=J$(KL(n,s),{min:-1/0,max:1/0});return[o.min,o.max]};return typeof t!="function"&&typeof n!="function"?[i(),a()]:s=>[i(s),a(s)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",ea.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r}});class wBe extends jI{constructor(...e){super(...e),us(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(RT(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=RT(e),n=this.state;n._delta=ea.sub(t,n._values),ea.addTo(n._movement,n._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const CBe=Ta(Ta({},zb),{},{mouseOnly:(r=!0)=>r});class MBe extends jI{constructor(...e){super(...e),us(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,n=nBe(e);t._delta=ea.sub(n,t._values),ea.addTo(t._movement,t._delta),this.computeValues(n),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const RBe=zb;class IBe extends jI{constructor(...e){super(...e),us(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=Iie(e),ea.addTo(t._movement,t._delta);const[n,i]=t.overflow,[a,s]=t._delta,[o,l]=t._direction;(n<0&&a>0&&o<0||n>0&&a<0&&o>0)&&(t._movement[0]=t._movementBound[0]),(i<0&&s>0&&l<0||i>0&&s<0&&l>0)&&(t._movement[1]=t._movementBound[1]),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const NBe=zb;class DBe extends jI{constructor(...e){super(...e),us(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(RT(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const n=RT(e);t._movement=t._delta=ea.sub(n,t._values),this.computeValues(n),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const OBe=Ta(Ta({},zb),{},{mouseOnly:(r=!0)=>r}),s8=new Map,HH=new Map;function PBe(r){s8.set(r.key,r.engine),HH.set(r.key,r.resolver)}const LBe={key:"drag",engine:uBe,resolver:_Be},UBe={key:"hover",engine:DBe,resolver:OBe},BBe={key:"move",engine:wBe,resolver:CBe},kBe={key:"pinch",engine:xBe,resolver:TBe},FBe={key:"scroll",engine:MBe,resolver:RBe},zBe={key:"wheel",engine:IBe,resolver:NBe};function GBe(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function HBe(r,e){if(r==null)return{};var t=GBe(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const VBe={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=$u.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},jBe=["target","eventOptions","window","enabled","transform"];function hL(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=hL(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function QBe(r,e){const t=r,{target:n,eventOptions:i,window:a,enabled:s,transform:o}=t,l=HBe(t,jBe),u={shared:hL({target:n,eventOptions:i,window:a,enabled:s,transform:o},VBe)};if(e){const f=HH.get(e);u[e]=hL(Ta({shared:u.shared},l),f)}else for(const f in l){const h=HH.get(f);h&&(u[f]=hL(Ta({shared:u.shared},l[f]),h))}return u}class Oie{constructor(e,t){us(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,a){const s=this._listeners,o=ZUe(t,n),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},u=Ta(Ta({},l),a);e.addEventListener(o,i,u);const f=()=>{e.removeEventListener(o,i,u),s.delete(f)};return s.add(f),f}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class WBe{constructor(){us(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class YBe{constructor(e){us(this,"gestures",new Set),us(this,"_targetEventStore",new Oie(this)),us(this,"gestureEventStores",{}),us(this,"gestureTimeoutStores",{}),us(this,"handlers",{}),us(this,"config",{}),us(this,"pointerIds",new Set),us(this,"touchIds",new Set),us(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),qBe(this,e)}setEventIds(e){if(rB(e))return this.touchIds=new Set(tBe(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=QBe(e,t)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const s of this.gestures){const o=this.config[s],l=rK(n,o.eventOptions,!!i);if(o.enabled){const u=s8.get(s);new u(this,e,s).bind(l)}}const a=rK(n,t.eventOptions,!!i);for(const s in this.nativeHandlers)a(s,"",o=>this.nativeHandlers[s](Ta(Ta({},this.state.shared),{},{event:o,args:e})),void 0,!0)}for(const a in n)n[a]=aBe(...n[a]);if(!i)return n;for(const a in n){const{device:s,capture:o,passive:l}=KUe(a);this._targetEventStore.add(i,s,"",n[a],{capture:o,passive:l})}}}}function Sx(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Oie(r,e),r.gestureTimeoutStores[e]=new WBe}function qBe(r,e){e.drag&&Sx(r,"drag"),e.wheel&&Sx(r,"wheel"),e.scroll&&Sx(r,"scroll"),e.move&&Sx(r,"move"),e.pinch&&Sx(r,"pinch"),e.hover&&Sx(r,"hover")}const rK=(r,e,t)=>(n,i,a,s={},o=!1)=>{var l,u;const f=(l=s.capture)!==null&&l!==void 0?l:e.capture,h=(u=s.passive)!==null&&u!==void 0?u:e.passive;let p=o?n:XUe(n,i,f);t&&h&&(p+="Passive"),r[p]=r[p]||[],r[p].push(a)},XBe=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function $Be(r){const e={},t={},n=new Set;for(let i in r)XBe.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function xx(r,e,t,n,i,a){if(!r.has(t)||!s8.has(n))return;const s=t+"Start",o=t+"End",l=u=>{let f;return u.first&&s in e&&e[s](u),t in e&&(f=e[t](u)),u.last&&o in e&&e[o](u),f};i[n]=l,a[n]=a[n]||{}}function KBe(r,e){const[t,n,i]=$Be(r),a={};return xx(i,t,"onDrag","drag",a,e),xx(i,t,"onWheel","wheel",a,e),xx(i,t,"onScroll","scroll",a,e),xx(i,t,"onPinch","pinch",a,e),xx(i,t,"onMove","move",a,e),xx(i,t,"onHover","hover",a,e),{handlers:a,config:e,nativeHandlers:n}}function ZBe(r,e={},t,n){const i=Xa.useMemo(()=>new YBe(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),Xa.useEffect(i.effect.bind(i)),Xa.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function JBe(r){return r.forEach(PBe),function(t,n){const{handlers:i,nativeHandlers:a,config:s}=KBe(t,n||{});return ZBe(i,s,void 0,a)}}function Pie(r,e){return JBe([LBe,kBe,FBe,zBe,BBe,UBe])(r,e||{})}function e3e({children:r,guid:e,onDragStartHandler:t,onDragEndHandler:n,onItemClickHandler:i,onPointerEnter:a,onPointerLeave:s,dragging:o=!1,intersectingGhostObject:l=null,isInteractive:u=!0,initialIntersectedGhostUUID:f=null,isSnapAllowed:h=!1,...p}){const m=oe.useRef(),y=oe.useRef(-1),E=oe.useRef([]),b=oe.useRef([]),{raycaster:v,size:x,camera:S}=fs(),_=hi(W=>W.isAnyHotspotActive),w=Je(W=>W.multipleTouchDetected),[R,N]=oe.useState(null),{raycasterGhost:L}=oe.useMemo(()=>({raycasterGhost:new xy})),I=W=>{let V;return W.isGhost===!0?V=W:W.parent?W.parent.isGhost===!0?V=W.parent:V=I(W.parent):V=null,V},D=W=>{L.setFromCamera(W,S);const V=L.intersectObject(gr.getState().ghostParentRef);let $=null;return V.length>0&&($=I(V[0].object)),$},k=W=>{let V=W.whichNodesAreAttachedToUs();return V.map($=>{k($).map(pe=>{V.push(pe)})}),V},{initialMouse2D:F,mouse2D:U,mouse3D:z,offset:j,normal:Q,plane:H,pointerDownPos:K}=oe.useMemo(()=>({initialMouse2D:new Rt,mouse2D:new Rt,mouse3D:new ve,offset:new ve,normal:new ve,plane:new Sm,pointerDownPos:new Rt}),[]);oe.useEffect(()=>{let W=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(e);N(W)},[]);const J=Pie({onPointerEnter:W=>{w||Je.getState().sceneSettings.disableDragDrop&&Je.getState().sceneSettings.disableContextMenu||Je.getState().itemDraggedSkuID||Je.getState().cameraActive!==!0&&!Je.getState().dragging&&!_&&(R&&!R.isEndNode?nt.switchCursor(eo.POINTER):nt.switchCursor(eo.GRAB),a(W.event))},onPointerLeave:W=>{w||Je.getState().sceneSettings.disableDragDrop&&Je.getState().sceneSettings.disableContextMenu||Je.getState().itemDraggedSkuID||Je.getState().cameraActive!==!0&&!Je.getState().dragging&&!_&&(nt.switchCursor(eo.GRAB),s(W.event))},onClick:W=>{if(W.event.stopPropagation(),!w){if(Je.getState().builderMode){const{eventObject:V,point:$}=W.event;V.getWorldPosition(j).sub($),z.copy($);const re=W.event.offsetX,pe=W.event.offsetY,ue=re/x.width*2-1,ce=-pe/x.height*2+1;U.set(ue,ce);const ye=new xy;ye.setFromCamera(U,S);const Se=ye.intersectObject(Je.getState().sceneRef.getObjectByName("proxyGeometry"));Se.length>0&&nt.fireEvent(nt.EVENTS.CONFIGURATION.OnClickItem,{point:Se[0].point,camera:ye.camera})}if(!Je.getState().sceneSettings.disableContextMenu)if(!W.dragging&&!_){if(Math.abs(W.event.x-K.x)>1)return;i(W.event.offsetX,W.event.offsetY,e)}else hi.getState().actions.exitHotspot(!0)}},onDrag:async W=>{if(Je.getState().simulateDragEnd===!0||Je.getState().dragging&&Je.getState().draggingItemGUID!==R.guid||Je.getState().sceneSettings.disableDragDrop)return;const V=W.event;if(V.stopPropagation(),_){nt.switchCursor(eo.BLOCKED);return}if(Wt.getState().selectedItemData){nt.switchCursor(eo.BLOCKED);return}if(Object.keys(Wt.getState().itemsSpawned).length<2){nt.switchCursor(eo.BLOCKED);return}const re=W.event.offsetX,pe=W.event.offsetY;if(!Je.getState().dragging){if(Wt.setState({busy:!0}),Math.abs(V.x-K.x)<=1)return;if(R&&!R.canDrag){nt.switchCursor(eo.BLOCKED);return}const We=R.whichPlugAreWeAttachedUsing().attachedPlug.guid;let Fe=R.swapRoot();Fe||(Fe={rootDetachedPlugs:R.detachNodeFromReceiver()}),E.current=k(R),b.current=[],E.current.map(He=>{b.current.push(He.guid),R.ref.attach(He.ref)}),nt.switchCursor(eo.MOVE),Je.setState({dragging:!0}),Je.setState({draggingItemGUID:R.guid}),h=!1,l=null,f=null,y.current=-1;const ie=re/x.width*2-1,qe=-pe/x.height*2+1;F.set(ie,qe);const Me=await t({guid:e,node:R,detachedData:Fe,attachedChildrenGuids:b.current});if(Me.length<=0||Me.transforms===void 0)return;Me.transforms.map((He,Oe)=>{He.receiverPlugGUID===We&&(y.current=Oe)})}const ue=re/x.width*2-1,ce=-pe/x.height*2+1;U.set(ue,ce),v.setFromCamera(U,S),S.getWorldDirection(Q).negate(),H.setFromNormalAndCoplanarPoint(Q,z),v.ray.intersectPlane(H,z);const ye=gr.getState().ghostParentRef;ye.children.length>0&&(l=D(U),f===null&&y.current!==-1&&y.current<ye.children.length&&ye.children[y.current]!==void 0&&(f=ye.children[y.current].children[0].uuid),l&&f!==null&&f!==l.uuid&&!h&&(h=!0),!h&&!l&&(h=!0)),l&&h?(gr.setState({ghostVisibility:!1}),R.ref.position.set(l.position.x,l.position.y,l.position.z),R.ref.setRotationFromEuler(l.rotation)):(gr.setState({ghostVisibility:!0}),R.ref.position.copy(z).add(j)),(ue>1||ue<-1||ce<-1||ce>1)&&(Je.setState({simulateDragEnd:!0}),Je.setState({dragging:!1}),Je.setState({draggingItemGUID:null}),Wt.setState({busy:!1}),nt.switchCursor(eo.GRAB),n({node:R,intersectingGhostObject:l,attachedChildrenGuids:b.current,attachedNodesToCurrentNode:E.current}))},onDragStart:({event:W})=>{if(Je.setState({simulateDragEnd:!1}),w||Je.getState().sceneSettings.disableDragDrop&&Je.getState().sceneSettings.disableContextMenu)return;W.stopPropagation();const{eventObject:V,point:$}=W;V.getWorldPosition(j).sub($),z.copy($),K.set(W.x,W.y)},onDragEnd:({event:W})=>{Je.setState({simulateDragEnd:!1}),!(Je.getState().dragging&&Je.getState().draggingItemGUID!==R.guid)&&(Je.getState().sceneSettings.disableDragDrop&&Je.getState().sceneSettings.disableContextMenu||(W.stopPropagation(),Je.setState({dragging:!1}),Je.setState({draggingItemGUID:null}),Wt.setState({busy:!1}),nt.switchCursor(eo.GRAB),n({node:R,intersectingGhostObject:l,attachedChildrenGuids:b.current,attachedNodesToCurrentNode:E.current})))}});return ne(fi,{children:u?ne("group",{ref:m,...J(),...p,children:r},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:479,columnNumber:9},this):ne("group",{ref:m,...p,children:r},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:483,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:477,columnNumber:5},this)}const t3e=({modelData:r,clonedMesh:e,clonedProxyMesh:t,itemKey:n,scale:i,onItemClickHandler:a,onDragEndHandler:s,onDragStartHandler:o,stockAlert:l=!0})=>{const u=hi(Q=>Q),f=Wt(Q=>Q),h=Wt(Q=>Q.hoveredItemRef),p=oe.useRef(null),m=oe.useRef(null),y=oe.useRef([]),E=oe.useRef(null),[b,v]=oe.useState(e),[x,S]=oe.useState(t),_=oe.useRef(0),w=oe.useRef(0),{ref:R,actions:N,names:L}=KLe(r.data.animations),I=oe.useCallback((Q,H,K,J)=>n3e(Q,H,K,J,L,N),[L,N]),D=oe.useCallback(Q=>i3e(Q,L,N),[L,N]);oe.useEffect(()=>{if(p.current===n.itemData.guid){p.current=null;let Q=u.lastActiveHotspotData.hotspotData;if(!Q)return;if(Q.exitAnim?I(Q.exitAnim,!1,!1,!1):Q.entryAnim&&I(Q.entryAnim,!1,!0,!1),Q.activeAnim&&D(Q.activeAnim),u.activeHotspotData){if(n.itemData.guid===u.activeHotspotData.itemData.guid){p.current=n.itemData.guid;let H=u.activeHotspotData.hotspotData;if(!H)return;H.entryAnim&&I(H.entryAnim,!1,!1,!0),H.activeAnim&&I(H.activeAnim,!0,!1,!1)}}else return}else if(u.activeHotspotData){if(n.itemData.guid===u.activeHotspotData.itemData.guid){p.current=n.itemData.guid;let Q=u.activeHotspotData.hotspotData;if(!Q)return;Q.entryAnim&&I(Q.entryAnim,!1,!1,!0),Q.activeAnim&&I(Q.activeAnim,!0,!1,!1)}}else return},[u.activeHotspotData]),oe.useEffect(()=>{Je.getState().actions.triggerAutoFocus(),nt.fireEvent(nt.EVENTS.SCENE.Item_Added,{...n})},[]);const k=oe.useCallback(()=>{if(!R.current||(y.current=RUe(b,R.current.inStock),y.current.length==0))return;if(R.current.inStock===!1){l==!0&&(l=!1,nt.alert({alertMsg:"Some item(s) in configuration are out of stock",alertTime:7e3,alertType:"warn",alertLabel:"Stock Alert",persistant:!0,alertId:"outOfStock"}));return}const{current:Q}=w;for(let H=0;H<y.current.length;H++){const K=y.current[H].material;if(K.emissiveIntensity==Q)return;K.emissiveIntensity=Q}},[w,R]),F=oe.useCallback(()=>{_.current=0},[y]),U=oe.useCallback(()=>{_.current=.005},[y,b]);Zm(()=>{Je.getState().builderMode||(w.current=Mb.lerp(w.current,_.current,.1),k())}),oe.useEffect(()=>{const Q=ln.getState().attachmentSystem.currentStructure,H=Q.getNodeByGUID(n.itemData.guid);if(H?.isDependent&&!H.isInteractive&&Object.keys(h).length>0){const K=Q.getNodeByGUID(Object.keys(h)[0]);if(!K||!K.myDependenciesGUID)return;K.myDependenciesGUID.includes(n.itemData.guid)?F():U()}else h.hasOwnProperty(n.itemData.guid)||Object.keys(h).length==0?F():U()},[h]);const z=oe.useCallback(Q=>{Q.stopPropagation();const H=f.selectedItemData;Je.setState({canvasTooltipText:"-"+n.itemData.name+"-"}),H||Wt.setState({hoveredItemRef:{}});let K=Wt.getState().hoveredItemRef;K.hasOwnProperty(n.itemData.guid)||(K[n.itemData.guid]={instance:R.current},f.actions.setHoveredItemRef({...K}))},[f,h,m]),j=oe.useCallback(Q=>{Q.stopPropagation();const H=f.selectedItemData;if(Je.setState({canvasTooltipText:""}),H){if(H.itemData.guid==n.itemData.guid)return;h[n.itemData.guid]&&(delete h[n.itemData.guid],f.actions.setHoveredItemRef({...h}))}else Wt.setState({hoveredItemRef:{}})},[m,f,h]);return oe.useEffect(()=>{if(E.current)return f.collidersRef.push(E),f.actions.setCollidersRef([...f.collidersRef]),()=>{const Q=f.collidersRef.indexOf(E);Q>-1&&f.collidersRef.splice(Q,1),f.actions.setCollidersRef([...f.collidersRef])}},[E]),ne(fi,{children:[ne("primitive",{name:"GRP_RenderGeometry",ref:R,object:b,scale:i,inStock:!0},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:240,columnNumber:7},globalThis),(n.itemData.hasOwnProperty("disableCollider")?!n.itemData.disableCollider:!Je.getState().sceneSettings.disableCollider)&&ne("group",{name:"GRP_LoadingPlaceholder",children:ne("group",{position:n.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:ne(gie,{ref:E,scale:Vx(n.itemData.boundingBoxSize),visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:257,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:252,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:251,columnNumber:9},globalThis),r.proxy.isLoaded&&ne(e3e,{guid:n.itemData.guid,onDragStartHandler:o,onDragEndHandler:s,onItemClickHandler:a,onPointerEnter:z,onPointerLeave:j,name:"GRP_ProxyMesh",isInteractive:n.itemData.isInteractive,children:ne("primitive",{name:"proxyGeometry",object:x,scale:i,visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:277,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:267,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:239,columnNumber:5},globalThis)};function n3e(r,e,t,n,i,a){if(!i.includes(r))return;const s=a[r];s.setLoop(e?l6:o6),s.clampWhenFinished=!e,n&&s.reset(),t?s.fadeOut(.5).play():s.fadeIn(.5).play()}function i3e(r,e,t){if(!e.includes(r))return;t[r].stop()}function r3e({distanceFactor:r,position:e,proxymodel:t,scale:n}){return ne("primitive",{position:[0,0,0],name:"proxyLoader",object:t,scale:n,visible:!0,wireframe:!0,children:ne(OR,{center:!0,position:e,distanceFactor:r,zIndexRange:[29,0],children:ne("img",{alt:"Loading...",draggable:"false",src:Om+"/Animation/Loading.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:32,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:25,columnNumber:7},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:17,columnNumber:5},this)}function a3e({proxymodel:r,itemKey:e,scale:t}){return oe.useEffect(()=>{ln.getState().actions.updateFittingSkuIds()},[]),ne("group",{children:[(e.itemData.hasOwnProperty("disableCollider")?!e.itemData.disableCollider:!Je.getState().sceneSettings.disableCollider)&&ne("group",{name:"GRP_LoadingPlaceholder",children:ne("group",{position:e.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:ne(gie,{scale:Vx(e.itemData.boundingBoxSize),visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:65,columnNumber:13},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:60,columnNumber:11},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:59,columnNumber:9},this),ne("group",{name:"GRP_ProxyMesh",children:ne("primitive",{name:"proxyGeometry",object:r.clone(),scale:t,visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:73,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:72,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:55,columnNumber:5},this)}const s3e=({position:r,rotation:e,itemKey:t,scale:n,rejectFunc:i,onItemClickHandler:a,onDragEndHandler:s,onDragStartHandler:o,itemIndex:l,proxyScene:u})=>{const f=Je(x=>x.sceneRef),h=Mo(x=>x),[p,m]=oe.useState(null),[y,E]=oe.useState(u.clone()),b=oe.useRef(null);oe.useEffect(()=>((async()=>{let x=await h.actions.loadAsset(t.itemData.skuID).catch((w,R)=>{i(w,R,t.itemData.guid)});if(!x||!x.data){m({data:null,clonedMesh:null,mainModelReady:!1});return}let S=x.data,_;t.itemData.replace===!0?_=S.scene:_=S.scene.clone(),t.itemData.clonedScene=_,S.functions&&(S.functions.copyVariantMaterials(_,S.scene),await v(S,_)),Gt.info({title:"model loaded: "+t.itemData.skuID}),t.itemData.hasItemLoaded=!0,Wt.getState().actions.triggerModelLoaded(),nt.fireEvent(nt.EVENTS.SCENE.Model_Loaded,t.itemData.skuID),m({data:x,clonedMesh:_,mainModelReady:!0})})(),()=>{nt.fireEvent(nt.EVENTS.SCENE.Model_Removed,t.itemData.skuID)}),[]);const v=oe.useCallback(async(x,S)=>{const _=ln.getState().attachmentSystem;var w=_.currentStructure.getNodeByGUID(t.itemData.guid);if(!w)return;let R="";if(w.overrideVariant)R=w.overrideVariant,nt.fireEvent(nt.EVENTS.SCENE.MaterialOverrides_Exists,!0);else{const N=_.globalVariants;if(!N||N.Count<=0)return;let L=[];Object.keys(N).map((I,D)=>{L.push(N[I])}),t.itemData.looks?.map(I=>{L.includes(I)&&(R=I)}),R||(R=t.itemData.looks[0])}return R&&(w.currentVariant=R,await x.functions.selectVariant(S,R),Wt.setState({variantChangeAlert:!Wt.getState().variantChangeAlert})),R},[]);return oe.useEffect(()=>{if(!b.current)return;const x=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(t.itemData.guid);x&&p!==null?(x.ref=b.current,x.transform={position:r,rotation:e},ln.getState().actions.updateFittingSkuIds()):Gt.warn({title:t.itemData.guid})},[b,p]),oe.useEffect(()=>{if(b.current&&f&&t.itemData.hasOwnProperty("excludeFromSceneBounds")&&t.itemData.excludeFromSceneBounds){const x=f.getObjectByName("#GRP_EXCLUDED");x!==void 0&&x.attach(b.current)}},[f,b]),ne("group",{ref:b,position:r,quaternion:e,name:`GRP_${t.itemData.name}_`+l.toString().padStart(2,"0"),children:[p!==null&&(p.mainModelReady?ne(t3e,{modelData:p.data,clonedMesh:p.clonedMesh,clonedProxyMesh:y,itemKey:t,scale:n,onDragStartHandler:o,onDragEndHandler:s,onItemClickHandler:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:264,columnNumber:11},globalThis):ne(a3e,{itemKey:t,proxymodel:y,scale:n},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:275,columnNumber:11},globalThis)),p==null&&y&&ne(r3e,{proxymodel:y,distanceFactor:t.itemData.boundingBoxSize.x*4>1?1:t.itemData.boundingBoxSize.x*4,position:t.itemData.boundingSphereCenter,scale:n},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:283,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:254,columnNumber:5},globalThis)};function o3e({index:r,children:e,...t}){const n=oe.useRef(),i=Pie({onPointerEnter:a=>{a.event.stopPropagation(),Je.getState().itemDraggedSkuID&&Je.setState({hoveredGhostIndex:r})},onPointerLeave:a=>{a.event.stopPropagation(),Je.getState().itemDraggedSkuID&&Je.setState({hoveredGhostIndex:-1})}});return ne("group",{ref:n,...i(),...t,children:e},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/GhostEventHandler.js",lineNumber:22,columnNumber:5},this)}const l3e=({ghostData:r,ghostTransform:e,index:t})=>{const n=oe.useRef(),i=oe.useMemo(()=>r.proxyScene.clone(),[r]),a=Je(o=>o.hoveredGhostIndex),s=new Yt(.6,.98,0);return oe.useEffect(()=>{const{current:o}=n;o&&(o.userData.incomingPlugName=e.incomingPlugName,o.userData.receiverPlugName=e.receiverPlugName,o.userData.incomingPlugGUID=e.incomingPlugGUID,o.userData.receiverPlugGUID=e.receiverPlugGUID,nt.fireEvent(nt.EVENTS.SCENE.Ghost_Loaded,{ghostData:r,ghostTransform:e}))},[n]),oe.useEffect(()=>{if(!i||!Je.getState().itemDraggedSkuID)return;let o;a===t?o=s:o=Je.getState().sceneSettings.ghostThreeColor,i.traverse(l=>{l.isMesh===!0&&(l.material=l.material.clone(),l.material.emissive=o)})},[a,i]),ne(fi,{children:ne(o3e,{index:t,children:ne("primitive",{isGhost:!0,ref:n,index:t,position:e.position,quaternion:e.rotation,object:i,castShadow:!1,receiveShadow:!1,frustumCulled:!1},`ghost${t}`,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:59,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:58,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:57,columnNumber:5},globalThis)},c3e=({intersectingGhostObject:r=null})=>{const{camera:e}=fs(),t=gr(l=>l.ghostVisibility),n=gr(l=>l.ghostData),i=gr(l=>l.ghostsTransform),a=oe.useRef(),{_touch2D:s}=oe.useMemo(()=>({_touch2D:new Rt}),[]);oe.useEffect(()=>{const{current:l}=a;l&&gr.setState({ghostParentRef:l})},[a]);const o=l=>{let u=0,f=0;if(l.touches&&l.touches[0])u=l.touches[0].clientX,f=l.touches[0].clientY;else return;if(!Je.getState().itemDraggedSkuID)return;const h=Je.getState().cursorParentRef,p=Je.getState().canvasSize;if(!h)return;const m=h.getBoundingClientRect(),y=m.top,E=m.left,b=(u-E)/p.width*2-1,v=(-f+y)/p.height*2+1;s.set(b,v);const x=new xy;x.setFromCamera(s,e);const S=x.intersectObject(gr.getState().ghostParentRef);S.length>0?(r=S[0].object,Je.setState({hoveredGhostIndex:r.parent.index})):(r=null,Je.setState({hoveredGhostIndex:-1}))};return oe.useEffect(()=>{window.addEventListener("touchmove",o,!1),Gt.info({title:"Ghost Manager Mounted!"})},[]),ne("group",{name:"#GRP_GhostParent",visible:t,ref:a,children:n&&ne(fi,{children:i.map((l,u)=>u<n.count&&ne(l3e,{ghostData:n,ghostTransform:l,index:u},"ghosts"+u,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:89,columnNumber:17},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:85,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:79,columnNumber:5},globalThis)},u3e=()=>{const r=ln(L=>L.attachmentSystem),e=ln(L=>L),t=Wt(L=>L.removeItemTrigger),n=Wt(L=>L.variantChangeAlert),i=hi(L=>L),a=Je(L=>L.showDimensions);Je(L=>L.sceneSettings);const s=Wt(L=>L),o=Wt(L=>L.lastDeletedItemData),l=Cr(L=>L),u=Wt(L=>L.selectedItemData),f=Wt(L=>L.itemsSpawned),h=oe.useRef(null),p=oe.useRef(null),m=oe.useRef(!1),y=oe.useRef(null),E=oe.useRef(null),b=oe.useRef(!1),v=oe.useRef(!1);oe.useRef(!1),oe.useRef(!1);const x=oe.useCallback(({guid:L,node:I,detachedData:D,attachedChildrenGuids:k})=>{if(m.current!==!0)return m.current=!0,Cr.setState({canCameraRotate:!1}),i.actions.switchHotspotsVisibility(!1,!0),y.current={position:I.ref.position.clone(),rotation:I.ref.rotation.clone()},E.current=D,r.currentStructure.removeNodeFromStructure(I),k.length<=0&&(k=!1),gr.getState().actions.spawnGhostsForSkuID(f[L].itemData.skuID,k)},[l,f]),S=oe.useCallback(({node:L,intersectingGhostObject:I,attachedChildrenGuids:D,attachedNodesToCurrentNode:k})=>{if(!m.current)return;m.current=!1,Cr.setState({canCameraRotate:!0}),i.actions.switchHotspotsVisibility(!0,!0);function F(){L.ref.position.set(0,0,0),gr.getState().actions.clearAllGhosts()}if(!gr.getState().ghostData?.connectablePlugs){F();return}r.currentStructure.addNode(L);let z=null,j=null,Q=!1,H=[],K={};if(Je.getState().sceneSettings.ignoreCollisionPostDragging===!1&&D.map((J,W)=>{H[W]=r.currentStructure.checkCollisionforGUID(J),H[W]&&(K[J]=f[J])}),H.map(J=>{Q||(Q=J)}),I&&Q){Je.setState({draggingOnDropCollisionData:{node:L,attachedChildrenGuids:D,collidingStatus:H,intersectingGhostObject:I,initPosition:y.current.position,initRotation:y.current.rotation,detachedPlugs:E.current,attachedNodesToCurrentNode:k}}),L.ref.position.set(I.position.x,I.position.y,I.position.z),L.ref.setRotationFromEuler(I.rotation),nt.fireEvent(nt.EVENTS.SCENE.DraggingOnDrop_CollsionDetected,K);return}if(I){const J=I.userData;z=L.getPlugByName(J.incomingPlugName),j=r.currentStructure.getPlugByGUID(J.receiverPlugGUID),L.ref.position.set(I.position.x,I.position.y,I.position.z),L.ref.setRotationFromEuler(I.rotation),L.transform={position:I.position,rotation:I.quaternion}}else{const J=E.current.neighbourDetachedPlugs;J&&(E.current.neighbourNode.detachNodeFromReceiver(),r.currentStructure.connectPlugs({incomingPlug:J.incomingPlug,receiverPlug:J.receiverPlug})),z=E.current.rootDetachedPlugs.incomingPlug,j=E.current.rootDetachedPlugs.receiverPlug,L.ref.position.set(y.current.position.x,y.current.position.y,y.current.position.z),L.ref.setRotationFromEuler(y.current.rotation);let W=new $i().identity();L.ref.getWorldQuaternion(W),L.transform={position:y.current.position,rotation:W}}r.currentStructure.connectPlugs({incomingPlug:z,receiverPlug:j}),gr.getState().actions.clearAllGhosts(),Wt.getState().actions.deselectItem(),k.map(J=>{L.ref.parent.attach(J.ref)}),ln.getState().actions.updateFittingSkuIds()},[l,Je,gr,r,e,f]),_=oe.useCallback((L,I,D)=>{if(Je.getState().sceneSettings.disableContextMenu)return;const k=ln.getState().attachmentSystem.currentStructure,F=k.getNodeByGUID(D);let U=[];if(!F.myDependenciesGUID)return;F.myDependenciesGUID.map(Q=>{const H=k.getNodeByGUID(Q);let K={guid:Q,name:f[Q].itemData.guid,data:{...f[Q],overrideVariant:H.overrideVariant,currentVariant:H.currentVariant,offsetX:L,offsetY:I}};U.push(K)}),U.sort((Q,H)=>Q.name>H.name?1:H.name>Q.name?-1:0);let z=Gd.getState().inventoryData[f[D].itemData.skuID];const j={primary:{guid:D,name:f[D].itemData.name,data:{inventory:z,...f[D],overrideVariant:F.overrideVariant,currentVariant:F.currentVariant,offsetX:L,offsetY:I}},dependencies:U};s.actions.setSelectedItemData(j.primary.data),nt.fireEvent(nt.EVENTS.UI.ContextMenu_Show,j)},[f]),w=oe.useCallback(L=>{L&&(Wt.setState({lastDeletedItemData:{...f[L]}}),nt.fireEvent(nt.EVENTS.SCENE.Item_Removed,{...f[L]}),delete f[L],s.actions.setItemsSpawned({...f}))},[s,Wt,f]);oe.useEffect(()=>{let L=Wt.getState().removeItems;if(L.length<=0&&!o)return;let I=L.pop();w(I)},[t,o]);const R=oe.useCallback(function(L,I){const D=L>0,k=L<=0;Gt.groupCollapsed("Resolving buttons visibility"),Gt.table({sceneIsEmpty:k,sceneIsNotEmpty:D}),Gt.groupEnd(),I.showViewInYourSpaceBtn===!0&&(D&&b.current===!1?(nt.fireEvent(nt.EVENTS.UI.ViewInYourSpaceButton_Show),b.current=!0):k&&b.current===!0&&(nt.fireEvent(nt.EVENTS.UI.ViewInYourSpaceButton_Hide),b.current=!1)),I.showShareBtn===!0&&(D&&v.current===!1?(nt.fireEvent(nt.EVENTS.UI.ShareButton_Show),v.current=!0):k&&v.current===!0&&(nt.fireEvent(nt.EVENTS.UI.ShareButton_Hide),v.current=!1))},[f]);oe.useEffect(()=>{nt.fireEvent(nt.EVENTS.SCENE.Items_Updated,{itemsSpawned:f});const L=Je.getState().sceneSettings;R(Object.keys(f).length,L),Object.keys(f).length==0?Je.setState({canvasTooltipText:L.textSettings.tooltipEmptySceneText}):Object.keys(f).length==1&&Je.setState({canvasTooltipText:L.textSettings.tooltipInstructionText})},[f]),oe.useEffect(()=>{const L=ln.getState().attachmentSystem;if(!L)return;Gd.getState().actions.refreshInventory(f);const I=L.getCartItems();nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,I),nt.fireEvent(nt.EVENTS.SCENE.ReplaceableCategory_Updated,L.currentStructure.getCurrentItemsInReplaceableCategory())},[f,n]);const N=oe.useCallback((L,I,D)=>{nt.removeItemByGUID(D),nt.alert({alertMsg:I+": "+L,alertTime:5e3,alertType:"error",alertLabel:"Error",persistant:!0})},[]);return oe.useEffect(()=>{const{current:L}=p;L&&ln.setState({colliderMeshRef:L})},[p]),oe.useEffect(()=>{const{current:L}=h;L&&Je.setState({sceneRef:L})},[h]),oe.useEffect(()=>{let L=u?Cr.getState().cameraSettings.zoomingMultiplier:Cr.getState().cameraSettings.zoomingMultiplier+.1;L+=a?.3:.1,Cr.setState({boundsMargin:L}),Je.getState().actions.triggerAutoFocus()},[a,u]),oe.useEffect(()=>{Gt.info({title:"item Manager mounted"}),Je.getState().preconfigurationLoaded||ln.getState().actions.loadDefaultStructure()},[]),ne(fi,{children:[ne("group",{name:"Scene",ref:h,onPointerMissed:()=>{u&&s.actions.deselectItem(),hi.getState().isAnyHotspotActive&&hi.getState().actions.exitHotspot()},children:[lUe,ne("group",{name:"#GRP_EXCLUDED"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:466,columnNumber:9},globalThis),ne("group",{name:"#ITEMSANDGHOSTS",children:[ne("group",{name:"#ITEMS",children:Object.keys(f).map((L,I)=>ne(s3e,{scale:[1,1,1],onDragStartHandler:x,onDragEndHandler:S,onItemClickHandler:_,itemKey:f[L],position:f[L].itemData.position,rotation:f[L].itemData.rotation,itemIndex:I,proxyScene:f[L].itemData.proxyScene,rejectFunc:N},L,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:470,columnNumber:15},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:468,columnNumber:11},globalThis),ne(c3e,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:485,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:467,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:456,columnNumber:7},globalThis),ne("group",{name:"#Parent_ColliderMesh",children:ne("mesh",{ref:p,visible:!1,enabled:!0,name:"#COLLIDER_MESH",children:ne("meshPhongMaterial",{depthTest:!1,transparent:!0,opacity:.8},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:495,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:489,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:488,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:455,columnNumber:5},globalThis)},h3e=({...r})=>{const[e,t]=oe.useState(10),n=Je(a=>a.bbox),i=Je(a=>a.sceneSettings);return oe.useEffect(()=>{if(!n||!n.isBox3){t(10);return}const a=new ve(0,0,0);let s=a.distanceTo(n.min)*2,o=a.distanceTo(n.max)*2,l=o>s?o:s;l!=1/0&&l!=-1/0&&(l+=5,t(l||10))},[n]),ne(fi,{children:i.contactShadowVisibility&&ne(sUe,{rotation:[Math.PI/2,0,0],position:[0,0,0],opacity:.3,scale:e,blur:1,far:5,resolution:512},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/EffectsComposer.js",lineNumber:32,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/EffectsComposer.js",lineNumber:30,columnNumber:5},globalThis)};function f3e({hotspotKey:r}){const e=ln(v=>v.attachmentSystem),t=hi(v=>v),n=hi(v=>v.activeHotspotData),i=Wt(v=>v.lastDeletedItemData),a=gr(v=>v.ghostData),s=hi(v=>v.actions),o=hi(v=>v.hotspotsVisibility),l=hi(v=>v.hotspotsTempVisibility),[u,f]=oe.useState(null),[h,p]=oe.useState(!1),m=oe.useRef(null),y=oe.useRef(null),E=oe.useRef(null),b=oe.useCallback(v=>{v.includes(r.itemData.skuID+"_"+r.hotspotData.hotspotID)&&p(!0)},[r]);return oe.useEffect(()=>b(t.visitedHotspotsID),[t,b]),oe.useEffect(()=>{f(n?n.hotspotData.guid:null)},[n]),oe.useEffect(()=>{y.current&&(u===r.hotspotData.guid?y.current.parentNode.classList.add("topmostActive"):y.current.parentNode.classList.remove("topmostActive"))},[u]),oe.useEffect(()=>{m.current&&u===r.hotspotData.guid&&(m.current.style.opacity=1)},[u,m]),oe.useEffect(()=>{if(!(!E.current&&!i)){var v=e.currentStructure.getNodeByGUID(r.itemData.guid);v?.ref&&(E.current.parent=v.ref)}},[E,e,o,i]),ne("group",{ref:E,position:r.hotspotData.hotspotPointTransform,children:ne(OR,{ref:y,zIndexRange:[6,0],style:o&&l&&!a?{opacity:"1",pointerEvents:"all",transition:"0.5s"}:{opacity:"0",pointerEvents:"none",transition:"0.5s"},children:ne("button",{style:{display:r.hotspotData.visibleInScene==!1?"none":"block"},ref:m,className:u===r.hotspotData.guid?"hotspot hotspot-0 active":h?"hotspot hotspot-0 visited":"hotspot hotspot-0",onPointerEnter:v=>{v.stopPropagation(),m.current&&u!==r.hotspotData.guid&&(m.current.getClientRects()[0].left>Je.getState().canvasSize.width/1.6?m.current.classList.add("left"):m.current.classList.remove("left")),y.current&&y.current.parentNode.classList.add("topmostHover")},onPointerLeave:v=>{v.stopPropagation(),y.current&&y.current.parentNode.classList.remove("topmostHover")},id:"hotspot3D_"+r.itemData.skuID+"_"+r.hotspotData.hotspotID,onClick:v=>{if(v.stopPropagation(),t.isAnyHotspotActive&&t.activeHotspotData.hotspotData.guid===r.hotspotData.guid){s.exitHotspot();return}s.clickHotspot(r.hotspotData.hotspotID,r.hotspotData.guid,r.itemData.guid)},children:[ne("span",{className:"inner-circle"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:137,columnNumber:11},this),ne("span",{className:"hotspot-annotation",children:r.hotspotData.title},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:138,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:83,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:74,columnNumber:7},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:73,columnNumber:5},this)}const d3e=()=>{const r=hi(b=>b),e=hi(b=>b.hotspotsHealthCheck),t=Wt(b=>b.lastDeletedItemData),n=hi(b=>b.hotspotsSpawned),i=Wt(b=>b.itemsSpawned),a=hi(b=>b.activeHotspotData),[s,o]=oe.useState(null),{camera:l}=fs(),u=oe.useRef(null),f=oe.useCallback(()=>{const b=hi.getState().hotspotSpawnedForCategoryIDs,v=ln.getState().attachmentSystem.globalGeometryVariants;Object.keys(i).map(x=>{let S=i[x];if(!S.hotspotsData)return;let _=!1;Object.keys(n).map(w=>{const R=n[w].hotspotData.geometryVariantID;if(R){let N=!1;if(Object.keys(v).map(L=>{R==v[L]&&(N=!0)}),N===!1){_=!0;let L=[];L.push(n[w].hotspotData.categoryID);const I=new Set(L);k$(b,D=>!I.has(D)),delete n[w]}}}),_===!0&&(hi.setState({hotspotSpawned:{...n}}),hi.setState({hotspotSpawnedForCategoryIDs:b})),S.hotspotsData.map(w=>{const R=hi.getState().hotspotSpawnedForCategoryIDs;if(w.geometryVariantID){let N=!1;if(Object.keys(v).map(L=>{w.geometryVariantID==v[L]&&(N=!0)}),N===!1)return}w.categoryID!==""&&R.includes(w.categoryID)||(S.hotspotSpawned=!0,R.push(w.categoryID),h(x,w))})})},[i,n]),h=oe.useCallback((b,v)=>{let x=i[b].itemData.skuID+"_"+v.hotspotID;n[x]={itemData:{guid:b,...i[b].itemData},hotspotData:{guid:x,...v}},hi.setState({hotspotsSpawned:{...n}})},[i,r,n]);oe.useEffect(()=>{if(!t)return;if(t.hotspotSpawned){hi.getState().actions.removeHotspotForItem({...t});const v=hi.getState().hotspotSpawnedForCategoryIDs;let x=[];t.hotspotsData.map(_=>{x.push(_.categoryID)});const S=new Set(x);k$(v,_=>!S.has(_)),hi.setState({hotspotSpawnedForCategoryIDs:v})}Wt.setState({lastDeletedItemData:null});const b=ln.getState().attachmentSystem;b.currentStructure.removeNodeByGUID(t.itemData.guid),nt.fireEvent(nt.EVENTS.SCENE.MaterialOverrides_Exists,b.currentStructure.materialOverrideExists())},[t]);const{raycasterHotspot:p,worldPos:m}=oe.useMemo(()=>({raycasterHotspot:new xy,worldPos:new ve}),[]),y=(b,v)=>{let x=b;x.sub(l.position);const S=x.length();p.set(l.position,x);const _=p.intersectObject(Je.getState().sceneRef);if(_.length>0&&_[0].distance<S){v.style.opacity=.5;return}v.style.opacity=s?.5:1};oe.useEffect(()=>{o(a?a.hotspotData.guid:null)},[a]);const E=oe.useRef(0);return Zm(()=>{if(u.current===null||u.current.children.length<=0)return;E.current<u.current.children.length-1?E.current+=1:E.current=0;const b=Object.keys(n)[E.current],v="hotspot3D_"+n[b].itemData.skuID+"_"+n[b].hotspotData.hotspotID,x=nt.coreWCRef.shadowRoot.getElementById(v);s===b||x===null||(u.current.children[E.current].getWorldPosition(m),y(m,x))},[]),oe.useEffect(()=>{f()},[Object.keys(i).length,e]),r.hotspotsVisibility===!0&&ne("group",{name:"#GRP_HotspotManager",ref:u,children:Object.keys(n).map(b=>ne(f3e,{hotspotKey:n[b]},b,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/HotspotManager.js",lineNumber:261,columnNumber:11},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/HotspotManager.js",lineNumber:259,columnNumber:7},globalThis)};var p3e={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},o8=p3e,m3e=o8;function g3e(r){return!!(r&&m3e[typeof r])}var aB=g3e,v3e=Object.prototype,y3e=v3e.toString,A3e=RegExp("^"+String(y3e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),sB=A3e,b3e=o8,_3e=Object.prototype,E3e=_3e.hasOwnProperty,S3e=function(r){var e,t=r,n=[];if(!t||!b3e[typeof r])return n;for(e in t)E3e.call(t,e)&&n.push(e);return n},x3e=S3e,T3e=aB,w3e=sB,C3e=x3e,ZL=w3e.test(ZL=Object.keys)&&ZL,M3e=ZL?function(r){return T3e(r)?ZL(r):[]}:C3e,Lie=M3e;function R3e(){}var I3e=R3e,Uie=aB,N3e=sB,JL=N3e.test(JL=Object.create)&&JL;function Bie(r,e){return Uie(r)?JL(r):{}}JL||(Bie=function(){function r(){}return function(e){if(Uie(e)){r.prototype=e;var t=new r;r.prototype=null}return t||zl.Object()}}());var kie=Bie,D3e=I3e,O3e=sB,aK={configurable:!1,enumerable:!1,value:null,writable:!1},sK=function(){try{var r={},e=O3e.test(e=Object.defineProperty)&&e,t=e(r,r,r)&&e}catch{}return t}(),P3e=sK?function(r,e){aK.value=e,sK(r,"__bindData__",aK)}:D3e,l8=P3e,L3e=kie,U3e=aB,B3e=l8,k3e=[],F3e=k3e.push;function z3e(r){var e=r[0],t=r[2],n=r[4];function i(){if(t){var a=t.slice();F3e.apply(a,arguments)}if(this instanceof i){var s=L3e(e.prototype),o=e.apply(s,a||arguments);return U3e(o)?o:s}return e.apply(n,a||arguments)}return B3e(i,r),i}var G3e=z3e;function H3e(r,e,t){e||(e=0),typeof t>"u"&&(t=r?r.length:0);for(var n=-1,i=t-e||0,a=Array(i<0?0:i);++n<i;)a[n]=r[e+n];return a}var Fie=H3e,V3e=kie,j3e=aB,Q3e=l8,W3e=Fie,Y3e=[],oK=Y3e.push;function zie(r){var e=r[0],t=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=t&1,l=t&2,u=t&4,f=t&8,h=e;function p(){var m=o?a:this;if(n){var y=n.slice();oK.apply(y,arguments)}if((i||u)&&(y||(y=W3e(arguments)),i&&oK.apply(y,i),u&&y.length<s))return t|=16,zie([e,f?t:t&-4,y,null,a,s]);if(y||(y=arguments),l&&(e=m[h]),this instanceof p){m=V3e(e.prototype);var E=e.apply(m,y);return j3e(E)?E:m}return e.apply(m,y)}return Q3e(p,r),p}var q3e=zie;function X3e(r){return typeof r=="function"}var $3e=X3e,K3e=G3e,Z3e=q3e,J3e=$3e,eke=[],lK=eke.push;function Gie(r,e,t,n,i,a){var s=e&1,o=e&2,l=e&4,u=e&16,f=e&32;if(!o&&!J3e(r))throw new TypeError;u&&!t.length&&(e&=-17,u=t=!1),f&&!n.length&&(e&=-33,f=n=!1);var h=r&&r.__bindData__;if(h&&h!==!0)return h=h.slice(),s&&!(h[1]&1)&&(h[4]=i),!s&&h[1]&1&&(e|=8),l&&!(h[1]&4)&&(h[5]=a),u&&lK.apply(h[2]||(h[2]=[]),t),f&&lK.apply(h[3]||(h[3]=[]),n),h[1]|=e,Gie.apply(null,h);var p=e==1||e===17?K3e:Z3e;return p([r,e,t,n,i,a])}var tke=Gie,cK=tke,nke=Fie;function ike(r,e){return arguments.length>2?cK(r,17,nke(arguments,2),null,e):cK(r,1,null,null,e)}var rke=ike;function ake(r){return r}var ske=ake,oke=sB,lke=/\bthis\b/,c8={};c8.funcDecomp=!oke.test(zl.WinRTError)&&lke.test(function(){return this});c8.funcNames=typeof Function.name=="string";var cke=c8,uke=rke,hke=ske,fke=l8,bG=cke,dke=/^\s*function[ \n\r\t]+\w/,pke=/\bthis\b/,mke=Function.prototype.toString;function gke(r,e,t){if(typeof r!="function")return hke;if(typeof e>"u"||!("prototype"in r))return r;var n=r.__bindData__;if(typeof n>"u"&&(bG.funcNames&&(n=!r.name),n=n||!bG.funcDecomp,!n)){var i=mke.call(r);bG.funcNames||(n=!dke.test(i)),n||(n=pke.test(i),fke(r,n))}if(n===!1||n!==!0&&n[1]&1)return r;switch(t){case 1:return function(a){return r.call(e,a)};case 2:return function(a,s){return r.call(e,a,s)};case 3:return function(a,s,o){return r.call(e,a,s,o)};case 4:return function(a,s,o,l){return r.call(e,a,s,o,l)}}return uke(r,e)}var Hie=gke,vke=Hie,yke=Lie,uK=o8,Ake=function(r,e,t){var n,i=r,a=i;if(!i||!uK[typeof i])return a;e=e&&typeof t>"u"?e:vke(e,t,3);for(var s=-1,o=uK[typeof i]&&yke(i),l=o?o.length:0;++s<l;)if(n=o[s],e(i[n],n,r)===!1)return a;return a},bke=Ake,_ke=Hie,Eke=bke;function Ske(r,e,t){var n=-1,i=r?r.length:0;if(e=e&&typeof t>"u"?e:_ke(e,t,3),typeof i=="number")for(;++n<i&&e(r[n],n,r)!==!1;);else Eke(r,e);return r}var xke=Ske,Vie,jie;Vie={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:1/1e3},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/100},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}};jie={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}};var Tke={metric:Vie,imperial:jie,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},Qie,Wie;Qie={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1/1e6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/1e4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}};Wie={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}};var wke={metric:Qie,imperial:Wie,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},Yie,qie;Yie={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1/1e6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:1/1e3},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}};qie={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}};var Cke={metric:Yie,imperial:qie,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},Xie,$ie;Xie={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1/1e6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:1/1e3},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:1/1e3},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:1/100},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:1/10},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:1/1e3},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:5/1e3},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:15/1e3},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:150/1e3},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:200/1e3},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}};$ie={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:1/2},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}};var Mke={metric:Xie,imperial:$ie,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},Kie;Kie={ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}};var Rke={metric:Kie,imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},Zie,Jie;Zie={C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}};Jie={F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}};var Ike={metric:Zie,imperial:Jie,_anchors:{metric:{unit:"C",transform:function(r){return r/(5/9)+32}},imperial:{unit:"F",transform:function(r){return(r-32)*(5/9)}}}},ere,hK=365.25;ere={ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1/1e9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1/1e6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:1/1e3},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:60*60},d:{name:{singular:"Day",plural:"Days"},to_anchor:60*60*24},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:60*60*24*7},month:{name:{singular:"Month",plural:"Months"},to_anchor:60*60*24*hK/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:60*60*24*hK}};var Nke={metric:ere,_anchors:{metric:{unit:"s",ratio:1}}},tre,nre;tre={b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}};nre={B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}};var Dke={bits:tre,bytes:nre,_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},ire;ire={ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}};var Oke={metric:ire,imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},rre,are;rre={"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}};are={"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}};var Pke={metric:rre,imperial:are,_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},sre,ore;sre={"min/km":{name:{singular:"Minute per kilometre",plural:"Minutes per kilometre"},to_anchor:.06},"s/m":{name:{singular:"Second per metre",plural:"Seconds per metre"},to_anchor:1}};ore={"min/mi":{name:{singular:"Minute per mile",plural:"Minutes per mile"},to_anchor:.0113636},"s/ft":{name:{singular:"Second per foot",plural:"Seconds per foot"},to_anchor:1}};var Lke={metric:sre,imperial:ore,_anchors:{metric:{unit:"s/m",ratio:.3048},imperial:{unit:"s/ft",ratio:1/.3048}}},lre,cre;lre={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:1/1e3},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:1/10},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}};cre={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:1/1e3},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}};var Uke={metric:lre,imperial:cre,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},ure;ure={A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}};var Bke={metric:ure,_anchors:{metric:{unit:"A",ratio:1}}},hre;hre={V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}};var kke={metric:hre,_anchors:{metric:{unit:"V",ratio:1}}},fre;fre={W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}};var Fke={metric:fre,_anchors:{metric:{unit:"W",ratio:1}}},dre;dre={VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}};var zke={metric:dre,_anchors:{metric:{unit:"VAR",ratio:1}}},pre;pre={VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}};var Gke={metric:pre,_anchors:{metric:{unit:"VA",ratio:1}}},mre;mre={Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}};var Hke={metric:mre,_anchors:{metric:{unit:"J",ratio:1}}},gre;gre={VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}};var Vke={metric:gre,_anchors:{metric:{unit:"VARh",ratio:1}}},vre,yre;vre={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1/1e6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:1/1e3},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:1/1e3},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:1/100},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:1/10},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}};yre={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:1/2},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}};var jke={metric:vre,imperial:yre,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},Are,bre;Are={lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}};bre={"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}};var Qke={metric:Are,imperial:bre,_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},_re;_re={mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:1/1e3},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e3*1e3},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e3*1e3*1e3},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e3*1e3*1e3*1e3},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(Math.PI*2)}};var Wke={metric:_re,_anchors:{frequency:{unit:"hz",ratio:1}}},Ere;Ere={rad:{name:{singular:"radian",plural:"radians"},to_anchor:180/Math.PI},deg:{name:{singular:"degree",plural:"degrees"},to_anchor:1},grad:{name:{singular:"gradian",plural:"gradians"},to_anchor:9/10},arcmin:{name:{singular:"arcminute",plural:"arcminutes"},to_anchor:1/60},arcsec:{name:{singular:"arcsecond",plural:"arcseconds"},to_anchor:1/3600}};var Yke={metric:Ere,_anchors:{metric:{unit:"deg",ratio:1}}},Sre,LR=Lie,eh=xke,Gm={length:Tke,area:wke,mass:Cke,volume:Mke,each:Rke,temperature:Ike,time:Nke,digital:Dke,partsPer:Oke,speed:Pke,pace:Lke,pressure:Uke,current:Bke,voltage:kke,power:Fke,reactivePower:zke,apparentPower:Gke,energy:Hke,reactiveEnergy:Vke,volumeFlowRate:jke,illuminance:Qke,frequency:Wke,angle:Yke},th;th=function(r,e){e?this.val=r/e:this.val=r};th.prototype.from=function(r){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(r),this.origin||this.throwUnsupportedUnitError(r),this};th.prototype.to=function(r){if(!this.origin)throw new Error(".to must be called after .from");this.destination=this.getUnit(r);var e,t;if(this.destination||this.throwUnsupportedUnitError(r),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!=this.origin.measure)throw new Error("Cannot convert incompatible measures of "+this.destination.measure+" and "+this.origin.measure);return e=this.val*this.origin.unit.to_anchor,this.origin.unit.anchor_shift&&(e-=this.origin.unit.anchor_shift),this.origin.system!=this.destination.system&&(t=Gm[this.origin.measure]._anchors[this.origin.system].transform,typeof t=="function"?e=t(e):e*=Gm[this.origin.measure]._anchors[this.origin.system].ratio),this.destination.unit.anchor_shift&&(e+=this.destination.unit.anchor_shift),e/this.destination.unit.to_anchor};th.prototype.toBest=function(e){if(!this.origin)throw new Error(".toBest must be called after .from");var e=Object.assign({exclude:[],cutOffNumber:1},e),t;return eh(this.possibilities(),function(n){var i=this.describe(n),a=e.exclude.indexOf(n)===-1;if(a&&i.system===this.origin.system){var s=this.to(n);(!t||s>=e.cutOffNumber&&s<t.val)&&(t={val:s,unit:n,singular:i.singular,plural:i.plural})}}.bind(this)),t};th.prototype.getUnit=function(r){var e;return eh(Gm,function(t,n){if(eh(t,function(i,a){if(a=="_anchors"||(eh(i,function(s,o){if(o==r)return e={abbr:r,measure:n,system:a,unit:s},!1}),e))return!1}),e)return!1}),e};var xre=function(r){return{abbr:r.abbr,measure:r.measure,system:r.system,singular:r.unit.name.singular,plural:r.unit.name.plural}};th.prototype.describe=function(r){var e=th.prototype.getUnit(r),t=null;try{t=xre(e)}catch{this.throwUnsupportedUnitError(r)}return t};th.prototype.list=function(r){var e=[];return eh(Gm,function(t,n){r&&r!==n||eh(t,function(i,a){if(a=="_anchors")return!1;eh(i,function(s,o){e=e.concat(xre({abbr:o,measure:n,system:a,unit:s}))})})}),e};th.prototype.throwUnsupportedUnitError=function(r){var e=[];throw eh(Gm,function(t,n){eh(t,function(i,a){if(a=="_anchors")return!1;e=e.concat(LR(i))})}),new Error("Unsupported unit "+r+", use one of: "+e.join(", "))};th.prototype.possibilities=function(r){var e=[];return!this.origin&&!r?eh(LR(Gm),function(t){eh(Gm[t],function(n,i){if(i=="_anchors")return!1;e=e.concat(LR(n))})}):(r=r||this.origin.measure,eh(Gm[r],function(t,n){if(n=="_anchors")return!1;e=e.concat(LR(t))})),e};th.prototype.measures=function(){return LR(Gm)};Sre=function(r){return new th(r)};var _G=Sre;const qke=()=>{const r=Wt(y=>y.itemsSpawned),e=Je(y=>y.showDimensions),t=Je(y=>y.sceneSettings),n=Je(y=>y.boundData),i=Je(y=>y.sceneSettings.sceneScaleUnit),a=Je(y=>y.sceneSettings.sceneScaleDisplayUnit),[s,o]=oe.useState(.2),[l,u]=oe.useState("#000000"),[f,h]=oe.useState(.01),p=oe.useRef(null);oe.useRef(null);const m=oe.useRef(0);return oe.useEffect(()=>{if(t==null)return;const y=t.dimensionColor,E=F$(y.r,y.g,y.b);u(E)},[t]),oe.useEffect(()=>{if(t==null)return;const y=t.dimensionColor,E=F$(y.r,y.g,y.b);u(E)},[t]),oe.useEffect(()=>{if(!n||!n.size)return;let y=n.size.x;y>n.size.z&&(y=n.size.z);let E=y/20;h(E<.005?E:.005),o(y<.2?y:.2)},[n]),oe.useEffect(()=>{m.current=0},[e]),Zm(()=>{p.current!==null&&m.current<1&&(m.current+=.05,p.current.scale.x=m.current,p.current.scale.y=m.current,p.current.scale.z=m.current)}),e===!0&&ne("group",{ref:p,children:n!==null&&n.size.x!==0&&n.size.y!==0&&n.size.z!==0&&Object.keys(r).length>0&&ne(fi,{children:[ne(bm,{position:[n.center.x,n.center.y-n.size.y/2,n.center.z+n.size.z/2+s],rotation:[0,0,XL(90)],scale:[f,n.size.x,f],visible:!0,children:[ne(bm,{position:[0,.5,0],scale:[1,f,7],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:105,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:100,columnNumber:17},globalThis),ne(bm,{position:[0,-.5,0],scale:[1,f,7],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:112,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:107,columnNumber:17},globalThis),ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:116,columnNumber:17},globalThis),ne(OR,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[_G(n.size.x).from("m").to(i).toFixed(t.measurementPrecision),a??i]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:119,columnNumber:17},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:89,columnNumber:15},globalThis),ne(bm,{position:[n.center.x-n.size.x/2-s,n.center.y,n.center.z+n.size.z/2+s],rotation:[0,0,0],scale:[f,n.size.y,f],visible:!0,children:[ne(bm,{position:[0,.5,0],scale:[1,f,7],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:150,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:145,columnNumber:17},globalThis),ne(bm,{position:[0,-.5,0],scale:[1,f,7],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:157,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:152,columnNumber:17},globalThis),ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:161,columnNumber:17},globalThis),ne(OR,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[_G(n.size.y).from("m").to(i).toFixed(t.measurementPrecision),a??i]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:164,columnNumber:17},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:134,columnNumber:15},globalThis),ne(bm,{position:[n.center.x+n.size.x/2+s,n.center.y-n.size.y/2,n.center.z],rotation:[XL(90),0,0],scale:[f,n.size.z,f],visible:!0,children:[ne(bm,{position:[0,.5,0],scale:[7,f,1],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:195,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:190,columnNumber:17},globalThis),ne(bm,{position:[0,-.5,0],scale:[7,f,1],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:202,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:197,columnNumber:17},globalThis),ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:206,columnNumber:17},globalThis),ne(OR,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[_G(n.size.z).from("m").to(i).toFixed(t.measurementPrecision),a??i]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:209,columnNumber:17},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:179,columnNumber:15},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:87,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:81,columnNumber:7},globalThis)},Xke=({...r})=>ne(fi,{children:[ne(d3e,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:11,columnNumber:7},globalThis),ne(qke,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:12,columnNumber:7},globalThis),ne(u3e,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:13,columnNumber:7},globalThis),ne(h3e,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:14,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:10,columnNumber:5},globalThis),$ke=()=>{const r=oe.useRef(null),e=Wt(E=>E.itemsSpawned),t=hi(E=>E.isAnyHotspotActive),n=Cr(E=>E.canCameraRotate),i=Cr(E=>E.cameraSettings),a=Cr(E=>E.disableAutoRotate),s=Je(E=>E.autoFocusTrigger),o=Je(E=>E.dragging),l=Cr(E=>E.sendCameraDetailsTrigger),u=Cr(E=>E.focusPointPosition),f=Cr(E=>E.viewPointPosition),h=oe.useRef(!1),{camera:p}=fs(),m=gr(E=>E.ghostsTransform),y=()=>{if(r.current===null)return;const E=Cr.getState().boundsMargin,b=Je.getState().autoFocusRef,v=Je.getState().sceneRef.getObjectByName("#ITEMSANDGHOSTS"),x=b||v,S=new fl().setFromObject(x);b||Je.setState({bbox:S});const _=new ve;if(S.getSize(_),_.x>0){const w=new ve;S.getCenter(w);const R=new ve(S.max.x,S.max.y,S.max.z);R.sub(S.min),Je.setState({boundData:{center:w,size:R}}),r.current.setBoundary(S);const N=new fl(S.min,S.max);N.min=new ve(N.min.x-E/2,N.min.y-E/2,N.min.z-E/2),N.max=new ve(N.max.x+E/2,N.max.y+E/2,N.max.z+E/2);const L=N.getBoundingSphere(new du(w));L.radius>0&&r.current.fitToSphere(L,!0)}else{const w=new ve(0,0,0),R=new ve(0,0,0);Je.setState({boundData:{center:w,size:R}})}};return oe.useEffect(()=>{y()},[s,Object.keys(e).length]),oe.useEffect(()=>{nt!=null&&(Je.getState().sceneSettings.focusCameraOnGhosts===!0?nt.focusOnGhosts():nt.refocus())},[m]),oe.useEffect(()=>{if(t==!1){h.current==!0&&(r.current.reset(!0),h.current=!1);return}h.current==!1&&(r.current.saveState(),h.current=!0),r.current.setLookAt(f.x,f.y,f.z,u.x,u.y,u.z,!0)},[t,f,u]),oe.useEffect(()=>{nt.fireEvent(nt.EVENTS.CONFIGURATION.CameraDetails_Update,p)},[l]),Zm(E=>{i.canAutoRotate===!1||r.current===null||a===!1&&t===!1&&(r.current.azimuthAngle+=20*E*Mb.DEG2RAD*i.autoRotateSpeed)}),oe.useEffect(()=>{r.current!==null&&(n===!0?(r.current.mouseButtons.left=Js.ROTATE,r.current.touches.one=Js.TOUCH_ROTATE):(r.current.mouseButtons.left=Js.NONE,r.current.touches.one=Js.NONE),i.canZoom===!0&&o===!1?(r.current.mouseButtons.wheel=Js.ZOOM,r.current.mouseButtons.middle=Js.ZOOM):(r.current.mouseButtons.wheel=Js.NONE,r.current.mouseButtons.middle=Js.NONE),i.canPan===!0&&o===!1?(r.current.mouseButtons.right=Js.OFFSET,i.canZoom===!0&&o===!1?(r.current.touches.two=Js.TOUCH_ZOOM_OFFSET,r.current.touches.three=Js.TOUCH_ZOOM_OFFSET):(r.current.touches.two=Js.TOUCH_OFFSET,r.current.touches.three=Js.TOUCH_OFFSET)):(r.current.mouseButtons.right=Js.NONE,i.canZoom===!0&&o===!1?(r.current.touches.two=Js.TOUCH_ZOOM,r.current.touches.three=Js.TOUCH_ZOOM):(r.current.touches.two=Js.NONE,r.current.touches.three=Js.NONE)))},[r,i,o,n]),oe.useEffect(()=>{if(r.current===null)return;p.fov=i.fov,p.updateProjectionMatrix();const E=()=>{r.current.removeEventListener("rest",E),Cr.setState({userDragging:!1,disableAutoRotate:!1})};r.current.addEventListener("controlstart",()=>{r.current.removeEventListener("rest",E),Cr.setState({userDragging:!0,disableAutoRotate:!0})}),r.current.addEventListener("controlend",()=>{r.current.active?r.current.addEventListener("rest",E):E()}),r.current.addEventListener("transitionstart",()=>{Cr.getState().userDragging!==!0&&(Cr.setState({disableAutoRotate:!0}),r.current.addEventListener("rest",E))})},[r]),ne(fi,{children:ne($Le,{ref:r,makeDefault:!0,dollySpeed:i.dollySpeed,truckSpeed:i.truckSpeed,minZoom:i.minZoom,maxZoom:i.maxZoom,minPolarAngle:t?-Math.PI:XL(i.minPolarAngle),maxPolarAngle:t?Math.PI:XL(i.maxPolarAngle)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/CameraManager.js",lineNumber:219,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/CameraManager.js",lineNumber:218,columnNumber:5},globalThis)},Kke=()=>{const r=fs(e=>e.gl);return oe.useEffect(()=>{Je.setState({glContext:r})},[]),ne(fi,{children:[ne(Xke,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:16,columnNumber:7},globalThis),ne($ke,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:17,columnNumber:7},globalThis),ne(jUe,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:18,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:15,columnNumber:5},globalThis)},Zke=({handleCloseAlert:r,alertData:e})=>{const t=oe.useRef(null),n=oe.useRef(null),i=oe.useRef(null),a=()=>{clearTimeout(t.current),i.current.style="",n.current.style="",r()};return oe.useEffect(()=>{if(i.current===null||n.current===null)return;const s=e.alertTime?e.alertTime:1e3;i.current.style="animation: loader "+s+"ms; animation-timing-function: linear;",n.current.style="animation: loader "+s+"ms; animation-timing-function: linear;",t.current=setTimeout(a,s)},[i,n,e]),ne(fi,{children:[ne("div",{className:"alert-bg ".concat(kl[e.alertType].cssClass),children:[ne("div",{className:"alert-icon-bg ".concat(kl[e.alertType].cssClass),children:ne("img",{src:kl[e.alertType].src,className:"alert-icon"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:50,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:45,columnNumber:9},globalThis),ne("div",{className:"alert-msg-cross-timer-bg",children:[ne("div",{className:"alert-msg-cross-bg",children:[ne("div",{className:"alert-msg-bg",style:e.alertLabel?{}:{display:"flex",alignItems:"center"},children:[e.alertLabel&&ne("p",{className:"alert-label",children:e.alertLabel},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:66,columnNumber:17},globalThis),ne("span",{className:"alert-msg",children:e.alertMsg},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:68,columnNumber:15},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:57,columnNumber:13},globalThis),ne("div",{className:"alert-close-btn-bg",children:ne("img",{onClick:a,className:"alert-cross-btn",src:Om+"/Icon/X.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:71,columnNumber:15},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:70,columnNumber:13},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:56,columnNumber:11},globalThis),ne("div",{ref:n,className:"alert-timer ".concat(kl[e.alertType].cssClass)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:78,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:55,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:40,columnNumber:7},globalThis),ne("div",{className:"alert-bg alert-mobile ".concat(kl[e.alertType].cssClass),children:[ne("div",{className:"alert-icon-msg-cross-bg",children:[ne("div",{className:"alert-icon-bg ".concat(kl[e.alertType].cssClass),children:ne("img",{src:kl[e.alertType].src,className:"alert-icon"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:99,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:94,columnNumber:11},globalThis),ne("div",{className:"alert-msg-bg",children:[e.alertLabel&&ne("p",{className:"alert-label",children:e.alertLabel},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:106,columnNumber:15},globalThis),ne("span",{className:"alert-msg",children:e.alertMsg_Mobile?e.alertMsg_Mobile:e.alertMsg},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:108,columnNumber:13},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:104,columnNumber:11},globalThis),ne("div",{className:"alert-close-btn-bg",children:ne("img",{onClick:a,className:"alert-cross-btn",src:Om+"/Icon/X.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:115,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:114,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:93,columnNumber:9},globalThis),ne("div",{ref:i,className:"alert-timer ".concat(kl[e.alertType].cssClass)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:122,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:88,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:38,columnNumber:5},globalThis)},Jke=()=>{const[r,e]=oe.useState(null),t=Je(o=>o.alertData),n=Je(o=>o.persistantAlertData);oe.useEffect(()=>{!t||!t.alertMsg||i(t)},[t]),oe.useEffect(()=>{const o=Je.getState().alertQueue;o.length<=0||(r===null&&(e(o[0]),o[0].persistant===!0&&Je.setState({persistantAlertData:o[0]})),Je.getState().actions.popFromAlertQueue())},[r]);const i=oe.useCallback(o=>{if(Je.getState().sceneSettings.disableAlerts===!0)return;let l=o.alertType,u=!1;if(Object.keys(kl).map(h=>{h==l.toLowerCase()&&(u=!0)}),u==!1&&(l=kl.info.id,o.alertType=l),kl[o.alertType].level<Je.getState().sceneSettings.alertLevel||Je.getState().sceneSettings.alertControl[o.alertId]!==!0)return;const f=Je.getState().actions.addToAlertQueue(o);r===null&&f.length===1&&(e(o),o.persistant===!0&&Je.setState({persistantAlertData:o}))},[r]),a=oe.useCallback(()=>{e(n)},[n]),s=oe.useCallback(async()=>{e(null)},[]);return oe.useEffect(()=>{async function o(){await gc(1500);let l=null,u={alertMsg:"Add items by selecting from the panel",alertMsg_Mobile:"Add items by selecting from the panel",alertTime:8e3,alertType:"info",alertLabel:"Get Started"};Je.getState().alertSettings&&(Je.getState().alertSettings.welcomeMessage&&(l=Je.getState().alertSettings.welcomeMessage),Je.getState().alertSettings.instructionMessage&&(u=Je.getState().alertSettings.instructionMessage)),l!==null&&i(l),i(u)}o()},[]),ne("div",{className:"alert-space",children:[r===null&&n&&ne("div",{onClick:a,className:"alert-persistant-btn-bg",style:{background:kl[n.alertType].background,border:"1px solid "+kl[n.alertType].color},children:ne("img",{style:{filter:kl[n.alertType].filter},className:"alert-persistant-btn",src:kl[n.alertType].src},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:144,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:135,columnNumber:9},globalThis),r&&ne(Zke,{handleCloseAlert:s,alertData:r},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:154,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:133,columnNumber:5},globalThis)},eFe=()=>{const r=Je(n=>n.canvasTooltipText),e=Je(n=>n.sceneSettings),t=gr(n=>n.ghostData);return ne(fi,{children:ne("div",{children:[ne(Jke,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:16,columnNumber:9},globalThis),nt.getSceneItemCount()<=0&&!t&&ne("div",{className:"emptySceneBG",children:e.emptySceneText},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:19,columnNumber:11},globalThis),ne("div",{className:"canvasTooltip",children:r},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:22,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:15,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:14,columnNumber:5},globalThis)};function tFe(r){let e={};if(r.type.toLowerCase()==="object3d"){const t=r.userData;if(t?.isPlug===1){const n=t.name;n&&typeof n=="string"&&(e.name=n);const i=t.type;i&&typeof i=="string"?e.type=i:e.type="";const a=t.weight;a&&typeof a=="number"?e.weight=a:e.weight=1;const s=t.affectedNodes;s&&typeof s=="string"?e.affectedNodes=s.replaceAll(" ","").split(","):e.affectedNodes=[];const o=t.acceptedPlugTypes;o&&typeof o=="string"?e.acceptedPlugTypes=o.replaceAll(" ","").split(","):e.acceptedPlugTypes=[];const l=t.connectsToPlugTypes;l&&typeof l=="string"?e.connectsToPlugTypes=l.replaceAll(" ","").split(","):e.connectsToPlugTypes=[];const u=t.dependencySku;u&&typeof u=="string"?e.dependencySku=u:e.dependencySku="";const f=t.isDependencySkuInteractive;u!==void 0&&typeof f=="number"?e.isDependencySkuInteractive=f:e.isDependencySkuInteractive=1}}return e}async function nFe(r){const e=Mo.getState().actions;for(let t=0;t<Object.keys(r).length;t++){const n=Object.keys(r)[t];Gt.info({title:"loading proxy: "+n});const i=performance.now(),a=await e.loadAsset(n,!0),s=performance.now();if(Gt.info({title:`${n} proxy: ${((s-i)/1e3).toFixed(2)} seconds to load.`}),Gt.info({title:"loaded proxy: "+n}),Gt.info({title:"waitingForAsset",details:a}),!a||!a.proxy.data)continue;const o=r[n]?.plugs,l=o===void 0||Array.isArray(o)&&o.length===0;l===!0&&Gt.info({title:`Collecting plugs information for ${n} from the proxy mesh`});let u=[];a.proxy.data.scene.traverse(p=>{if(l===!0){const m=tFe(p);Object.keys(m).length>0&&u.push(m)}if(p.isMesh){p.material.color=new Yt(0/255,0/255,0/255);const m=Je.getState().sceneSettings.ghostColor;p.material.emissive=new Yt(m.r/255,m.g/255,m.b/255),p.material.emissiveIntensity=.75,p.material.alphaTest=m.a,p.material.transparent=!0,p.material.opacity=m.a,p.material.depthTest=!1,p.material.reflectivity=0,p.material.metalness=0,p.material.wireframe=Je.getState().sceneSettings.ghostAsWireframe}}),u.length>0&&(r[n].plugs=u);const{boundingBox:f,boundingSphere:h}=rFe(a);if(f&&h){const p=iFe(f);r[n].boundingBox=f,r[n].boundingSphereCenter=h.center,r[n].boundingBoxSize=p}else r[n].boundingSphereCenter={x:0,y:0,z:0},r[n].boundingBoxSize={x:0,y:0,z:0}}}function iFe(r){return{x:r.max.x-r.min.x,y:r.max.y-r.min.y,z:r.max.z-r.min.z}}function rFe(r){const e=r.proxy.data.scene;if(e){let t=null;return e.traverse(n=>{if(n.isMesh){t=n;return}}),t?(t.geometry.boundingBox||t.geometry.computeBoundingBox(),{boundingBox:t.geometry.boundingBox,boundingSphere:t.geometry.boundingSphere}):!1}}const aFe=`.alert-space{position:absolute;width:auto;height:auto;max-width:40%;top:0;margin:1rem}.alert-bg{display:flex;flex-direction:row;border-radius:5.04px}.alert-mobile{display:none}.alert-persistant-btn{width:2rem;height:2rem;margin:4px;filter:invert(100%) brightness(200%)}.alert-persistant-btn-bg{cursor:pointer;display:flex;justify-content:center;align-items:center;border-radius:4px}.alert-persistant-btn-bg:hover{opacity:.9!important}.alert-icon{width:2rem;height:2rem;margin:14px;filter:invert(100%) brightness(200%)}.alert-icon-bg{border-radius:5.04px 0 0 5.04px}.alert-msg-bg{padding:1rem}.alert-label{font-weight:600;font-size:1.125rem;margin:0 0 4px;text-transform:capitalize}.alert-msg{font-size:1rem}.alert-cross-btn{width:1.5rem;cursor:pointer;margin:.5rem}.alert-msg-cross-timer-bg{display:flex;flex-direction:column;justify-content:space-between}.alert-msg-cross-bg{display:flex;flex-direction:row}.alert-timer{width:0%;height:2px;transition:10ms}.alert-bg.alert-info,.alert-bg.alert-mobile.alert-info{background-color:var(--info-light);border:1.26px solid var(--info-dark)}.alert-icon-bg.alert-info{background-color:var(--info-dark);border:1.26px solid var(--info-dark)}.alert-timer.alert-info{background-color:var(--info-dark)}.alert-bg.alert-warn,.alert-bg.alert-mobile.alert-warn{background-color:var(--warn-light);border:1.26px solid var(--warn-dark)}.alert-icon-bg.alert-warn{background-color:var(--warn-dark);border:1.26px solid var(--warn-dark)}.alert-timer.alert-warn{background-color:var(--warn-dark)}.alert-bg.alert-error,.alert-bg.alert-mobile.alert-error{background-color:var(--error-light);border:1.26px solid var(--error-dark)}.alert-icon-bg.alert-error{background-color:var(--error-dark);border:1.26px solid var(--error-dark)}.alert-timer.alert-error{background-color:var(--error-dark)}.alert-bg.alert-success,.alert-bg.alert-mobile.alert-success{background-color:var(--success-light);border:1.26px solid var(--success-dark)}.alert-icon-bg.alert-success{background-color:var(--success-dark);border:1.26px solid var(--success-dark)}.alert-timer.alert-success{background-color:var(--success-dark)}@keyframes loader{0%{width:0%}to{width:100%}}@media only screen and (orientation: portrait){.alert-label{margin:auto}.alert-close-btn-bg{display:flex;justify-content:center}.alert-icon-msg-cross-bg{display:flex;flex-direction:row;width:100%;align-items:center}.alert-space{width:100%;max-width:100%;margin:auto}.alert-bg{display:none;flex-direction:column}.alert-mobile{display:flex;justify-content:center;align-items:flex-start}.alert-icon{margin:4px}.alert-icon-bg{display:flex;justify-content:center;align-items:center;border-radius:5.04px;margin:8px 16px;height:fit-content}.alert-msg-bg{padding:1rem 0rem;width:calc(100% - 70px)}.alert-persistant-btn{margin:4px!important}.alert-persistant-btn-bg{display:flex;justify-content:center;width:calc(8px + 2rem)!important;align-items:center;border-radius:5.04px;margin:8px 16px}}
|
|
9196
|
+
`),W.fragmentShader=W.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const K=new _c(GLe),J=new _c(HLe);return J.depthTest=K.depthTest=!1,[U,j,H,Q,K,J,z]},[o,n,i,r,u]),I=U=>{w.visible=!0,w.material=R,R.uniforms.tDiffuse.value=x.texture,R.uniforms.h.value=U*1/256,b.setRenderTarget(L),b.render(w,v.current),w.material=N,N.uniforms.tDiffuse.value=L.texture,N.uniforms.v.value=U*1/256,b.setRenderTarget(x),b.render(w,v.current),w.visible=!1};let D=0,k,F;return Zm(()=>{v.current&&(e===1/0||D<e)&&(D++,k=E.background,F=E.overrideMaterial,y.current.visible=!1,E.background=null,E.overrideMaterial=_,b.setRenderTarget(x),b.render(E,v.current),I(a),l&&I(a*.4),b.setRenderTarget(null),y.current.visible=!0,E.overrideMaterial=F,E.background=k)}),oe.useImperativeHandle(m,()=>y.current,[]),oe.createElement("group",zd({"rotation-x":Math.PI/2},p,{ref:y}),oe.createElement("mesh",{renderOrder:h,geometry:S,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},oe.createElement("meshBasicMaterial",{transparent:!0,map:x.texture,"map-encoding":b.outputEncoding,opacity:t,depthWrite:f})),oe.createElement("orthographicCamera",{ref:v,args:[-n/2,n/2,i/2,-i/2,0,s]}))}),oUe={}.VITE_APP_ENV,lUe=!1;let cUe=!1,MT;const Gt=new MJ("CORE");oUe==="staging"?(Gt.setCurrentMode(YR.Staging),MT="https://storage.googleapis.com/epigraph-configurator"):(Gt.setCurrentMode(YR.Release),MT="https://storage.googleapis.com/epigraph-configurator");Gt.info({title:"test"});const P$=99999,uUe=99999;let nt=null;function hUe(r){nt=r,nt.disableAnalyticsEvents=cUe}const Aie=`${MT}/projects-asset-data`,fUe=`${Aie}/generic`;let dUe="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?moduleID=",BH="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe/saveConfig",kH="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?configID=",Om="https://storage.googleapis.com/gsc-epigraph-design/product-assets";function pUe(r){const e=r.SAVE_CONFIG_ENDPOINT;BH=e||BH;const t=r.FETCH_CONFIG_ENDPOINT;kH=t||kH;const n=r.PUBLIC_DESIGN_ASSETS_ENDPOINT;Om=n||Om;const i=r.ASSETS_SOURCE_ROOT;MT=i||MT}const kl=Object.freeze({info:{id:"info",level:1e3,src:Om+"/Icon/Info.svg",color:"#2E6CDF",cssClass:"alert-info",background:"#D3E0F8",filter:"invert(39%) sepia(41%) saturate(5002%) hue-rotate(208deg) brightness(91%) contrast(92%)"},warn:{id:"warn",level:3e3,src:Om+"/Icon/Warning.svg",color:"#E2B236",cssClass:"alert-warn",background:"#F9EED2",filter:"invert(83%) sepia(67%) saturate(1578%) hue-rotate(328deg) brightness(93%) contrast(90%)"},error:{id:"error",level:4e3,src:Om+"/Icon/Block.svg",color:"#D0342C",cssClass:"alert-error",background:"#F6D7D5",filter:"invert(24%) sepia(96%) saturate(1914%) hue-rotate(349deg) brightness(95%) contrast(81%)"},success:{id:"success",level:2e3,src:Om+"/Icon/CheckCircle.svg",color:"#65BC6C",cssClass:"alert-success",background:"#DBF0DD",filter:"invert(74%) sepia(3%) saturate(5600%) hue-rotate(75deg) brightness(90%) contrast(90%)"}}),Js=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),eo={GRAB:"grab",POINTER:"pointer",BLOCKED:"blocked",GRABBING:"grabbing",MOVE:"move"},mUe=r=>{const e=[],t=new Set;for(const n of r){let i=n,a=0;for(;t.has(i);)i=n+"."+ ++a;t.add(i),e.push(i)}return e},gUe=(r,e)=>{const t={};for(const n of r.mappings)for(const i of n.variants)t[e[i]]={material:null,gltfMaterialIndex:n.material};return t},TP=r=>r.material!==void 0&&r.userData&&r.userData.variantMaterials,bie=(r,e,t)=>{t(r,e);for(let n=0;n<r.children.length;n++)bie(r.children[n],e.children[n],t)},L$=(r,e)=>{e.userData.variantMaterials!==void 0&&(r.userData.variantMaterials=Object.assign({},e.userData.variantMaterials)),e.userData.originalMaterial!==void 0&&(r.userData.originalMaterial=e.userData.originalMaterial)};class vUe{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,n=t.json;if(!n.extensions||!n.extensions[this.name])return null;const a=n.extensions[this.name].variants||[],s=mUe(a.map(u=>u.name));for(const u of e.scenes)u.traverse(f=>{const h=t.associations.get(f);if(!h||h.meshes===void 0||h.primitives===void 0)return;const y=n.meshes[h.meshes].primitives[h.primitives].extensions;!y||!y[this.name]||(f.userData.variantMaterials=gUe(y[this.name],s))});e.userData.variants=s,e.functions=e.functions||{};const o=async(u,f,h)=>{u.userData.originalMaterial||(u.userData.originalMaterial=u.material);const p=u.material;let m=null;if(f===null||!u.userData.variantMaterials[f])u.material=u.userData.originalMaterial,t.associations.has(u.material)&&(m=t.associations.get(u.material).index);else{const y=u.userData.variantMaterials[f];y.material?(u.material=y.material,y.gltfMaterialIndex!==void 0&&(m=y.gltfMaterialIndex)):(m=y.gltfMaterialIndex,u.material=await t.getDependency("material",m),t.assignFinalMaterial(u),y.material=u.material)}h!==null&&h(u,p,m)},l=u=>{const f=u.material,h=u.userData.variantMaterials,p=[];for(const m in h){const y=h[m];if(y.material)continue;const E=y.gltfMaterialIndex;p.push(t.getDependency("material",E).then(b=>{u.material=b,t.assignFinalMaterial(u),h[m].material=u.material}))}return Promise.all(p).then(()=>{u.material=f})};e.functions.selectVariant=(u,f,h=!0,p=null)=>{const m=[];return h?u.traverse(y=>TP(y)&&m.push(o(y,f,p))):TP(u)&&m.push(o(u,f,p)),Promise.all(m)},e.functions.ensureLoadVariants=(u,f=!0)=>{const h=[];return f?u.traverse(p=>TP(p)&&h.push(l(p))):TP(u)&&h.push(l(u)),Promise.all(h)},e.functions.copyVariantMaterials=(u,f,h=!0)=>{h?bie(u,f,(p,m)=>L$(p,m)):L$(u,f)}}}var r8=new jLe;r8.setDecoderPath(`${MT}/external-libs/draco/`);r8.setDecoderConfig({type:"js"});const Mo=Do((r,e)=>({assets:{items:{}},actions:{async loadAsset(t,n=!1){const{assets:i}=e();let a,s;if(i.items[t]){const h=n?i.items[t].proxy:i.items[t];if(h.isLoaded)return i.items[t];if(h.errorLoading)throw Error((n?"Proxy ":"Model ")+"Loading failed for: "+t,t)}else i.items[t]={isLoaded:!1,errorLoading:!1,proxy:{isLoaded:!1,errorLoading:!1}};const o=Ln.getState().productData[t];if(!o)throw Error("Data doesn't exists for "+t,t);if(n?(a=i.items[t].proxy,s=nt.getResolvedAssetUrl(o.colliderProxyGLTF)):(a=i.items[t],s=nt.getResolvedAssetUrl(o.gltfURL)),!a||!s)return null;const l=new lLe;l.register(h=>new vUe(h)),l.setDRACOLoader(r8);async function u(h){const p=h.loaded/h.total*100;a.progress=p}const f=await l.loadAsync(s,u).catch(h=>{throw a.isLoaded=!1,a.errorLoading=!0,a.error=h,Gt.info(s),Error("Couldn't load "+t,t)});return a.data=f,a.isLoaded=!0,i.items[t]},IsAssetLoaded(t){const{assets:n}=e();return n.items.hasOwnProperty(t)?n.items[t].isLoaded:!1},IsProxyLoaded(t){const{assets:n}=e();return n.items.hasOwnProperty(t)&&n.items[t].hasOwnProperty(proxy)?n.items[t].proxy.isLoaded:!1}}}));var jv=null,Qv=[];const gr=Do((r,e)=>({ghostData:null,ghostsTransform:[],ghostVisibility:!0,ghostParentRef:null,ghostMaterial:null,actions:{spawnGhostsForSkuID:async(t,n=!1,i)=>{const{ghostData:a,ghostsTransform:s}=e();if(a!==null||s.length>0){Gt.info("ghosts are already spawned for: "+a.skuID);return}return await new Promise(async(l,u)=>{let f={};const h=()=>{l(f)};nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Ghost_Loaded,h,{once:!0});const p=Ln.getState().productData,m=ln.getState().attachmentSystem.currentStructure;if(jv=m.getFirstNodeByCategoryID(p[t].categoryID),p[t].replace&&jv){if(t==jv.skuID)return;const{transforms:E,connectablePlugs:b}=m.findGhostTransformForReplacement(t,jv);if(E==null&&b==null){Gt.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+t});return}f.transforms=E,f.newNodes=[jv],f.connectablePlugs=b,f.addItemOrSwap=["replace"],jv.setModelVisibility(!1)}else{const{transforms:E,newNodes:b,connectablePlugs:v}=m.findGhostTransforms(t,n);let x=E,S=v,_=b,w=[];for(let R=0;R<E.length;R++)w.push("add");if(p[t].swappable&&!Je.getState().dragging){Qv=m.getNodesByCategoryID(p[t].categoryID);for(let R=0;R<Qv.length;R++){const N=m.findGhostTransformForReplacement(t,Qv[R]);N.transforms&&(x.push(N.transforms[0]),S.push(N.connectablePlugs[0]),_.push(Qv[R]),w.push("replace"),Qv[R].setModelVisibility(!1))}}f.transforms=x,f.newNodes=_,f.connectablePlugs=S,f.addItemOrSwap=w}if(f.transforms.length<=0)return;const y=await Mo.getState().actions.loadAsset(t,!0);r({ghostsTransform:f.transforms,ghostData:{proxyScene:y.proxy.data.scene,skuID:t,newNodes:f.newNodes,addItemOrSwap:f.addItemOrSwap,connectablePlugs:f.connectablePlugs,count:i||f.transforms.length}})})},clearAllGhosts:()=>{if(jv&&jv.setModelVisibility(!0),Qv)for(let t=0;t<Qv.length;t++)Qv[t].setModelVisibility(!0);r({ghostVisibility:!0,ghostData:null,ghostsTransform:[]})}}})),Cr=Do((r,e)=>({manualControl:!1,sourcePos:null,destPos:new ve(0,0,0),interpolationFactor:0,duration:0,focusPointPosition:new ve(0,0,0),canCameraRotate:!0,sendCameraDetailsTrigger:!1,viewPointPosition:new ve(0,0,0),boundsMargin:0,userDragging:!1,disableAutoRotate:!1,cameraSettings:{truckSpeed:1,fov:35,dollySpeed:1,initialViewPointPosition:new ve(20,15,50),canZoom:!1,canPan:!1,minZoom:1,maxZoom:3,canAutoRotate:!1,autoRotateSpeed:.5,minPolarAngle:0,maxPolarAngle:180,clearColour:"white",zoomingMultiplier:0},actions:{triggerFetchingCamera:()=>{r(t=>({sendCameraDetailsTrigger:!t.sendCameraDetailsTrigger}))},setCameraSettings:t=>{const{cameraSettings:n}=e();Je.getState().isMobile===!0&&t.zoomingMultiplier_mobile!==void 0?t.zoomingMultiplier=t.zoomingMultiplier_mobile:t.zoomingMultiplier_desktop!==void 0&&(t.zoomingMultiplier=t.zoomingMultiplier_desktop),Object.keys(t).map(a=>n[a]=t[a]),r({cameraSettings:{...n},viewPointPosition:FH(n.initialViewPointPosition)})}}})),hi=Do((r,e)=>({activeHotspotData:null,lastActiveHotspotData:null,isAnyHotspotActive:!1,hotspotsVisibility:!1,hotspotsTempVisibility:!0,hotspotsHealthCheck:!0,hotspotsSpawned:{},visitedHotspotsID:[],hotspotSpawnedForCategoryIDs:[],actions:{clearAllHotspots:()=>r({isAnyHotspotActive:!1,activeHotspotData:null,lastActiveHotspotData:null,hotspotsSpawned:{}}),removeHotspotForItem(t){const{hotspotsSpawned:n}=e();Object.keys(n).map(i=>{n[i].itemData.guid==t.itemData.guid&&delete n[i]}),r({hotspotsSpawned:{...n}})},checkHotspotHealth(){const{hotspotsHealthCheck:t}=e();r({hotspotsHealthCheck:!t})},toggleHotspotVisibility(){const{hotspotsVisibility:t}=e();r({hotspotsVisibility:!t})},switchHotspotsVisibility(t,n=!1){r(n===!0?{hotspotsTempVisibility:t}:{hotspotsVisibility:t})},clickHotspot(t,n,i,a=!1){const{activeHotspotData:s}=e();r({lastActiveHotspotData:s}),AUe(t,n,i);let l=Wt.getState().itemsSpawned[i].itemData.skuID;a===!1&&(nt.fireEvent(nt.EVENTS.SCENE.Hotspot_Enter,{hotspotAbsID:EUe(l,t)}),nt.fireEvent(nt.EVENTS.UI.UtilityMenu_Hide))},exitHotspot(t=!1){const{activeHotspotData:n}=e();n&&(r({lastActiveHotspotData:n}),yUe(),t===!1&&(nt.fireEvent(nt.EVENTS.SCENE.Hotspot_Exit,n),nt.fireEvent(nt.EVENTS.UI.UtilityMenu_Show)))}}}));function yUe(){hi.setState({activeHotspotData:null}),hi.setState({isAnyHotspotActive:!1}),Je.getState().actions.triggerAutoFocus()}function AUe(r,e,t){let n=hi.getState();const a=Wt.getState().itemsSpawned;let s=n.visitedHotspotsID;const o=a[t].hotspotsData.filter(w=>w.hotspotID==r);if(!o||o.length<=0)return;const l=o[0],u=a[t].itemData.skuID+"_"+r;let h=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(t),p=new ve(0,0,0);h&&h.ref&&h.ref.getWorldPosition(p);let m=new $i().identity();h&&h.ref&&h.ref.getWorldQuaternion(m);let y=l.focusPointTransform;Gt.info(y);let E=FH(y);E.applyQuaternion(m);let b=l.viewPointTransform,v=FH(b);v.applyQuaternion(m);let x=B$(Vx(E),Vx(p)),S=B$(Vx(v),Vx(p));Cr.setState({sourcePos:null,manualControl:!1,focusPointPosition:x,destPos:S,viewPointPosition:S,duration:1e3}),hi.setState({activeHotspotData:{hotspotData:{guid:e,...l},itemData:{...a[t],guid:t},domID:"rd_"+u},isAnyHotspotActive:!0}),s.includes(u)||(s.push(u),hi.setState({visitedIDs:{...s}}))}const Wt=Do((r,e)=>({variantChangeAlert:!1,removeItems:[],removeItemTrigger:!1,itemsSpawned:{},itemsCount:0,modelLoadedAlert:0,lastDeletedItemData:null,lastDeletedItemsData:[],hoveredItemRef:{},collidersRef:[],filteredCollidersRef:[],selectedItemData:null,busy:!1,actions:{triggerModelLoaded:()=>r(t=>({modelLoadedAlert:t.modelLoadedAlert+1})),triggerRemoveItem:()=>r(t=>({removeItemTrigger:!t.removeItemTrigger})),addToRemoveItems:t=>{const{removeItems:n}=e();n.push(t)},switchToVariant:async(t,n,i=!1)=>{const{itemsSpawned:a,variantChangeAlert:s}=e(),o=Ln.getState().categoryData,l=a[t.guid].itemData.clonedScene;var f=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(t.guid);Mo.getState().assets.items[t.skuID].data||o.geometryVariants&&o.geometryVariants.map(m=>{m.productsInCategory.map(y=>{let E=!1;y.products.map(b=>{b==t.skuID&&(E=!0)}),E&&y.products.map(b=>{const v=Mo.getState().assets.items[b].data;v&&(Mo.getState().assets.items[t.skuID].data=v)})})});const p=Mo.getState().assets.items[t.skuID].data;p&&(await p.functions.selectVariant(l,n),i?(f.overrideVariant=n,nt.fireEvent(nt.EVENTS.SCENE.MaterialOverrides_Exists,!0)):f.currentVariant=n,r({variantChangeAlert:!s}))},clearAllItems:()=>{r({itemsSpawned:{},itemsCount:0,lastDeletedItemsData:[],hoveredItemRef:[],collidersRef:[],filteredCollidersRef:[],selectedItemData:null})},setItemsSpawned:t=>{r({itemsSpawned:t,itemsCount:Object.keys(t).length})},setHoveredItemRef:t=>r({hoveredItemRef:t}),setCollidersRef:t=>{r({collidersRef:t});let n=[];for(var i=0;i<t.length;i++)t[i].current&&n.push(t[i]);Wt.setState({filteredCollidersRef:[...n]})},setSelectedItemData:t=>{const{selectedItemData:n,hoveredItemRef:i,actions:a}=e();n&&(delete i[n.itemData.guid],a.setHoveredItemRef({...i})),r({selectedItemData:{...t}}),Je.getState().actions.triggerAutoFocus(),hi.getState().actions.switchHotspotsVisibility(!1,!0),Cr.setState({canCameraRotate:!1})},deselectItem:()=>{const{selectedItemData:t}=e();t&&nt.fireEvent(nt.EVENTS.UI.ContextMenu_Hide,t),r(()=>({selectedItemData:null})),Je.getState().actions.triggerAutoFocus(),hi.getState().actions.switchHotspotsVisibility(!0,!0),Cr.setState({canCameraRotate:!0}),Wt.getState().actions.setHoveredItemRef({})},removeItemByGUID:async t=>{const{itemsSpawned:n,actions:i}=e();if(n.hasOwnProperty(t))return new Promise(async(a,s)=>{i.addToRemoveItems(t),i.triggerRemoveItem();const o=l=>{t===l.data.itemData.guid&&a(t)};nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Item_Removed,o,{once:!0})})},addItemBySkuID:async(t,n=0,i=!1,a)=>{r({busy:!0});const{actions:s,itemsSpawned:o}=e(),l=Ln.getState().productData,u=Ln.getState().hotspotsData,f=ln.getState().attachmentSystem;let h=!0;const p=await new Promise(async(E,b)=>{if(s.deselectItem(),!l[t]){Gt.warn({title:`Product not found: ${t}`}),nt.alert({alertMsg:t+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),h=!1,b(t+": product not found!");return}const v=[...gr.getState().ghostsTransform],x={...gr.getState().ghostData};if(gr.getState().actions.clearAllGhosts(),v.length<=0){nt.alert({alertMsg:"Unable to add item to configuration",alertTime:6e3,alertType:"warn",alertLabel:"Action Unavailable"}),h=!1,b("No available connections for this product to attach to");return}const S=_=>{t===_.data&&E(x.newNodes[n].guid)};if(nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Model_Loaded,S,{once:!0}),x.addItemOrSwap[n]=="replace")await bUe(o,x.skuID,v[n],x.newNodes[n]);else{const _=x.newNodes[n];_.isDependent=i;let w=!0;if(l[x.skuID].hasOwnProperty("disableInteraction")){const I=l[x.skuID].disableInteraction;(I==!0||I==!1)&&(w=!I)}(a==!0||a==!1)&&(w=a),_.isInteractive=w;const{position:R,rotation:N}=v[n];_.transform={position:R,rotation:N},f.currentStructure.addNode(_),f.currentStructure.connectPlugs(x.connectablePlugs[n]);const L=await Mo.getState().actions.loadAsset(x.skuID,!0);Gt.info("GHOST NEW NODE: ",_),o[_.guid]={itemData:{proxyScene:L.proxy.data.scene,guid:x.newNodes[n].guid,...l[x.skuID],position:R,rotation:N,hasItemLoaded:!1,isDependent:i,isInteractive:w},hotspotsData:u[x.skuID],hotspotSpawned:!1},await gc(1),s.setItemsSpawned({...o})}}).catch(E=>{Gt.error({title:E}),h=!1});if(h===!1)return r({busy:!1}),p;const m=f.getCartItems();m&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,m);const y=l[t]?.plugs;if(y){for(const E of y){const b=E?.dependencySku;if(!b)continue;Gt.info(`Found a dependency: ${b} on the plug: ${E.name}`);let v=!0;l[b]&&l[b].hasOwnProperty("ignoreSpawningCollisionAsDependency")&&(v=l[b].ignoreSpawningCollisionAsDependency),E.hasOwnProperty("ignoreSpawningCollision")&&(v=E.ignoreSpawningCollision);let x=Je.getState().sceneSettings.ignoreSpawningCollision;l[b].hasOwnProperty("ignoreSpawningCollision")&&(x=l[b].ignoreSpawningCollision),l[b].ignoreSpawningCollision=v;const S=await gr.getState().actions.spawnGhostsForSkuID(b,v);if(l[b].ignoreSpawningCollision=x,!S)continue;const _=f.currentStructure.getNodeByGUID(p),w=_.getPlugByName(E.name)?.guid,R=E?.isDependencySkuInteractive?E.isDependencySkuInteractive===1:!1,N=S.connectablePlugs;let L=!1;for(let I=0;I<S.connectablePlugs.length;I++){if(N[I].receiverPlug.guid!==w)continue;L=!0;const D=await s.addItemBySkuID(b,I,!0,R);D!==null&&_.addMyDependenciesGUID(D)}L||gr.getState().actions.clearAllGhosts()}gr.getState().actions.clearAllGhosts()}return r({busy:!1}),p},async addItemWithTransform(t,n,i,a=!0){return new Promise(async(s,o)=>{const{actions:l,itemsSpawned:u}=e();l.deselectItem();const f=Ln.getState().productData,h=Ln.getState().hotspotsData;if(!f[n]){nt.alert({alertMsg:n+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"});return}const{position:p,rotation:m}=t;u[i]!=null&&(hi.getState().actions.removeHotspotForItem({...u[i]}),delete u[i]);const y=b=>{n==b.data&&s(i)};nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Model_Loaded,y,{once:!0});const E=await Mo.getState().actions.loadAsset(n,!0);E!=null&&(await gc(1),u[i]={itemData:{proxyScene:E.proxy.data.scene,guid:i,...f[n],position:p,rotation:m,hasItemLoaded:!1,isInteractive:a},hotspotsData:h[n],hotspotSpawned:!1},r({itemsSpawned:{...u}}))})},async replaceGUIDItemBySKUID(t,n){const{itemsSpawned:i}=e(),a=Ln.getState().productData,s=Ln.getState().hotspotsData,o=ln.getState().attachmentSystem.currentStructure,l=o.getNodeByGUID(t);return l.isReplaceableWithSkuId(n)?(await new Promise(async(f,h)=>{hi.getState().actions.removeHotspotForItem({...i[t]}),delete i[t],l.update(n);const p=y=>{n===y.data&&f(!0)};nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Model_Loaded,p,{once:!0});const m=await Mo.getState().actions.loadAsset(n,!0);await gc(1),i[t]={itemData:{proxyScene:m.proxy.data.scene,guid:t,...a[n],position:l.transform.position,rotation:l.transform.rotation,hasItemLoaded:!1},hotspotsData:s[n],hotspotSpawned:!1},Wt.setState({itemsSpawned:{...i}})}),o.recalculateStructureFromNode(l.whichNodeAreWeAttachedTo()),ln.getState().actions.toggleStructureUpdated(),!0):!1}}}));async function bUe(r,e,t,n){const{position:i,rotation:a}=t,s=Ln.getState().productData,o=Ln.getState().hotspotsData,l=ln.getState().attachmentSystem.currentStructure;return new Promise(async(u,f)=>{const h=async()=>{const p=await Mo.getState().actions.loadAsset(e,!0);r[n.guid]={itemData:{proxyScene:p.proxy.data.scene,guid:n.guid,...s[e],position:i,rotation:a,hasItemLoaded:!1},hotspotsData:o[e],hotspotSpawned:!1},Gt.warn({title:"SWITCHING VARIANT: ",details:n.currentVariant}),n.currentVariant=n.currentVariant,n.transform=t,Wt.setState({itemsSpawned:{...r}}),l.recalculateStructureFromNode(n),ln.getState().actions.toggleStructureUpdated(),u(n.guid)};hi.getState().actions.removeHotspotForItem({...r[n.guid]}),delete r[n.guid],n.update(e),nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Model_Removed,h,{once:!0})})}const Gd=Do((r,e)=>({inventoryData:{},actions:{getInventoryInfo:()=>{const{inventoryData:t}=e();return t},updateInventoryForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(i=>{let a=t[i];Object.keys(a).map(s=>{n.updateInventoryForProduct(i,s,a[s].inventory)})}),n.refreshInventory(Wt.getState().itemsSpawned)},updateInventoryForProduct:(t,n,i)=>{const{inventoryData:a}=e();let s=a[t],o=s[n];!s||!o||(o.inventory=i)},_clearInScene:()=>{const{inventoryData:t}=e();Object.keys(t).map(n=>{const i=t[n];Object.keys(i).map(a=>{i[a].inScene=[]})})},refreshInventory:t=>{if(!t)return;Gt.info({title:"Refreshing Inventory"});const{actions:n,inventoryData:i}=e();n._clearInScene();const a=ln.getState().attachmentSystem;if(a===null)return;const s=a.currentStructure;if(s===null)return;Object.keys(t).map(f=>{const h=s.getNodeByGUID(f);if(!h)return;const p=h.overrideVariant?h.overrideVariant:h.currentVariant;if(!p)return;const m=i[h.skuID];if(!m||!m[p].inScene)return;m[p].inScene.push(f),Je.getState().sceneSettings.disableCart===!0?h.inStock={variantName:p,newValue:!0}:m[p].inScene.length>m[p].inventory?h.inStock={variantName:p,newValue:!1}:h.inStock={variantName:p,newValue:!0}});let o=!1;Object.keys(i).map(f=>{const h=i[f];Object.keys(h).map(p=>{h[p].countAvailable=h[p].inventory-h[p].inScene.length,h[p].countAvailable<0?(h[p].countUnavailable=h[p].countAvailable*-1,h[p].countAvailable=0,o=!0):h[p].countUnavailable=0})});const l={alertMsg:"Some items selected are out of stock",alertTime:3e3,alertType:"warn",alertLabel:"Stock Alert",alertId:"outOfStock"},u=SUe(Je.getState().persistantAlertData,l);o===!1&&u===!0&&nt.removePersistantAlert(),nt.fireEvent(nt.EVENTS.SCENE.Inventory_Updated,i)}}})),Je=Do((r,e)=>({hoveredGhostIndex:-1,itemDraggedSkuID:null,builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!0,configurationLoaded:!0,preconfigurationLoaded:!1,cursorParentRef:null,glContext:null,canvasTooltipText:"",canvasSize:{width:600,height:600},boundData:null,showDimensions:!1,autoFocusTrigger:0,cameraActive:!1,autoFocusRef:null,alertData:{},persistantAlertData:null,alertQueue:[],alertSettings:null,draggingOnDropCollisionData:null,multipleTouchDetected:!1,isMobile:!1,isTouchDevice:!1,isTablet:!1,isDesktop:!0,isLandscape:!1,sceneSettings:{swappableRoot:!0,preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,sceneScaleUnit:"ft",currency:"$",disableDragDrop:!1,ignoreSpawningCollision:!1,disableCollider:!1,disableContextMenu:!1,ghostColor:{r:250,g:50,b:0,a:.75},ghostAsWireframe:!1,draggableUI:!1,outOfStock_EmissiveColor:{r:250,g:50,b:0},outOfStock_EmissiveIntensity:.002,defaultConfigurationID:null,emptySceneText:"Empty Scene",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,textSettings:{cartQuantityText:"Qty",reviewButtonText:"Review",cartHeadingText:"Review Products",buildTabHeadingText:"Build",colorTabHeadingText:"Color",featuresTabHeadingText:"Features",tooltipEmptySceneText:"-Add items to the scene-",tooltipInstructionText:"-Drag to rotate the camera-"},variantsTabOrder:{color:{enabled:!0,priority:1},geometryVariants:{enabled:!0,priority:2}},boundingBoxLeeway:.9,contactShadowVisibility:!0,measurementPrecision:2,disableAlerts:!1,focusCameraOnGhosts:!0,alertLevel:0,alertControl:{itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0}},actions:{popFromAlertQueue:()=>{const{alertQueue:t}=e();return t.shift(),r({alertQueue:t}),t},addToAlertQueue:t=>{const{alertQueue:n}=e();return n.push(t),r({alertQueue:n}),n},getDeviceState:()=>{const{isDesktop:t,isMobile:n,isTablet:i,isTouchDevice:a,isLandscape:s}=e();return{isDesktop:t,isMobile:n,isTablet:i,isTouchDevice:a,isLandscape:s}},enableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!1,Gd.getState().actions.refreshInventory(Wt.getState().itemsSpawned),nt.fireEvent(nt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!0,Gd.getState().actions.refreshInventory(Wt.getState().itemsSpawned),nt.fireEvent(nt.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:t}=e();return t},sendAlert:t=>{r({alertData:{...t}})},switchCursor(t){const{cursorParentRef:n}=e();if(!n)return;let i="";switch(t){default:case eo.GRAB:i="grabCursor";break;case eo.GRABBING:i="grabbingCursor";break;case eo.BLOCKED:i="blockedCursor";break;case eo.POINTER:i="pointerCursor";break;case eo.MOVE:i="moveCursor";break}for(let a=0;a<n.classList.length;a++)n.classList[a].includes("Cursor")&&n.classList.remove(n.classList[a]);n.classList.add(i)},setAlertSettings:t=>{r({alertSettings:t})},async completeDropItem(){const t=ln.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:i,attachedChildrenGuids:a,collidingStatus:s,intersectingGhostObject:o,initPosition:l,initRotation:u,detachedPlugs:f,attachedNodesToCurrentNode:h}=n;nt.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[E,b]of a.entries())s[E]===!0&&await Wt.getState().actions.removeItemByGUID(b);const p=o.userData;let m=i.getPlugByName(p.incomingPlugName),y=t.currentStructure.getPlugByGUID(p.receiverPlugGUID);i.ref.position.set(o.position.x,o.position.y,o.position.z),i.ref.setRotationFromEuler(o.rotation),i.transform={position:o.position,rotation:o.quaternion},t.currentStructure.connectPlugs({incomingPlug:m,receiverPlug:y}),gr.getState().actions.clearAllGhosts(),Wt.getState().actions.deselectItem(),h.map(E=>{i.ref.parent.attach(E.ref)}),ln.getState().actions.updateFittingSkuIds()},revertDropItem(){const t=ln.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:i,attachedChildrenGuids:a,collidingStatus:s,intersectingGhostObject:o,initPosition:l,initRotation:u,detachedPlugs:f,attachedNodesToCurrentNode:h}=n;nt.alert({alertMsg:"Position of item"+i.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const p=f.neighbourDetachedPlugs;p&&(f.neighbourNode.detachNodeFromReceiver(),t.currentStructure.connectPlugs({incomingPlug:p.incomingPlug,receiverPlug:p.receiverPlug}));let m=f.rootDetachedPlugs.incomingPlug,y=f.rootDetachedPlugs.receiverPlug;i.ref.position.set(l.x,l.y,l.z),i.ref.setRotationFromEuler(u);let E=new $i().identity();i.ref.getWorldQuaternion(E),i.transform={position:l,rotation:E},t.currentStructure.connectPlugs({incomingPlug:m,receiverPlug:y}),gr.getState().actions.clearAllGhosts(),Wt.getState().actions.deselectItem(),h.map(b=>{i.ref.parent.attach(b.ref)}),ln.getState().actions.updateFittingSkuIds()},setCoreSettings:t=>{const{sceneSettings:n,isMobile:i,isTouchDevice:a,isLandscape:s,actions:o}=e(),l=i===!0?"mobile":"desktop",u=["showSave","showShare","showReset","showDimension","showHotspots","showViewInYourSpace","showContextMenu","draggableUI","textSettings","variantsTabOrder"];for(const f of u)if(f==="draggableUI"){const p=`${f}_${s===!1&&a===!0?"mobile":"desktop"}`;t[p]!==void 0&&(n[f]=t[p])}else if(f==="textSettings"||f==="variantsTabOrder"){if(t.hasOwnProperty(f)){let h=n[f];Object.keys(h).map(p=>{let m=t[f];m.hasOwnProperty(p)||(m[p]=h[p])})}}else{const h=`${f}_${l}`;if(t[h]!==void 0){let p=`${f}Btn`;f=="showContextMenu"&&(p=`${f}`),n[p]=t[h]}}t.disableCart===!0&&o.disableCart(),Object.keys(t).map(f=>n[f]=t[f]),r({sceneSettings:{...n,ghostThreeColor:{r:n.ghostColor.r/255,g:n.ghostColor.g/255,b:n.ghostColor.b/255,a:n.ghostColor.a/255}}})},triggerAutoFocus:(t=null)=>r(n=>({autoFocusRef:t,autoFocusTrigger:n.autoFocusTrigger+1})),requestNewScreenshot:async()=>new Promise((t,n)=>{Gt.info("Taking a screenshot");const{glContext:i}=e();if(i.preserveDrawingBuffer===!1)Gt.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),n({success:!1,imageData:null});else{Gt.info("Downloading the screenshot");const a=i.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");t({success:!0,imageData:a})}})}})),_Ue="rd",U$="_";function EUe(r,e){return`${_Ue}${U$}${r}${U$}${e}`}async function gc(r){return Gt.info({title:`Waiting for ${r}ms`}),new Promise((e,t)=>{setTimeout(()=>{e(!0)},r)})}function SUe(r,e){if(r===null||e===null)return!1;for(let t in r)if(r.hasOwnProperty(t)&&e.hasOwnProperty(t)&&r[t]!==e[t])return!1;return Object.keys(r).length===Object.keys(e).length}const xUe=r=>{const e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)};return fetch(BH,e)},TUe=function(){let r=!1;return function(e){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(r=!0)}(navigator.userAgent||navigator.vendor||window.opera),r};function wUe(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function CUe(){const r=navigator.userAgent.toLowerCase(),e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(r);return e||wUe()}function MUe(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function _ie(r){let e={data:null,report:"",success:!1};try{const n=await(await fetch(r)).text();e.data=JSON.parse(n),e.success=!0,e.report="Successfully fetched JSON data."}catch(t){e.report=t,nt.alert({alertMsg:"",alertTime:5e3,alertType:"warn",alertLabel:"Preload Failed"})}return e}const B$=(r,e)=>new ve(r[0]+e[0],r[1]+e[1],r[2]+e[2]),Vx=r=>[r.x,r.y,r.z],FH=r=>new ve(r[0],r[1],r[2]),RUe=(r,e=!0)=>{let t=[];const n=Je.getState().sceneSettings.outOfStock_EmissiveColor,i=Je.getState().sceneSettings.outOfStock_EmissiveIntensity;return r.traverse(a=>{a.isMesh&&(a.material.userData.cloned?a.material.userData.inStock!==e&&(e?(a.material.emissive.set(new Yt(255,255,255)),a.material.emissiveIntensity=0):(a.material.emissive.set(new Yt(n.r,n.g,n.b)),a.material.emissiveIntensity=i),a.material.userData.inStock=e):(a.material=a.material.clone(),a.material.userData.inStock=e,a.material.userData.cloned=!0,e?(a.material.emissive.set(new Yt(255,255,255)),a.material.emissiveIntensity=0):(a.material.emissive.set(new Yt(n.r,n.g,n.b)),a.material.emissiveIntensity=i)),t.push(a))}),t},k$=(r,e)=>{let t=0,n=[];for(let i=0;i<r.length;i++){const a=r[i];e(a)?r[t++]=a:n.push(r[i])}return r.length=t,n},XL=r=>r*Math.PI/180,IUe=r=>{if(!r)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(r))return r;let n=r;return n=n.replaceAll("<@all-projects@>",Aie),n=n.replaceAll("<@generic-project@>",fUe),n};function mG(r){var e=r.toString(16);return e.length==1?"0"+e:e}function F$(r,e,t){return"#"+mG(r)+mG(e)+mG(t)}var $L={},z$={get exports(){return $L},set exports(r){$L=r}},G$=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(G$){var H$=new Uint8Array(16);z$.exports=function(){return G$(H$),H$}}else{var V$=new Array(16);z$.exports=function(){for(var e=0,t;e<16;e++)e&3||(t=Math.random()*4294967296),V$[e]=t>>>((e&3)<<3)&255;return V$}}var Eie=[];for(var wP=0;wP<256;++wP)Eie[wP]=(wP+256).toString(16).substr(1);function NUe(r,e){var t=e||0,n=Eie;return[n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]]].join("")}var Sie=NUe,DUe=$L,OUe=Sie,j$,gG,vG=0,yG=0;function PUe(r,e,t){var n=e&&t||0,i=e||[];r=r||{};var a=r.node||j$,s=r.clockseq!==void 0?r.clockseq:gG;if(a==null||s==null){var o=DUe();a==null&&(a=j$=[o[0]|1,o[1],o[2],o[3],o[4],o[5]]),s==null&&(s=gG=(o[6]<<8|o[7])&16383)}var l=r.msecs!==void 0?r.msecs:new Date().getTime(),u=r.nsecs!==void 0?r.nsecs:yG+1,f=l-vG+(u-yG)/1e4;if(f<0&&r.clockseq===void 0&&(s=s+1&16383),(f<0||l>vG)&&r.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");vG=l,yG=u,gG=s,l+=122192928e5;var h=((l&268435455)*1e4+u)%4294967296;i[n++]=h>>>24&255,i[n++]=h>>>16&255,i[n++]=h>>>8&255,i[n++]=h&255;var p=l/4294967296*1e4&268435455;i[n++]=p>>>8&255,i[n++]=p&255,i[n++]=p>>>24&15|16,i[n++]=p>>>16&255,i[n++]=s>>>8|128,i[n++]=s&255;for(var m=0;m<6;++m)i[n+m]=a[m];return e||OUe(i)}var LUe=PUe,UUe=$L,BUe=Sie;function kUe(r,e,t){var n=e&&t||0;typeof r=="string"&&(e=r==="binary"?new Array(16):null,r=null),r=r||{};var i=r.random||(r.rng||UUe)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e)for(var a=0;a<16;++a)e[n+a]=i[a];return e||BUe(i)}var FUe=kUe,zUe=LUe,xie=FUe,a8=xie;a8.v1=zUe;a8.v4=xie;var Tie=a8;class zH{constructor(e,t,n=null){this._attachedPlug=null,this._name=e.name,this._acceptedPlugTypes=e.acceptedPlugTypes,this._type=e.type,this._affectedNodes=e.affectedNodes,this._weight=e.weight,this._connectsToPlugTypes=e.connectsToPlugTypes,this._node=t,this._guid=Tie.v4(),this._isOpen=!0,this._isReceiverPlug=!1,this._attachedPlugGUID=null,n&&(this._guid=n.guid,this._isOpen=n.isOpen,this._isReceiverPlug=n.isReceiverPlug,this._attachedPlugGUID=n.attachedPlugGUID)}export(){return this.isOpen?null:{guid:this._guid,isOpen:this._isOpen,attachedPlugGUID:this._attachedPlugGUID,isReceiverPlug:this._isReceiverPlug}}get node(){return this._node}get attachedPlug(){return this._attachedPlug}set attachedPlug(e){this._attachedPlug=e}get type(){return this._type}get weight(){return this._weight}get affectedNodes(){return this._affectedNodes}get guid(){return this._guid}get isReceiverPlug(){return this._isReceiverPlug}get name(){return this._name}get acceptedPlugTypes(){return this._acceptedPlugTypes}set acceptedPlugTypes(e){this._acceptedPlugTypes=e}get connectsToPlugTypes(){return this._connectsToPlugTypes}set connectsToPlugTypes(e){this._connectsToPlugTypes=e}get isOpen(){return this._isOpen}attachPlug(e,t=!1){if(this._attachedPlug=e,this._attachedPlugGUID=e.guid,this._isOpen=!1,this._isReceiverPlug=t,t&&e.type!==""&&e.type==this._type)switch(e.type){default:case"weighted_hider":this._weight>e.weight?e.node.hideNodes(e.affectedNodes)||nt.coreWCRef.addEventListener(e.node.guid+":refLoaded",function(){e.node.hideNodes(e.affectedNodes)},{once:!0}):this._weight<e.weight&&(this._node.hideNodes(this._affectedNodes)||nt.coreWCRef.addEventListener(this._node.guid+":refLoaded",function(){this._node.hideNodes(this._affectedNodes)},{once:!0}));break}t&&(this._node.isEndNode=!1)}openPlug(){if(this._isReceiverPlug&&this._attachedPlug.type!==""&&this._attachedPlug.type==this._type)switch(this._attachedPlug.type){default:case"weighted_hider":this._weight>this._attachedPlug.weight?this._attachedPlug.node.showNodes(this._attachedPlug.affectedNodes):this._weight<this._attachedPlug.weight&&this._node.showNodes(this._affectedNodes);break}this._attachedPlug=null,this._attachedPlugGUID=null,this._isOpen=!0,this._isReceiverPlug&&(this._isReceiverPlug=!1,this._node.checkIfEndNode())}canAttachToPlug(e){for(let t=0;t<this._connectsToPlugTypes.length;t++)if(e._acceptedPlugTypes.includes(this._connectsToPlugTypes[t]))return!0;return!1}}let vR=class{#e="default";#i=!1;#n=!1;#r=!0;#a={};#s=!1;#l={};#o=[];constructor(e,t=null,n,i){let a=Ln.getState().productData;this._plugs=[],this._skuID=e,this._ref=null,this._transform=null,this.#e="default",this._overrideVariant=null,this._followsParent=a[e].followsParent,this._categoryID=a[e].categoryID,this._replace=a[e].replace,this._swappable=a[e].swappable,this._price=this.#t(),this.#i=a[e]?.ignoreInCart,t?(this._guid=t.guid,this._isEndNode=t.isEndNode,this._overrideVariant=t.overrideVariant,this.generatePlugsWithData(e,t.plugs)):(this._guid=Tie.v4(),this._isEndNode=!0,this.generatePlugsForNode(e)),n&&Object.keys(n).map(s=>{if(a[e].looks&&a[e].looks.includes(s)){this.#e=s;return}})}updateGeometryVariant(e,t){const i=Ln.getState().categoryData.geometryVariants;let a=null;if(i.map(f=>{f.id==e&&(a=f)}),!a)return;const s=a.productsInCategory,l=a.variants[t].productsToSwitch,u=Wt.getState().itemsSpawned;s.map(f=>{f.products.map(h=>{this.skuID===h&&f.products.map(p=>{l.map(m=>{if(m==p){const y=Ln.getState().actions.getProductDataById(m);this.skuID=y.skuID;const E=u[this.guid];E&&E.itemData&&Object.keys(y).map(b=>{E.itemData[b]=y[b]}),this.hideNodes(y.geometriesToHide),this.showNodes(y.geometriesToShow),this.updatePricing(),this.resetInStock(),Gd.getState().actions.refreshInventory(u)}})})})})}resetInStock(){this.#a={},this.#s=!0}setInStockForRef(e){if(!this.ref)return!1;let t=this.ref.getObjectByName("GRP_RenderGeometry");return t?(t.inStock=e,!0):!1}set inStock({variantName:e,newValue:t}){if(this.#a[e]&&this.#a[e]==t||(this.#a[e]=t,e!==this.#e&&this.#s===!1))return;const n=()=>{this.setInStockForRef(t)};n()||nt.coreWCRef.addEventListener(this.guid+":refLoaded",n,{once:!0})}get myDependenciesGUID(){return this.#o}set myDependenciesGUID(e){this.#o=e}addMyDependenciesGUID(e){this.#o.push(e)}get isDependent(){return this.#n}set isDependent(e){this.#n=e}get isInteractive(){return this.#r}set isInteractive(e){this.#r=e}update(e){this._skuID=e;const t=Ln.getState().productData,n=t[e]?.plugs;if(this.ignoreInCart=t[e].ignoreInCart,!!n)for(let i=0;i<this._plugs.length;i++)for(let a=0;a<n.length;a++)this._plugs[i].name==n[a].name&&(this._plugs[i].acceptedPlugTypes=n[a].acceptedPlugTypes,this._plugs[i].connectsToPlugTypes=n[a].connectsToPlugTypes)}export(){let e={};for(var t=0;t<this._plugs.length;t++){let n=this._plugs[t].export();n&&(e[this._plugs[t].name]=n)}return{skuID:this._skuID,guid:this._guid,isEndNode:this._isEndNode,plugs:e,overrideVariant:this._overrideVariant}}get node(){return this}get swappable(){return this._swappable}get replace(){return this._replace}get ignoreInCart(){return this.#i}set ignoreInCart(e){this.#i=e}get canRotate(){let e=!0;if(!this._isEndNode){const s=this.whichNodesAreAttachedToUs();if(s.length>0){let o=!0;if(s.map(l=>{l.followsParent===!1&&(o=!1)}),!o)return!1}}let t=!1;for(var n=0;n<this.plugs.length;n++)if(!this.plugs[n].isOpen&&this.plugs[n].attachedPlug.isReceiverPlug){const s=this.plugs[n].attachedPlug.acceptedPlugTypes;for(var i=0;i<this.plugs.length;i++)if(n!=i)for(var a=0;a<this.plugs[i].connectsToPlugTypes.length;a++)s.includes(this.plugs[i].connectsToPlugTypes[a])&&(t=!0)}return e=t,e}hideNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");return e.map(i=>{if(t){const a=t.getObjectByName(i);a&&(a.visible=!1)}if(n){const a=n.getObjectByName(i);a&&(a.visible=!1)}}),!0}showNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");e.map(i=>{if(t){const a=t.getObjectByName(i);a&&(a.visible=!0)}if(n){const a=n.getObjectByName(i);a&&(a.visible=!0)}})}canConnectToPlugType(e){let t=!1;return this._plugs.map(n=>{n.connectsToPlugTypes.map(i=>{i==e&&(t=!0)})}),t}isConnectedToSkuID(e){let t=!1;return this._plugs.map(n=>{n.isOpen||n.attachedPlug.node.skuID==e&&(t=!0)}),t}get isConnectedToRoot(){return this.isConnectedToSkuID("Root")}swapRoot(){if(!this.canSwapRoot)return;const t=ln.getState().attachmentSystem.currentStructure,n=this.whichNodesAreAttachedToUs();let i=null;n.map(u=>{u.followsParent===!1&&(i=u)});const a=i.detachNodeFromReceiver();let s=null;this._plugs.map(u=>{u.isOpen||u.attachedPlug.node.skuID=="Root"&&(s=u.attachedPlug)});const o=this.detachNodeFromReceiver();let l=null;return i.plugs.map(u=>{u.connectsToPlugTypes.includes("root")&&(l=u)}),t.connectPlugs({incomingPlug:l,receiverPlug:s}),{neighbourDetachedPlugs:a,rootDetachedPlugs:o,neighbourNode:i}}get canSwapRoot(){if(Je.getState().sceneSettings.swappableRoot===!1)return!1;let e=!1;if(this.isConnectedToRoot&&!this._isEndNode){const n=this.whichNodesAreAttachedToUs();let i=0,a=null;n.map(s=>{s.followsParent===!1&&(i++,a=s)}),i==1?a.canConnectToPlugType("root")&&(e=!0):i>0&&(e=!1)}return e}get canDrag(){let e=!0;return this._isEndNode||(this.whichNodesAreAttachedToUs().map(n=>{n.followsParent===!1&&(e=!1)}),e||(e=this.canSwapRoot)),e}get followsParent(){return this._followsParent}set followsParent(e){this._followsParent=e}get currentVariant(){return this.#e==="default"?Ln.getState().actions.getProductDataById(this._skuID).lookDetails.default.id:this.#e}get price(){return this._price}set price(e){this._price=e}updatePricing(){this._price=this.#t()}#t(){let t=Ln.getState().actions.getProductDataById(this._skuID).lookDetails[this.#e]?.price;return t||(t=0),t}set currentVariant(e){this.#e=e,this._price=this.#t()}get overrideVariant(){return this._overrideVariant}set overrideVariant(e){this._overrideVariant=e,this.#e=this._overrideVariant,this._price=this.#t()}get guid(){return this._guid}get skuID(){return this._skuID}set skuID(e){this._skuID=e}get plugs(){return this._plugs}get ref(){return this._ref}set ref(e){this._ref=e;let t=new CustomEvent(this._guid+":refLoaded",{bubbles:!0,cancelable:!1,composed:!0});const n=ln.getState().attachmentSystem;n.globalGeometryVariants&&Object.keys(n.globalGeometryVariants).map(i=>{this.updateGeometryVariant(i,n.globalGeometryVariants[i])}),t.data={},nt.coreWCRef?nt.coreWCRef.dispatchEvent(t):Gt.warn({title:"core web component not found!"})}get isEndNode(){return this._isEndNode}set isEndNode(e){this._isEndNode=e}get categoryID(){return this._categoryID}get transform(){return this._transform}set transform(e){this._transform=e}setModelVisibility(e){e?this._ref?.scale.set(1,1,1):this._ref.scale.set(0,0,0)}checkIfEndNode(){let e=!0;for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&(e=!1);this.isEndNode=e}whichNodesAreAttachedToUs(){var e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&e.push(this._plugs[t].attachedPlug.node);return e}whichPlugsAreAttachedToUs(){var e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&e.push({receiverPlug:this._plugs[t],incomingPlug:this._plugs[t].attachedPlug});return e}whichNodeAreWeAttachedTo(){var e=null;for(let t=0;t<this._plugs.length;t++)this._plugs[t].isReceiverPlug&&(e=this._plugs[t].attachedPlug.node);return e}isReplaceableWithSkuId(e){const n=Ln.getState().productData[e]?.plugs;let i=0;if(!n)return!1;for(let a=0;a<this._plugs.length;a++)for(let s=0;s<n.length;s++)this._plugs[a].name==n[s].name&&i++;return i==this._plugs.length}whichPlugAreWeAttachedUsing(){for(let e=0;e<this._plugs.length;e++)if(!this._plugs[e].isOpen&&this._plugs[e].attachedPlug.isReceiverPlug)return this._plugs[e]}whichPlugAreWeAttachedTo(){for(let e=0;e<this._plugs.length;e++)if(!this._plugs[e].isOpen&&this._plugs[e].attachedPlug.isReceiverPlug)return this._plugs[e].attachedPlug}getPlugWhichCanConnectToType(e){for(const t of this._plugs)if(t.connectsToPlugTypes.includes(e))return t;return null}getOpenPlugsWeCanAttachFrom(){let e=[];if(this.whichNodeAreWeAttachedTo())return e;for(let t=0;t<this._plugs.length;t++)this.plugs[t].isOpen&&this.plugs[t].connectsToPlugTypes.length>0&&e.push(this._plugs[t]);return e}getOpenPlugsFromNode(){let e=[];for(let t=0;t<this._plugs.length;t++)this._plugs[t].isOpen&&this._plugs[t].acceptedPlugTypes.length>0&&e.push(this._plugs[t]);return e}generatePlugsForNode(e){this._plugs=[];let t=Ln.getState().productData[e]?.plugs;if(t)for(var n=0;n<t.length;n++){const i=new zH(t[n],this);this._plugs.push(i)}}generatePlugsWithData(e,t){let n=Ln.getState().productData[e]?.plugs;if(n)for(var i=0;i<n.length;i++){const a=new zH(n[i],this,t[n[i].name]);this._plugs.push(a)}}detachNodeFromReceiver(){for(var e=0;e<this.plugs.length;e++)if(!this.plugs[e].isOpen&&this.plugs[e].attachedPlug.isReceiverPlug){const t={incomingPlug:this.plugs[e],receiverPlug:this.plugs[e].attachedPlug};return this.plugs[e].attachedPlug.openPlug(),this.plugs[e].openPlug(),t}}detachNodeCompletely(){for(var e=0;e<this._plugs.length;e++)this._plugs[e].isOpen||(this._plugs[e].attachedPlug.openPlug(),this._plugs[e].openPlug())}getPlugByName(e){for(var t=0;t<this._plugs.length;t++)if(this._plugs[t].name==e)return this._plugs[t];return null}getPlugByGUID(e){for(var t=0;t<this._plugs.length;t++)if(this._plugs[t].guid==e)return this._plugs[t];return null}removeNode(){for(var e=0;e<this._plugs.length;e++)this._plugs[e].isOpen||(this._plugs[e].attachedPlug.isReceiverPlug?this._plugs[e].attachedPlug.openPlug():Wt.getState().actions.addToRemoveItems(this._plugs[e].attachedPlug.node.guid))}};class Q${#e=!1;constructor(e=null,t,n){if(this._nodes=[],this._rootNode=null,Gt.info({title:"preloadNodes",details:e}),e){Gt.info({title:"PRELOAD Length-----------------:"+e.length});for(var i=0;i<e.length;i++){Gt.info({title:"FOUND PRELOAD-----------------"});let a=e[i].skuID,s=new vR(a,e[i],t,n);a=="Root"&&(this._rootNode=s),this._nodes.push(s)}this.resolvePlugConnections(e)}else{const a=new vR("Root",null,t,n);this._rootNode=a,this._nodes.push(a)}Wt.getState().actions.addItemWithTransform({position:new ve(0,0,0),rotation:new $i().identity()},"Root",this._rootNode.guid,!1),this._boundingBoxLeeway=Je.getState().sceneSettings.boundingBoxLeeway}get nodes(){return this._nodes}get rootNode(){return this._rootNode}updatePricing(){for(let e=0;e<this._nodes.length;e++)this._nodes[e].updatePricing()}getCurrentItemsInReplaceableCategory(){let e={};for(const t of this._nodes)t.replace&&(e[t.categoryID]=t.skuID);return e}recalculateStructureFromNode(e){for(let t=0;t<e.plugs.length;t++)if(!e.plugs[t].isOpen&&e.plugs[t].isReceiverPlug){const n=e.plugs[t].attachedPlug.node,i={receiverPlug:e.plugs[t],incomingPlug:e.plugs[t].attachedPlug};if(i){const a=this.findItemTransform(i);a&&(n.ref.position.set(a.position.x,a.position.y,a.position.z),n.ref.setRotationFromQuaternion(a.rotation),n.transform={position:a.position,rotation:a.rotation})}this.recalculateStructureFromNode(n)}}rotateNode(e){const t=this.getNodeByGUID(e);let n=null,i=null;for(let o=0;o<t.plugs.length;o++)if(!i&&!t.plugs[o].isOpen&&t.plugs[o].attachedPlug.isReceiverPlug){const l=t.plugs[o].attachedPlug.acceptedPlugTypes;i=t.plugs[o].attachedPlug;let u=[];for(let f=o+1;f<t.plugs.length;f++)u.push(t.plugs[f]);for(let f=0;f<o;f++)u.push(t.plugs[f]);for(let f=0;f<u.length;f++)for(let h=0;h<u[f].connectsToPlugTypes.length;h++)l.includes(u[f].connectsToPlugTypes[h])&&(n=u[f])}if(!n)return;t.detachNodeFromReceiver();const{position:a,rotation:s}=this.findItemTransform({receiverPlug:i,incomingPlug:n});t.ref.position.set(a.x,a.y,a.z),t.ref.setRotationFromQuaternion(s),t.transform={position:t.ref.position,rotation:s},this.connectPlugs({receiverPlug:i,incomingPlug:n}),this.recalculateStructureFromNode(t)}async load(){await this.respawnItems()}materialOverrideExists(){let e=!1;return this.nodes.map(t=>{if(t.overrideVariant)return e=!0,!0}),e}findGhostTransformForReplacement(e,t){const n=ln.getState().attachmentSystem,i=t.whichPlugAreWeAttachedTo(),a=t.whichPlugAreWeAttachedUsing(),o=new vR(e,null,n.globalVariants,n.globalGeometryVariants).getPlugByName(a.name);if(!o)return{transforms:null,connectablePlugs:null};const l={incomingPlug:o,receiverPlug:i};let u=[],f=this.findItemTransform(l);if(!f)return{transforms:u,connectablePlugs:l};let{position:h,rotation:p}=f;return h&&p&&u.push({position:h,rotation:p,incomingPlugName:l.incomingPlug.name,receiverPlugName:l.receiverPlug.name,incomingPlugGUID:l.incomingPlug.guid,receiverPlugGUID:l.receiverPlug.guid}),{transforms:u,connectablePlugs:l}}findGhostTransforms(e,t){const n=this.getOpenPlugs();if(n.length<=0)return{transforms:[]};const i=ln.getState().attachmentSystem,a=Ln.getState().productData,s=new vR(e,null,i.globalVariants,i.globalGeometryVariants),o=this.getConnectablePlugs(s,n);let l=[];if(o.length<=0)return{transforms:[]};let u=[];for(let h=0;h<o.length;h++){let p=this.findItemTransform(o[h]);if(!p)continue;let{position:m,rotation:y}=p;if(m&&y){let E=t;Array.isArray(t)===!0&&(E=!1),a[e].hasOwnProperty("ignoreSpawningCollision")&&(E=a[e].ignoreSpawningCollision),(E?!1:this.isColliding(s.skuID,p,o[h].receiverPlug,t))||(u.push({position:m,rotation:y,incomingPlugName:o[h].incomingPlug.name,receiverPlugName:o[h].receiverPlug.name,incomingPlugGUID:o[h].incomingPlug.guid,receiverPlugGUID:o[h].receiverPlug.guid}),l.push(o[h]))}}let f=[];for(let h=0;h<u.length;h++)f.push(s);return{transforms:u,newNodes:f,connectablePlugs:l}}resolvePlugConnections(e){for(let t=0;t<e.length;t++)Object.keys(e[t].plugs).map(n=>{let i=e[t].plugs[n].guid,a=this.getPlugInNodesByGUID(i);if(!a||a.attachedPlug)return;let s=e[t].plugs[n].attachedPlugGUID,o=this.getPlugInNodesByGUID(s);o&&(o.attachedPlug||(a.attachPlug(o,e[t].plugs[n].isReceiverPlug),o.attachPlug(a,!e[t].plugs[n].isReceiverPlug)))});Gt.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let e=[this.rootNode];for(let t=0;t<e.length;t++){let i=e[t].whichPlugsAreAttachedToUs();for(let a=0;a<i.length;a++){let s=this.findItemTransformForPreload(i[a],i[a].receiverPlug.node.transform);s?await Wt.getState().actions.addItemWithTransform(s,i[a].incomingPlug.node.skuID,i[a].incomingPlug.node.guid):Gt.warn({title:"Problem finding plug transform! "+i[a].name}),i[a].incomingPlug.node.transform=s,e.push(i[a].incomingPlug.node)}}nt.fireEvent(nt.EVENTS.SCENE.SavedConfiguration_Loaded),Je.getState().actions.triggerAutoFocus(),hi.getState().actions.checkHotspotHealth()}getPlugInNodesByGUID(e){for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t].getPlugByGUID(e);if(n)return n}return null}export(){let e=[];for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t].export();n&&e.push(n)}return e}async clear(){return new Promise(async(e,t)=>{!this._rootNode&&this._rootNode.isEndNode&&e(!0);let n=this._rootNode.whichNodeAreWeAttachedTo();this.#e=!0,nt.coreWCRef.addEventListener(nt.EVENTS.SCENE.Scene_Cleared,i=>e(i.data),{once:!0}),n?nt.removeItemByGUID(n.guid,!0):(await gc(500),e(!0))})}getNodeByGUID(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e)return this._nodes[t];return null}getPlugByGUID(e){for(const t of this._nodes){const n=t.getPlugByGUID(e);if(n)return n}return null}findItemTransformForPreload(e,t){let{receiverPlug:n,incomingPlug:i}=e,a=n,s=i;if(a.node.skuID=="Root")return this.findItemTransformRoot(e);let o=null,l=null,u=new Ei,f=Mo.getState().assets.items[a.node.skuID].proxy.data.scene.clone();u.add(f);let{position:h,rotation:p}=t;if(f.position.set(h.x,h.y,h.z),f.setRotationFromQuaternion(p),l=f,!l||(o=l.getObjectByName(a.name),!o))return;let m=new ve(0,0,0);o.getWorldPosition(m);let y=new $i().identity();o.getWorldQuaternion(y);let E=new Ei;o.add(E);let b=Mo.getState().assets.items[s.node.skuID].proxy.data.scene.clone();b.position.set(m.x,m.y,m.z),b.applyQuaternion(y);let v=new ve;v.copy(f.up).applyQuaternion(l.quaternion);let x=new ve;x.copy(b.up).applyQuaternion(y),x.negate();let S=new $i().setFromUnitVectors(v,x);v.round(),x.round();let _=v.dot(x);_!==1&&_!==-1&&b.applyQuaternion(S);let w=b.getObjectByName(s.name),R=new $i().identity();w.getWorldQuaternion(R);let N=new ve(0,1,0);N.applyQuaternion(R);let L=new ve(0,1,0);L.applyQuaternion(y),L.negate();let I=new $i().setFromUnitVectors(N,L);if(N.round(),L.round(),N.dot(L)!==-1)b.applyQuaternion(I);else{let j=new ve(0,1,0),Q=L.dot(j);if(Q!==1&&Q!==-1)b.rotateOnAxis(j,Math.PI);else{let H=new ve(0,0,1),K=L.dot(H);if(K!==1&&K!==-1)b.rotateOnAxis(H,Math.PI);else{let J=new ve(1,0,0),W=L.dot(J);W!==1&&W!==-1&&b.rotateOnAxis(J,Math.PI)}}}let k=b.getObjectByName(s.name),F=new ve(k.position.x,k.position.y,k.position.z);b.translateX(-F.x),b.translateY(-F.y),b.translateZ(-F.z);let U=new ve(0,0,0);b.getWorldPosition(U);let z=new $i().identity();return b.getWorldQuaternion(z),b=null,{position:U,rotation:z}}findItemTransformRoot(e){let{receiverPlug:t,incomingPlug:n}=e,i=n;const a=new Ei;let s=a,o=new ve(0,0,0);s.getWorldPosition(o);let l=new $i().identity(),u=new Ei;u.position.set(0,0,0),a.add(u);let f=Mo.getState().assets.items[i.node.skuID].proxy.data.scene.clone();u.attach(f),f.translateX(o.x),f.translateY(o.y),f.translateZ(o.z);let h=f.getObjectByName(i.name),p=new $i().identity();h.getWorldQuaternion(p);const m=new ve(0,1,0);m.applyQuaternion(p);const y=new ve(0,1,0);y.applyQuaternion(l);const E=y.angleTo(m),b=new ve(0,0,0);b.crossVectors(y,m),b.round(),b.length()!==0&&f.rotateOnAxis(b,E);var v=new Wn().extractRotation(f.matrixWorld);let x=new ve(h.position.x,h.position.y,h.position.z);x.applyMatrix4(v),f.translateX(-x.x),f.translateY(-x.y),f.translateZ(-x.z);let S=new ve(0,0,0);f.getWorldPosition(S);let _=new $i().identity();return f.getWorldQuaternion(_),u.remove(f),u=null,f=null,{position:S,rotation:_}}findItemTransform(e){let{receiverPlug:t,incomingPlug:n}=e,i=t,a=n;if(i.node.skuID=="Root")return this.findItemTransformRoot(e);const s=i.node.transform;if(!s)return;const o=Mo.getState().assets.items[i.node.skuID].proxy.data.scene.clone(),l=new Ei;l.position.set(s.position.x,s.position.y,s.position.z),l.setRotationFromQuaternion(s.rotation),l.add(o);let u=l.getObjectByName(""+i.name);if(!u){Gt.error({title:"Plug: "+i.name+" doesn't exist in "+i.node.skuID});return}let f=new ve(0,1,0);u.getWorldPosition(f);let h=new $i().identity();u.getWorldQuaternion(h);let p=Mo.getState().assets.items[a.node.skuID].proxy.data.scene.clone();p.position.set(f.x,f.y,f.z),p.applyQuaternion(h);let m=new ve;m.copy(o.up).applyQuaternion(l.quaternion);let y=new ve;y.copy(p.up).applyQuaternion(h),y.negate();let E=new $i().setFromUnitVectors(m,y);m.round(),y.round();let b=m.dot(y);b!==1&&b!==-1&&p.applyQuaternion(E);let v=p.getObjectByName(a.name);if(!v){Gt.error({title:"Plug: "+a.name+" doesn't exist in "+a.node.skuID});return}let x=new $i().identity();v.getWorldQuaternion(x);let S=new ve(0,1,0);S.applyQuaternion(x);let _=new ve(0,1,0);_.applyQuaternion(h),_.negate();let w=new $i().setFromUnitVectors(S,_);if(S.round(),_.round(),S.dot(_)!==-1)p.applyQuaternion(w);else{let k=new ve(0,1,0),F=_.dot(k);if(F!==1&&F!==-1)p.rotateOnAxis(k,Math.PI);else{let U=new ve(0,0,1),z=_.dot(U);if(z!==1&&z!==-1)p.rotateOnAxis(U,Math.PI);else{let j=new ve(1,0,0),Q=_.dot(j);Q!==1&&Q!==-1&&p.rotateOnAxis(j,Math.PI)}}}let N=p.getObjectByName(a.name),L=new ve(N.position.x,N.position.y,N.position.z);p.translateX(-L.x),p.translateY(-L.y),p.translateZ(-L.z);let I=new ve(0,0,0);p.getWorldPosition(I);let D=new $i().identity();return p.getWorldQuaternion(D),l.remove(o),p=null,{position:I,rotation:D}}getSpawningRequirementForSkuID(e){let t=[];const n=Ln.getState().productData,i=n[e];if(!i)return t;const a=[];return i.plugs.map(s=>{s.connectsToPlugTypes.map(o=>{a.push(o)})}),Object.keys(n).map(s=>{for(let o=0;o<n[s].plugs.length;o++){const l=n[s].plugs[o].acceptedPlugTypes;for(let u=0;u<l.length;u++)a.map(f=>{f==l[u]&&!t.includes(s)&&t.push(s)})}}),t}getConnectablePlugs(e,t){let n=[],i=e.getOpenPlugsWeCanAttachFrom();for(let a=0;a<i.length;a++)for(let s=0;s<t.length;s++){let o=!1;for(let u=0;u<n.length;u++)if(n[u].receiverPlug.guid==t[s].guid){o=!0;break}if(o)continue;i[a].canAttachToPlug(t[s])&&n.push({incomingPlug:i[a],receiverPlug:t[s]})}return n}getOpenPlugs(){let e=[];return this._nodes.map(t=>{let n=t.getOpenPlugsFromNode();e=e.concat(n)}),e}checkCollisionforGUID(e){if(Je.getState().sceneSettings.disableCollider)return!1;const t=Wt.getState().itemsSpawned,n=Ln.getState().productData;if(!t[e])return!1;const a=this.getNodeByGUID(e);if(!a||!a.ref||n[a.skuID].disableCollider)return!1;const s={position:a.ref.position,rotation:a.ref.rotation},o=a.whichPlugAreWeAttachedTo();return o==null?!1:this.isColliding(a.skuID,s,o,[])}isColliding(e,{position:t,rotation:n},i,a=[]){const s=Mo.getState().assets.items[e].proxy.data.scene,o=Ln.getState().productData;if(!s)return!1;let l=s.clone();l.position.set(t.x,t.y,t.z),l.setRotationFromQuaternion(n);let u=new fl().setFromObject(l);var f=new ve;u.getCenter(f);let h=new Ei;h.position.set(f.x,f.y,f.z),h.attach(l),h.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),u=new fl().setFromObject(h);const p=[];if(this._nodes.forEach(y=>{i.node.guid!=y.guid&&(Array.isArray(a)===!0&&a.includes(y.guid)||y.ref&&((o[y.skuID].hasOwnProperty("disableCollider")?o[y.skuID].disableCollider:Je.getState().sceneSettings.disableCollider)||p.push(y.ref)))}),p.length<=0)return!1;let m=!1;return p.forEach(y=>{if(m)return;let E=new fl().setFromObject(y);if(u.intersectsBox(E)){m=!0;return}}),h.clear(),l=null,h=null,u=null,m}boxOverlapPercent(e,t){if(e.containsBox(t)||t.containsBox(e))return 100;if(!(e.min.x<t.max.x||t.min.x<e.max.x))return 0;let n=new ve(0,0,0);e.getSize(n),n.x*n.y*n.z;let i=new ve(0,0,0);t.getSize(i),i.x*i.y*i.z}checkInsideOutCollision(e,t,n){let i=t.position.clone(),a=new Float32Array(n.attributes.position.array),s=a.length/3;for(let o=0;o<s;o++){let l=new ve(a[o*3],a[o*3+1],a[o*3+2]),u=l.add(t.position);u=l.applyQuaternion(t.quaternion);let f=u.sub(t.position);const p=new xy(i,f.clone().normalize()).intersectObjects(e),m=p.length>0,y=p[0].distance<f.length();if(m&&y)return!0}return!1}addNode(e){this._nodes.push(e)}getFirstNodeByCategoryID(e){for(var t=0;t<this._nodes.length;t++)if(this._nodes[t]._categoryID==e)return this._nodes[t];return null}getNodesBySKUID(e){let t=[];for(var n=0;n<this._nodes.length;n++)this._nodes[n].skuID==e&&t.push(this._nodes[n]);return t}getNodesByCategoryID(e){let t=[];for(var n=0;n<this._nodes.length;n++)this._nodes[n]._categoryID==e&&t.push(this._nodes[n]);return t}connectPlugs({incomingPlug:e,receiverPlug:t}){e.attachPlug(t,!1),t.attachPlug(e,!0),ln.getState().actions.toggleStructureUpdated()}removeNodeByGUID(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e){this._nodes[t].removeNode(),this._nodes.splice(t,1);break}this._nodes.length==1&&this.#e&&nt.fireEvent(nt.EVENTS.SCENE.Scene_Cleared,!0),ln.getState().actions.updateFittingSkuIds(),ln.getState().actions.toggleStructureUpdated()}removeNodeFromStructure(e){for(let t=0;t<this._nodes.length;t++)if(this._nodes[t].guid==e.guid){this._nodes.splice(t,1);break}ln.getState().actions.toggleStructureUpdated()}}class GUe{constructor(){this._globalVariants={},this._globalGeometryVariants={},Ln.getState().categoryData.geometryVariants.map(e=>{this._globalGeometryVariants[e.id]=e.defaultVariant}),Ln.getState().categoryData.color.map(e=>{this._globalVariants[e.id]=e.defaultLook}),this._currentStructure=new Q$(null,this._globalVariants,this._globalGeometryVariants);for(const[e,t]of Object.entries(this._globalVariants))this.switchGlobalVariant(e,t);for(const[e,t]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(e,t)}get globalGeometryVariants(){return this._globalGeometryVariants}get globalVariants(){return this._globalVariants}get currentStructure(){return this._currentStructure}getClientProductId(e,t){let n;return n=Ln.getState()?.productData[e]?.lookDetails[t],n?.clientProductId?n?.clientProductId:""}getCartItems(){let e=[];const t=Gd.getState().inventoryData;this.currentStructure.nodes.map(a=>{if(a.skuID=="Root"||a.ignoreInCart===!0)return;let s=!1;if(e.map(u=>{const f=t[u.skuID];if(u.skuID==a.skuID&&u.currentVariant==a.currentVariant){u.count++,u.countAvailable=f[a.currentVariant].countAvailable,u.countUnavailable=f[a.currentVariant].countUnavailable,u.price=a.price*u.count,s=!0;return}}),s===!0)return;let o={};o.skuID=a.skuID,o.currentVariant=a.currentVariant,o.clientProductId=this.getClientProductId(o.skuID,o.currentVariant),o.count=1;const l=t[o.skuID];o.price=a.price,o.countAvailable=l[a.currentVariant].countAvailable,o.countUnavailable=l[a.currentVariant].countUnavailable,e.push(o)});let n=0;for(const a of e)n=n+a.price;return{cartItems:e,details:{total:n.toFixed(2)}}}getFittingSKUIDs(){const e=Ln.getState().productData;if(!this.currentStructure)return;let t=this.currentStructure.nodes,n=[],i=[],a=[],s=[];if(t.map(l=>{s.push(l.skuID),l.plugs.map(u=>{if(!u.isOpen){u.attachedPlug.node.replace&&u.acceptedPlugTypes.map(f=>{i.includes(f)||i.push(f)});return}u.acceptedPlugTypes.map(f=>{n.includes(f)||n.push(f)})})}),n.length<=0&&i.length<=0)return[];Object.keys(e).map(l=>{!e[l].plugs||a.includes(l)||e[l].plugs.map(u=>{a.includes(l)||u.connectsToPlugTypes.map(f=>{if(!a.includes(l)){if(i.includes(f)){if(!s.includes(l)){let h=!1,p=this.currentStructure.getFirstNodeByCategoryID(e[l].categoryID),m=!1;p?.plugs.map(y=>{!y.isOpen&&y.isReceiverPlug&&(m=!0,e[l].plugs.map(E=>{E.name==y.name&&y.attachedPlug.connectsToPlugTypes.map(b=>{E.acceptedPlugTypes.includes(b)&&(h=!0)})}))}),(h||!m)&&a.push(l)}}else if(n.includes(f)){const h=this.currentStructure.getFirstNodeByCategoryID(e[l].categoryID);if(h&&h.replace)return;a.push(l)}}})})});let o=[];return a.map(l=>{if(o.includes(l))return;if(e[l].replace){o.push(l);return}const{transforms:u,newNodes:f,connectablePlugs:h}=this.currentStructure.findGhostTransforms(l,Je.getState().sceneSettings.ignoreSpawningCollision);u.length>0&&o.push(l)}),o.map(l=>{e[l].replace}),o}async removeAllVariantOverrides(){let e=this._currentStructure.nodes,t=Ln.getState().productData,n=Wt.getState().itemsSpawned;await e.map(async i=>{if(!i.overrideVariant||(i.overrideVariant=null,!t[i.skuID].looks))return;let a=null;Object.keys(this._globalVariants).map(s=>{t[i.skuID].looks.includes(this._globalVariants[s])&&a==null&&(a=this._globalVariants[s])}),a&&await Wt.getState().actions.switchToVariant(n[i.guid].itemData,a)}),nt.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),nt.fireEvent(nt.EVENTS.SCENE.MaterialOverrides_Exists,!1)}async switchGlobalGeometryVariant(e,t){const i=Ln.getState().categoryData.geometryVariants;let a=null;if(i.map(p=>{p.id==e&&(a=p)}),!a)return;const s=a.productsInCategory,l=a.variants[t].productsToSwitch,u=Wt.getState().itemsSpawned;let f=Ln.getState().categoryData;l.map(p=>{s.map(m=>{let y=!1;m.products.map(E=>{p==E&&(y=!0)}),y&&f.build.map(E=>{m.products.map(b=>{E.skus.map((v,x)=>{E.skus[x]==b&&(E.skus[x]=p)})})})})}),this._currentStructure.nodes.map(p=>{s.map(m=>{m.products.map(y=>{p.skuID==y&&p.ref!==null&&m.products.map(E=>{l.map(b=>{if(b==E){const v=Ln.getState().actions.getProductDataById(b);p.hideNodes(v.geometriesToHide),p.showNodes(v.geometriesToShow),p.skuID=b;const x=u[p.guid];x&&x.itemData&&Object.keys(v).map(S=>{x.itemData[S]=v[S]}),p.resetInStock(),p.updatePricing()}})})})})}),this._globalGeometryVariants[e]=t,hi.getState().actions.checkHotspotHealth(),Gd.getState().actions.refreshInventory(u),Ln.setState({categoryData:f}),nt.fireEvent(nt.EVENTS.SCENE.CategoryData_Updated,f),nt.fireEvent(nt.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const h=this.getCartItems();h&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,h)}async switchGlobalVariant(e,t){this._globalVariants[e]=t;const n=Wt.getState().actions;let i=Wt.getState().itemsSpawned;for(let l=0;l<Object.keys(i).length;l++){let u=i[Object.keys(i)[l]];if(u.itemData.looks&&u.itemData.looks.includes(t)){let f=this._currentStructure.getNodeByGUID(u.itemData.guid);f&&!f.overrideVariant&&await n.switchToVariant(u.itemData,t)}}const a=Ln.getState().lookData;tT.getState().actions.processLookEnvMapOverride(t);const s=e;Object.keys(i).length>0&&nt.alert({alertMsg:s.charAt(0).toUpperCase()+s.slice(1)+" was successfully switched to "+a[t].label+".",alertTime:3e3,alertType:"success",alertLabel:`${s} Changed`,alertId:"materialVariantChanged"}),nt.fireEvent(nt.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),Wt.setState({variantChangeAlert:!Wt.getState().variantChangeAlert});const o=this.getCartItems();o&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,o)}async#e(e){if(!e)return;Gt.info({title:"Structure to load",details:e}),delete this._currentStructure,this._globalVariants={...e.globalVariants},this._globalGeometryVariants=e.globalGeometryVariants?{...e.globalGeometryVariants}:{};const t=[...e.structure];this._currentStructure=new Q$(t,this._globalVariants,this._globalGeometryVariants);for(const[n,i]of Object.entries(this._globalVariants))this.switchGlobalVariant(n,i);for(const[n,i]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(n,i);Gt.info({title:"Structure Loading..."}),await this._currentStructure.load(),Gt.info({title:"Structure Loaded."})}async loadStructure(e){e&&(nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Show),Je.setState({configurationLoaded:!1}),await gc(500),await this._currentStructure.clear(),await this.#e(e),Je.getState().preconfigurationLoaded?nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Hide):Je.setState({preconfigurationLoaded:!0}),Je.setState({configurationLoaded:!0}),ln.getState().actions.toggleStructureUpdated())}export(){return{structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Show),this._currentStructure.clear(),nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Hide)}async restart(){Gt.warn({title:"Restarting the Scene!!"}),Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem(),nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Show),await gc(500),await this._currentStructure.clear();const e=ln.getState().defaultConfig;await this.#e(e),ln.getState().actions.toggleStructureUpdated(),Je.setState({configurationLoaded:!0}),nt.fireEvent(nt.EVENTS.UI.PreloadScreen_Hide)}}const wie=Do((r,e)=>({attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async()=>{const{actions:t,defaultConfig:n}=e(),i=await new GUe;r({attachmentSystem:i}),t.updateFittingSkuIds(),t.toggleStructureUpdated()},loadSavedStructureFromConfigID:async t=>{const n=await _ie(kH+t);return n.success===!1?null:n.data},loadDefaultStructure:async()=>{const{actions:t,defaultConfig:n,attachmentSystem:i}=e();await t.loadStructure(n)},updateFittingSkuIds:()=>{const t=wie.getState().attachmentSystem.getFittingSKUIDs();t&&nt.fireEvent(nt.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:t})},toggleStructureUpdated:()=>{const{attachmentSystem:t}=e();r(i=>({structureUpdated:!i.structureUpdated})),nt.fireEvent(nt.EVENTS.SCENE.ReplaceableCategory_Updated,t.currentStructure.getCurrentItemsInReplaceableCategory());const n=t.getCartItems();n&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,n)},loadStructure:async t=>{const{attachmentSystem:n}=e();n&&Je.getState().configurationLoaded!==!1&&await n.loadStructure(t)},export:()=>{const{attachmentSystem:t}=e();if(t)return t.export()}}})),ln=wie,HUe=Do((r,e)=>({productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:{},actions:{getCurrentPricingInfo:()=>{const{productData:t}=e();let n={};return Object.keys(t).map(i=>{if(i.toLowerCase()==="root")return;let a=t[i].lookDetails,s={};Object.keys(a).map(o=>{o!="default"&&(s[o]=a[o].price)}),n[i]=s}),n},updatePricingForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(i=>{let a=t[i];Object.keys(a).map(s=>{n.updatePricingForProduct(i,s,a[s])})})},updatePricingForProduct:(t,n,i)=>{const{productData:a}=e();let s=a[t];if(!s||!s.lookDetails)return;let o=s.lookDetails[n];if(!o)return;o.price=i,ln.getState().attachmentSystem.currentStructure.getNodesBySKUID(t).map(f=>f.updatePricing())},setProductData:t=>{let n={};t&&Object.keys(t).map(i=>{const a=t[i];if(a.skuID=i,a.skuID.toLowerCase()==="root"){a.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},a.defaultVariant="default";return}if(a?.lookDetails){const s=a.lookDetails;let o=Object.keys(a.lookDetails);if(o.includes("default")){const u=o.indexOf("default");o.splice(u,1)}a.looks=o,Object.keys(a.lookDetails).map(u=>{let f=a.lookDetails[u];f.inventory===void 0&&(f.inventory=P$),f.price===void 0&&(f.price=uUe),n[i]={...n[i],[u]:{inventory:P$,inScene:[]}}});let l=a?.defaultVariant;l||(Gt.warn({title:`No defaultVariant set for ${a.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),l=Object.keys(a.lookDetails).sort()[0],Gt.warn({title:"Auto resolved default look ID: "+l})),o.includes(l)?(a.lookDetails.default=s[l],a.lookDetails.default.id=l):(Gt.error({title:`Default look [ ${l} ] doesn't exist for: ${i}. Please make sure to select a default variant in Input Data for this project`}),a.lookDetails.default=null)}}),Gt.info("PRODUCT DATA: ",t),Gd.setState({inventoryData:n}),r({productData:t})},setCategoryData:t=>{const{productData:n}=e();t.geometryVariants!==void 0&&t.geometryVariants.map(i=>{i.defaultVariant===void 0&&Object.keys(i.variants).length>0&&(i.defaultVariant=Object.keys(i.variants)[0])}),t.color!==void 0&&t.color.map(i=>{(i.defaultLook===void 0&&i.looks.length>0||!i.looks.includes(i.defaultLook))&&(i.defaultLook=i.looks[0])}),r({categoryData:t}),t.build!==void 0&&t.build.map(i=>{i.skus.map(a=>{n[a].categoryID=i.categoryID,n[a].categoryLabel=i.label,n[a].swappable=i.swappable?i.swappable:!1,n[a].replace=i.replace})})},getProductDataById:t=>{const{productData:n}=e();let i=null;return n[t]&&(i=n[t]),i},setLookData:t=>r({lookData:t}),setHotspotsData:t=>{const{categoryData:n,productData:i}=e();n.geometryVariants&&Object.keys(t).map(a=>{t[a].map(s=>{s.geometryVariantID&&n.geometryVariants.map(o=>{Object.keys(o.variants).map(l=>{s.geometryVariantID==l&&o.productsInCategory.map(u=>{let f=null;u.products.map(h=>{t.hasOwnProperty(h)&&(f=t[h])}),u.products.map(h=>{t.hasOwnProperty(h)||(t[h]=f)})})})})})}),r({hotspotsData:t})},setEndpoints:t=>{r({endpoints:t}),pUe(t)},setAssetsData:t=>r({assetsData:t})}})),Ln=HUe,VUe=Do((r,e)=>({defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:t=>{r(n=>({envMapUrl:t}))},processLookEnvMapOverride:t=>{const{envMapUrl:n,defaultEnvMapUrl:i,actions:a}=e(),s=Ln.getState().lookData[t],o=s?.envMapOverride;if(!s||!o){a.setEnvLightMap(i);return}if(o===n){Gt.info(`New Env Map Url is the same as the current ${o}`);return}a.setEnvLightMap(o)}}})),tT=VUe,jUe=()=>{const[r,e]=oe.useState(!1),t=Ln(s=>s),n=tT(s=>s),[i,a]=oe.useState(1);return oe.useEffect(()=>{const s=t.assetsData,o=s?.sceneMoodSettings?.envMap;o&&(tT.setState({defaultEnvMapUrl:o}),n.actions.setEnvLightMap(o)),n.envMapUrl===""&&n.actions.setEnvLightMap(tT.getState().defaultEnvMapUrl);const l=s?.sceneMoodSettings?.ambientLightIntensity;l!==void 0&&a(l),e(!0)},[]),oe.useEffect(()=>{r!==!1&&(Gt.groupCollapsed("SCENE LIGHTING INFO:"),Gt.table({title:"Scene Lights",details:{"Environment Map":n.envMapUrl,"Ambient Light Intensity":i}}),Gt.groupEnd())},[r]),ne(fi,{children:r===!0&&ne("group",{name:"GRP_LIGHTS",children:[ne("ambientLight",{intensity:i},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:70,columnNumber:11},globalThis),ne(aUe,{background:!1,files:nt.getResolvedAssetUrl(n.envMapUrl)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:71,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:69,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:67,columnNumber:5},globalThis)};function QUe(r,e,t){return Math.max(e,Math.min(r,t))}const ea={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function W$(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function Y$(r,e,t,n=.15){return n===0?QUe(r,e,t):r<e?-W$(e-r,t-e,n)+e:r>t?+W$(r-t,t-e,n)+t:r}function WUe(r,[e,t],[n,i]){const[[a,s],[o,l]]=r;return[Y$(e,a,s,n),Y$(t,o,l,i)]}function us(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function q$(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ta(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?q$(Object(t),!0).forEach(function(n){us(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):q$(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}const Cie={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function X$(r){return r?r[0].toUpperCase()+r.slice(1):""}const YUe=["enter","leave"];function qUe(r=!1,e){return r&&!YUe.includes(e)}function XUe(r,e="",t=!1){const n=Cie[r],i=n&&n[e]||e;return"on"+X$(r)+X$(i)+(qUe(t,i)?"Capture":"")}const $Ue=["gotpointercapture","lostpointercapture"];function KUe(r){let e=r.substring(2).toLowerCase();const t=!!~e.indexOf("passive");t&&(e=e.replace("passive",""));const n=$Ue.includes(e)?"capturecapture":"capture",i=!!~e.indexOf(n);return i&&(e=e.replace("capture","")),{device:e,capture:i,passive:t}}function ZUe(r,e=""){const t=Cie[r],n=t&&t[e]||e;return r+n}function rB(r){return"touches"in r}function Mie(r){return rB(r)?"touch":"pointerType"in r?r.pointerType:"mouse"}function JUe(r){return Array.from(r.touches).filter(e=>{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function eBe(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Rie(r){return rB(r)?eBe(r)[0]:r}function GH(r,e){const t=e.clientX-r.clientX,n=e.clientY-r.clientY,i=(e.clientX+r.clientX)/2,a=(e.clientY+r.clientY)/2,s=Math.hypot(t,n);return{angle:-(Math.atan2(t,n)*180)/Math.PI,distance:s,origin:[i,a]}}function tBe(r){return JUe(r).map(e=>e.identifier)}function $$(r,e){const[t,n]=Array.from(r.touches).filter(i=>e.includes(i.identifier));return GH(t,n)}function AG(r){const e=Rie(r);return rB(r)?e.identifier:e.pointerId}function RT(r){const e=Rie(r);return[e.clientX,e.clientY]}const K$=40,Z$=800;function Iie(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=K$,t*=K$):n===2&&(e*=Z$,t*=Z$),[e,t]}function nBe(r){var e,t;const{scrollX:n,scrollY:i,scrollLeft:a,scrollTop:s}=r.currentTarget;return[(e=n??a)!==null&&e!==void 0?e:0,(t=i??s)!==null&&t!==void 0?t:0]}function iBe(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:a}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:a})}return e}function KL(r,...e){return typeof r=="function"?r(...e):r}function rBe(){}function aBe(...r){return r.length===0?rBe:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function J$(r,e){return Object.assign({},e,r||{})}const sBe=32;class Nie{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?KL(n.from,t):t.offset,t.offset=t.lastOffset),t.startTime=t.timeStamp=e.timeStamp}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let a=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,iBe(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,a=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const R=t._delta.map(Math.abs);ea.addTo(t._distance,R)}this.axisIntent&&this.axisIntent(e);const[s,o]=t._movement,[l,u]=n.threshold,{_step:f,values:h}=t;if(n.hasCustomTransform?(f[0]===!1&&(f[0]=Math.abs(s)>=l&&h[0]),f[1]===!1&&(f[1]=Math.abs(o)>=u&&h[1])):(f[0]===!1&&(f[0]=Math.abs(s)>=l&&Math.sign(s)*l),f[1]===!1&&(f[1]=Math.abs(o)>=u&&Math.sign(o)*u)),t.intentional=f[0]!==!1||f[1]!==!1,!t.intentional)return;const p=[0,0];if(n.hasCustomTransform){const[R,N]=h;p[0]=f[0]!==!1?R-f[0]:0,p[1]=f[1]!==!1?N-f[1]:0}else p[0]=f[0]!==!1?s-f[0]:0,p[1]=f[1]!==!1?o-f[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(p);const m=t.offset,y=t._active&&!t._blocked||t.active;y&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=KL(n.bounds,t)),this.setup&&this.setup()),t.movement=p,this.computeOffset()));const[E,b]=t.offset,[[v,x],[S,_]]=t._bounds;t.overflow=[E<v?-1:E>x?1:0,b<S?-1:b>_?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const w=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=WUe(t._bounds,t.offset,w),t.delta=ea.sub(t.offset,m),this.computeMovement(),y&&(!t.last||a>sBe)){t.delta=ea.sub(t.offset,m);const R=t.delta.map(Math.abs);ea.addTo(t.distance,R),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&a>0&&(t.velocity=[R[0]/a,R[1]/a])}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(Ta(Ta(Ta({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function oBe([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class jI extends Nie{constructor(...e){super(...e),us(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=ea.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=ea.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Mie(e)]:n.axisThreshold;t.axis=oBe(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const lBe=r=>r,eK=.15,Die={enabled(r=!0){return r},eventOptions(r,e,t){return Ta(Ta({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[eK,eK];case!1:return[0,0];default:return ea.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return ea.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||lBe},threshold(r){return ea.toVector(r,0)}},cBe=0,zb=Ta(Ta({},Die),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=cBe){return r},bounds(r={}){if(typeof r=="function")return a=>zb.bounds(r(a));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),CP=10,tK={ArrowRight:(r=1)=>[CP*r,0],ArrowLeft:(r=1)=>[-CP*r,0],ArrowUp:(r=1)=>[0,-CP*r],ArrowDown:(r=1)=>[0,CP*r]};class uBe extends jI{constructor(...e){super(...e),us(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=zb.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=AG(e),n._pointerActive=!0,this.computeValues(RT(e)),this.computeInitial(),t.preventScrollAxis&&Mie(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive||t.type===e.type&&e.timeStamp===t.timeStamp)return;const i=AG(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const a=RT(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=ea.sub(a,t._values),this.computeValues(a)),ea.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=AG(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[a,s]=t._distance;if(t.tap=a<=n.tapsThreshold&&s<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[o,l]=t.direction,[u,f]=t.velocity,[h,p]=t.movement,[m,y]=n.swipe.velocity,[E,b]=n.swipe.distance,v=n.swipe.duration;t.elapsedTime<v&&(Math.abs(u)>m&&Math.abs(h)>E&&(t.swipe[0]=o),Math.abs(f)>y&&Math.abs(p)>b&&(t.swipe[1]=l))}this.emit()}pointerClick(e){this.state.tap||(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,hBe(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=tK[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(i),n._keyboardActive=!0,ea.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in tK&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this)),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function hBe(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const QI=typeof window<"u"&&window.document&&window.document.createElement;function fBe(){return QI&&"ontouchstart"in window}function nK(){return fBe()||QI&&window.navigator.maxTouchPoints>1}function dBe(){return QI&&"onpointerdown"in window}function pBe(){return QI&&"exitPointerLock"in window.document}function mBe(){try{return"constructor"in GestureEvent}catch{return!1}}const $u={isBrowser:QI,gesture:mBe(),touch:nK(),touchscreen:nK(),pointer:dBe(),pointerLock:pBe()},gBe=250,vBe=180,yBe=.5,ABe=50,bBe=250,iK={mouse:0,touch:0,pen:8},_Be=Ta(Ta({},zb),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&$u.pointerLock,$u.touch&&t?"touch":this.pointerLock?"mouse":$u.pointer&&!i?"pointer":$u.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?gBe:void 0,!(!$u.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1}={}}){return this.pointerButtons=n,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const a=ea.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,a},swipe({velocity:r=yBe,distance:e=ABe,duration:t=bBe}={}){return{velocity:this.transform(ea.toVector(r)),distance:this.transform(ea.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return vBe;case!1:return 0;default:return r}},axisThreshold(r){return r?Ta(Ta({},iK),r):iK}}),EBe=30,SBe=100;class xBe extends Nie{constructor(...e){super(...e),us(this,"ingKey","pinching"),us(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:n}=this.state;e==="wheel"?this.state.offset=ea.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,n]=e._movement;if(!e.axis){const i=Math.abs(t)*EBe-Math.abs(n);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(a=>n.has(a))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);const i=$$(e,t._touchIds);this.pinchStart(e,i)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,n=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(n.keys()).every(s=>i.has(s))||(n.size<2&&n.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const a=GH(...Array.from(n.values()));this.pinchStart(e,a)}pinchStart(e,t){const n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=$$(e,this.state._touchIds);this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const n=GH(...Array.from(t.values()));this.pinchMove(e,n)}pinchMove(e,t){const n=this.state,i=n._values[1],a=t.angle-i;let s=0;Math.abs(a)>270&&(s+=Math.sign(a)),this.computeValues([t.distance,t.angle-360*s]),n.origin=t.origin,n.turns=s,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=ea.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&!e[t]||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const n=this.state;n._delta=[-Iie(e)[1]/SBe*n.offset[0],0],ea.addTo(n._movement,n._delta),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t?(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this))):e("wheel","",this.wheel.bind(this),{passive:!1})}}const TBe=Ta(Ta({},Die),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!$u.touch&&$u.gesture)return"gesture";if($u.touch&&n)return"touch";if($u.touchscreen){if($u.pointer)return"pointer";if($u.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=s=>{const o=J$(KL(t,s),{min:-1/0,max:1/0});return[o.min,o.max]},a=s=>{const o=J$(KL(n,s),{min:-1/0,max:1/0});return[o.min,o.max]};return typeof t!="function"&&typeof n!="function"?[i(),a()]:s=>[i(s),a(s)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",ea.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r}});class wBe extends jI{constructor(...e){super(...e),us(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(RT(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=RT(e),n=this.state;n._delta=ea.sub(t,n._values),ea.addTo(n._movement,n._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const CBe=Ta(Ta({},zb),{},{mouseOnly:(r=!0)=>r});class MBe extends jI{constructor(...e){super(...e),us(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,n=nBe(e);t._delta=ea.sub(n,t._values),ea.addTo(t._movement,t._delta),this.computeValues(n),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const RBe=zb;class IBe extends jI{constructor(...e){super(...e),us(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=Iie(e),ea.addTo(t._movement,t._delta);const[n,i]=t.overflow,[a,s]=t._delta,[o,l]=t._direction;(n<0&&a>0&&o<0||n>0&&a<0&&o>0)&&(t._movement[0]=t._movementBound[0]),(i<0&&s>0&&l<0||i>0&&s<0&&l>0)&&(t._movement[1]=t._movementBound[1]),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const NBe=zb;class DBe extends jI{constructor(...e){super(...e),us(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(RT(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const n=RT(e);t._movement=t._delta=ea.sub(n,t._values),this.computeValues(n),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const OBe=Ta(Ta({},zb),{},{mouseOnly:(r=!0)=>r}),s8=new Map,HH=new Map;function PBe(r){s8.set(r.key,r.engine),HH.set(r.key,r.resolver)}const LBe={key:"drag",engine:uBe,resolver:_Be},UBe={key:"hover",engine:DBe,resolver:OBe},BBe={key:"move",engine:wBe,resolver:CBe},kBe={key:"pinch",engine:xBe,resolver:TBe},FBe={key:"scroll",engine:MBe,resolver:RBe},zBe={key:"wheel",engine:IBe,resolver:NBe};function GBe(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function HBe(r,e){if(r==null)return{};var t=GBe(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const VBe={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=$u.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},jBe=["target","eventOptions","window","enabled","transform"];function hL(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=hL(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function QBe(r,e){const t=r,{target:n,eventOptions:i,window:a,enabled:s,transform:o}=t,l=HBe(t,jBe),u={shared:hL({target:n,eventOptions:i,window:a,enabled:s,transform:o},VBe)};if(e){const f=HH.get(e);u[e]=hL(Ta({shared:u.shared},l),f)}else for(const f in l){const h=HH.get(f);h&&(u[f]=hL(Ta({shared:u.shared},l[f]),h))}return u}class Oie{constructor(e,t){us(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,a){const s=this._listeners,o=ZUe(t,n),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},u=Ta(Ta({},l),a);e.addEventListener(o,i,u);const f=()=>{e.removeEventListener(o,i,u),s.delete(f)};return s.add(f),f}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class WBe{constructor(){us(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class YBe{constructor(e){us(this,"gestures",new Set),us(this,"_targetEventStore",new Oie(this)),us(this,"gestureEventStores",{}),us(this,"gestureTimeoutStores",{}),us(this,"handlers",{}),us(this,"config",{}),us(this,"pointerIds",new Set),us(this,"touchIds",new Set),us(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),qBe(this,e)}setEventIds(e){if(rB(e))return this.touchIds=new Set(tBe(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=QBe(e,t)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const s of this.gestures){const o=this.config[s],l=rK(n,o.eventOptions,!!i);if(o.enabled){const u=s8.get(s);new u(this,e,s).bind(l)}}const a=rK(n,t.eventOptions,!!i);for(const s in this.nativeHandlers)a(s,"",o=>this.nativeHandlers[s](Ta(Ta({},this.state.shared),{},{event:o,args:e})),void 0,!0)}for(const a in n)n[a]=aBe(...n[a]);if(!i)return n;for(const a in n){const{device:s,capture:o,passive:l}=KUe(a);this._targetEventStore.add(i,s,"",n[a],{capture:o,passive:l})}}}}function Sx(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Oie(r,e),r.gestureTimeoutStores[e]=new WBe}function qBe(r,e){e.drag&&Sx(r,"drag"),e.wheel&&Sx(r,"wheel"),e.scroll&&Sx(r,"scroll"),e.move&&Sx(r,"move"),e.pinch&&Sx(r,"pinch"),e.hover&&Sx(r,"hover")}const rK=(r,e,t)=>(n,i,a,s={},o=!1)=>{var l,u;const f=(l=s.capture)!==null&&l!==void 0?l:e.capture,h=(u=s.passive)!==null&&u!==void 0?u:e.passive;let p=o?n:XUe(n,i,f);t&&h&&(p+="Passive"),r[p]=r[p]||[],r[p].push(a)},XBe=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function $Be(r){const e={},t={},n=new Set;for(let i in r)XBe.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function xx(r,e,t,n,i,a){if(!r.has(t)||!s8.has(n))return;const s=t+"Start",o=t+"End",l=u=>{let f;return u.first&&s in e&&e[s](u),t in e&&(f=e[t](u)),u.last&&o in e&&e[o](u),f};i[n]=l,a[n]=a[n]||{}}function KBe(r,e){const[t,n,i]=$Be(r),a={};return xx(i,t,"onDrag","drag",a,e),xx(i,t,"onWheel","wheel",a,e),xx(i,t,"onScroll","scroll",a,e),xx(i,t,"onPinch","pinch",a,e),xx(i,t,"onMove","move",a,e),xx(i,t,"onHover","hover",a,e),{handlers:a,config:e,nativeHandlers:n}}function ZBe(r,e={},t,n){const i=Xa.useMemo(()=>new YBe(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),Xa.useEffect(i.effect.bind(i)),Xa.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function JBe(r){return r.forEach(PBe),function(t,n){const{handlers:i,nativeHandlers:a,config:s}=KBe(t,n||{});return ZBe(i,s,void 0,a)}}function Pie(r,e){return JBe([LBe,kBe,FBe,zBe,BBe,UBe])(r,e||{})}function e3e({children:r,guid:e,onDragStartHandler:t,onDragEndHandler:n,onItemClickHandler:i,onPointerEnter:a,onPointerLeave:s,dragging:o=!1,intersectingGhostObject:l=null,isInteractive:u=!0,initialIntersectedGhostUUID:f=null,isSnapAllowed:h=!1,...p}){const m=oe.useRef(),y=oe.useRef(-1),E=oe.useRef([]),b=oe.useRef([]),{raycaster:v,size:x,camera:S}=fs(),_=hi(W=>W.isAnyHotspotActive),w=Je(W=>W.multipleTouchDetected),[R,N]=oe.useState(null),{raycasterGhost:L}=oe.useMemo(()=>({raycasterGhost:new xy})),I=W=>{let V;return W.isGhost===!0?V=W:W.parent?W.parent.isGhost===!0?V=W.parent:V=I(W.parent):V=null,V},D=W=>{L.setFromCamera(W,S);const V=L.intersectObject(gr.getState().ghostParentRef);let $=null;return V.length>0&&($=I(V[0].object)),$},k=W=>{let V=W.whichNodesAreAttachedToUs();return V.map($=>{k($).map(pe=>{V.push(pe)})}),V},{initialMouse2D:F,mouse2D:U,mouse3D:z,offset:j,normal:Q,plane:H,pointerDownPos:K}=oe.useMemo(()=>({initialMouse2D:new Rt,mouse2D:new Rt,mouse3D:new ve,offset:new ve,normal:new ve,plane:new Sm,pointerDownPos:new Rt}),[]);oe.useEffect(()=>{let W=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(e);N(W)},[]);const J=Pie({onPointerEnter:W=>{w||Je.getState().sceneSettings.disableDragDrop&&Je.getState().sceneSettings.disableContextMenu||Je.getState().itemDraggedSkuID||Je.getState().cameraActive!==!0&&!Je.getState().dragging&&!_&&(R&&!R.isEndNode?nt.switchCursor(eo.POINTER):nt.switchCursor(eo.GRAB),a(W.event))},onPointerLeave:W=>{w||Je.getState().sceneSettings.disableDragDrop&&Je.getState().sceneSettings.disableContextMenu||Je.getState().itemDraggedSkuID||Je.getState().cameraActive!==!0&&!Je.getState().dragging&&!_&&(nt.switchCursor(eo.GRAB),s(W.event))},onClick:W=>{if(W.event.stopPropagation(),!w){if(Je.getState().builderMode){const{eventObject:V,point:$}=W.event;V.getWorldPosition(j).sub($),z.copy($);const re=W.event.offsetX,pe=W.event.offsetY,ue=re/x.width*2-1,ce=-pe/x.height*2+1;U.set(ue,ce);const ye=new xy;ye.setFromCamera(U,S);const Se=ye.intersectObject(Je.getState().sceneRef.getObjectByName("proxyGeometry"));Se.length>0&&nt.fireEvent(nt.EVENTS.CONFIGURATION.OnClickItem,{point:Se[0].point,camera:ye.camera})}if(!Je.getState().sceneSettings.disableContextMenu)if(!W.dragging&&!_){if(Math.abs(W.event.x-K.x)>1)return;i(W.event.offsetX,W.event.offsetY,e)}else hi.getState().actions.exitHotspot(!0)}},onDrag:async W=>{if(Je.getState().simulateDragEnd===!0||Je.getState().dragging&&Je.getState().draggingItemGUID!==R.guid||Je.getState().sceneSettings.disableDragDrop)return;const V=W.event;if(V.stopPropagation(),_){nt.switchCursor(eo.BLOCKED);return}if(Wt.getState().selectedItemData){nt.switchCursor(eo.BLOCKED);return}if(Object.keys(Wt.getState().itemsSpawned).length<2){nt.switchCursor(eo.BLOCKED);return}const re=W.event.offsetX,pe=W.event.offsetY;if(!Je.getState().dragging){if(Wt.setState({busy:!0}),Math.abs(V.x-K.x)<=1)return;if(R&&!R.canDrag){nt.switchCursor(eo.BLOCKED);return}const We=R.whichPlugAreWeAttachedUsing().attachedPlug.guid;let Fe=R.swapRoot();Fe||(Fe={rootDetachedPlugs:R.detachNodeFromReceiver()}),E.current=k(R),b.current=[],E.current.map(He=>{b.current.push(He.guid),R.ref.attach(He.ref)}),nt.switchCursor(eo.MOVE),Je.setState({dragging:!0}),Je.setState({draggingItemGUID:R.guid}),h=!1,l=null,f=null,y.current=-1;const ie=re/x.width*2-1,qe=-pe/x.height*2+1;F.set(ie,qe);const Me=await t({guid:e,node:R,detachedData:Fe,attachedChildrenGuids:b.current});if(Me.length<=0||Me.transforms===void 0)return;Me.transforms.map((He,Oe)=>{He.receiverPlugGUID===We&&(y.current=Oe)})}const ue=re/x.width*2-1,ce=-pe/x.height*2+1;U.set(ue,ce),v.setFromCamera(U,S),S.getWorldDirection(Q).negate(),H.setFromNormalAndCoplanarPoint(Q,z),v.ray.intersectPlane(H,z);const ye=gr.getState().ghostParentRef;ye.children.length>0&&(l=D(U),f===null&&y.current!==-1&&y.current<ye.children.length&&ye.children[y.current]!==void 0&&(f=ye.children[y.current].children[0].uuid),l&&f!==null&&f!==l.uuid&&!h&&(h=!0),!h&&!l&&(h=!0)),l&&h?(gr.setState({ghostVisibility:!1}),R.ref.position.set(l.position.x,l.position.y,l.position.z),R.ref.setRotationFromEuler(l.rotation)):(gr.setState({ghostVisibility:!0}),R.ref.position.copy(z).add(j)),(ue>1||ue<-1||ce<-1||ce>1)&&(Je.setState({simulateDragEnd:!0}),Je.setState({dragging:!1}),Je.setState({draggingItemGUID:null}),Wt.setState({busy:!1}),nt.switchCursor(eo.GRAB),n({node:R,intersectingGhostObject:l,attachedChildrenGuids:b.current,attachedNodesToCurrentNode:E.current}))},onDragStart:({event:W})=>{if(Je.setState({simulateDragEnd:!1}),w||Je.getState().sceneSettings.disableDragDrop&&Je.getState().sceneSettings.disableContextMenu)return;W.stopPropagation();const{eventObject:V,point:$}=W;V.getWorldPosition(j).sub($),z.copy($),K.set(W.x,W.y)},onDragEnd:({event:W})=>{Je.setState({simulateDragEnd:!1}),!(Je.getState().dragging&&Je.getState().draggingItemGUID!==R.guid)&&(Je.getState().sceneSettings.disableDragDrop&&Je.getState().sceneSettings.disableContextMenu||(W.stopPropagation(),Je.setState({dragging:!1}),Je.setState({draggingItemGUID:null}),Wt.setState({busy:!1}),nt.switchCursor(eo.GRAB),n({node:R,intersectingGhostObject:l,attachedChildrenGuids:b.current,attachedNodesToCurrentNode:E.current})))}});return ne(fi,{children:u?ne("group",{ref:m,...J(),...p,children:r},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:479,columnNumber:9},this):ne("group",{ref:m,...p,children:r},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:483,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:477,columnNumber:5},this)}const t3e=({modelData:r,clonedMesh:e,clonedProxyMesh:t,itemKey:n,scale:i,onItemClickHandler:a,onDragEndHandler:s,onDragStartHandler:o,stockAlert:l=!0})=>{const u=hi(Q=>Q),f=Wt(Q=>Q),h=Wt(Q=>Q.hoveredItemRef),p=oe.useRef(null),m=oe.useRef(null),y=oe.useRef([]),E=oe.useRef(null),[b,v]=oe.useState(e),[x,S]=oe.useState(t),_=oe.useRef(0),w=oe.useRef(0),{ref:R,actions:N,names:L}=KLe(r.data.animations),I=oe.useCallback((Q,H,K,J)=>n3e(Q,H,K,J,L,N),[L,N]),D=oe.useCallback(Q=>i3e(Q,L,N),[L,N]);oe.useEffect(()=>{if(p.current===n.itemData.guid){p.current=null;let Q=u.lastActiveHotspotData.hotspotData;if(!Q)return;if(Q.exitAnim?I(Q.exitAnim,!1,!1,!1):Q.entryAnim&&I(Q.entryAnim,!1,!0,!1),Q.activeAnim&&D(Q.activeAnim),u.activeHotspotData){if(n.itemData.guid===u.activeHotspotData.itemData.guid){p.current=n.itemData.guid;let H=u.activeHotspotData.hotspotData;if(!H)return;H.entryAnim&&I(H.entryAnim,!1,!1,!0),H.activeAnim&&I(H.activeAnim,!0,!1,!1)}}else return}else if(u.activeHotspotData){if(n.itemData.guid===u.activeHotspotData.itemData.guid){p.current=n.itemData.guid;let Q=u.activeHotspotData.hotspotData;if(!Q)return;Q.entryAnim&&I(Q.entryAnim,!1,!1,!0),Q.activeAnim&&I(Q.activeAnim,!0,!1,!1)}}else return},[u.activeHotspotData]),oe.useEffect(()=>{Je.getState().actions.triggerAutoFocus(),nt.fireEvent(nt.EVENTS.SCENE.Item_Added,{...n})},[]);const k=oe.useCallback(()=>{if(!R.current||(y.current=RUe(b,R.current.inStock),y.current.length==0))return;if(R.current.inStock===!1){l==!0&&(l=!1,nt.alert({alertMsg:"Some item(s) in configuration are out of stock",alertTime:7e3,alertType:"warn",alertLabel:"Stock Alert",persistant:!0,alertId:"outOfStock"}));return}const{current:Q}=w;for(let H=0;H<y.current.length;H++){const K=y.current[H].material;if(K.emissiveIntensity==Q)return;K.emissiveIntensity=Q}},[w,R]),F=oe.useCallback(()=>{_.current=0},[y]),U=oe.useCallback(()=>{_.current=.005},[y,b]);Zm(()=>{Je.getState().builderMode||(w.current=Mb.lerp(w.current,_.current,.1),k())}),oe.useEffect(()=>{const Q=ln.getState().attachmentSystem.currentStructure,H=Q.getNodeByGUID(n.itemData.guid);if(H?.isDependent&&!H.isInteractive&&Object.keys(h).length>0){const K=Q.getNodeByGUID(Object.keys(h)[0]);if(!K||!K.myDependenciesGUID)return;K.myDependenciesGUID.includes(n.itemData.guid)?F():U()}else h.hasOwnProperty(n.itemData.guid)||Object.keys(h).length==0?F():U()},[h]);const z=oe.useCallback(Q=>{Q.stopPropagation();const H=f.selectedItemData;Je.setState({canvasTooltipText:"-"+n.itemData.name+"-"}),H||Wt.setState({hoveredItemRef:{}});let K=Wt.getState().hoveredItemRef;K.hasOwnProperty(n.itemData.guid)||(K[n.itemData.guid]={instance:R.current},f.actions.setHoveredItemRef({...K}))},[f,h,m]),j=oe.useCallback(Q=>{Q.stopPropagation();const H=f.selectedItemData;if(Je.setState({canvasTooltipText:""}),H){if(H.itemData.guid==n.itemData.guid)return;h[n.itemData.guid]&&(delete h[n.itemData.guid],f.actions.setHoveredItemRef({...h}))}else Wt.setState({hoveredItemRef:{}})},[m,f,h]);return oe.useEffect(()=>{if(E.current)return f.collidersRef.push(E),f.actions.setCollidersRef([...f.collidersRef]),()=>{const Q=f.collidersRef.indexOf(E);Q>-1&&f.collidersRef.splice(Q,1),f.actions.setCollidersRef([...f.collidersRef])}},[E]),ne(fi,{children:[ne("primitive",{name:"GRP_RenderGeometry",ref:R,object:b,scale:i,inStock:!0},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:240,columnNumber:7},globalThis),(n.itemData.hasOwnProperty("disableCollider")?!n.itemData.disableCollider:!Je.getState().sceneSettings.disableCollider)&&ne("group",{name:"GRP_LoadingPlaceholder",children:ne("group",{position:n.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:ne(gie,{ref:E,scale:Vx(n.itemData.boundingBoxSize),visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:257,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:252,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:251,columnNumber:9},globalThis),r.proxy.isLoaded&&ne(e3e,{guid:n.itemData.guid,onDragStartHandler:o,onDragEndHandler:s,onItemClickHandler:a,onPointerEnter:z,onPointerLeave:j,name:"GRP_ProxyMesh",isInteractive:n.itemData.isInteractive,children:ne("primitive",{name:"proxyGeometry",object:x,scale:i,visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:277,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:267,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:239,columnNumber:5},globalThis)};function n3e(r,e,t,n,i,a){if(!i.includes(r))return;const s=a[r];s.setLoop(e?l6:o6),s.clampWhenFinished=!e,n&&s.reset(),t?s.fadeOut(.5).play():s.fadeIn(.5).play()}function i3e(r,e,t){if(!e.includes(r))return;t[r].stop()}function r3e({distanceFactor:r,position:e,proxymodel:t,scale:n}){return ne("primitive",{position:[0,0,0],name:"proxyLoader",object:t,scale:n,visible:!0,wireframe:!0,children:ne(OR,{center:!0,position:e,distanceFactor:r,zIndexRange:[29,0],children:ne("img",{alt:"Loading...",draggable:"false",src:Om+"/Animation/Loading.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:32,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:25,columnNumber:7},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:17,columnNumber:5},this)}function a3e({proxymodel:r,itemKey:e,scale:t}){return oe.useEffect(()=>{ln.getState().actions.updateFittingSkuIds()},[]),ne("group",{children:[(e.itemData.hasOwnProperty("disableCollider")?!e.itemData.disableCollider:!Je.getState().sceneSettings.disableCollider)&&ne("group",{name:"GRP_LoadingPlaceholder",children:ne("group",{position:e.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:ne(gie,{scale:Vx(e.itemData.boundingBoxSize),visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:65,columnNumber:13},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:60,columnNumber:11},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:59,columnNumber:9},this),ne("group",{name:"GRP_ProxyMesh",children:ne("primitive",{name:"proxyGeometry",object:r.clone(),scale:t,visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:73,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:72,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:55,columnNumber:5},this)}const s3e=({position:r,rotation:e,itemKey:t,scale:n,rejectFunc:i,onItemClickHandler:a,onDragEndHandler:s,onDragStartHandler:o,itemIndex:l,proxyScene:u})=>{const f=Je(x=>x.sceneRef),h=Mo(x=>x),[p,m]=oe.useState(null),[y,E]=oe.useState(u.clone()),b=oe.useRef(null);oe.useEffect(()=>((async()=>{let x=await h.actions.loadAsset(t.itemData.skuID).catch((w,R)=>{i(w,R,t.itemData.guid)});if(!x||!x.data){m({data:null,clonedMesh:null,mainModelReady:!1});return}let S=x.data,_;t.itemData.replace===!0?_=S.scene:_=S.scene.clone(),t.itemData.clonedScene=_,S.functions&&(S.functions.copyVariantMaterials(_,S.scene),await v(S,_)),Gt.info({title:"model loaded: "+t.itemData.skuID}),t.itemData.hasItemLoaded=!0,Wt.getState().actions.triggerModelLoaded(),nt.fireEvent(nt.EVENTS.SCENE.Model_Loaded,t.itemData.skuID),m({data:x,clonedMesh:_,mainModelReady:!0})})(),()=>{nt.fireEvent(nt.EVENTS.SCENE.Model_Removed,t.itemData.skuID)}),[]);const v=oe.useCallback(async(x,S)=>{const _=ln.getState().attachmentSystem;var w=_.currentStructure.getNodeByGUID(t.itemData.guid);if(!w)return;let R="";if(w.overrideVariant)R=w.overrideVariant,nt.fireEvent(nt.EVENTS.SCENE.MaterialOverrides_Exists,!0);else{const N=_.globalVariants;if(!N||N.Count<=0)return;let L=[];Object.keys(N).map((I,D)=>{L.push(N[I])}),t.itemData.looks?.map(I=>{L.includes(I)&&(R=I)}),R||(R=t.itemData.looks[0])}return R&&(w.currentVariant=R,await x.functions.selectVariant(S,R),Wt.setState({variantChangeAlert:!Wt.getState().variantChangeAlert})),R},[]);return oe.useEffect(()=>{if(!b.current)return;const x=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(t.itemData.guid);x&&p!==null?(x.ref=b.current,x.transform={position:r,rotation:e},ln.getState().actions.updateFittingSkuIds()):Gt.warn({title:t.itemData.guid})},[b,p]),oe.useEffect(()=>{if(b.current&&f&&t.itemData.hasOwnProperty("excludeFromSceneBounds")&&t.itemData.excludeFromSceneBounds){const x=f.getObjectByName("#GRP_EXCLUDED");x!==void 0&&x.attach(b.current)}},[f,b]),ne("group",{ref:b,position:r,quaternion:e,name:`GRP_${t.itemData.name}_`+l.toString().padStart(2,"0"),children:[p!==null&&(p.mainModelReady?ne(t3e,{modelData:p.data,clonedMesh:p.clonedMesh,clonedProxyMesh:y,itemKey:t,scale:n,onDragStartHandler:o,onDragEndHandler:s,onItemClickHandler:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:264,columnNumber:11},globalThis):ne(a3e,{itemKey:t,proxymodel:y,scale:n},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:275,columnNumber:11},globalThis)),p==null&&y&&ne(r3e,{proxymodel:y,distanceFactor:t.itemData.boundingBoxSize.x*4>1?1:t.itemData.boundingBoxSize.x*4,position:t.itemData.boundingSphereCenter,scale:n},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:283,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:254,columnNumber:5},globalThis)};function o3e({index:r,children:e,...t}){const n=oe.useRef(),i=Pie({onPointerEnter:a=>{a.event.stopPropagation(),Je.getState().itemDraggedSkuID&&Je.setState({hoveredGhostIndex:r})},onPointerLeave:a=>{a.event.stopPropagation(),Je.getState().itemDraggedSkuID&&Je.setState({hoveredGhostIndex:-1})}});return ne("group",{ref:n,...i(),...t,children:e},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/GhostEventHandler.js",lineNumber:22,columnNumber:5},this)}const l3e=({ghostData:r,ghostTransform:e,index:t})=>{const n=oe.useRef(),i=oe.useMemo(()=>r.proxyScene.clone(),[r]),a=Je(o=>o.hoveredGhostIndex),s=new Yt(.6,.98,0);return oe.useEffect(()=>{const{current:o}=n;o&&(o.userData.incomingPlugName=e.incomingPlugName,o.userData.receiverPlugName=e.receiverPlugName,o.userData.incomingPlugGUID=e.incomingPlugGUID,o.userData.receiverPlugGUID=e.receiverPlugGUID,nt.fireEvent(nt.EVENTS.SCENE.Ghost_Loaded,{ghostData:r,ghostTransform:e}))},[n]),oe.useEffect(()=>{if(!i||!Je.getState().itemDraggedSkuID)return;let o;a===t?o=s:o=Je.getState().sceneSettings.ghostThreeColor,i.traverse(l=>{l.isMesh===!0&&(l.material=l.material.clone(),l.material.emissive=o)})},[a,i]),ne(fi,{children:ne(o3e,{index:t,children:ne("primitive",{isGhost:!0,ref:n,index:t,position:e.position,quaternion:e.rotation,object:i,castShadow:!1,receiveShadow:!1,frustumCulled:!1},`ghost${t}`,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:59,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:58,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:57,columnNumber:5},globalThis)},c3e=({intersectingGhostObject:r=null})=>{const{camera:e}=fs(),t=gr(l=>l.ghostVisibility),n=gr(l=>l.ghostData),i=gr(l=>l.ghostsTransform),a=oe.useRef(),{_touch2D:s}=oe.useMemo(()=>({_touch2D:new Rt}),[]);oe.useEffect(()=>{const{current:l}=a;l&&gr.setState({ghostParentRef:l})},[a]);const o=l=>{let u=0,f=0;if(l.touches&&l.touches[0])u=l.touches[0].clientX,f=l.touches[0].clientY;else return;if(!Je.getState().itemDraggedSkuID)return;const h=Je.getState().cursorParentRef,p=Je.getState().canvasSize;if(!h)return;const m=h.getBoundingClientRect(),y=m.top,E=m.left,b=(u-E)/p.width*2-1,v=(-f+y)/p.height*2+1;s.set(b,v);const x=new xy;x.setFromCamera(s,e);const S=x.intersectObject(gr.getState().ghostParentRef);S.length>0?(r=S[0].object,Je.setState({hoveredGhostIndex:r.parent.index})):(r=null,Je.setState({hoveredGhostIndex:-1}))};return oe.useEffect(()=>{window.addEventListener("touchmove",o,!1),Gt.info({title:"Ghost Manager Mounted!"})},[]),ne("group",{name:"#GRP_GhostParent",visible:t,ref:a,children:n&&ne(fi,{children:i.map((l,u)=>u<n.count&&ne(l3e,{ghostData:n,ghostTransform:l,index:u},"ghosts"+u,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:89,columnNumber:17},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:85,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:79,columnNumber:5},globalThis)},u3e=()=>{const r=ln(L=>L.attachmentSystem),e=ln(L=>L),t=Wt(L=>L.removeItemTrigger),n=Wt(L=>L.variantChangeAlert),i=hi(L=>L),a=Je(L=>L.showDimensions);Je(L=>L.sceneSettings);const s=Wt(L=>L),o=Wt(L=>L.lastDeletedItemData),l=Cr(L=>L),u=Wt(L=>L.selectedItemData),f=Wt(L=>L.itemsSpawned),h=oe.useRef(null),p=oe.useRef(null),m=oe.useRef(!1),y=oe.useRef(null),E=oe.useRef(null),b=oe.useRef(!1),v=oe.useRef(!1);oe.useRef(!1),oe.useRef(!1);const x=oe.useCallback(({guid:L,node:I,detachedData:D,attachedChildrenGuids:k})=>{if(m.current!==!0)return m.current=!0,Cr.setState({canCameraRotate:!1}),i.actions.switchHotspotsVisibility(!1,!0),y.current={position:I.ref.position.clone(),rotation:I.ref.rotation.clone()},E.current=D,r.currentStructure.removeNodeFromStructure(I),k.length<=0&&(k=!1),gr.getState().actions.spawnGhostsForSkuID(f[L].itemData.skuID,k)},[l,f]),S=oe.useCallback(({node:L,intersectingGhostObject:I,attachedChildrenGuids:D,attachedNodesToCurrentNode:k})=>{if(!m.current)return;m.current=!1,Cr.setState({canCameraRotate:!0}),i.actions.switchHotspotsVisibility(!0,!0);function F(){L.ref.position.set(0,0,0),gr.getState().actions.clearAllGhosts()}if(!gr.getState().ghostData?.connectablePlugs){F();return}r.currentStructure.addNode(L);let z=null,j=null,Q=!1,H=[],K={};if(Je.getState().sceneSettings.ignoreCollisionPostDragging===!1&&D.map((J,W)=>{H[W]=r.currentStructure.checkCollisionforGUID(J),H[W]&&(K[J]=f[J])}),H.map(J=>{Q||(Q=J)}),I&&Q){Je.setState({draggingOnDropCollisionData:{node:L,attachedChildrenGuids:D,collidingStatus:H,intersectingGhostObject:I,initPosition:y.current.position,initRotation:y.current.rotation,detachedPlugs:E.current,attachedNodesToCurrentNode:k}}),L.ref.position.set(I.position.x,I.position.y,I.position.z),L.ref.setRotationFromEuler(I.rotation),nt.fireEvent(nt.EVENTS.SCENE.DraggingOnDrop_CollsionDetected,K);return}if(I){const J=I.userData;z=L.getPlugByName(J.incomingPlugName),j=r.currentStructure.getPlugByGUID(J.receiverPlugGUID),L.ref.position.set(I.position.x,I.position.y,I.position.z),L.ref.setRotationFromEuler(I.rotation),L.transform={position:I.position,rotation:I.quaternion}}else{const J=E.current.neighbourDetachedPlugs;J&&(E.current.neighbourNode.detachNodeFromReceiver(),r.currentStructure.connectPlugs({incomingPlug:J.incomingPlug,receiverPlug:J.receiverPlug})),z=E.current.rootDetachedPlugs.incomingPlug,j=E.current.rootDetachedPlugs.receiverPlug,L.ref.position.set(y.current.position.x,y.current.position.y,y.current.position.z),L.ref.setRotationFromEuler(y.current.rotation);let W=new $i().identity();L.ref.getWorldQuaternion(W),L.transform={position:y.current.position,rotation:W}}r.currentStructure.connectPlugs({incomingPlug:z,receiverPlug:j}),gr.getState().actions.clearAllGhosts(),Wt.getState().actions.deselectItem(),k.map(J=>{L.ref.parent.attach(J.ref)}),ln.getState().actions.updateFittingSkuIds()},[l,Je,gr,r,e,f]),_=oe.useCallback((L,I,D)=>{if(Je.getState().sceneSettings.disableContextMenu)return;const k=ln.getState().attachmentSystem.currentStructure,F=k.getNodeByGUID(D);let U=[];if(!F.myDependenciesGUID)return;F.myDependenciesGUID.map(Q=>{const H=k.getNodeByGUID(Q);let K={guid:Q,name:f[Q].itemData.guid,data:{...f[Q],overrideVariant:H.overrideVariant,currentVariant:H.currentVariant,offsetX:L,offsetY:I}};U.push(K)}),U.sort((Q,H)=>Q.name>H.name?1:H.name>Q.name?-1:0);let z=Gd.getState().inventoryData[f[D].itemData.skuID];const j={primary:{guid:D,name:f[D].itemData.name,data:{inventory:z,...f[D],overrideVariant:F.overrideVariant,currentVariant:F.currentVariant,offsetX:L,offsetY:I}},dependencies:U};s.actions.setSelectedItemData(j.primary.data),nt.fireEvent(nt.EVENTS.UI.ContextMenu_Show,j)},[f]),w=oe.useCallback(L=>{L&&(Wt.setState({lastDeletedItemData:{...f[L]}}),nt.fireEvent(nt.EVENTS.SCENE.Item_Removed,{...f[L]}),delete f[L],s.actions.setItemsSpawned({...f}))},[s,Wt,f]);oe.useEffect(()=>{let L=Wt.getState().removeItems;if(L.length<=0&&!o)return;let I=L.pop();w(I)},[t,o]);const R=oe.useCallback(function(L,I){const D=L>0,k=L<=0;Gt.groupCollapsed("Resolving buttons visibility"),Gt.table({sceneIsEmpty:k,sceneIsNotEmpty:D}),Gt.groupEnd(),I.showViewInYourSpaceBtn===!0&&(D&&b.current===!1?(nt.fireEvent(nt.EVENTS.UI.ViewInYourSpaceButton_Show),b.current=!0):k&&b.current===!0&&(nt.fireEvent(nt.EVENTS.UI.ViewInYourSpaceButton_Hide),b.current=!1)),I.showShareBtn===!0&&(D&&v.current===!1?(nt.fireEvent(nt.EVENTS.UI.ShareButton_Show),v.current=!0):k&&v.current===!0&&(nt.fireEvent(nt.EVENTS.UI.ShareButton_Hide),v.current=!1))},[f]);oe.useEffect(()=>{nt.fireEvent(nt.EVENTS.SCENE.Items_Updated,{itemsSpawned:f});const L=Je.getState().sceneSettings;R(Object.keys(f).length,L),Object.keys(f).length==0?Je.setState({canvasTooltipText:L.textSettings.tooltipEmptySceneText}):Object.keys(f).length==1&&Je.setState({canvasTooltipText:L.textSettings.tooltipInstructionText})},[f]),oe.useEffect(()=>{const L=ln.getState().attachmentSystem;if(!L)return;Gd.getState().actions.refreshInventory(f);const I=L.getCartItems();nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,I),nt.fireEvent(nt.EVENTS.SCENE.ReplaceableCategory_Updated,L.currentStructure.getCurrentItemsInReplaceableCategory())},[f,n]);const N=oe.useCallback((L,I,D)=>{nt.removeItemByGUID(D),nt.alert({alertMsg:I+": "+L,alertTime:5e3,alertType:"error",alertLabel:"Error",persistant:!0})},[]);return oe.useEffect(()=>{const{current:L}=p;L&&ln.setState({colliderMeshRef:L})},[p]),oe.useEffect(()=>{const{current:L}=h;L&&Je.setState({sceneRef:L})},[h]),oe.useEffect(()=>{let L=u?Cr.getState().cameraSettings.zoomingMultiplier:Cr.getState().cameraSettings.zoomingMultiplier+.1;L+=a?.3:.1,Cr.setState({boundsMargin:L}),Je.getState().actions.triggerAutoFocus()},[a,u]),oe.useEffect(()=>{Gt.info({title:"item Manager mounted"}),Je.getState().preconfigurationLoaded||ln.getState().actions.loadDefaultStructure()},[]),ne(fi,{children:[ne("group",{name:"Scene",ref:h,onPointerMissed:()=>{u&&s.actions.deselectItem(),hi.getState().isAnyHotspotActive&&hi.getState().actions.exitHotspot()},children:[lUe,ne("group",{name:"#GRP_EXCLUDED"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:466,columnNumber:9},globalThis),ne("group",{name:"#ITEMSANDGHOSTS",children:[ne("group",{name:"#ITEMS",children:Object.keys(f).map((L,I)=>ne(s3e,{scale:[1,1,1],onDragStartHandler:x,onDragEndHandler:S,onItemClickHandler:_,itemKey:f[L],position:f[L].itemData.position,rotation:f[L].itemData.rotation,itemIndex:I,proxyScene:f[L].itemData.proxyScene,rejectFunc:N},L,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:470,columnNumber:15},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:468,columnNumber:11},globalThis),ne(c3e,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:485,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:467,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:456,columnNumber:7},globalThis),ne("group",{name:"#Parent_ColliderMesh",children:ne("mesh",{ref:p,visible:!1,enabled:!0,name:"#COLLIDER_MESH",children:ne("meshPhongMaterial",{depthTest:!1,transparent:!0,opacity:.8},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:495,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:489,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:488,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:455,columnNumber:5},globalThis)},h3e=({...r})=>{const[e,t]=oe.useState(10),n=Je(a=>a.bbox),i=Je(a=>a.sceneSettings);return oe.useEffect(()=>{if(!n||!n.isBox3){t(10);return}const a=new ve(0,0,0);let s=a.distanceTo(n.min)*2,o=a.distanceTo(n.max)*2,l=o>s?o:s;l!=1/0&&l!=-1/0&&(l+=5,t(l||10))},[n]),ne(fi,{children:i.contactShadowVisibility&&ne(sUe,{rotation:[Math.PI/2,0,0],position:[0,0,0],opacity:.3,scale:e,blur:1,far:5,resolution:512},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/EffectsComposer.js",lineNumber:32,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/EffectsComposer.js",lineNumber:30,columnNumber:5},globalThis)};function f3e({hotspotKey:r}){const e=ln(v=>v.attachmentSystem),t=hi(v=>v),n=hi(v=>v.activeHotspotData),i=Wt(v=>v.lastDeletedItemData),a=gr(v=>v.ghostData),s=hi(v=>v.actions),o=hi(v=>v.hotspotsVisibility),l=hi(v=>v.hotspotsTempVisibility),[u,f]=oe.useState(null),[h,p]=oe.useState(!1),m=oe.useRef(null),y=oe.useRef(null),E=oe.useRef(null),b=oe.useCallback(v=>{v.includes(r.itemData.skuID+"_"+r.hotspotData.hotspotID)&&p(!0)},[r]);return oe.useEffect(()=>b(t.visitedHotspotsID),[t,b]),oe.useEffect(()=>{f(n?n.hotspotData.guid:null)},[n]),oe.useEffect(()=>{y.current&&(u===r.hotspotData.guid?y.current.parentNode.classList.add("topmostActive"):y.current.parentNode.classList.remove("topmostActive"))},[u]),oe.useEffect(()=>{m.current&&u===r.hotspotData.guid&&(m.current.style.opacity=1)},[u,m]),oe.useEffect(()=>{if(!(!E.current&&!i)){var v=e.currentStructure.getNodeByGUID(r.itemData.guid);v?.ref&&(E.current.parent=v.ref)}},[E,e,o,i]),ne("group",{ref:E,position:r.hotspotData.hotspotPointTransform,children:ne(OR,{ref:y,zIndexRange:[6,0],style:o&&l&&!a?{opacity:"1",pointerEvents:"all",transition:"0.5s"}:{opacity:"0",pointerEvents:"none",transition:"0.5s"},children:ne("button",{style:{display:r.hotspotData.visibleInScene==!1?"none":"block"},ref:m,className:u===r.hotspotData.guid?"hotspot hotspot-0 active":h?"hotspot hotspot-0 visited":"hotspot hotspot-0",onPointerEnter:v=>{v.stopPropagation(),m.current&&u!==r.hotspotData.guid&&(m.current.getClientRects()[0].left>Je.getState().canvasSize.width/1.6?m.current.classList.add("left"):m.current.classList.remove("left")),y.current&&y.current.parentNode.classList.add("topmostHover")},onPointerLeave:v=>{v.stopPropagation(),y.current&&y.current.parentNode.classList.remove("topmostHover")},id:"hotspot3D_"+r.itemData.skuID+"_"+r.hotspotData.hotspotID,onClick:v=>{if(v.stopPropagation(),t.isAnyHotspotActive&&t.activeHotspotData.hotspotData.guid===r.hotspotData.guid){s.exitHotspot();return}s.clickHotspot(r.hotspotData.hotspotID,r.hotspotData.guid,r.itemData.guid)},children:[ne("span",{className:"inner-circle"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:137,columnNumber:11},this),ne("span",{className:"hotspot-annotation",children:r.hotspotData.title},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:138,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:83,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:74,columnNumber:7},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:73,columnNumber:5},this)}const d3e=()=>{const r=hi(b=>b),e=hi(b=>b.hotspotsHealthCheck),t=Wt(b=>b.lastDeletedItemData),n=hi(b=>b.hotspotsSpawned),i=Wt(b=>b.itemsSpawned),a=hi(b=>b.activeHotspotData),[s,o]=oe.useState(null),{camera:l}=fs(),u=oe.useRef(null),f=oe.useCallback(()=>{const b=hi.getState().hotspotSpawnedForCategoryIDs,v=ln.getState().attachmentSystem.globalGeometryVariants;Object.keys(i).map(x=>{let S=i[x];if(!S.hotspotsData)return;let _=!1;Object.keys(n).map(w=>{const R=n[w].hotspotData.geometryVariantID;if(R){let N=!1;if(Object.keys(v).map(L=>{R==v[L]&&(N=!0)}),N===!1){_=!0;let L=[];L.push(n[w].hotspotData.categoryID);const I=new Set(L);k$(b,D=>!I.has(D)),delete n[w]}}}),_===!0&&(hi.setState({hotspotSpawned:{...n}}),hi.setState({hotspotSpawnedForCategoryIDs:b})),S.hotspotsData.map(w=>{const R=hi.getState().hotspotSpawnedForCategoryIDs;if(w.geometryVariantID){let N=!1;if(Object.keys(v).map(L=>{w.geometryVariantID==v[L]&&(N=!0)}),N===!1)return}w.categoryID!==""&&R.includes(w.categoryID)||(S.hotspotSpawned=!0,R.push(w.categoryID),h(x,w))})})},[i,n]),h=oe.useCallback((b,v)=>{let x=i[b].itemData.skuID+"_"+v.hotspotID;n[x]={itemData:{guid:b,...i[b].itemData},hotspotData:{guid:x,...v}},hi.setState({hotspotsSpawned:{...n}})},[i,r,n]);oe.useEffect(()=>{if(!t)return;if(t.hotspotSpawned){hi.getState().actions.removeHotspotForItem({...t});const v=hi.getState().hotspotSpawnedForCategoryIDs;let x=[];t.hotspotsData.map(_=>{x.push(_.categoryID)});const S=new Set(x);k$(v,_=>!S.has(_)),hi.setState({hotspotSpawnedForCategoryIDs:v})}Wt.setState({lastDeletedItemData:null});const b=ln.getState().attachmentSystem;b.currentStructure.removeNodeByGUID(t.itemData.guid),nt.fireEvent(nt.EVENTS.SCENE.MaterialOverrides_Exists,b.currentStructure.materialOverrideExists())},[t]);const{raycasterHotspot:p,worldPos:m}=oe.useMemo(()=>({raycasterHotspot:new xy,worldPos:new ve}),[]),y=(b,v)=>{let x=b;x.sub(l.position);const S=x.length();p.set(l.position,x);const _=p.intersectObject(Je.getState().sceneRef);if(_.length>0&&_[0].distance<S){v.style.opacity=.5;return}v.style.opacity=s?.5:1};oe.useEffect(()=>{o(a?a.hotspotData.guid:null)},[a]);const E=oe.useRef(0);return Zm(()=>{if(u.current===null||u.current.children.length<=0)return;E.current<u.current.children.length-1?E.current+=1:E.current=0;const b=Object.keys(n)[E.current],v="hotspot3D_"+n[b].itemData.skuID+"_"+n[b].hotspotData.hotspotID,x=nt.coreWCRef.shadowRoot.getElementById(v);s===b||x===null||(u.current.children[E.current].getWorldPosition(m),y(m,x))},[]),oe.useEffect(()=>{f()},[Object.keys(i).length,e]),r.hotspotsVisibility===!0&&ne("group",{name:"#GRP_HotspotManager",ref:u,children:Object.keys(n).map(b=>ne(f3e,{hotspotKey:n[b]},b,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/HotspotManager.js",lineNumber:261,columnNumber:11},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/HotspotManager.js",lineNumber:259,columnNumber:7},globalThis)};var p3e={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},o8=p3e,m3e=o8;function g3e(r){return!!(r&&m3e[typeof r])}var aB=g3e,v3e=Object.prototype,y3e=v3e.toString,A3e=RegExp("^"+String(y3e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),sB=A3e,b3e=o8,_3e=Object.prototype,E3e=_3e.hasOwnProperty,S3e=function(r){var e,t=r,n=[];if(!t||!b3e[typeof r])return n;for(e in t)E3e.call(t,e)&&n.push(e);return n},x3e=S3e,T3e=aB,w3e=sB,C3e=x3e,ZL=w3e.test(ZL=Object.keys)&&ZL,M3e=ZL?function(r){return T3e(r)?ZL(r):[]}:C3e,Lie=M3e;function R3e(){}var I3e=R3e,Uie=aB,N3e=sB,JL=N3e.test(JL=Object.create)&&JL;function Bie(r,e){return Uie(r)?JL(r):{}}JL||(Bie=function(){function r(){}return function(e){if(Uie(e)){r.prototype=e;var t=new r;r.prototype=null}return t||zl.Object()}}());var kie=Bie,D3e=I3e,O3e=sB,aK={configurable:!1,enumerable:!1,value:null,writable:!1},sK=function(){try{var r={},e=O3e.test(e=Object.defineProperty)&&e,t=e(r,r,r)&&e}catch{}return t}(),P3e=sK?function(r,e){aK.value=e,sK(r,"__bindData__",aK)}:D3e,l8=P3e,L3e=kie,U3e=aB,B3e=l8,k3e=[],F3e=k3e.push;function z3e(r){var e=r[0],t=r[2],n=r[4];function i(){if(t){var a=t.slice();F3e.apply(a,arguments)}if(this instanceof i){var s=L3e(e.prototype),o=e.apply(s,a||arguments);return U3e(o)?o:s}return e.apply(n,a||arguments)}return B3e(i,r),i}var G3e=z3e;function H3e(r,e,t){e||(e=0),typeof t>"u"&&(t=r?r.length:0);for(var n=-1,i=t-e||0,a=Array(i<0?0:i);++n<i;)a[n]=r[e+n];return a}var Fie=H3e,V3e=kie,j3e=aB,Q3e=l8,W3e=Fie,Y3e=[],oK=Y3e.push;function zie(r){var e=r[0],t=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=t&1,l=t&2,u=t&4,f=t&8,h=e;function p(){var m=o?a:this;if(n){var y=n.slice();oK.apply(y,arguments)}if((i||u)&&(y||(y=W3e(arguments)),i&&oK.apply(y,i),u&&y.length<s))return t|=16,zie([e,f?t:t&-4,y,null,a,s]);if(y||(y=arguments),l&&(e=m[h]),this instanceof p){m=V3e(e.prototype);var E=e.apply(m,y);return j3e(E)?E:m}return e.apply(m,y)}return Q3e(p,r),p}var q3e=zie;function X3e(r){return typeof r=="function"}var $3e=X3e,K3e=G3e,Z3e=q3e,J3e=$3e,eke=[],lK=eke.push;function Gie(r,e,t,n,i,a){var s=e&1,o=e&2,l=e&4,u=e&16,f=e&32;if(!o&&!J3e(r))throw new TypeError;u&&!t.length&&(e&=-17,u=t=!1),f&&!n.length&&(e&=-33,f=n=!1);var h=r&&r.__bindData__;if(h&&h!==!0)return h=h.slice(),s&&!(h[1]&1)&&(h[4]=i),!s&&h[1]&1&&(e|=8),l&&!(h[1]&4)&&(h[5]=a),u&&lK.apply(h[2]||(h[2]=[]),t),f&&lK.apply(h[3]||(h[3]=[]),n),h[1]|=e,Gie.apply(null,h);var p=e==1||e===17?K3e:Z3e;return p([r,e,t,n,i,a])}var tke=Gie,cK=tke,nke=Fie;function ike(r,e){return arguments.length>2?cK(r,17,nke(arguments,2),null,e):cK(r,1,null,null,e)}var rke=ike;function ake(r){return r}var ske=ake,oke=sB,lke=/\bthis\b/,c8={};c8.funcDecomp=!oke.test(zl.WinRTError)&&lke.test(function(){return this});c8.funcNames=typeof Function.name=="string";var cke=c8,uke=rke,hke=ske,fke=l8,bG=cke,dke=/^\s*function[ \n\r\t]+\w/,pke=/\bthis\b/,mke=Function.prototype.toString;function gke(r,e,t){if(typeof r!="function")return hke;if(typeof e>"u"||!("prototype"in r))return r;var n=r.__bindData__;if(typeof n>"u"&&(bG.funcNames&&(n=!r.name),n=n||!bG.funcDecomp,!n)){var i=mke.call(r);bG.funcNames||(n=!dke.test(i)),n||(n=pke.test(i),fke(r,n))}if(n===!1||n!==!0&&n[1]&1)return r;switch(t){case 1:return function(a){return r.call(e,a)};case 2:return function(a,s){return r.call(e,a,s)};case 3:return function(a,s,o){return r.call(e,a,s,o)};case 4:return function(a,s,o,l){return r.call(e,a,s,o,l)}}return uke(r,e)}var Hie=gke,vke=Hie,yke=Lie,uK=o8,Ake=function(r,e,t){var n,i=r,a=i;if(!i||!uK[typeof i])return a;e=e&&typeof t>"u"?e:vke(e,t,3);for(var s=-1,o=uK[typeof i]&&yke(i),l=o?o.length:0;++s<l;)if(n=o[s],e(i[n],n,r)===!1)return a;return a},bke=Ake,_ke=Hie,Eke=bke;function Ske(r,e,t){var n=-1,i=r?r.length:0;if(e=e&&typeof t>"u"?e:_ke(e,t,3),typeof i=="number")for(;++n<i&&e(r[n],n,r)!==!1;);else Eke(r,e);return r}var xke=Ske,Vie,jie;Vie={mm:{name:{singular:"Millimeter",plural:"Millimeters"},to_anchor:1/1e3},cm:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/100},m:{name:{singular:"Meter",plural:"Meters"},to_anchor:1},km:{name:{singular:"Kilometer",plural:"Kilometers"},to_anchor:1e3}};jie={in:{name:{singular:"Inch",plural:"Inches"},to_anchor:1/12},yd:{name:{singular:"Yard",plural:"Yards"},to_anchor:3},"ft-us":{name:{singular:"US Survey Foot",plural:"US Survey Feet"},to_anchor:1.000002},ft:{name:{singular:"Foot",plural:"Feet"},to_anchor:1},mi:{name:{singular:"Mile",plural:"Miles"},to_anchor:5280}};var Tke={metric:Vie,imperial:jie,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},Qie,Wie;Qie={mm2:{name:{singular:"Square Millimeter",plural:"Square Millimeters"},to_anchor:1/1e6},cm2:{name:{singular:"Centimeter",plural:"Centimeters"},to_anchor:1/1e4},m2:{name:{singular:"Square Meter",plural:"Square Meters"},to_anchor:1},ha:{name:{singular:"Hectare",plural:"Hectares"},to_anchor:1e4},km2:{name:{singular:"Square Kilometer",plural:"Square Kilometers"},to_anchor:1e6}};Wie={in2:{name:{singular:"Square Inch",plural:"Square Inches"},to_anchor:1/144},yd2:{name:{singular:"Square Yard",plural:"Square Yards"},to_anchor:9},ft2:{name:{singular:"Square Foot",plural:"Square Feet"},to_anchor:1},ac:{name:{singular:"Acre",plural:"Acres"},to_anchor:43560},mi2:{name:{singular:"Square Mile",plural:"Square Miles"},to_anchor:27878400}};var wke={metric:Qie,imperial:Wie,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},Yie,qie;Yie={mcg:{name:{singular:"Microgram",plural:"Micrograms"},to_anchor:1/1e6},mg:{name:{singular:"Milligram",plural:"Milligrams"},to_anchor:1/1e3},g:{name:{singular:"Gram",plural:"Grams"},to_anchor:1},kg:{name:{singular:"Kilogram",plural:"Kilograms"},to_anchor:1e3},mt:{name:{singular:"Metric Tonne",plural:"Metric Tonnes"},to_anchor:1e6}};qie={oz:{name:{singular:"Ounce",plural:"Ounces"},to_anchor:1/16},lb:{name:{singular:"Pound",plural:"Pounds"},to_anchor:1},t:{name:{singular:"Ton",plural:"Tons"},to_anchor:2e3}};var Cke={metric:Yie,imperial:qie,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},Xie,$ie;Xie={mm3:{name:{singular:"Cubic Millimeter",plural:"Cubic Millimeters"},to_anchor:1/1e6},cm3:{name:{singular:"Cubic Centimeter",plural:"Cubic Centimeters"},to_anchor:1/1e3},ml:{name:{singular:"Millilitre",plural:"Millilitres"},to_anchor:1/1e3},cl:{name:{singular:"Centilitre",plural:"Centilitres"},to_anchor:1/100},dl:{name:{singular:"Decilitre",plural:"Decilitres"},to_anchor:1/10},l:{name:{singular:"Litre",plural:"Litres"},to_anchor:1},kl:{name:{singular:"Kilolitre",plural:"Kilolitres"},to_anchor:1e3},m3:{name:{singular:"Cubic meter",plural:"Cubic meters"},to_anchor:1e3},km3:{name:{singular:"Cubic kilometer",plural:"Cubic kilometers"},to_anchor:1e12},krm:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:1/1e3},tsk:{name:{singular:"Tesked",plural:"Teskedar"},to_anchor:5/1e3},msk:{name:{singular:"Matsked",plural:"Matskedar"},to_anchor:15/1e3},kkp:{name:{singular:"Kaffekopp",plural:"Kaffekoppar"},to_anchor:150/1e3},glas:{name:{singular:"Glas",plural:"Glas"},to_anchor:200/1e3},kanna:{name:{singular:"Kanna",plural:"Kannor"},to_anchor:2.617}};$ie={tsp:{name:{singular:"Teaspoon",plural:"Teaspoons"},to_anchor:1/6},Tbs:{name:{singular:"Tablespoon",plural:"Tablespoons"},to_anchor:1/2},in3:{name:{singular:"Cubic inch",plural:"Cubic inches"},to_anchor:.55411},"fl-oz":{name:{singular:"Fluid Ounce",plural:"Fluid Ounces"},to_anchor:1},cup:{name:{singular:"Cup",plural:"Cups"},to_anchor:8},pnt:{name:{singular:"Pint",plural:"Pints"},to_anchor:16},qt:{name:{singular:"Quart",plural:"Quarts"},to_anchor:32},gal:{name:{singular:"Gallon",plural:"Gallons"},to_anchor:128},ft3:{name:{singular:"Cubic foot",plural:"Cubic feet"},to_anchor:957.506},yd3:{name:{singular:"Cubic yard",plural:"Cubic yards"},to_anchor:25852.7}};var Mke={metric:Xie,imperial:$ie,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},Kie;Kie={ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}};var Rke={metric:Kie,imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},Zie,Jie;Zie={C:{name:{singular:"degree Celsius",plural:"degrees Celsius"},to_anchor:1,anchor_shift:0},K:{name:{singular:"degree Kelvin",plural:"degrees Kelvin"},to_anchor:1,anchor_shift:273.15}};Jie={F:{name:{singular:"degree Fahrenheit",plural:"degrees Fahrenheit"},to_anchor:1},R:{name:{singular:"degree Rankine",plural:"degrees Rankine"},to_anchor:1,anchor_shift:459.67}};var Ike={metric:Zie,imperial:Jie,_anchors:{metric:{unit:"C",transform:function(r){return r/(5/9)+32}},imperial:{unit:"F",transform:function(r){return(r-32)*(5/9)}}}},ere,hK=365.25;ere={ns:{name:{singular:"Nanosecond",plural:"Nanoseconds"},to_anchor:1/1e9},mu:{name:{singular:"Microsecond",plural:"Microseconds"},to_anchor:1/1e6},ms:{name:{singular:"Millisecond",plural:"Milliseconds"},to_anchor:1/1e3},s:{name:{singular:"Second",plural:"Seconds"},to_anchor:1},min:{name:{singular:"Minute",plural:"Minutes"},to_anchor:60},h:{name:{singular:"Hour",plural:"Hours"},to_anchor:60*60},d:{name:{singular:"Day",plural:"Days"},to_anchor:60*60*24},week:{name:{singular:"Week",plural:"Weeks"},to_anchor:60*60*24*7},month:{name:{singular:"Month",plural:"Months"},to_anchor:60*60*24*hK/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:60*60*24*hK}};var Nke={metric:ere,_anchors:{metric:{unit:"s",ratio:1}}},tre,nre;tre={b:{name:{singular:"Bit",plural:"Bits"},to_anchor:1},Kb:{name:{singular:"Kilobit",plural:"Kilobits"},to_anchor:1024},Mb:{name:{singular:"Megabit",plural:"Megabits"},to_anchor:1048576},Gb:{name:{singular:"Gigabit",plural:"Gigabits"},to_anchor:1073741824},Tb:{name:{singular:"Terabit",plural:"Terabits"},to_anchor:1099511627776}};nre={B:{name:{singular:"Byte",plural:"Bytes"},to_anchor:1},KB:{name:{singular:"Kilobyte",plural:"Kilobytes"},to_anchor:1024},MB:{name:{singular:"Megabyte",plural:"Megabytes"},to_anchor:1048576},GB:{name:{singular:"Gigabyte",plural:"Gigabytes"},to_anchor:1073741824},TB:{name:{singular:"Terabyte",plural:"Terabytes"},to_anchor:1099511627776}};var Dke={bits:tre,bytes:nre,_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},ire;ire={ppm:{name:{singular:"Part-per Million",plural:"Parts-per Million"},to_anchor:1},ppb:{name:{singular:"Part-per Billion",plural:"Parts-per Billion"},to_anchor:.001},ppt:{name:{singular:"Part-per Trillion",plural:"Parts-per Trillion"},to_anchor:1e-6},ppq:{name:{singular:"Part-per Quadrillion",plural:"Parts-per Quadrillion"},to_anchor:1e-9}};var Oke={metric:ire,imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},rre,are;rre={"m/s":{name:{singular:"Metre per second",plural:"Metres per second"},to_anchor:3.6},"km/h":{name:{singular:"Kilometre per hour",plural:"Kilometres per hour"},to_anchor:1}};are={"m/h":{name:{singular:"Mile per hour",plural:"Miles per hour"},to_anchor:1},knot:{name:{singular:"Knot",plural:"Knots"},to_anchor:1.150779},"ft/s":{name:{singular:"Foot per second",plural:"Feet per second"},to_anchor:.681818}};var Pke={metric:rre,imperial:are,_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},sre,ore;sre={"min/km":{name:{singular:"Minute per kilometre",plural:"Minutes per kilometre"},to_anchor:.06},"s/m":{name:{singular:"Second per metre",plural:"Seconds per metre"},to_anchor:1}};ore={"min/mi":{name:{singular:"Minute per mile",plural:"Minutes per mile"},to_anchor:.0113636},"s/ft":{name:{singular:"Second per foot",plural:"Seconds per foot"},to_anchor:1}};var Lke={metric:sre,imperial:ore,_anchors:{metric:{unit:"s/m",ratio:.3048},imperial:{unit:"s/ft",ratio:1/.3048}}},lre,cre;lre={Pa:{name:{singular:"pascal",plural:"pascals"},to_anchor:1/1e3},kPa:{name:{singular:"kilopascal",plural:"kilopascals"},to_anchor:1},MPa:{name:{singular:"megapascal",plural:"megapascals"},to_anchor:1e3},hPa:{name:{singular:"hectopascal",plural:"hectopascals"},to_anchor:1/10},bar:{name:{singular:"bar",plural:"bar"},to_anchor:100},torr:{name:{singular:"torr",plural:"torr"},to_anchor:101325/76e4}};cre={psi:{name:{singular:"pound per square inch",plural:"pounds per square inch"},to_anchor:1/1e3},ksi:{name:{singular:"kilopound per square inch",plural:"kilopound per square inch"},to_anchor:1}};var Uke={metric:lre,imperial:cre,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},ure;ure={A:{name:{singular:"Ampere",plural:"Amperes"},to_anchor:1},mA:{name:{singular:"Milliampere",plural:"Milliamperes"},to_anchor:.001},kA:{name:{singular:"Kiloampere",plural:"Kiloamperes"},to_anchor:1e3}};var Bke={metric:ure,_anchors:{metric:{unit:"A",ratio:1}}},hre;hre={V:{name:{singular:"Volt",plural:"Volts"},to_anchor:1},mV:{name:{singular:"Millivolt",plural:"Millivolts"},to_anchor:.001},kV:{name:{singular:"Kilovolt",plural:"Kilovolts"},to_anchor:1e3}};var kke={metric:hre,_anchors:{metric:{unit:"V",ratio:1}}},fre;fre={W:{name:{singular:"Watt",plural:"Watts"},to_anchor:1},mW:{name:{singular:"Milliwatt",plural:"Milliwatts"},to_anchor:.001},kW:{name:{singular:"Kilowatt",plural:"Kilowatts"},to_anchor:1e3},MW:{name:{singular:"Megawatt",plural:"Megawatts"},to_anchor:1e6},GW:{name:{singular:"Gigawatt",plural:"Gigawatts"},to_anchor:1e9}};var Fke={metric:fre,_anchors:{metric:{unit:"W",ratio:1}}},dre;dre={VAR:{name:{singular:"Volt-Ampere Reactive",plural:"Volt-Amperes Reactive"},to_anchor:1},mVAR:{name:{singular:"Millivolt-Ampere Reactive",plural:"Millivolt-Amperes Reactive"},to_anchor:.001},kVAR:{name:{singular:"Kilovolt-Ampere Reactive",plural:"Kilovolt-Amperes Reactive"},to_anchor:1e3},MVAR:{name:{singular:"Megavolt-Ampere Reactive",plural:"Megavolt-Amperes Reactive"},to_anchor:1e6},GVAR:{name:{singular:"Gigavolt-Ampere Reactive",plural:"Gigavolt-Amperes Reactive"},to_anchor:1e9}};var zke={metric:dre,_anchors:{metric:{unit:"VAR",ratio:1}}},pre;pre={VA:{name:{singular:"Volt-Ampere",plural:"Volt-Amperes"},to_anchor:1},mVA:{name:{singular:"Millivolt-Ampere",plural:"Millivolt-Amperes"},to_anchor:.001},kVA:{name:{singular:"Kilovolt-Ampere",plural:"Kilovolt-Amperes"},to_anchor:1e3},MVA:{name:{singular:"Megavolt-Ampere",plural:"Megavolt-Amperes"},to_anchor:1e6},GVA:{name:{singular:"Gigavolt-Ampere",plural:"Gigavolt-Amperes"},to_anchor:1e9}};var Gke={metric:pre,_anchors:{metric:{unit:"VA",ratio:1}}},mre;mre={Wh:{name:{singular:"Watt-hour",plural:"Watt-hours"},to_anchor:3600},mWh:{name:{singular:"Milliwatt-hour",plural:"Milliwatt-hours"},to_anchor:3.6},kWh:{name:{singular:"Kilowatt-hour",plural:"Kilowatt-hours"},to_anchor:36e5},MWh:{name:{singular:"Megawatt-hour",plural:"Megawatt-hours"},to_anchor:36e8},GWh:{name:{singular:"Gigawatt-hour",plural:"Gigawatt-hours"},to_anchor:36e11},J:{name:{singular:"Joule",plural:"Joules"},to_anchor:1},kJ:{name:{singular:"Kilojoule",plural:"Kilojoules"},to_anchor:1e3}};var Hke={metric:mre,_anchors:{metric:{unit:"J",ratio:1}}},gre;gre={VARh:{name:{singular:"Volt-Ampere Reactive Hour",plural:"Volt-Amperes Reactive Hour"},to_anchor:1},mVARh:{name:{singular:"Millivolt-Ampere Reactive Hour",plural:"Millivolt-Amperes Reactive Hour"},to_anchor:.001},kVARh:{name:{singular:"Kilovolt-Ampere Reactive Hour",plural:"Kilovolt-Amperes Reactive Hour"},to_anchor:1e3},MVARh:{name:{singular:"Megavolt-Ampere Reactive Hour",plural:"Megavolt-Amperes Reactive Hour"},to_anchor:1e6},GVARh:{name:{singular:"Gigavolt-Ampere Reactive Hour",plural:"Gigavolt-Amperes Reactive Hour"},to_anchor:1e9}};var Vke={metric:gre,_anchors:{metric:{unit:"VARh",ratio:1}}},vre,yre;vre={"mm3/s":{name:{singular:"Cubic Millimeter per second",plural:"Cubic Millimeters per second"},to_anchor:1/1e6},"cm3/s":{name:{singular:"Cubic Centimeter per second",plural:"Cubic Centimeters per second"},to_anchor:1/1e3},"ml/s":{name:{singular:"Millilitre per second",plural:"Millilitres per second"},to_anchor:1/1e3},"cl/s":{name:{singular:"Centilitre per second",plural:"Centilitres per second"},to_anchor:1/100},"dl/s":{name:{singular:"Decilitre per second",plural:"Decilitres per second"},to_anchor:1/10},"l/s":{name:{singular:"Litre per second",plural:"Litres per second"},to_anchor:1},"l/min":{name:{singular:"Litre per minute",plural:"Litres per minute"},to_anchor:1/60},"l/h":{name:{singular:"Litre per hour",plural:"Litres per hour"},to_anchor:1/3600},"kl/s":{name:{singular:"Kilolitre per second",plural:"Kilolitres per second"},to_anchor:1e3},"kl/min":{name:{singular:"Kilolitre per minute",plural:"Kilolitres per minute"},to_anchor:50/3},"kl/h":{name:{singular:"Kilolitre per hour",plural:"Kilolitres per hour"},to_anchor:5/18},"m3/s":{name:{singular:"Cubic meter per second",plural:"Cubic meters per second"},to_anchor:1e3},"m3/min":{name:{singular:"Cubic meter per minute",plural:"Cubic meters per minute"},to_anchor:50/3},"m3/h":{name:{singular:"Cubic meter per hour",plural:"Cubic meters per hour"},to_anchor:5/18},"km3/s":{name:{singular:"Cubic kilometer per second",plural:"Cubic kilometers per second"},to_anchor:1e12}};yre={"tsp/s":{name:{singular:"Teaspoon per second",plural:"Teaspoons per second"},to_anchor:1/6},"Tbs/s":{name:{singular:"Tablespoon per second",plural:"Tablespoons per second"},to_anchor:1/2},"in3/s":{name:{singular:"Cubic inch per second",plural:"Cubic inches per second"},to_anchor:.55411},"in3/min":{name:{singular:"Cubic inch per minute",plural:"Cubic inches per minute"},to_anchor:.55411/60},"in3/h":{name:{singular:"Cubic inch per hour",plural:"Cubic inches per hour"},to_anchor:.55411/3600},"fl-oz/s":{name:{singular:"Fluid Ounce per second",plural:"Fluid Ounces per second"},to_anchor:1},"fl-oz/min":{name:{singular:"Fluid Ounce per minute",plural:"Fluid Ounces per minute"},to_anchor:1/60},"fl-oz/h":{name:{singular:"Fluid Ounce per hour",plural:"Fluid Ounces per hour"},to_anchor:1/3600},"cup/s":{name:{singular:"Cup per second",plural:"Cups per second"},to_anchor:8},"pnt/s":{name:{singular:"Pint per second",plural:"Pints per second"},to_anchor:16},"pnt/min":{name:{singular:"Pint per minute",plural:"Pints per minute"},to_anchor:4/15},"pnt/h":{name:{singular:"Pint per hour",plural:"Pints per hour"},to_anchor:1/225},"qt/s":{name:{singular:"Quart per second",plural:"Quarts per second"},to_anchor:32},"gal/s":{name:{singular:"Gallon per second",plural:"Gallons per second"},to_anchor:128},"gal/min":{name:{singular:"Gallon per minute",plural:"Gallons per minute"},to_anchor:32/15},"gal/h":{name:{singular:"Gallon per hour",plural:"Gallons per hour"},to_anchor:8/225},"ft3/s":{name:{singular:"Cubic foot per second",plural:"Cubic feet per second"},to_anchor:957.506},"ft3/min":{name:{singular:"Cubic foot per minute",plural:"Cubic feet per minute"},to_anchor:957.506/60},"ft3/h":{name:{singular:"Cubic foot per hour",plural:"Cubic feet per hour"},to_anchor:957.506/3600},"yd3/s":{name:{singular:"Cubic yard per second",plural:"Cubic yards per second"},to_anchor:25852.7},"yd3/min":{name:{singular:"Cubic yard per minute",plural:"Cubic yards per minute"},to_anchor:25852.7/60},"yd3/h":{name:{singular:"Cubic yard per hour",plural:"Cubic yards per hour"},to_anchor:25852.7/3600}};var jke={metric:vre,imperial:yre,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},Are,bre;Are={lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}};bre={"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}};var Qke={metric:Are,imperial:bre,_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},_re;_re={mHz:{name:{singular:"millihertz",plural:"millihertz"},to_anchor:1/1e3},Hz:{name:{singular:"hertz",plural:"hertz"},to_anchor:1},kHz:{name:{singular:"kilohertz",plural:"kilohertz"},to_anchor:1e3},MHz:{name:{singular:"megahertz",plural:"megahertz"},to_anchor:1e3*1e3},GHz:{name:{singular:"gigahertz",plural:"gigahertz"},to_anchor:1e3*1e3*1e3},THz:{name:{singular:"terahertz",plural:"terahertz"},to_anchor:1e3*1e3*1e3*1e3},rpm:{name:{singular:"rotation per minute",plural:"rotations per minute"},to_anchor:1/60},"deg/s":{name:{singular:"degree per second",plural:"degrees per second"},to_anchor:1/360},"rad/s":{name:{singular:"radian per second",plural:"radians per second"},to_anchor:1/(Math.PI*2)}};var Wke={metric:_re,_anchors:{frequency:{unit:"hz",ratio:1}}},Ere;Ere={rad:{name:{singular:"radian",plural:"radians"},to_anchor:180/Math.PI},deg:{name:{singular:"degree",plural:"degrees"},to_anchor:1},grad:{name:{singular:"gradian",plural:"gradians"},to_anchor:9/10},arcmin:{name:{singular:"arcminute",plural:"arcminutes"},to_anchor:1/60},arcsec:{name:{singular:"arcsecond",plural:"arcseconds"},to_anchor:1/3600}};var Yke={metric:Ere,_anchors:{metric:{unit:"deg",ratio:1}}},Sre,LR=Lie,eh=xke,Gm={length:Tke,area:wke,mass:Cke,volume:Mke,each:Rke,temperature:Ike,time:Nke,digital:Dke,partsPer:Oke,speed:Pke,pace:Lke,pressure:Uke,current:Bke,voltage:kke,power:Fke,reactivePower:zke,apparentPower:Gke,energy:Hke,reactiveEnergy:Vke,volumeFlowRate:jke,illuminance:Qke,frequency:Wke,angle:Yke},th;th=function(r,e){e?this.val=r/e:this.val=r};th.prototype.from=function(r){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(r),this.origin||this.throwUnsupportedUnitError(r),this};th.prototype.to=function(r){if(!this.origin)throw new Error(".to must be called after .from");this.destination=this.getUnit(r);var e,t;if(this.destination||this.throwUnsupportedUnitError(r),this.origin.abbr===this.destination.abbr)return this.val;if(this.destination.measure!=this.origin.measure)throw new Error("Cannot convert incompatible measures of "+this.destination.measure+" and "+this.origin.measure);return e=this.val*this.origin.unit.to_anchor,this.origin.unit.anchor_shift&&(e-=this.origin.unit.anchor_shift),this.origin.system!=this.destination.system&&(t=Gm[this.origin.measure]._anchors[this.origin.system].transform,typeof t=="function"?e=t(e):e*=Gm[this.origin.measure]._anchors[this.origin.system].ratio),this.destination.unit.anchor_shift&&(e+=this.destination.unit.anchor_shift),e/this.destination.unit.to_anchor};th.prototype.toBest=function(e){if(!this.origin)throw new Error(".toBest must be called after .from");var e=Object.assign({exclude:[],cutOffNumber:1},e),t;return eh(this.possibilities(),function(n){var i=this.describe(n),a=e.exclude.indexOf(n)===-1;if(a&&i.system===this.origin.system){var s=this.to(n);(!t||s>=e.cutOffNumber&&s<t.val)&&(t={val:s,unit:n,singular:i.singular,plural:i.plural})}}.bind(this)),t};th.prototype.getUnit=function(r){var e;return eh(Gm,function(t,n){if(eh(t,function(i,a){if(a=="_anchors"||(eh(i,function(s,o){if(o==r)return e={abbr:r,measure:n,system:a,unit:s},!1}),e))return!1}),e)return!1}),e};var xre=function(r){return{abbr:r.abbr,measure:r.measure,system:r.system,singular:r.unit.name.singular,plural:r.unit.name.plural}};th.prototype.describe=function(r){var e=th.prototype.getUnit(r),t=null;try{t=xre(e)}catch{this.throwUnsupportedUnitError(r)}return t};th.prototype.list=function(r){var e=[];return eh(Gm,function(t,n){r&&r!==n||eh(t,function(i,a){if(a=="_anchors")return!1;eh(i,function(s,o){e=e.concat(xre({abbr:o,measure:n,system:a,unit:s}))})})}),e};th.prototype.throwUnsupportedUnitError=function(r){var e=[];throw eh(Gm,function(t,n){eh(t,function(i,a){if(a=="_anchors")return!1;e=e.concat(LR(i))})}),new Error("Unsupported unit "+r+", use one of: "+e.join(", "))};th.prototype.possibilities=function(r){var e=[];return!this.origin&&!r?eh(LR(Gm),function(t){eh(Gm[t],function(n,i){if(i=="_anchors")return!1;e=e.concat(LR(n))})}):(r=r||this.origin.measure,eh(Gm[r],function(t,n){if(n=="_anchors")return!1;e=e.concat(LR(t))})),e};th.prototype.measures=function(){return LR(Gm)};Sre=function(r){return new th(r)};var _G=Sre;const qke=()=>{const r=Wt(y=>y.itemsSpawned),e=Je(y=>y.showDimensions),t=Je(y=>y.sceneSettings),n=Je(y=>y.boundData),i=Je(y=>y.sceneSettings.sceneScaleUnit),a=Je(y=>y.sceneSettings.sceneScaleDisplayUnit),[s,o]=oe.useState(.2),[l,u]=oe.useState("#000000"),[f,h]=oe.useState(.01),p=oe.useRef(null);oe.useRef(null);const m=oe.useRef(0);return oe.useEffect(()=>{if(t==null)return;const y=t.dimensionColor,E=F$(y.r,y.g,y.b);u(E)},[t]),oe.useEffect(()=>{if(t==null)return;const y=t.dimensionColor,E=F$(y.r,y.g,y.b);u(E)},[t]),oe.useEffect(()=>{if(!n||!n.size)return;let y=n.size.x;y>n.size.z&&(y=n.size.z);let E=y/20;h(E<.005?E:.005),o(y<.2?y:.2)},[n]),oe.useEffect(()=>{m.current=0},[e]),Zm(()=>{p.current!==null&&m.current<1&&(m.current+=.05,p.current.scale.x=m.current,p.current.scale.y=m.current,p.current.scale.z=m.current)}),e===!0&&ne("group",{ref:p,children:n!==null&&n.size.x!==0&&n.size.y!==0&&n.size.z!==0&&Object.keys(r).length>0&&ne(fi,{children:[ne(bm,{position:[n.center.x,n.center.y-n.size.y/2,n.center.z+n.size.z/2+s],rotation:[0,0,XL(90)],scale:[f,n.size.x,f],visible:!0,children:[ne(bm,{position:[0,.5,0],scale:[1,f,7],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:105,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:100,columnNumber:17},globalThis),ne(bm,{position:[0,-.5,0],scale:[1,f,7],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:112,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:107,columnNumber:17},globalThis),ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:116,columnNumber:17},globalThis),ne(OR,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[_G(n.size.x).from("m").to(i).toFixed(t.measurementPrecision),a??i]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:119,columnNumber:17},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:89,columnNumber:15},globalThis),ne(bm,{position:[n.center.x-n.size.x/2-s,n.center.y,n.center.z+n.size.z/2+s],rotation:[0,0,0],scale:[f,n.size.y,f],visible:!0,children:[ne(bm,{position:[0,.5,0],scale:[1,f,7],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:150,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:145,columnNumber:17},globalThis),ne(bm,{position:[0,-.5,0],scale:[1,f,7],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:157,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:152,columnNumber:17},globalThis),ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:161,columnNumber:17},globalThis),ne(OR,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[_G(n.size.y).from("m").to(i).toFixed(t.measurementPrecision),a??i]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:164,columnNumber:17},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:134,columnNumber:15},globalThis),ne(bm,{position:[n.center.x+n.size.x/2+s,n.center.y-n.size.y/2,n.center.z],rotation:[XL(90),0,0],scale:[f,n.size.z,f],visible:!0,children:[ne(bm,{position:[0,.5,0],scale:[7,f,1],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:195,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:190,columnNumber:17},globalThis),ne(bm,{position:[0,-.5,0],scale:[7,f,1],visible:!0,children:ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:202,columnNumber:19},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:197,columnNumber:17},globalThis),ne("meshBasicMaterial",{color:l},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:206,columnNumber:17},globalThis),ne(OR,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[_G(n.size.z).from("m").to(i).toFixed(t.measurementPrecision),a??i]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:209,columnNumber:17},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:179,columnNumber:15},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:87,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:81,columnNumber:7},globalThis)},Xke=({...r})=>ne(fi,{children:[ne(d3e,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:11,columnNumber:7},globalThis),ne(qke,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:12,columnNumber:7},globalThis),ne(u3e,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:13,columnNumber:7},globalThis),ne(h3e,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:14,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:10,columnNumber:5},globalThis),$ke=()=>{const r=oe.useRef(null),e=Wt(E=>E.itemsSpawned),t=hi(E=>E.isAnyHotspotActive),n=Cr(E=>E.canCameraRotate),i=Cr(E=>E.cameraSettings),a=Cr(E=>E.disableAutoRotate),s=Je(E=>E.autoFocusTrigger),o=Je(E=>E.dragging),l=Cr(E=>E.sendCameraDetailsTrigger),u=Cr(E=>E.focusPointPosition),f=Cr(E=>E.viewPointPosition),h=oe.useRef(!1),{camera:p}=fs(),m=gr(E=>E.ghostsTransform),y=()=>{if(r.current===null)return;const E=Cr.getState().boundsMargin,b=Je.getState().autoFocusRef,v=Je.getState().sceneRef.getObjectByName("#ITEMSANDGHOSTS"),x=b||v,S=new fl().setFromObject(x);b||Je.setState({bbox:S});const _=new ve;if(S.getSize(_),_.x>0){const w=new ve;S.getCenter(w);const R=new ve(S.max.x,S.max.y,S.max.z);R.sub(S.min),Je.setState({boundData:{center:w,size:R}}),r.current.setBoundary(S);const N=new fl(S.min,S.max);N.min=new ve(N.min.x-E/2,N.min.y-E/2,N.min.z-E/2),N.max=new ve(N.max.x+E/2,N.max.y+E/2,N.max.z+E/2);const L=N.getBoundingSphere(new du(w));L.radius>0&&r.current.fitToSphere(L,!0)}else{const w=new ve(0,0,0),R=new ve(0,0,0);Je.setState({boundData:{center:w,size:R}})}};return oe.useEffect(()=>{y()},[s,Object.keys(e).length]),oe.useEffect(()=>{nt!=null&&(Je.getState().sceneSettings.focusCameraOnGhosts===!0?nt.focusOnGhosts():nt.refocus())},[m]),oe.useEffect(()=>{if(t==!1){h.current==!0&&(r.current.reset(!0),h.current=!1);return}h.current==!1&&(r.current.saveState(),h.current=!0),r.current.setLookAt(f.x,f.y,f.z,u.x,u.y,u.z,!0)},[t,f,u]),oe.useEffect(()=>{nt.fireEvent(nt.EVENTS.CONFIGURATION.CameraDetails_Update,p)},[l]),Zm(E=>{i.canAutoRotate===!1||r.current===null||a===!1&&t===!1&&(r.current.azimuthAngle+=20*E*Mb.DEG2RAD*i.autoRotateSpeed)}),oe.useEffect(()=>{r.current!==null&&(n===!0?(r.current.mouseButtons.left=Js.ROTATE,r.current.touches.one=Js.TOUCH_ROTATE):(r.current.mouseButtons.left=Js.NONE,r.current.touches.one=Js.NONE),i.canZoom===!0&&o===!1?(r.current.mouseButtons.wheel=Js.ZOOM,r.current.mouseButtons.middle=Js.ZOOM):(r.current.mouseButtons.wheel=Js.NONE,r.current.mouseButtons.middle=Js.NONE),i.canPan===!0&&o===!1?(r.current.mouseButtons.right=Js.OFFSET,i.canZoom===!0&&o===!1?(r.current.touches.two=Js.TOUCH_ZOOM_OFFSET,r.current.touches.three=Js.TOUCH_ZOOM_OFFSET):(r.current.touches.two=Js.TOUCH_OFFSET,r.current.touches.three=Js.TOUCH_OFFSET)):(r.current.mouseButtons.right=Js.NONE,i.canZoom===!0&&o===!1?(r.current.touches.two=Js.TOUCH_ZOOM,r.current.touches.three=Js.TOUCH_ZOOM):(r.current.touches.two=Js.NONE,r.current.touches.three=Js.NONE)))},[r,i,o,n]),oe.useEffect(()=>{if(r.current===null)return;p.fov=i.fov,p.updateProjectionMatrix();const E=()=>{r.current.removeEventListener("rest",E),Cr.setState({userDragging:!1,disableAutoRotate:!1})};r.current.addEventListener("controlstart",()=>{r.current.removeEventListener("rest",E),Cr.setState({userDragging:!0,disableAutoRotate:!0})}),r.current.addEventListener("controlend",()=>{r.current.active?r.current.addEventListener("rest",E):E()}),r.current.addEventListener("transitionstart",()=>{Cr.getState().userDragging!==!0&&(Cr.setState({disableAutoRotate:!0}),r.current.addEventListener("rest",E))})},[r]),ne(fi,{children:ne($Le,{ref:r,makeDefault:!0,dollySpeed:i.dollySpeed,truckSpeed:i.truckSpeed,minZoom:i.minZoom,maxZoom:i.maxZoom,minPolarAngle:t?-Math.PI:XL(i.minPolarAngle),maxPolarAngle:t?Math.PI:XL(i.maxPolarAngle)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/CameraManager.js",lineNumber:219,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/CameraManager.js",lineNumber:218,columnNumber:5},globalThis)},Kke=()=>{const r=fs(e=>e.gl);return oe.useEffect(()=>{Je.setState({glContext:r})},[]),ne(fi,{children:[ne(Xke,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:16,columnNumber:7},globalThis),ne($ke,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:17,columnNumber:7},globalThis),ne(jUe,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:18,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:15,columnNumber:5},globalThis)},Zke=({handleCloseAlert:r,alertData:e})=>{const t=oe.useRef(null),n=oe.useRef(null),i=oe.useRef(null),a=()=>{clearTimeout(t.current),i.current.style="",n.current.style="",r()};return oe.useEffect(()=>{if(i.current===null||n.current===null)return;const s=e.alertTime?e.alertTime:1e3;i.current.style="animation: loader "+s+"ms; animation-timing-function: linear;",n.current.style="animation: loader "+s+"ms; animation-timing-function: linear;",t.current=setTimeout(a,s)},[i,n,e]),ne(fi,{children:[ne("div",{className:"alert-bg ".concat(kl[e.alertType].cssClass),children:[ne("div",{className:"alert-icon-bg ".concat(kl[e.alertType].cssClass),children:ne("img",{src:kl[e.alertType].src,className:"alert-icon"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:50,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:45,columnNumber:9},globalThis),ne("div",{className:"alert-msg-cross-timer-bg",children:[ne("div",{className:"alert-msg-cross-bg",children:[ne("div",{className:"alert-msg-bg",style:e.alertLabel?{}:{display:"flex",alignItems:"center"},children:[e.alertLabel&&ne("p",{className:"alert-label",children:e.alertLabel},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:66,columnNumber:17},globalThis),ne("span",{className:"alert-msg",children:e.alertMsg},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:68,columnNumber:15},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:57,columnNumber:13},globalThis),ne("div",{className:"alert-close-btn-bg",children:ne("img",{onClick:a,className:"alert-cross-btn",src:Om+"/Icon/X.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:71,columnNumber:15},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:70,columnNumber:13},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:56,columnNumber:11},globalThis),ne("div",{ref:n,className:"alert-timer ".concat(kl[e.alertType].cssClass)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:78,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:55,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:40,columnNumber:7},globalThis),ne("div",{className:"alert-bg alert-mobile ".concat(kl[e.alertType].cssClass),children:[ne("div",{className:"alert-icon-msg-cross-bg",children:[ne("div",{className:"alert-icon-bg ".concat(kl[e.alertType].cssClass),children:ne("img",{src:kl[e.alertType].src,className:"alert-icon"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:99,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:94,columnNumber:11},globalThis),ne("div",{className:"alert-msg-bg",children:[e.alertLabel&&ne("p",{className:"alert-label",children:e.alertLabel},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:106,columnNumber:15},globalThis),ne("span",{className:"alert-msg",children:e.alertMsg_Mobile?e.alertMsg_Mobile:e.alertMsg},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:108,columnNumber:13},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:104,columnNumber:11},globalThis),ne("div",{className:"alert-close-btn-bg",children:ne("img",{onClick:a,className:"alert-cross-btn",src:Om+"/Icon/X.svg"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:115,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:114,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:93,columnNumber:9},globalThis),ne("div",{ref:i,className:"alert-timer ".concat(kl[e.alertType].cssClass)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:122,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:88,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Alert.js",lineNumber:38,columnNumber:5},globalThis)},Jke=()=>{const[r,e]=oe.useState(null),t=Je(o=>o.alertData),n=Je(o=>o.persistantAlertData);oe.useEffect(()=>{!t||!t.alertMsg||i(t)},[t]),oe.useEffect(()=>{const o=Je.getState().alertQueue;o.length<=0||(r===null&&(e(o[0]),o[0].persistant===!0&&Je.setState({persistantAlertData:o[0]})),Je.getState().actions.popFromAlertQueue())},[r]);const i=oe.useCallback(o=>{if(Je.getState().sceneSettings.disableAlerts===!0)return;let l=o.alertType,u=!1;if(Object.keys(kl).map(h=>{h==l.toLowerCase()&&(u=!0)}),u==!1&&(l=kl.info.id,o.alertType=l),kl[o.alertType].level<Je.getState().sceneSettings.alertLevel||Je.getState().sceneSettings.alertControl[o.alertId]!==!0)return;const f=Je.getState().actions.addToAlertQueue(o);r===null&&f.length===1&&(e(o),o.persistant===!0&&Je.setState({persistantAlertData:o}))},[r]),a=oe.useCallback(()=>{e(n)},[n]),s=oe.useCallback(async()=>{e(null)},[]);return oe.useEffect(()=>{async function o(){await gc(1500);let l=null,u={alertMsg:"Add items by selecting from the panel",alertMsg_Mobile:"Add items by selecting from the panel",alertTime:8e3,alertType:"info",alertLabel:"Get Started"};Je.getState().alertSettings&&(Je.getState().alertSettings.welcomeMessage&&(l=Je.getState().alertSettings.welcomeMessage),Je.getState().alertSettings.instructionMessage&&(u=Je.getState().alertSettings.instructionMessage)),l!==null&&i(l),i(u)}o()},[]),ne("div",{className:"alert-space",children:[r===null&&n&&ne("div",{onClick:a,className:"alert-persistant-btn-bg",style:{background:kl[n.alertType].background,border:"1px solid "+kl[n.alertType].color},children:ne("img",{style:{filter:kl[n.alertType].filter},className:"alert-persistant-btn",src:kl[n.alertType].src},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:144,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:135,columnNumber:9},globalThis),r&&ne(Zke,{handleCloseAlert:s,alertData:r},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:154,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:133,columnNumber:5},globalThis)},eFe=()=>{const r=Je(n=>n.canvasTooltipText),e=Je(n=>n.sceneSettings),t=gr(n=>n.ghostData);return ne(fi,{children:ne("div",{children:[ne(Jke,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:16,columnNumber:9},globalThis),nt.getSceneItemCount()<=0&&!t&&ne("div",{className:"emptySceneBG",children:e.emptySceneText},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:19,columnNumber:11},globalThis),ne("div",{className:"canvasTooltip",children:r},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:22,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:15,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:14,columnNumber:5},globalThis)};function tFe(r){let e={};if(r.type.toLowerCase()==="object3d"){const t=r.userData;if(t?.isPlug===1){const n=t.name;n&&typeof n=="string"&&(e.name=n);const i=t.type;i&&typeof i=="string"?e.type=i:e.type="";const a=t.weight;a&&typeof a=="number"?e.weight=a:e.weight=1;const s=t.affectedNodes;s&&typeof s=="string"?e.affectedNodes=s.replaceAll(" ","").split(","):e.affectedNodes=[];const o=t.acceptedPlugTypes;o&&typeof o=="string"?e.acceptedPlugTypes=o.replaceAll(" ","").split(","):e.acceptedPlugTypes=[];const l=t.connectsToPlugTypes;l&&typeof l=="string"?e.connectsToPlugTypes=l.replaceAll(" ","").split(","):e.connectsToPlugTypes=[];const u=t.dependencySku;u&&typeof u=="string"?e.dependencySku=u:e.dependencySku="";const f=t.isDependencySkuInteractive;u!==void 0&&typeof f=="number"?e.isDependencySkuInteractive=f:e.isDependencySkuInteractive=1}}return e}async function nFe(r){const e=Mo.getState().actions;for(let t=0;t<Object.keys(r).length;t++){const n=Object.keys(r)[t];Gt.info({title:"loading proxy: "+n});const i=performance.now(),a=await e.loadAsset(n,!0),s=performance.now();if(Gt.info({title:`${n} proxy: ${((s-i)/1e3).toFixed(2)} seconds to load.`}),Gt.info({title:"loaded proxy: "+n}),Gt.info({title:"waitingForAsset",details:a}),!a||!a.proxy.data)continue;const o=r[n]?.plugs,l=o===void 0||Array.isArray(o)&&o.length===0;l===!0&&Gt.info({title:`Collecting plugs information for ${n} from the proxy mesh`});let u=[];a.proxy.data.scene.traverse(p=>{if(l===!0){const m=tFe(p);Object.keys(m).length>0&&u.push(m)}if(p.isMesh){p.material.color=new Yt(0/255,0/255,0/255);const m=Je.getState().sceneSettings.ghostColor;p.material.emissive=new Yt(m.r/255,m.g/255,m.b/255),p.material.emissiveIntensity=.75,p.material.alphaTest=m.a,p.material.transparent=!0,p.material.opacity=m.a,p.material.depthTest=!1,p.material.reflectivity=0,p.material.metalness=0,p.material.wireframe=Je.getState().sceneSettings.ghostAsWireframe}}),u.length>0&&(r[n].plugs=u);const{boundingBox:f,boundingSphere:h}=rFe(a);if(f&&h){const p=iFe(f);r[n].boundingBox=f,r[n].boundingSphereCenter=h.center,r[n].boundingBoxSize=p}else r[n].boundingSphereCenter={x:0,y:0,z:0},r[n].boundingBoxSize={x:0,y:0,z:0}}}function iFe(r){return{x:r.max.x-r.min.x,y:r.max.y-r.min.y,z:r.max.z-r.min.z}}function rFe(r){const e=r.proxy.data.scene;if(e){let t=null;return e.traverse(n=>{if(n.isMesh){t=n;return}}),t?(t.geometry.boundingBox||t.geometry.computeBoundingBox(),{boundingBox:t.geometry.boundingBox,boundingSphere:t.geometry.boundingSphere}):!1}}const aFe=`.alert-space{position:absolute;width:auto;height:auto;max-width:40%;top:0;margin:1rem}.alert-bg{display:flex;flex-direction:row;border-radius:5.04px}.alert-mobile{display:none}.alert-persistant-btn{width:2rem;height:2rem;margin:4px;filter:invert(100%) brightness(200%)}.alert-persistant-btn-bg{cursor:pointer;display:flex;justify-content:center;align-items:center;border-radius:4px}.alert-persistant-btn-bg:hover{opacity:.9!important}.alert-icon{width:2rem;height:2rem;margin:14px;filter:invert(100%) brightness(200%)}.alert-icon-bg{border-radius:5.04px 0 0 5.04px}.alert-msg-bg{padding:1rem}.alert-label{font-weight:600;font-size:1.125rem;margin:0 0 4px;text-transform:capitalize}.alert-msg{font-size:1rem}.alert-cross-btn{width:1.5rem;cursor:pointer;margin:.5rem}.alert-msg-cross-timer-bg{display:flex;flex-direction:column;justify-content:space-between}.alert-msg-cross-bg{display:flex;flex-direction:row}.alert-timer{width:0%;height:2px;transition:10ms}.alert-bg.alert-info,.alert-bg.alert-mobile.alert-info{background-color:var(--info-light);border:1.26px solid var(--info-dark)}.alert-icon-bg.alert-info{background-color:var(--info-dark);border:1.26px solid var(--info-dark)}.alert-timer.alert-info{background-color:var(--info-dark)}.alert-bg.alert-warn,.alert-bg.alert-mobile.alert-warn{background-color:var(--warn-light);border:1.26px solid var(--warn-dark)}.alert-icon-bg.alert-warn{background-color:var(--warn-dark);border:1.26px solid var(--warn-dark)}.alert-timer.alert-warn{background-color:var(--warn-dark)}.alert-bg.alert-error,.alert-bg.alert-mobile.alert-error{background-color:var(--error-light);border:1.26px solid var(--error-dark)}.alert-icon-bg.alert-error{background-color:var(--error-dark);border:1.26px solid var(--error-dark)}.alert-timer.alert-error{background-color:var(--error-dark)}.alert-bg.alert-success,.alert-bg.alert-mobile.alert-success{background-color:var(--success-light);border:1.26px solid var(--success-dark)}.alert-icon-bg.alert-success{background-color:var(--success-dark);border:1.26px solid var(--success-dark)}.alert-timer.alert-success{background-color:var(--success-dark)}@keyframes loader{0%{width:0%}to{width:100%}}@media only screen and (orientation: portrait){.alert-label{margin:auto}.alert-close-btn-bg{display:flex;justify-content:center}.alert-icon-msg-cross-bg{display:flex;flex-direction:row;width:100%;align-items:center}.alert-space{width:100%;max-width:100%;margin:auto}.alert-bg{display:none;flex-direction:column}.alert-mobile{display:flex;justify-content:center;align-items:flex-start}.alert-icon{margin:4px}.alert-icon-bg{display:flex;justify-content:center;align-items:center;border-radius:5.04px;margin:8px 16px;height:fit-content}.alert-msg-bg{padding:1rem 0rem;width:calc(100% - 70px)}.alert-persistant-btn{margin:4px!important}.alert-persistant-btn-bg{display:flex;justify-content:center;width:calc(8px + 2rem)!important;align-items:center;border-radius:5.04px;margin:8px 16px}}
|
|
9197
9197
|
`,sFe=`@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap";*{box-sizing:border-box}html,#root,epigraph-configurator-core{width:100%;height:100%;margin:0;padding:0;overflow:hidden;display:flex;align-items:center;justify-content:space-evenly;align-content:center;flex-direction:row}.loading{color:red}.shadowRoot{position:relative;width:100%;height:100%}.shellCanvasContainerParent{display:flex;height:100%;align-items:center;position:absolute;z-index:30;top:0;left:0}.grabCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-Move.svg) 6 3,auto}.grabbingCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-Grab.svg) 6 3,auto}.pointerCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-Click.svg) 6 2,auto}.blockedCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-Block.svg),auto}.moveCursor{cursor:url(https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Cursor-MoveArrows.svg) 8.65 8.65,auto}.mainCanvas{width:100%!important;height:100%!important;background:white}.annotation{cursor:pointer;outline:none;border:none;font-size:8px;font-weight:300;background:black;color:#f0f0f0;padding:2px 10px;border-radius:20px;letter-spacing:1px;display:flex;justify-content:center;align-items:center;gap:5px}.annotation:hover{opacity:.8}.content{transform:translate3d(50%,0,0);text-align:left;background:#202035;color:#fff;padding:10px 15px;border-radius:5px}.ItemsParent{position:absolute;right:0;bottom:0;background-color:#e0e0e0ee;margin:5px;border-radius:15%}.Item{width:75px;height:75px;padding:15px;cursor:grab;user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.Item:hover{transform:scale(1.1)}.cursorImg{position:absolute;top:0;left:0;opacity:0;width:0px;height:0px;pointer-events:none}.heading{font-size:2rem;padding:1rem;font-weight:700}.description{font-size:1rem;padding:0rem 1rem}.overlayUI{width:100%;height:100%;padding:1%;position:absolute;display:flex;align-items:center;justify-content:space-evenly;align-content:center;flex-direction:row}.shellCanvas{width:100%;height:85%;position:relative;border-radius:12px 12px 0 0}.shellSideMenu{width:30%;height:100%}.ignore{pointer-events:none}.interactable{pointer-events:all}.uninteractable{pointer-events:none;opacity:.8}.arButton{position:absolute;bottom:3vh;left:2vh}.sideMenu{width:30%;height:100%;background:#f5f5f5;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;align-content:center}.sideMenuTabs{width:100%;height:10vh;display:flex;justify-content:space-between;padding:1vh 0%;gap:12px}.sideMenuTabs .button{display:flex;align-items:center;justify-content:center;flex-direction:column;font-weight:600;color:#333;min-width:33.33%;opacity:1;text-transform:uppercase;padding-bottom:16px;font-size:.8rem}.sideMenuTabs .button .icon{width:22px;margin-bottom:.5rem}.sideMenuContent{height:75%;width:100%;padding:1vh;background:#f5f5f5;overflow-y:auto}.leftShell{width:65%;height:100%;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;align-content:center}.bottomBar{background-color:#333;height:72px;width:100%;display:flex;padding:1vh;justify-content:flex-end;align-items:center}.bottomBar.right{justify-content:space-between;padding:0 24px;border-radius:12px 12px 0 0}.bottomBar .cartButton{position:relative}.bottomBar .reviewButton{color:#fff;margin-right:12px;font-size:18px}.bottomBar .cartButton .cartNumber{position:absolute;right:-8px;bottom:-4px;padding:4px;background:#e52438;color:#fff;font-size:12px;border-radius:50%}.button{cursor:pointer;font-weight:700}.rightTopBarButton{margin:1vh}.leftBottomBarButton{color:#fff;margin:1vh;width:80px;padding:12px;font-size:14px;border:2px solid #ccc!important;text-align:center;border-radius:4px}.activeSideMenuTab{border-bottom:1px solid #333333}*{scrollbar-width:8px;scrollbar-color:blue transparent}*::-webkit-scrollbar{width:8px}*::-webkit-scrollbar-track{background:black}*::-webkit-scrollbar-thumb{background-color:#e52438;border-radius:0;border:none}.dimensionsButtonParent{position:relative;display:flex}.dimensionText{font-size:.8rem;font-style:normal;font-weight:600}.dimensionActive{border-color:#c7c7c7!important}.color-grid{display:flex;gap:1rem}.colorSelector{cursor:pointer;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:.25rem;transition:.1s ease all}.colorSelector .colorThumbnailContainer{position:relative;transition:.1s ease all}.colorSelector .colorThumbnailContainer .colorThumbnail{width:2.625rem;height:2.625rem;border-radius:50%}.colorSelector .colorThumbnailContainer .checkMark{width:100%;height:100%;display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0}.colorSelector .colorThumbnailContainer .checkMark img{opacity:0;transition:.1s all ease;width:45%;filter:invert(100%) sepia(100%) saturate(2%) hue-rotate(188deg) brightness(101%)}.colorSelector.selected .colorThumbnailContainer .checkMark img{opacity:1}.colorSelector .colorDetails{text-align:center;opacity:0;pointer-events:none}.colorSelector:hover .colorDetails,.colorSelector.selected .colorDetails{opacity:1;pointer-events:all}.colorSelector .colorDetails p{margin:0;font-size:.75rem;color:#333}.colorSelector .colorDetails p:nth-child(1){font-weight:600}.colorSelector .colorDetails p:nth-child(2){font-weight:400}.shellCanvasContainer{box-shadow:4px 4px 12px #0000000d;border-radius:2px;padding:1rem 1rem 1rem 0px;display:none;flex-direction:column;gap:1.125rem;background:white;transition:.25s ease-in-out}.shellCanvasContainerInactive{opacity:0;pointer-events:none}.shellButtonContainer{padding-left:1rem;cursor:pointer;pointer-events:all;border-left:1px solid #fff;position:relative}.shellButtonContainer .buttonContent{background:#fff;transition:.2s all ease;-webkit-transition:.2s all ease;min-width:2.5rem;max-width:2.5rem;min-height:2.5rem;max-height:2.5rem;display:flex;flex-direction:column;justify-content:center;align-items:center;border-radius:50%}.shellButtonContainer .buttonContent span{display:none}.shellButtonContainer:hover .buttonContent{background:#f1f1f1}.shellButtonContainer.active{border-left:1px solid #333333}.shellButtonContainer.active .buttonContent{background:#f1f1f1}.shellButtonContainer img{width:1.375rem}.shellButtonContainer span{font-size:.6875rem;color:#333}.shellButtonContainer:hover span{color:#fff}.shellButtonContainer .hoverDescriptor{position:absolute;top:calc(50% - .5625rem);left:calc(100% + 1rem);padding:.25rem .5rem;background:rgba(0,0,0,.6);border-radius:1px;display:flex;justify-content:center;transition:.2s all ease;-webkit-transition:.2s all ease;opacity:0;pointer-events:none}.shellButtonContainer:hover .hoverDescriptor{opacity:1}.shellButtonContainer .hoverDescriptor span{color:#fff;font-size:11px;white-space:nowrap}.canvasTooltip{position:absolute;width:100%;display:flex;padding:1rem;bottom:0;justify-content:center;color:#898989;font-style:italic;font-size:.75rem;font-family:Inter,helvetica,sans-serif;opacity:1;transition:.2s all ease;-webkit-transition:.2s all ease;pointer-events:none;text-transform:uppercase;margin-bottom:5rem}.emptySceneBG{position:absolute;width:100%;height:100%;display:flex;padding:1rem;bottom:0;font-size:2rem;justify-content:center;align-items:center;color:#89898939;font-family:Inter,helvetica,sans-serif;opacity:1;transition:.2s all ease;-webkit-transition:.2s all ease;pointer-events:none;text-transform:uppercase}
|
|
9198
9198
|
`,oFe=`.topmostActive{z-index:1001!important}.topmostHover{z-index:1002!important}.hotspot{margin-left:0;transition:max-width .5s ease 0s;display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:auto;max-width:36px;height:36px;border:3px solid var(--hotspot-button-border-color);border-radius:18px;box-shadow:#0000001f 0 1px 3px,#0000003d 0 1px 2px;background-color:var(--hotspot-button-background-color);transition:all .5s ease 0s;position:absolute;z-index:0;cursor:pointer;overflow:hidden;color:#000}.hotspot.left{right:-36px}.hotspot:hover{border:3px solid #000}.hotspot:hover,.hotspot.active{opacity:1!important;cursor:pointer;max-width:400px;box-shadow:#00000040 0 14px 28px,#00000038 0 10px 10px}.hotspot:hover .inner-circle{border:2px solid #000}.hotspot.active .inner-circle{background:#fff;border:10px solid var(--hotspot-active-inner-circle-border-color);width:30px;height:30px;left:-.2px;top:-.2px}.hotspot-annotation{display:inline-flex;margin:0 27px 0 34px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-style:normal;font-weight:500;font-size:14px;white-space:nowrap}.hotspot.visited:not(:focus) .inner-circle{background:#fff;border:12px solid var(--visited-color)}.hotspot .inner-circle{width:36px;height:36px;border:3px solid var(--hotspot-inner-circle-border-color);background:white;border-radius:18px;box-sizing:border-box;position:absolute;top:-3px;left:-3px;transition:.1s}.hotspot.left .inner-circle{left:auto;right:-2px}.hotspot.left:hover .inner-circle{left:auto;right:-3px}.hotspot.left .hotspot-annotation{margin:0 34px 0 27px}@media screen and (orientation: portrait){.hotspot:hover{opacity:1!important;cursor:pointer;max-width:36px;box-shadow:#0000001f 0 1px 3px,#0000003d 0 1px 2px;border:3px solid var(--hotspot-button-border-color)}.hotspot:hover .inner-circle{border:3px solid var(--hotspot-inner-circle-border-color)}.hotspot.active{opacity:1!important;cursor:pointer;max-width:400px;box-shadow:#00000040 0 14px 28px,#00000038 0 10px 10px}.hotspot.active .inner-circle{background:#fff;border:10px solid var(--hotspot-active-inner-circle-border-color);width:30px;height:30px;left:-.2px;top:-.2px}}
|
|
9199
9199
|
`,lFe=`.dimensionsText{background:rgb(0,0,0);padding:.2rem .6rem;border-radius:.5rem;color:#fff;white-space:nowrap;transition:.5s}.dimensions:before{content:"";display:block;position:absolute;top:50%;left:-30px;width:30px;height:1px;background-color:#000}.dimensions:after{content:"";display:block;position:absolute;top:50%;right:-30px;width:30px;height:1px;background-color:#000}.yDimension{transform:rotate(90deg)}.zDimension{transform:rotateY(90deg)}
|
|
@@ -9314,7 +9314,7 @@ ${i.join(`
|
|
|
9314
9314
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9315
9315
|
* See the License for the specific language governing permissions and
|
|
9316
9316
|
* limitations under the License.
|
|
9317
|
-
*/const w5e=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;w5e&&self.XRSession.prototype.requestHitTestSource!=null;(()=>{const r=navigator.userAgent||navigator.vendor||self.opera;let e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(r)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(r.substr(0,4)))&&(e=!0),e})();const kre=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,C5e=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(kre){if(C5e)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const r=document.createElement("a");return!!(r.relList&&r.relList.supports&&r.relList.supports("ar"))}}else return!1})();class kR{static instanceSingleton=void 0;#e=!1;#i;#t;#r;#a=!0;#o;#n;#s=!0;#l;#h=!0;#c="";#u="";#f=null;epigraphAnalytics=null;EVENTS={UI:{PreloadScreen_Show:"preload:show",PreloadScreen_Hide:"preload:hide",ContextMenu_InfoBtnClicked:"infoButtonClicked_ContextMenu",ContextMenu_Show:"contextMenu:show",ContextMenu_Hide:"contextMenu:hide",UtilityMenu_Show:"utilityMenu:show",UtilityMenu_Hide:"utilityMenu:hide",ShareButton_Show:"shareButton:show",ShareButton_Hide:"shareButton:hide",ViewInYourSpaceButton_Show:"viewInYourSpace:show",ViewInYourSpaceButton_Hide:"viewInYourSpace:hide",ResetButton_Show:"resetBtn:show",ResetButton_Hide:"resetBtn:hide",DimensionsButton_Show:"dimensionsBtn:show",DimensionsButton_Hide:"dimensionsBtn:hide"},SCENE:{Item_Added:"item:added",Item_Removed:"item:removed",Items_Updated:"items:updated",FittingSkuIds_Updated:"fittingSkuIds:updated",CartItems_Updated:"cartItems:updated",Hotspot_Enter:"hotspot:enter",Hotspot_Exit:"hotspot:exit",SavedConfiguration_Loaded:"loaded-saved-configuration",MaterialOverrides_Exists:"materialOverrideExists",Cart_Checkout:"cart:checkout",Cart_OutOfStock:"cart:outOfStock",Cart_StatusUpdated:"cart:statusUpdated",ReplaceableCategory_Updated:"replaceableCategory:updated",GlobalVariant_Updated:"globalVariant:updated",CategoryData_Updated:"categoryData:updated",GlobalGeometryVariant_Updated:"globalGeometryVariant:updated",Ghost_Loaded:"ghost:loaded",Model_Loaded:"model:loaded",Model_Removed:"model:removed",Scene_Cleared:"scene:cleared",Inventory_Updated:"inventory:updated",DraggingOnDrop_CollsionDetected:"draggingOnDrop:collisionDetected",ActionButton_Clicked:"actionButton:clicked",CartMessage_Update:"cartMessage:updated"},CONFIGURATION:{OnClickItem:"onClickItem",CameraDetails_Update:"cameraDetails:Update"}};constructor(e,t=null){if(kR.instanceSingleton!==void 0)return kR.instanceSingleton;if(e.identifier!=="wc-epigraph-configurator-core")return Gt.error({title:"Invalid identifier on the 'wc-epigraph-configurator-core'. Unable to initialise the ConfiguratorCoreAPI class."}),null;kR.instanceSingleton=this,Object.freeze(this.CORE_EVENTS),this.#r=e,this.#t=t,this.#r.addEventListener(this.EVENTS.SCENE.CartItems_Updated,()=>{this.#l=void 0,this.#s=!0,this.#h=!0}),this.setupAnalyticsEventListeners(),this.#e=!0}set clientAccessKey(e){this.#o=e}set canUpdateInventory(e){this.#a=e}get lastSharedConfigurationID(){return this.#l}set lastSharedConfigurationID(e){this.#l=e}set projectId(e){this.#n=e}get coreWCRef(){return this.#r}getResolvedAssetUrl(e){return IUe(e)}initializeAnalytics(e=void 0){e!==void 0&&(this.epigraphAnalytics=new UAe,this.epigraphAnalytics.addEventPlugin(new LAe(e,!1)))}get isReady(){return this.#e}get preloadProgress(){return this.#i}get categoryData(){return Ln.getState().categoryData}get productData(){return Ln.getState().productData}get lookData(){return Ln.getState().lookData}get sceneSettings(){return Je.getState().sceneSettings}get assetsData(){return Ln.getState().assetsData}get isMobile(){return Je.getState().isMobile}getDeviceState(){return Je.getState().actions.getDeviceState()}get hasSceneChanged(){return this.#s}set hasSceneChanged(e){this.#s=e}enableCart(){Je.getState().actions.enableCart()}disableCart(){Je.getState().actions.disableCart()}fireEvent(e,t){let n=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0});n.data=t,this.coreWCRef?this.coreWCRef.dispatchEvent(n):Gt.warn({title:"core web component not found!"})}setupAnalyticsEventListeners(){this.coreWCRef.addEventListener("coreApi:ready",e=>{let t=Object.assign({},c5e);t.parameters={project_id:`${this.#n}`},this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener("coreApi:failed",e=>{let t=Object.assign({},u5e);t.parameters={project_id:`${this.#n}`},this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Added,e=>{Gt.info({title:"Add Item",details:e});const t=e.data.itemData.guid,a=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(t).currentVariant,s=`${e.data.itemData.skuID}(${a})`;let o=Object.assign({},_5e);o.parameters={item_added:`${s}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(o)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Removed,e=>{if(Gt.info({title:"Remove Item"}),e.data.itemData==null)return;const t=e.data.itemData.skuID;let n=Object.assign({},b5e);n.parameters={item_removed:`${t}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(n)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,e=>{let t=Object.assign({},x5e);t.parameters={hotspot_entered:`${e.data.hotspotAbsID}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,e=>{let t=Object.assign({},T5e);t.parameters={hotspot_exited:`${e.data.domID}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Cart_Checkout,e=>{let t=0,n=0,i=0;e.data.cartItems.forEach((s,o)=>{n++,i+=s.count,t+=s.price;let l=Object.assign({},p5e);l.parameters={client_product_id:s.clientProductId,count_added_to_cart:s.count,variant:`${s.currentVariant}`,total_value:s.price,epigraph_sku:`${s.skuID}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(l)});let a=Object.assign({},d5e);a.parameters={cart_total:t,unique_items_count:n,total_items:i,project_id:`${this.#n}`},this.sendAnalyticsEvent(a)})}setEmptySceneText(e){const t=Je.getState().sceneSettings;t.emptySceneText=e,Je.setState({sceneSettings:{...t}})}getSpawningRequirementForSkuID(e){return ln.getState().attachmentSystem.currentStructure.getSpawningRequirementForSkuID(e)}getCartItems(){return ln.getState().attachmentSystem.getCartItems()}checkout(e=!1){const t=ln.getState().attachmentSystem;this.#f=this.getSceneStructure();const n=t.getCartItems();return Gt.warn({title:"CONFIGURATOR CHECKED OUT: "}),Gt.table(n),e===!0||n.cartItems.find(i=>i.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,n),nt.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,n),n}async reloadCheckedoutScene(){if(!this.#f){Gt.info({title:"No data found since last checkout"});return}await this.loadSceneFromConfiguration(this.#f)}getCurrentItemsInReplaceableCategory(){return ln.getState().attachmentSystem.currentStructure.getCurrentItemsInReplaceableCategory()}async getSceneAsGlbUrl(){return this.#h===!1?this.#c:(URL.revokeObjectURL(this.#c),this.#c=void 0,this.#c=await a5e(),this.#h=!1,this.#c)}async getSceneAsUsdzUrl(){return this.#h===!1?this.#u:(URL.revokeObjectURL(this.#u),this.#u=void 0,this.#u=await r5e(),this.#h=!1,this.#u)}async generateShareableLink(e=!1){if(!this.#s&&this.#l)Gt.info({title:"Reusing the cached configuration ID that was last saved..."});else{Gt.info({title:"Generating a new configuration ID..."});let a=ln.getState().actions.export();const s=await xUe(a);this.#l=await s.text()}const t=window.location.href;let n=new URL(t);e===!0&&n.searchParams.set("launchInAR",!0),n.searchParams.set("projectId",this.#n),n.searchParams.set("epgsharedconfigid",this.#l),this.#s=!1;let i=Object.assign({},TK);return i.parameters={shared_url:`${n}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(i),n.href}closeContextMenu(){Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem()}updatePreloadProgress(e){const t=this.#i;this.#i=e;const n=new CustomEvent("preload:update",{detail:{progress:this.#i}});window.dispatchEvent(n),typeof this.#t=="function"&&this.#t(t,e)}alert({alertMsg:e,alertTime:t,alertType:n,alertLabel:i,persistant:a=!1,alertId:s}){Je.getState().actions.sendAlert({alertMsg:e,alertTime:t,alertType:n,alertLabel:i,persistant:a,alertId:s})}removePersistantAlert(){Je.setState({persistantAlertData:null})}clickHotspot(e){let t=this.coreWCRef.shadowRoot.getElementById(e);t&&t.click()}exitHotspot(){hi.getState().actions.exitHotspot(!1)}async spawnGhostsForSkuID(e,t=!1,n){if(Wt.getState().busy)return null;await gr.getState().actions.spawnGhostsForSkuID(e,t,n)}removeAllGhosts(){if(Wt.getState().busy)return null;gr.getState().actions.clearAllGhosts()}printSceneHierarchy(e=!1){const t=Je.getState().sceneRef;(function n(i){const a=`${i.name} < ${i.type} >`;e===!0?console.groupCollapsed(a):console.group(a),i.children.forEach(n),console.groupEnd()})(t)}getSceneItems(){const e=Wt.getState().itemsSpawned;if(typeof e!="object"){Gt.error({title:"There was an error while fetching the scene item count."});return}return e}getSceneItemCount(){let e;const t=Wt.getState().itemsSpawned;return typeof t!="object"&&Gt.error({title:"There was an error while fetching the scene item count."}),e=Object.keys(t).length,e}async spawnItemBySkuID(e,t=!1){return Wt.getState().busy?null:(t===!0&&await this.spawnGhostsForSkuID(e,!1,1),await Wt.getState().actions.addItemBySkuID(e))}async replaceItemsByGuid(e){let t={...e},n=!1;const i=ln.getState().attachmentSystem.currentStructure;let a=this.getSceneStructure();return Object.keys(e).map(s=>{a.structure.map(o=>{if(o.guid==s){let l=!1;const u=i.getNodeByGUID(s);u&&(l=u.isReplaceableWithSkuId(e[s].skuId)),t[s].success=l,l&&(o.skuID=e[s].skuId,n=!0)}})}),n&&await this.loadSceneFromConfiguration(a),t}async replaceItemsBySkuId(e,t=[]){let n={...e},i=!1;const a=ln.getState().attachmentSystem.currentStructure;let s=this.getSceneStructure();return s.structure.map(o=>{t.includes(o.guid)!==!0&&Object.keys(e).map(l=>{if(o.skuID==l){let u=!1;const f=a.getNodeByGUID(o.guid);f&&(u=f.isReplaceableWithSkuId(e[l].skuId)),n[l].success=u,u&&(o.skuID=e[l].skuId,i=!0)}})}),i&&await this.loadSceneFromConfiguration(s),n}async removeItemByGUID(e,t=!1){const i=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(e);t===!1&&i.canSwapRoot===!0&&i.swapRoot(),await Wt.getState().actions.removeItemByGUID(e)}rotateItemByGUID(e){ln.getState().attachmentSystem.currentStructure.rotateNode(e)}rotateSelectedItem(){const e=Wt.getState().selectedItemData;if(!e){Gt.info("No current item selected to rotate");return}const t=e.itemData.guid;return ln.getState().attachmentSystem.currentStructure.rotateNode(t),e}removeItemBySkuID(e,t=!0){this.removeSelectedItem()}async removeSelectedItem(){const e=Wt.getState().selectedItemData;if(!e){Gt.info({title:"No current item selected to delete"});return}const t=e.itemData.guid;return Wt.getState().actions.deselectItem(),await this.removeItemByGUID(t),Gt.info({title:`Removed Item: ${t}`}),e}refocus(){Je.getState().actions.triggerAutoFocus()}focusOnGhosts(){if(gr.getState().ghostParentRef===null){Gt.warn({title:"Ghost Parent Reference not found"});return}gr.getState().ghostParentRef.children.length<=0?Je.getState().actions.triggerAutoFocus():Je.getState().actions.triggerAutoFocus(gr.getState().ghostParentRef)}exitSelectedItem(){Wt.getState().actions.deselectItem()}getSelectedItemData(){return Wt.getState().selectedItemData}canSelectedItemRotate(){const e=ln.getState().attachmentSystem.currentStructure;let t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).canRotate:!1}canSelectedItemDrag(){const e=ln.getState().attachmentSystem.currentStructure,t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).canDrag:!1}doesGuidItemHaveAnAttachedDependency(e){let t=!0;const i=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(e),a=i.isEndNode;return t=!a,a||i.canSwapRoot&&i.whichNodesAreAttachedToUs().length==1&&(t=!1),t}doesSelectedItemHasAttachedDependency(){const e=this.getSelectedItemData();return e?this.doesGuidItemHaveAnAttachedDependency(e.itemData.guid):!1}isSelectedItemAnEndNode(){const e=ln.getState().attachmentSystem.currentStructure,t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).isEndNode:!1}getCurrentSceneEnvMap(){return tT.getState().envMapUrl}async switchGlobalGeometryVariant(e,t){if(!e){Gt.WARN({title:"Geometry Category: '"+e+"' not valid!"});return}Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem(),await ln.getState().attachmentSystem.switchGlobalGeometryVariant(e,t),await gc(1);let n=Object.assign({},m5e);n.parameters={variant:`${t}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(n);const a=Ln.getState().categoryData.geometryVariants;let s=null;if(a.map(l=>{l.id==e&&(s=l)}),!s)return;const o=s.variants[t];this.alert({alertMsg:s.label.charAt(0).toUpperCase()+s.label.slice(1)+" was successfully switched to "+o.label.charAt(0).toUpperCase()+o.label.slice(1)+".",alertTime:3e3,alertType:"success",alertLabel:`${s.label} Changed`,alertId:"geometryVariantChanged"})}async switchGlobalVariant(e,t=""){if(!e){Gt.WARN({title:"Look Category: '"+e+"' not valid!"});return}Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem(),Gt.info({title:`Changing Global Variant: Category: ${e} Id: ${t}`}),await ln.getState().attachmentSystem.switchGlobalVariant(e,t),await gc(1);let n=Object.assign({},g5e);n.parameters={variant:`${t}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(n)}async overrideSelectedItemMaterial(e=""){return Wt.getState().selectedItemData?(await Wt.getState().actions.switchToVariant(Wt.getState().selectedItemData.itemData,e,!0),!0):!1}async overrideItemMaterialByGuid(e,t){const n=Wt.getState().itemsSpawned[e];if(!n)return Gt.warn({title:"Item with guid: "+e+" doesn't exist"}),!1;await Wt.getState().actions.switchToVariant(n.itemData,t,!0);let i=Object.assign({},v5e);return i.parameters={variant:`${t}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(i),!0}getSelectedItemColors(){let e=[];if(this.getSelectedItemData()==null)return e;let n=this.getSelectedItemData().itemData.looks;if(n){let i=Ln.getState().lookData;n.map(a=>{i.hasOwnProperty(a)&&e.push(i[a])})}return e}getCanvasSize(){return Je.getState().canvasSize}async removeAllVariantOverrides(){Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem(),await ln.getState().attachmentSystem.removeAllVariantOverrides()}switchCursor(e){Je&&Je.getState().actions.switchCursor(e)}getSceneStructure(){return ln.getState().actions.export()}async loadSceneFromConfiguration(e){await ln.getState().actions.loadStructure(e);let t=Object.assign({},xK);t.parameters={project_id:`${this.#n}`},this.sendAnalyticsEvent(t)}async loadSceneFromConfigurationID(e){const t=await ln.getState().actions.loadSavedStructureFromConfigID(e);if(!t)return null;ln.setState({defaultConfig:t});let n=Object.assign({},xK);n.label=`Preconfig ID: ${e}`,await this.loadSceneFromConfiguration(t)}viewInYourSpace(){Gt.info({title:"View in your space called from the Core API"});let e=Object.assign({},A5e);e.label="AR Requested",e.parameters={project_id:`${this.#n}`},this.sendAnalyticsEvent(e),this.#r.epigraphViewInYourSpaceRef._onViewInYourSpaceButtonClicked()}async shareScene(){const e=await this.generateShareableLink();let t=Object.assign({},TK);return t.parameters={shared_url:`${e}`,project_id:`${this.#n}`},this.sendAnalyticsEvent(t),e}async clearScene(){await ln.getState().attachmentSystem.clear()}async restartScene(){Gt.info({title:"Restarting Scene."}),await ln.getState().attachmentSystem.restart();let e=Object.assign({},y5e);e.label="Scene Restarted",e.parameters={project_id:`${this.#n}`},this.sendAnalyticsEvent(e)}areDimensionsVisible(){return Je.getState().showDimensions}getActiveHotspot(){return hi.getState().activeHotspotData}reviewCartShown(){let e=Object.assign({},h5e);e.label="Review Cart shown",e.parameters={project_id:`${this.#n}`},this.sendAnalyticsEvent(e)}reviewCartHidden(){let e=Object.assign({},f5e);e.label="Review Cart hidden",e.parameters={project_id:`${this.#n}`},this.sendAnalyticsEvent(e)}showDimensions(){Je.setState({showDimensions:!0});let e=Object.assign({},E5e);e.label="Dimensions shown",e.parameters={project_id:`${this.#n}`},this.sendAnalyticsEvent(e)}hideDimensions(){Je.setState({showDimensions:!1});let e=Object.assign({},S5e);e.label="Dimensions hidden",e.parameters={project_id:`${this.#n}`},this.sendAnalyticsEvent(e)}areHotspotsVisible(){return hi.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return hi.getState().hotspotsTempVisibility}showAllHotspots(e=!1){hi.getState().actions.switchHotspotsVisibility(!0,e)}hideAllHotspots(e=!1){hi.getState().actions.switchHotspotsVisibility(!1,e)}getFittingSkuIds(){return ln.getState().attachmentSystem.getFittingSKUIDs()}selectItemWithGUID(e){const t=Wt.getState().itemsSpawned,n=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(e);Wt.getState().actions.setSelectedItemData({...t[e],overrideVariant:n.overrideVariant,currentVariant:n.currentVariant,offsetX:0,offsetY:0})}async getCurrentCameraDetails(){return new Promise((e,t)=>{nt.coreWCRef.addEventListener(nt.EVENTS.CONFIGURATION.CameraDetails_Update,n=>{e(n.data)},{once:!0}),Cr.getState().actions.triggerFetchingCamera()})}moveCamera(e,t,n,i,a){hi.setState({isAnyHotspotActive:!0}),Cr.setState({manualControl:!0,sourcePos:e,destPos:t,interpolationFactor:n,duration:i}),a&&Cr.setState({focusPointPosition:a})}setEnvLightMap(e){tT.setState({envMapUrl:e})}updateInventoryForAllProducts(e){return this.#a===!1?(Gt.warn({title:"Inventory has been already updated once!"}),null):(Gd.getState().actions.updateInventoryForAllProducts(e),this.#a=!1,this.getInventoryInfo())}getInventoryInfo(){return Gd.getState().actions.getInventoryInfo()}updatePricingForAllProducts(e){Ln.getState().actions.updatePricingForAllProducts(e);const n=ln.getState().attachmentSystem.getCartItems();n&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,n)}updatePricingForProduct(e,t,n){Ln.getState().actions.updatePricingForProduct(e,t,n);const a=ln.getState().attachmentSystem.getCartItems();a&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,a)}getCurrentPricingInfo(){return Ln.getState().actions.getCurrentPricingInfo()}async itemDragStart(e){if(Wt.getState().busy)return null;Je.setState({hoveredGhostIndex:-1}),await this.removeAllGhosts(),Je.setState({itemDraggedSkuID:e}),await this.spawnGhostsForSkuID(e,!1)}async itemDragEnd(){if(Wt.getState().busy)return null;const e=Je.getState().hoveredGhostIndex;e!==-1?await Wt.getState().actions.addItemBySkuID(Je.getState().itemDraggedSkuID,e):await this.removeAllGhosts(),Je.setState({itemDraggedSkuID:null,hoveredGhostIndex:-1})}async forceSpawnItem(e,t){const n=Ln.getState().productData,i=ln.getState().attachmentSystem;if(!i)return;const a=i.currentStructure;if(!a)return;let s=a.getNodeByGUID(t);s?(s._skuID=e,s.generatePlugsForNode(e)):(s=new vR(e,{guid:t,isEndNode:!0,overrideVariant:null,plugs:n[e].plugs}),a.addNode(s),a.connectPlugs({incomingPlug:new zH({name:"haha",acceptedPlugTypes:[],connectsToPlugTypes:[]},s),receiverPlug:a.rootNode.plugs[0]}));const o=await Wt.getState().actions.addItemWithTransform({position:new ve(0,0,0),rotation:new $i().identity()},e,t);return await gc(1),o}async downloadCurrentViewAsImage(e,t="png"){if(!e){Gt.warn({title:`Couldn't take screenshot for ${e}. Missing imageName parameter`});return}if(!t){Gt.warn({title:`Couldn't take screenshot for ${t}. Missing imageExtension parameter`});return}await gc(1);const n=await this.getCurrentViewAsImageUrl();await gc(1);let i;return n.success===!0&&(Gt.info({title:"Downloading the screenshot"}),i=document.createElement("a"),i.setAttribute("download",`${e}.${t}`),i.setAttribute("href",n.imageData),i.click(),Gt.info({title:"Screenshot download complete"})),i}async getCurrentViewAsImageUrl(){await gc(1);const e=await Je.getState().actions.requestNewScreenshot();return await gc(1),e}setCameraFocusPointPosition(e){Cr.setState({focusPointPosition:e})}triggerFetchingCamera(){Cr.getState().actions.triggerFetchingCamera()}async completeItemDrop(){await Je.getState().actions.completeDropItem()}revertItemDrop(){Je.getState().actions.revertDropItem()}getCameraFocusPointPosition(){return Cr.getState().focusPointPosition}sendAnalyticsPageViewedEvent(){}sendAnalyticsEvent(e){this.epigraphAnalytics!==null&&this.epigraphAnalytics.sendEvent(e)}isIosDevice(){return kre}actionButtonClicked(e){this.fireEvent(this.EVENTS.SCENE.ActionButton_Clicked,{data:e.actionButton.data,skuID:e.skuID,count:e.count,price:e.price,countAvailable:e.countAvailable,countUnavailable:e.countUnavailable,currentVariant:e.currentVariant})}setCartMessage(e){this.fireEvent(this.EVENTS.SCENE.CartMessage_Update,{cartMessage:e})}}class M5e extends HTMLElement{#e="wc-epigraph-configurator-core";#i=!1;#t=void 0;#r=void 0;initialConfigId="";clientAccessKey="";gaCode="";builderMode=!1;projectId="";api=null;constructor(){super(),this.attachShadow({mode:"open"}),hUe(new kR(this)),this.api=nt}get identifier(){return this.#e}static get observedAttributes(){}get epigraphViewInYourSpaceRef(){return this.#t}#a(){this.hasAttribute("configurator-wc-id")&&(this.configuratorWcId=this.getAttribute("configurator-wc-id")),this.hasAttribute("initial-config-id")&&(this.initialConfigId=this.getAttribute("initial-config-id")),this.hasAttribute("client-access-key")&&(this.clientAccessKey=this.getAttribute("client-access-key")),this.hasAttribute("ga-code")&&(this.gaCode=this.getAttribute("ga-code")),this.hasAttribute("builder-mode")&&(this.builderMode=!0),Gt.group("Collected Web Component Attributes"),Gt.table({initialConfigId:this.initialConfigId,clientAccessKey:this.clientAccessKey,builderMode:this.builderMode}),Gt.groupEnd()}static get observedAttributes(){return["view-in-your-space-elem-id"]}attributeChangedCallback(e,t,n){if(this.#r||(this.#r=document.querySelector(`#${this.configuratorWcId}`)),!!this.#r)switch(e){case"view-in-your-space-elem-id":this.#t=this.#r.shadowRoot.querySelector(`#${n}`),Gt.warn({title:"ViewInYourSpace is now accessible from the core: "});break}}async#o(e){return new Promise(function(t,n){let i=new XMLHttpRequest;i.withCredentials=!1,i.open("GET","https://api.seeitinyourspace.com/auth/"+e),i.setRequestHeader("Content-Type","application/json"),i.onreadystatechange=function(){if(this.readyState===4){const a=JSON.parse(this.responseText);Gt.warn({title:a}),t(a)}},i.onerror=function(){n({status:this.status,statusText:i.statusText})},i.send()})}async connectedCallback(){if(this.#i===!0)return;this.#a();const e=await this.#o(this.clientAccessKey);this.validationPassed=e.passed,this.projectId=e.projectID,this.api.projectId=this.projectId,nt.initializeAnalytics(this.gaCode);let t=Object.assign({},l5e);if(t.parameters={project_id:`${this.projectId}`},nt.sendAnalyticsEvent(t),this.validationPassed==="false"){Gt.error({title:"Request from an invalidated source: "+window.location.href}),nt.fireEvent("coreApi:failed");return}Gt.info({title:"VALIDATION SUCCESSFUL!"}),this.#i=!0,this.#r=document.querySelector(`#${this.configuratorWcId}`);let n=new URL(window.location).searchParams;n.has("epgsharedconfigid")&&(this.initialConfigId=n.get("epgsharedconfigid")),iB(this.shadowRoot).render(ne(hFe,{projectId:this.projectId,clientAccessKey:this.clientAccessKey,initialConfigId:this.initialConfigId,builderMode:this.builderMode,disableCart:this.hasAttribute("disable-cart")},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/index.js",lineNumber:206,columnNumber:7},this))}disconnectedCallback(){nt.fireEvent("coreApi:shutDown")}}const v8=document.createElement("template");v8.id="fullScreenModalTemplate";v8.innerHTML=`
|
|
9317
|
+
*/const w5e=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null;w5e&&self.XRSession.prototype.requestHitTestSource!=null;(()=>{const r=navigator.userAgent||navigator.vendor||self.opera;let e=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(r)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(r.substr(0,4)))&&(e=!0),e})();const kre=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,C5e=!!(window.webkit&&window.webkit.messageHandlers);(()=>{if(kre){if(C5e)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{const r=document.createElement("a");return!!(r.relList&&r.relList.supports&&r.relList.supports("ar"))}}else return!1})();class kR{static instanceSingleton=void 0;#e=!1;#i;#n;#r;#a;#s;#l=!0;#o;#t;#f=!0;#c;#u=!0;#h="";#d="";#p=null;epigraphAnalytics=null;EVENTS={UI:{PreloadScreen_Show:"preload:show",PreloadScreen_Hide:"preload:hide",ContextMenu_InfoBtnClicked:"infoButtonClicked_ContextMenu",ContextMenu_Show:"contextMenu:show",ContextMenu_Hide:"contextMenu:hide",UtilityMenu_Show:"utilityMenu:show",UtilityMenu_Hide:"utilityMenu:hide",ShareButton_Show:"shareButton:show",ShareButton_Hide:"shareButton:hide",ViewInYourSpaceButton_Show:"viewInYourSpace:show",ViewInYourSpaceButton_Hide:"viewInYourSpace:hide",ResetButton_Show:"resetBtn:show",ResetButton_Hide:"resetBtn:hide",DimensionsButton_Show:"dimensionsBtn:show",DimensionsButton_Hide:"dimensionsBtn:hide"},SCENE:{Item_Added:"item:added",Item_Removed:"item:removed",Items_Updated:"items:updated",FittingSkuIds_Updated:"fittingSkuIds:updated",CartItems_Updated:"cartItems:updated",Hotspot_Enter:"hotspot:enter",Hotspot_Exit:"hotspot:exit",SavedConfiguration_Loaded:"loaded-saved-configuration",MaterialOverrides_Exists:"materialOverrideExists",Cart_Checkout:"cart:checkout",Cart_OutOfStock:"cart:outOfStock",Cart_StatusUpdated:"cart:statusUpdated",ReplaceableCategory_Updated:"replaceableCategory:updated",GlobalVariant_Updated:"globalVariant:updated",CategoryData_Updated:"categoryData:updated",GlobalGeometryVariant_Updated:"globalGeometryVariant:updated",Ghost_Loaded:"ghost:loaded",Model_Loaded:"model:loaded",Model_Removed:"model:removed",Scene_Cleared:"scene:cleared",Inventory_Updated:"inventory:updated",DraggingOnDrop_CollsionDetected:"draggingOnDrop:collisionDetected",ActionButton_Clicked:"actionButton:clicked",CartMessage_Update:"cartMessage:updated"},CONFIGURATION:{OnClickItem:"onClickItem",CameraDetails_Update:"cameraDetails:Update"}};constructor(e,t=null){if(kR.instanceSingleton!==void 0)return kR.instanceSingleton;if(e.identifier!=="wc-epigraph-configurator-core")return Gt.error({title:"Invalid identifier on the 'wc-epigraph-configurator-core'. Unable to initialise the ConfiguratorCoreAPI class."}),null;kR.instanceSingleton=this,Object.freeze(this.CORE_EVENTS),this.#r=e,this.#a=performance.now(),this.#n=t,this.#r.addEventListener(this.EVENTS.SCENE.CartItems_Updated,()=>{this.#c=void 0,this.#f=!0,this.#u=!0}),this.setupAnalyticsEventListeners(),this.#e=!0}set clientAccessKey(e){this.#o=e}set canUpdateInventory(e){this.#l=e}get lastSharedConfigurationID(){return this.#c}set lastSharedConfigurationID(e){this.#c=e}set projectId(e){this.#t=e}get coreWCRef(){return this.#r}getResolvedAssetUrl(e){return IUe(e)}initializeAnalytics(e=void 0){e!==void 0&&(this.epigraphAnalytics=new UAe,this.epigraphAnalytics.addEventPlugin(new LAe(e,!1)))}get isReady(){return this.#e}get preloadProgress(){return this.#i}get categoryData(){return Ln.getState().categoryData}get productData(){return Ln.getState().productData}get lookData(){return Ln.getState().lookData}get sceneSettings(){return Je.getState().sceneSettings}get assetsData(){return Ln.getState().assetsData}get isMobile(){return Je.getState().isMobile}getDeviceState(){return Je.getState().actions.getDeviceState()}get hasSceneChanged(){return this.#f}set hasSceneChanged(e){this.#f=e}enableCart(){Je.getState().actions.enableCart()}disableCart(){Je.getState().actions.disableCart()}fireEvent(e,t){let n=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0});n.data=t,this.coreWCRef?this.coreWCRef.dispatchEvent(n):Gt.warn({title:"core web component not found!"})}setupAnalyticsEventListeners(){this.coreWCRef.addEventListener("coreApi:ready",e=>{let t=Object.assign({},c5e);const n=((performance.now()-this.#a)/1e3).toFixed(2);this.#s=n,t.parameters={project_id:`${this.#t}`,load_time:n},this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener("coreApi:failed",e=>{let t=Object.assign({},u5e);t.parameters={project_id:`${this.#t}`},this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Added,e=>{Gt.info({title:"Add Item",details:e});const t=e.data.itemData.guid,a=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(t).currentVariant,s=`${e.data.itemData.skuID}(${a})`;let o=Object.assign({},_5e);o.parameters={item_added:`${s}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(o)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Item_Removed,e=>{if(Gt.info({title:"Remove Item"}),e.data.itemData==null)return;const t=e.data.itemData.skuID;let n=Object.assign({},b5e);n.parameters={item_removed:`${t}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(n)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Enter,e=>{let t=Object.assign({},x5e);t.parameters={hotspot_entered:`${e.data.hotspotAbsID}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Hotspot_Exit,e=>{let t=Object.assign({},T5e);t.parameters={hotspot_exited:`${e.data.domID}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(t)}),this.coreWCRef.addEventListener(this.EVENTS.SCENE.Cart_Checkout,e=>{let t=0,n=0,i=0;e.data.cartItems.forEach((s,o)=>{n++,i+=s.count,t+=s.price;let l=Object.assign({},p5e);l.parameters={client_product_id:s.clientProductId,count_added_to_cart:s.count,variant:`${s.currentVariant}`,total_value:s.price,epigraph_sku:`${s.skuID}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(l)});let a=Object.assign({},d5e);a.parameters={cart_total:t,unique_items_count:n,total_items:i,project_id:`${this.#t}`},this.sendAnalyticsEvent(a)})}setEmptySceneText(e){const t=Je.getState().sceneSettings;t.emptySceneText=e,Je.setState({sceneSettings:{...t}})}getSpawningRequirementForSkuID(e){return ln.getState().attachmentSystem.currentStructure.getSpawningRequirementForSkuID(e)}getCartItems(){return ln.getState().attachmentSystem.getCartItems()}checkout(e=!1){const t=ln.getState().attachmentSystem;this.#p=this.getSceneStructure();const n=t.getCartItems();return Gt.warn({title:"CONFIGURATOR CHECKED OUT: "}),Gt.table(n),e===!0||n.cartItems.find(i=>i.countUnavailable>0)===void 0?(this.fireEvent(this.EVENTS.SCENE.Cart_Checkout,n),nt.alert({alertMsg:"Items from your configuration have been added to your cart.",alertTime:6e3,alertType:"success",alertLabel:"Success",alertId:"itemAdded"})):this.fireEvent(this.EVENTS.SCENE.Cart_OutOfStock,n),n}async reloadCheckedoutScene(){if(!this.#p){Gt.info({title:"No data found since last checkout"});return}await this.loadSceneFromConfiguration(this.#p)}getCurrentItemsInReplaceableCategory(){return ln.getState().attachmentSystem.currentStructure.getCurrentItemsInReplaceableCategory()}async getSceneAsGlbUrl(){return this.#u===!1?this.#h:(URL.revokeObjectURL(this.#h),this.#h=void 0,this.#h=await a5e(),this.#u=!1,this.#h)}async getSceneAsUsdzUrl(){return this.#u===!1?this.#d:(URL.revokeObjectURL(this.#d),this.#d=void 0,this.#d=await r5e(),this.#u=!1,this.#d)}async generateShareableLink(e=!1){if(!this.#f&&this.#c)Gt.info({title:"Reusing the cached configuration ID that was last saved..."});else{Gt.info({title:"Generating a new configuration ID..."});let a=ln.getState().actions.export();const s=await xUe(a);this.#c=await s.text()}const t=window.location.href;let n=new URL(t);e===!0&&n.searchParams.set("launchInAR",!0),n.searchParams.set("projectId",this.#t),n.searchParams.set("epgsharedconfigid",this.#c),this.#f=!1;let i=Object.assign({},TK);return i.parameters={shared_url:`${n}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(i),n.href}closeContextMenu(){Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem()}updatePreloadProgress(e){const t=this.#i;this.#i=e;const n=new CustomEvent("preload:update",{detail:{progress:this.#i}});window.dispatchEvent(n),typeof this.#n=="function"&&this.#n(t,e)}alert({alertMsg:e,alertTime:t,alertType:n,alertLabel:i,persistant:a=!1,alertId:s}){Je.getState().actions.sendAlert({alertMsg:e,alertTime:t,alertType:n,alertLabel:i,persistant:a,alertId:s})}removePersistantAlert(){Je.setState({persistantAlertData:null})}clickHotspot(e){let t=this.coreWCRef.shadowRoot.getElementById(e);t&&t.click()}exitHotspot(){hi.getState().actions.exitHotspot(!1)}async spawnGhostsForSkuID(e,t=!1,n){if(Wt.getState().busy)return null;await gr.getState().actions.spawnGhostsForSkuID(e,t,n)}removeAllGhosts(){if(Wt.getState().busy)return null;gr.getState().actions.clearAllGhosts()}printSceneHierarchy(e=!1){const t=Je.getState().sceneRef;(function n(i){const a=`${i.name} < ${i.type} >`;e===!0?console.groupCollapsed(a):console.group(a),i.children.forEach(n),console.groupEnd()})(t)}getSceneItems(){const e=Wt.getState().itemsSpawned;if(typeof e!="object"){Gt.error({title:"There was an error while fetching the scene item count."});return}return e}getSceneItemCount(){let e;const t=Wt.getState().itemsSpawned;return typeof t!="object"&&Gt.error({title:"There was an error while fetching the scene item count."}),e=Object.keys(t).length,e}async spawnItemBySkuID(e,t=!1){return Wt.getState().busy?null:(t===!0&&await this.spawnGhostsForSkuID(e,!1,1),await Wt.getState().actions.addItemBySkuID(e))}async replaceItemsByGuid(e){let t={...e},n=!1;const i=ln.getState().attachmentSystem.currentStructure;let a=this.getSceneStructure();return Object.keys(e).map(s=>{a.structure.map(o=>{if(o.guid==s){let l=!1;const u=i.getNodeByGUID(s);u&&(l=u.isReplaceableWithSkuId(e[s].skuId)),t[s].success=l,l&&(o.skuID=e[s].skuId,n=!0)}})}),n&&await this.loadSceneFromConfiguration(a),t}async replaceItemsBySkuId(e,t=[]){let n={...e},i=!1;const a=ln.getState().attachmentSystem.currentStructure;let s=this.getSceneStructure();return s.structure.map(o=>{t.includes(o.guid)!==!0&&Object.keys(e).map(l=>{if(o.skuID==l){let u=!1;const f=a.getNodeByGUID(o.guid);f&&(u=f.isReplaceableWithSkuId(e[l].skuId)),n[l].success=u,u&&(o.skuID=e[l].skuId,i=!0)}})}),i&&await this.loadSceneFromConfiguration(s),n}async removeItemByGUID(e,t=!1){const i=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(e);t===!1&&i.canSwapRoot===!0&&i.swapRoot(),await Wt.getState().actions.removeItemByGUID(e)}rotateItemByGUID(e){ln.getState().attachmentSystem.currentStructure.rotateNode(e)}rotateSelectedItem(){const e=Wt.getState().selectedItemData;if(!e){Gt.info("No current item selected to rotate");return}const t=e.itemData.guid;return ln.getState().attachmentSystem.currentStructure.rotateNode(t),e}removeItemBySkuID(e,t=!0){this.removeSelectedItem()}async removeSelectedItem(){const e=Wt.getState().selectedItemData;if(!e){Gt.info({title:"No current item selected to delete"});return}const t=e.itemData.guid;return Wt.getState().actions.deselectItem(),await this.removeItemByGUID(t),Gt.info({title:`Removed Item: ${t}`}),e}refocus(){Je.getState().actions.triggerAutoFocus()}focusOnGhosts(){if(gr.getState().ghostParentRef===null){Gt.warn({title:"Ghost Parent Reference not found"});return}gr.getState().ghostParentRef.children.length<=0?Je.getState().actions.triggerAutoFocus():Je.getState().actions.triggerAutoFocus(gr.getState().ghostParentRef)}exitSelectedItem(){Wt.getState().actions.deselectItem()}getSelectedItemData(){return Wt.getState().selectedItemData}canSelectedItemRotate(){const e=ln.getState().attachmentSystem.currentStructure;let t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).canRotate:!1}canSelectedItemDrag(){const e=ln.getState().attachmentSystem.currentStructure,t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).canDrag:!1}doesGuidItemHaveAnAttachedDependency(e){let t=!0;const i=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(e),a=i.isEndNode;return t=!a,a||i.canSwapRoot&&i.whichNodesAreAttachedToUs().length==1&&(t=!1),t}doesSelectedItemHasAttachedDependency(){const e=this.getSelectedItemData();return e?this.doesGuidItemHaveAnAttachedDependency(e.itemData.guid):!1}isSelectedItemAnEndNode(){const e=ln.getState().attachmentSystem.currentStructure,t=this.getSelectedItemData();return t?e.getNodeByGUID(t.itemData.guid).isEndNode:!1}getCurrentSceneEnvMap(){return tT.getState().envMapUrl}async switchGlobalGeometryVariant(e,t){if(!e){Gt.WARN({title:"Geometry Category: '"+e+"' not valid!"});return}Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem(),await ln.getState().attachmentSystem.switchGlobalGeometryVariant(e,t),await gc(1);let n=Object.assign({},m5e);n.parameters={variant:`${t}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(n);const a=Ln.getState().categoryData.geometryVariants;let s=null;if(a.map(l=>{l.id==e&&(s=l)}),!s)return;const o=s.variants[t];this.alert({alertMsg:s.label.charAt(0).toUpperCase()+s.label.slice(1)+" was successfully switched to "+o.label.charAt(0).toUpperCase()+o.label.slice(1)+".",alertTime:3e3,alertType:"success",alertLabel:`${s.label} Changed`,alertId:"geometryVariantChanged"})}async switchGlobalVariant(e,t=""){if(!e){Gt.WARN({title:"Look Category: '"+e+"' not valid!"});return}Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem(),Gt.info({title:`Changing Global Variant: Category: ${e} Id: ${t}`}),await ln.getState().attachmentSystem.switchGlobalVariant(e,t),await gc(1);let n=Object.assign({},g5e);n.parameters={variant:`${t}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(n)}async overrideSelectedItemMaterial(e=""){return Wt.getState().selectedItemData?(await Wt.getState().actions.switchToVariant(Wt.getState().selectedItemData.itemData,e,!0),!0):!1}async overrideItemMaterialByGuid(e,t){const n=Wt.getState().itemsSpawned[e];if(!n)return Gt.warn({title:"Item with guid: "+e+" doesn't exist"}),!1;await Wt.getState().actions.switchToVariant(n.itemData,t,!0);let i=Object.assign({},v5e);return i.parameters={variant:`${t}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(i),!0}getSelectedItemColors(){let e=[];if(this.getSelectedItemData()==null)return e;let n=this.getSelectedItemData().itemData.looks;if(n){let i=Ln.getState().lookData;n.map(a=>{i.hasOwnProperty(a)&&e.push(i[a])})}return e}getCanvasSize(){return Je.getState().canvasSize}async removeAllVariantOverrides(){Wt.getState().selectedItemData&&Wt.getState().actions.deselectItem(),await ln.getState().attachmentSystem.removeAllVariantOverrides()}switchCursor(e){Je&&Je.getState().actions.switchCursor(e)}getSceneStructure(){return ln.getState().actions.export()}async loadSceneFromConfiguration(e){await ln.getState().actions.loadStructure(e);let t=Object.assign({},xK);t.parameters={project_id:`${this.#t}`},this.sendAnalyticsEvent(t)}async loadSceneFromConfigurationID(e){const t=await ln.getState().actions.loadSavedStructureFromConfigID(e);if(!t)return null;ln.setState({defaultConfig:t});let n=Object.assign({},xK);n.label=`Preconfig ID: ${e}`,await this.loadSceneFromConfiguration(t)}viewInYourSpace(){Gt.info({title:"View in your space called from the Core API"});let e=Object.assign({},A5e);e.label="AR Requested",e.parameters={project_id:`${this.#t}`},this.sendAnalyticsEvent(e),this.#r.epigraphViewInYourSpaceRef._onViewInYourSpaceButtonClicked()}async shareScene(){const e=await this.generateShareableLink();let t=Object.assign({},TK);return t.parameters={shared_url:`${e}`,project_id:`${this.#t}`},this.sendAnalyticsEvent(t),e}async clearScene(){await ln.getState().attachmentSystem.clear()}async restartScene(){Gt.info({title:"Restarting Scene."}),await ln.getState().attachmentSystem.restart();let e=Object.assign({},y5e);e.label="Scene Restarted",e.parameters={project_id:`${this.#t}`},this.sendAnalyticsEvent(e)}areDimensionsVisible(){return Je.getState().showDimensions}getActiveHotspot(){return hi.getState().activeHotspotData}reviewCartShown(){let e=Object.assign({},h5e);e.label="Review Cart shown",e.parameters={project_id:`${this.#t}`},this.sendAnalyticsEvent(e)}reviewCartHidden(){let e=Object.assign({},f5e);e.label="Review Cart hidden",e.parameters={project_id:`${this.#t}`},this.sendAnalyticsEvent(e)}showDimensions(){Je.setState({showDimensions:!0});let e=Object.assign({},E5e);e.label="Dimensions shown",e.parameters={project_id:`${this.#t}`},this.sendAnalyticsEvent(e)}hideDimensions(){Je.setState({showDimensions:!1});let e=Object.assign({},S5e);e.label="Dimensions hidden",e.parameters={project_id:`${this.#t}`},this.sendAnalyticsEvent(e)}areHotspotsVisible(){return hi.getState().hotspotsVisibility}areHotspotsTemporarilyVisible(){return hi.getState().hotspotsTempVisibility}showAllHotspots(e=!1){hi.getState().actions.switchHotspotsVisibility(!0,e)}hideAllHotspots(e=!1){hi.getState().actions.switchHotspotsVisibility(!1,e)}getFittingSkuIds(){return ln.getState().attachmentSystem.getFittingSKUIDs()}selectItemWithGUID(e){const t=Wt.getState().itemsSpawned,n=ln.getState().attachmentSystem.currentStructure.getNodeByGUID(e);Wt.getState().actions.setSelectedItemData({...t[e],overrideVariant:n.overrideVariant,currentVariant:n.currentVariant,offsetX:0,offsetY:0})}async getCurrentCameraDetails(){return new Promise((e,t)=>{nt.coreWCRef.addEventListener(nt.EVENTS.CONFIGURATION.CameraDetails_Update,n=>{e(n.data)},{once:!0}),Cr.getState().actions.triggerFetchingCamera()})}moveCamera(e,t,n,i,a){hi.setState({isAnyHotspotActive:!0}),Cr.setState({manualControl:!0,sourcePos:e,destPos:t,interpolationFactor:n,duration:i}),a&&Cr.setState({focusPointPosition:a})}setEnvLightMap(e){tT.setState({envMapUrl:e})}updateInventoryForAllProducts(e){return this.#l===!1?(Gt.warn({title:"Inventory has been already updated once!"}),null):(Gd.getState().actions.updateInventoryForAllProducts(e),this.#l=!1,this.getInventoryInfo())}getInventoryInfo(){return Gd.getState().actions.getInventoryInfo()}updatePricingForAllProducts(e){Ln.getState().actions.updatePricingForAllProducts(e);const n=ln.getState().attachmentSystem.getCartItems();n&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,n)}updatePricingForProduct(e,t,n){Ln.getState().actions.updatePricingForProduct(e,t,n);const a=ln.getState().attachmentSystem.getCartItems();a&&nt.fireEvent(nt.EVENTS.SCENE.CartItems_Updated,a)}getCurrentPricingInfo(){return Ln.getState().actions.getCurrentPricingInfo()}async itemDragStart(e){if(Wt.getState().busy)return null;Je.setState({hoveredGhostIndex:-1}),await this.removeAllGhosts(),Je.setState({itemDraggedSkuID:e}),await this.spawnGhostsForSkuID(e,!1)}async itemDragEnd(){if(Wt.getState().busy)return null;const e=Je.getState().hoveredGhostIndex;e!==-1?await Wt.getState().actions.addItemBySkuID(Je.getState().itemDraggedSkuID,e):await this.removeAllGhosts(),Je.setState({itemDraggedSkuID:null,hoveredGhostIndex:-1})}async forceSpawnItem(e,t){const n=Ln.getState().productData,i=ln.getState().attachmentSystem;if(!i)return;const a=i.currentStructure;if(!a)return;let s=a.getNodeByGUID(t);s?(s._skuID=e,s.generatePlugsForNode(e)):(s=new vR(e,{guid:t,isEndNode:!0,overrideVariant:null,plugs:n[e].plugs}),a.addNode(s),a.connectPlugs({incomingPlug:new zH({name:"haha",acceptedPlugTypes:[],connectsToPlugTypes:[]},s),receiverPlug:a.rootNode.plugs[0]}));const o=await Wt.getState().actions.addItemWithTransform({position:new ve(0,0,0),rotation:new $i().identity()},e,t);return await gc(1),o}async downloadCurrentViewAsImage(e,t="png"){if(!e){Gt.warn({title:`Couldn't take screenshot for ${e}. Missing imageName parameter`});return}if(!t){Gt.warn({title:`Couldn't take screenshot for ${t}. Missing imageExtension parameter`});return}await gc(1);const n=await this.getCurrentViewAsImageUrl();await gc(1);let i;return n.success===!0&&(Gt.info({title:"Downloading the screenshot"}),i=document.createElement("a"),i.setAttribute("download",`${e}.${t}`),i.setAttribute("href",n.imageData),i.click(),Gt.info({title:"Screenshot download complete"})),i}async getCurrentViewAsImageUrl(){await gc(1);const e=await Je.getState().actions.requestNewScreenshot();return await gc(1),e}setCameraFocusPointPosition(e){Cr.setState({focusPointPosition:e})}triggerFetchingCamera(){Cr.getState().actions.triggerFetchingCamera()}async completeItemDrop(){await Je.getState().actions.completeDropItem()}revertItemDrop(){Je.getState().actions.revertDropItem()}getCameraFocusPointPosition(){return Cr.getState().focusPointPosition}sendAnalyticsPageViewedEvent(){}sendAnalyticsEvent(e){this.epigraphAnalytics!==null&&this.epigraphAnalytics.sendEvent(e)}isIosDevice(){return kre}actionButtonClicked(e){this.fireEvent(this.EVENTS.SCENE.ActionButton_Clicked,{data:e.actionButton.data,skuID:e.skuID,count:e.count,price:e.price,countAvailable:e.countAvailable,countUnavailable:e.countUnavailable,currentVariant:e.currentVariant})}setCartMessage(e){this.fireEvent(this.EVENTS.SCENE.CartMessage_Update,{cartMessage:e})}}class M5e extends HTMLElement{#e="wc-epigraph-configurator-core";#i=!1;#n=void 0;#r=void 0;initialConfigId="";clientAccessKey="";gaCode="";builderMode=!1;projectId="";api=null;constructor(){super(),this.attachShadow({mode:"open"}),hUe(new kR(this)),this.api=nt}get identifier(){return this.#e}static get observedAttributes(){}get epigraphViewInYourSpaceRef(){return this.#n}#a(){this.hasAttribute("configurator-wc-id")&&(this.configuratorWcId=this.getAttribute("configurator-wc-id")),this.hasAttribute("initial-config-id")&&(this.initialConfigId=this.getAttribute("initial-config-id")),this.hasAttribute("client-access-key")&&(this.clientAccessKey=this.getAttribute("client-access-key")),this.hasAttribute("ga-code")&&(this.gaCode=this.getAttribute("ga-code")),this.hasAttribute("builder-mode")&&(this.builderMode=!0),Gt.group("Collected Web Component Attributes"),Gt.table({initialConfigId:this.initialConfigId,clientAccessKey:this.clientAccessKey,builderMode:this.builderMode}),Gt.groupEnd()}static get observedAttributes(){return["view-in-your-space-elem-id"]}attributeChangedCallback(e,t,n){if(this.#r||(this.#r=document.querySelector(`#${this.configuratorWcId}`)),!!this.#r)switch(e){case"view-in-your-space-elem-id":this.#n=this.#r.shadowRoot.querySelector(`#${n}`),Gt.warn({title:"ViewInYourSpace is now accessible from the core: "});break}}async#s(e){return new Promise(function(t,n){let i=new XMLHttpRequest;i.withCredentials=!1,i.open("GET","https://api.seeitinyourspace.com/auth/"+e),i.setRequestHeader("Content-Type","application/json"),i.onreadystatechange=function(){if(this.readyState===4){const a=JSON.parse(this.responseText);Gt.warn({title:a}),t(a)}},i.onerror=function(){n({status:this.status,statusText:i.statusText})},i.send()})}async connectedCallback(){if(this.#i===!0)return;this.#a();const e=await this.#s(this.clientAccessKey);this.validationPassed=e.passed,this.projectId=e.projectID,this.api.projectId=this.projectId,nt.initializeAnalytics(this.gaCode);let t=Object.assign({},l5e);if(t.parameters={project_id:`${this.projectId}`},nt.sendAnalyticsEvent(t),this.validationPassed==="false"){Gt.error({title:"Request from an invalidated source: "+window.location.href}),nt.fireEvent("coreApi:failed");return}Gt.info({title:"VALIDATION SUCCESSFUL!"}),this.#i=!0,this.#r=document.querySelector(`#${this.configuratorWcId}`);let n=new URL(window.location).searchParams;n.has("epgsharedconfigid")&&(this.initialConfigId=n.get("epgsharedconfigid")),iB(this.shadowRoot).render(ne(hFe,{projectId:this.projectId,clientAccessKey:this.clientAccessKey,initialConfigId:this.initialConfigId,builderMode:this.builderMode,disableCart:this.hasAttribute("disable-cart")},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/index.js",lineNumber:206,columnNumber:7},this))}disconnectedCallback(){nt.fireEvent("coreApi:shutDown")}}const v8=document.createElement("template");v8.id="fullScreenModalTemplate";v8.innerHTML=`
|
|
9318
9318
|
<style>
|
|
9319
9319
|
.full-screen-modal-container {
|
|
9320
9320
|
width: 100vw;
|
|
@@ -9373,7 +9373,7 @@ ${i.join(`
|
|
|
9373
9373
|
</slot>
|
|
9374
9374
|
</div>
|
|
9375
9375
|
</div>
|
|
9376
|
-
`;class R5e extends HTMLElement{#e=void 0;#i=void 0;constructor(){super(),this.attachShadow({mode:"open"}),this.#
|
|
9376
|
+
`;class R5e extends HTMLElement{#e=void 0;#i=void 0;constructor(){super(),this.attachShadow({mode:"open"}),this.#n()}#n(){this.shadowRoot.appendChild(v8.content.cloneNode(!0)),this.#e=this.shadowRoot.querySelector("#fullScreenDialogContainer"),this.#i=this.shadowRoot.querySelector(".close-button"),this.#i.addEventListener("click",()=>{this.hide()})}show(){this.#e.classList.add("show")}hide(){this.#e.classList.remove("show")}}window.customElements.get("full-screen-modal")===void 0&&window.customElements.define("full-screen-modal",R5e);const y8=document.createElement("template");y8.id="viewInYourSpaceTemplate";y8.innerHTML=`
|
|
9377
9377
|
<style>
|
|
9378
9378
|
model-viewer
|
|
9379
9379
|
{
|
|
@@ -9938,8 +9938,8 @@ ${i.join(`
|
|
|
9938
9938
|
</div>
|
|
9939
9939
|
</div>
|
|
9940
9940
|
</full-screen-modal>
|
|
9941
|
-
`;class I5e extends HTMLElement{#e="";#i="";#
|
|
9942
|
-
Make sure that the URL provided for the asset to be loaded is correct.`),console.error("==============================================================="),console.error(e),console.error("===============================================================")}_onViewInYourSpaceButtonClicked(e){this.canLaunchAR?this._prepareToLaunchAR():this._launchQRModal()}async wait(e){return new Promise((t,n)=>{setTimeout(()=>{t(!0)},e)})}async _prepareToLaunchAR(e){this._showARModal(),await this.wait(1e3),this.#a.isIosDevice()?(this.#i=await this.#a.getSceneAsUsdzUrl(),this.#e="https://storage.googleapis.com/epigraph-configurator/configurator-lite/assets/common/3d-assets/proxies/null-product-proxy.glb"):this.#e=await this.#a.getSceneAsGlbUrl(),this.syncModelViewerAttributes(),this._enableLaunchARButton()}_enableLaunchARButton(){this._launchARButton.disabled=!1,this._hideModelDownloadingLoader()}_disableLaunchARButton(){this._launchARButton.disabled=!0,this._showModelDownloadingLoader()}_launchAR(){this._modelViewer.activateAR()}_showQRLoader(){this._qrLoader.classList.remove("loader-hide")}_hideQRLoader(){this._qrLoader.classList.add("loader-hide")}async _launchQRModal(){if(this._qrCodeImage.classList.add("img-hide"),this._qrCodeImage.setAttribute("src",""),this._showQRLoader(),this._showQRModal(),this.#r=await this._getShareableLinkAsQR(),!this.#r){console.error("[VIEW-IN-YOUR-SPACE:Error] Cannot launch QR modal with no qrSrc.");return}this._qrCodeImage.setAttribute("src",this.#r),this._qrCodeImage.classList.remove("img-hide"),this._hideQRLoader()}async getQRForURL(e){return new Promise(function(t,n){let i={qrdata:e};i=JSON.stringify(i);const a=new XMLHttpRequest;a.withCredentials=!1,a.open("PUT","https://api.seeitinyourspace.com/qr"),a.setRequestHeader("Content-Type","application/json"),a.onreadystatechange=function(){if(this.readyState===4){let s=this.responseText;try{t(s)}catch(o){n({status:o})}}},a.onerror=function(){n({status:this.status,statusText:a.statusText})},a.send(i)})}async _getShareableLinkAsQR(){return this.#
|
|
9941
|
+
`;class I5e extends HTMLElement{#e="";#i="";#n="";#r="https://help.spreadsheetconverter.com/wp-content/uploads/2013/07/car-loan-amortization-mobile-qrcode.png";#a=void 0;#s=!1;#l=void 0;#o=void 0;constructor(){super(),this._modelViewerScriptSource="https://cdn.jsdelivr.net/npm/@google/model-viewer@2.x.x/dist/model-viewer.min.js",this._modelViewer=null,this._qrModalContainer=null,this.attachShadow({mode:"open"}),this._setupLaunchArDrawer(),this._setupQRModal(),this._setupViewInYourSpaceButton()}connectedCallback(){this._modelViewer.addEventListener("load",e=>{this._onModelLoadSuccess(e)}),this._modelViewer.addEventListener("error",e=>{this._onModelLoadFailure(e)}),this._viewInYourSpaceButton.addEventListener("click",e=>{this._onViewInYourSpaceButtonClicked(e)})}set coreApi(e){this.#a=e}get coreApi(){return this.#a}static get observedAttributes(){return["asset-src","debug","hide-button","launch-in-ar","core-api"]}get canLaunchAR(){return this._modelViewer.canActivateAR}attributeChangedCallback(e,t,n){switch(e){case"asset-src":this.#e=n;break;case"hide-button":break;case"launch-in-ar":if(!this.hasAttribute("launch-in-ar"))break;break;case"core-api":this.#a=this.getAttribute("core-api");break}this.syncModelViewerAttributes()}disconnectedCallback(){}syncModelViewerAttributes(){this._modelViewer.setAttribute("src",this.#e),this._modelViewer.setAttribute("ios-src",this.#i),this._modelViewer.style.display="none"}_setupViewInYourSpaceButton(){window.customElements.get("model-viewer")===void 0&&this._importModelViewer(),this.shadowRoot.appendChild(y8.content.cloneNode(!0)),this._fetchUsefulElements(),this.syncModelViewerAttributes(),this._modelViewer.addEventListener("ar-status",e=>{e.detail.status==="session-started"?(this._modelViewer.style.display="block",this.#s=!0):(e.detail.status==="not-presenting"||e.detail.status==="failed")&&(this._modelViewer.style.display="none",this.#s=!1)})}_importModelViewer(){this._modelViewerScriptElem=document.createElement("script"),this._modelViewerScriptElem.setAttribute("type","module"),this._modelViewerScriptElem.setAttribute("src",this._modelViewerScriptSource),this._modelViewerScriptElem.setAttribute("id","modelViewerScript"),document.head.appendChild(this._modelViewerScriptElem)}_setupQRModal(){this.shadowRoot.appendChild(A8.content.cloneNode(!0)),this._qrModalContainer=this.shadowRoot.getElementById("qrModalContainer"),this._qrCodeImage=this.shadowRoot.querySelector("#qrCodeImage"),this._arLink=this.shadowRoot.querySelector("#arLink"),this._qrLoader=this.shadowRoot.getElementById("qrLoader"),this.shadowRoot.getElementById("doneViewInYourSpaceBtn").addEventListener("click",()=>{this._hideQRModal()}),this.shadowRoot.getElementById("qrModalCloseButton").addEventListener("click",()=>{this._hideQRModal()})}_setupLaunchArDrawer(){this.shadowRoot.appendChild(b8.content.cloneNode(!0)),this.arDrawer=this.shadowRoot.getElementById("arDrawer"),this.#l=this.shadowRoot.getElementById("launchARModalContainer"),this.#o=this.shadowRoot.getElementById("launchARModalDrawer"),this._launchARButton=this.shadowRoot.getElementById("launchARButton"),this._modelDownloadLoader=this.shadowRoot.getElementById("modelDownloadLoader"),this._launchARButton.addEventListener("click",()=>{this.#s!==!0&&this._launchAR()})}_showModelDownloadingLoader(){this._modelDownloadLoader.classList.remove("loader-hide")}_hideModelDownloadingLoader(){this._modelDownloadLoader.classList.add("loader-hide")}_showARModal(){this._disableLaunchARButton(),this.arDrawer.show()}_hideARModal(){this.arDrawer.hide()}_fetchUsefulElements(){this._modelViewer=this.shadowRoot.querySelector("model-viewer"),this._viewInYourSpaceButton=this.shadowRoot.querySelector(".viewInYourSpaceButton")}_showQRModal(){this._qrModalContainer.classList.remove("qrModalHide")}_hideQRModal(){this._qrModalContainer.classList.add("qrModalHide")}_onModelLoadSuccess(){}_onModelLoadFailure(e){console.error(`[VIEW-IN-YOUR-SPACE ERROR]: Asset load Errors!!
|
|
9942
|
+
Make sure that the URL provided for the asset to be loaded is correct.`),console.error("==============================================================="),console.error(e),console.error("===============================================================")}_onViewInYourSpaceButtonClicked(e){this.canLaunchAR?this._prepareToLaunchAR():this._launchQRModal()}async wait(e){return new Promise((t,n)=>{setTimeout(()=>{t(!0)},e)})}async _prepareToLaunchAR(e){this._showARModal(),await this.wait(1e3),this.#a.isIosDevice()?(this.#i=await this.#a.getSceneAsUsdzUrl(),this.#e="https://storage.googleapis.com/epigraph-configurator/configurator-lite/assets/common/3d-assets/proxies/null-product-proxy.glb"):this.#e=await this.#a.getSceneAsGlbUrl(),this.syncModelViewerAttributes(),this._enableLaunchARButton()}_enableLaunchARButton(){this._launchARButton.disabled=!1,this._hideModelDownloadingLoader()}_disableLaunchARButton(){this._launchARButton.disabled=!0,this._showModelDownloadingLoader()}_launchAR(){this._modelViewer.activateAR()}_showQRLoader(){this._qrLoader.classList.remove("loader-hide")}_hideQRLoader(){this._qrLoader.classList.add("loader-hide")}async _launchQRModal(){if(this._qrCodeImage.classList.add("img-hide"),this._qrCodeImage.setAttribute("src",""),this._showQRLoader(),this._showQRModal(),this.#r=await this._getShareableLinkAsQR(),!this.#r){console.error("[VIEW-IN-YOUR-SPACE:Error] Cannot launch QR modal with no qrSrc.");return}this._qrCodeImage.setAttribute("src",this.#r),this._qrCodeImage.classList.remove("img-hide"),this._hideQRLoader()}async getQRForURL(e){return new Promise(function(t,n){let i={qrdata:e};i=JSON.stringify(i);const a=new XMLHttpRequest;a.withCredentials=!1,a.open("PUT","https://api.seeitinyourspace.com/qr"),a.setRequestHeader("Content-Type","application/json"),a.onreadystatechange=function(){if(this.readyState===4){let s=this.responseText;try{t(s)}catch(o){n({status:o})}}},a.onerror=function(){n({status:this.status,statusText:a.statusText})},a.send(i)})}async _getShareableLinkAsQR(){return this.#n=await this.#a.generateShareableLink(!0),await this.getQRForURL(this.#n)}}const N5e={}.VITE_APP_EPIGRAPHLOGGER_SCRIPT_SRC,Fre=document.createElement("template");Fre.innerHTML=`
|
|
9943
9943
|
<style>
|
|
9944
9944
|
.preload-main-container{
|
|
9945
9945
|
width: 100%;
|
|
@@ -10085,4 +10085,4 @@ ${i.join(`
|
|
|
10085
10085
|
There was a problem while trying to initialise the configurator.
|
|
10086
10086
|
</div>
|
|
10087
10087
|
</div>
|
|
10088
|
-
`;class D5e extends HTMLElement{#e=void 0;clientAccessKey=null;validationPassed=!1;projectID="";configID="default";gaCode="";#i=!1;#
|
|
10088
|
+
`;class D5e extends HTMLElement{#e=void 0;clientAccessKey=null;validationPassed=!1;projectID="";configID="default";gaCode="";#i=!1;#n=void 0;api={core:null,ui:null};constructor(){super(),this.api.ui=this,this.attachShadow({mode:"open"}),this.#r(),this.#a()}#r(){this.preloadDiv=document.createElement("div"),this.preloadDiv.id="preloadMainContainer",this.preloadDiv.classList.add("preload-main-container"),this.preloadDiv.classList.add("showPreload"),this.preloadDiv.appendChild(Fre.content.cloneNode(!0)),this.preloadDiv.appendChild(zre.content.cloneNode(!0)),this.shadowRoot.appendChild(this.preloadDiv)}#a(){this.hiccupUi=document.createElement("div"),this.hiccupUi.id="hiccupMainContainer",this.hiccupUi.classList.add("hiccup-ui-main-container"),this.hiccupUi.appendChild(Gre.content.cloneNode(!0)),this.hiccupUi.appendChild(Hre.content.cloneNode(!0)),this.shadowRoot.appendChild(this.hiccupUi)}#s(){window.customElements.define("epigraph-configurator-core",M5e)}#l(){window.customElements.define("view-in-your-space",I5e)}#o(){this._epigraphLoggerScriptElem=document.createElement("script"),this._epigraphLoggerScriptElem.setAttribute("src",N5e),this._epigraphLoggerScriptElem.setAttribute("id","epigraphLoggerScript"),document.head.appendChild(this._epigraphLoggerScriptElem),this._epigraphLoggerScriptElem.addEventListener("load",()=>{})}get configuratorWcId(){return this.#e}#t(){this.hasAttribute("id")?this.#e=this.getAttribute("id"):(this.setAttribute("id","epigraphConfiguratorWc"),this.#e=this.getAttribute("id")),this.hasAttribute("ga-code")&&(this.gaCode=this.getAttribute("ga-code")),this.clientAccessKey=this.getAttribute("client-access-key"),this.initialConfigId=this.getAttribute("initial-config-id"),this.initialConfigId||(this.initialConfigId="default")}async connectedCallback(){if(this.#i===!0){console.warn("Tried to remount configurator. Blocking the process.");return}this.#t(),this.#s(),console.log("Imported core"),this.#l(),console.log("Imported VIYS"),this.style.maxWidth="1440px",this.style.maxHeight="800px",this.style.overflow="hidden",this.style.width="100%",this.style.height="100%",this.style.position="relative",this.style.visibility="visible",this.style.display="flex";const e=document.createElement("div");e.id="configuratorContainer",e.style.width="100%",e.style.height="100%",e.style.userSelect="none",e.style.overflow="hidden",this.shadowRoot.appendChild(e),iB(e).render(ne(F2e,{disableUI:this.hasAttribute("disable-ui"),launchInAR:this.hasAttribute("launch-in-ar"),disableCart:this.hasAttribute("disable-cart"),gaCode:this.gaCode,configuratorWcRef:this},"Configurator-App",!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/index.js",lineNumber:357,columnNumber:7},this)),this.#i=!0}showPreloadScreen(){this.preloadDiv.classList.remove("no-pointer-events"),this.preloadDiv.classList.add("showPreload")}async hidePreloadScreen(){this.preloadDiv.classList.remove("showPreload"),await QX(1e3),this.preloadDiv.classList.add("no-pointer-events")}showHiccupScreen(){this.hiccupUi.classList.remove("no-pointer-events"),this.hiccupUi.classList.add("show-hiccup")}async hideHiccupScreen(){this.hiccupUi.classList.remove("show-hiccup"),await QX(1e3),this.hiccupUi.classList.add("no-pointer-events")}}window.customElements.define("epigraph-configurator",D5e);
|