@epigraph/configurator 1.9.2 → 1.9.4

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8916,7 +8916,7 @@ void main() {
8916
8916
  `;Ye=ie(ve),Ye!==!1;){if(Fe.string+=Ye+`
8917
8917
  `,Ye.charAt(0)==="#"){Fe.comments+=Ye+`
8918
8918
  `;continue}if((rn=Ye.match(De))&&(Fe.gamma=parseFloat(rn[1])),(rn=Ye.match(Le))&&(Fe.exposure=parseFloat(rn[1])),(rn=Ye.match(Ue))&&(Fe.valid|=2,Fe.format=rn[1]),(rn=Ye.match(Ge))&&(Fe.valid|=4,Fe.height=parseInt(rn[1],10),Fe.width=parseInt(rn[2],10)),Fe.valid&2&&Fe.valid&4)break}return Fe.valid&2?Fe.valid&4?Fe:A(3,"missing image size specifier"):A(3,"missing format specifier")},le=function(ve,xe,De){const Le=xe;if(Le<8||Le>32767||ve[0]!==2||ve[1]!==2||ve[2]&128)return new Uint8Array(ve);if(Le!==(ve[2]<<8|ve[3]))return A(3,"wrong scanline width");const Ue=new Uint8Array(4*xe*De);if(!Ue.length)return A(4,"unable to allocate buffer space");let Ge=0,Fe=0;const Ye=4*Le,rn=new Uint8Array(4),yn=new Uint8Array(Ye);let bt=De;for(;bt>0&&Fe<ve.byteLength;){if(Fe+4>ve.byteLength)return A(1);if(rn[0]=ve[Fe++],rn[1]=ve[Fe++],rn[2]=ve[Fe++],rn[3]=ve[Fe++],rn[0]!=2||rn[1]!=2||(rn[2]<<8|rn[3])!=Le)return A(3,"bad rgbe scanline format");let sn=0,Ur;for(;sn<Ye&&Fe<ve.byteLength;){Ur=ve[Fe++];const hr=Ur>128;if(hr&&(Ur-=128),Ur===0||sn+Ur>Ye)return A(3,"bad scanline data");if(hr){const zn=ve[Fe++];for(let ar=0;ar<Ur;ar++)yn[sn++]=zn}else yn.set(ve.subarray(Fe,Fe+Ur),sn),sn+=Ur,Fe+=Ur}const lr=Le;for(let hr=0;hr<lr;hr++){let zn=0;Ue[Ge]=yn[hr+zn],zn+=Le,Ue[Ge+1]=yn[hr+zn],zn+=Le,Ue[Ge+2]=yn[hr+zn],zn+=Le,Ue[Ge+3]=yn[hr+zn],Ge+=4}bt--}return Ue},pe=function(ve,xe,De,Le){const Ue=ve[xe+3],Ge=Math.pow(2,Ue-128)/255;De[Le+0]=ve[xe+0]*Ge,De[Le+1]=ve[xe+1]*Ge,De[Le+2]=ve[xe+2]*Ge,De[Le+3]=1},de=function(ve,xe,De,Le){const Ue=ve[xe+3],Ge=Math.pow(2,Ue-128)/255;De[Le+0]=DataUtils.toHalfFloat(Math.min(ve[xe+0]*Ge,65504)),De[Le+1]=DataUtils.toHalfFloat(Math.min(ve[xe+1]*Ge,65504)),De[Le+2]=DataUtils.toHalfFloat(Math.min(ve[xe+2]*Ge,65504)),De[Le+3]=DataUtils.toHalfFloat(1)},fe=new Uint8Array(e);fe.pos=0;const _e=se(fe);if(_e!==-1){const ve=_e.width,xe=_e.height,De=le(fe.subarray(fe.pos),ve,xe);if(De!==-1){let Le,Ue,Ge;switch(this.type){case FloatType:Ge=De.length/4;const Fe=new Float32Array(Ge*4);for(let rn=0;rn<Ge;rn++)pe(De,rn*4,Fe,rn*4);Le=Fe,Ue=FloatType;break;case HalfFloatType:Ge=De.length/4;const Ye=new Uint16Array(Ge*4);for(let rn=0;rn<Ge;rn++)de(De,rn*4,Ye,rn*4);Le=Ye,Ue=HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type);break}return{width:ve,height:xe,data:Le,header:_e.string,gamma:_e.gamma,exposure:_e.exposure,type:Ue}}}return null}setDataType(e){return this.type=e,this}load(e,t,n,s){function o(v,A){switch(v.type){case FloatType:case HalfFloatType:"colorSpace"in v?v.colorSpace="srgb-linear":v.encoding=3e3,v.minFilter=LinearFilter,v.magFilter=LinearFilter,v.generateMipmaps=!1,v.flipY=!0;break}t&&t(v,A)}return super.load(e,o,n,s)}}const hasColorSpace$1="colorSpace"in new Texture;class EXRLoader extends DataTextureLoader{constructor(e){super(e),this.type=HalfFloatType}parse(e){const Fe=Math.pow(2.7182818,2.2);function Ye(rs,ni){for(var ha=0,ls=0;ls<65536;++ls)(ls==0||rs[ls>>3]&1<<(ls&7))&&(ni[ha++]=ls);for(var es=ha-1;ha<65536;)ni[ha++]=0;return es}function rn(rs){for(var ni=0;ni<16384;ni++)rs[ni]={},rs[ni].len=0,rs[ni].lit=0,rs[ni].p=null}const yn={l:0,c:0,lc:0};function bt(rs,ni,ha,ls,es){for(;ha<rs;)ni=ni<<8|uf(ls,es),ha+=8;ha-=rs,yn.l=ni>>ha&(1<<rs)-1,yn.c=ni,yn.lc=ha}const sn=new Array(59);function Ur(rs){for(var ni=0;ni<=58;++ni)sn[ni]=0;for(var ni=0;ni<65537;++ni)sn[rs[ni]]+=1;for(var ha=0,ni=58;ni>0;--ni){var ls=ha+sn[ni]>>1;sn[ni]=ha,ha=ls}for(var ni=0;ni<65537;++ni){var es=rs[ni];es>0&&(rs[ni]=es|sn[es]++<<6)}}function lr(rs,ni,ha,ls,es,zs,El){for(var bh=ha,Dh=0,af=0;es<=zs;es++){if(bh.value-ha.value>ls)return!1;bt(6,Dh,af,rs,bh);var vf=yn.l;if(Dh=yn.c,af=yn.lc,El[es]=vf,vf==63){if(bh.value-ha.value>ls)throw"Something wrong with hufUnpackEncTable";bt(8,Dh,af,rs,bh);var Bh=yn.l+6;if(Dh=yn.c,af=yn.lc,es+Bh>zs+1)throw"Something wrong with hufUnpackEncTable";for(;Bh--;)El[es++]=0;es--}else if(vf>=59){var Bh=vf-59+2;if(es+Bh>zs+1)throw"Something wrong with hufUnpackEncTable";for(;Bh--;)El[es++]=0;es--}}Ur(El)}function hr(rs){return rs&63}function zn(rs){return rs>>6}function ar(rs,ni,ha,ls){for(;ni<=ha;ni++){var es=zn(rs[ni]),zs=hr(rs[ni]);if(es>>zs)throw"Invalid table entry";if(zs>14){var El=ls[es>>zs-14];if(El.len)throw"Invalid table entry";if(El.lit++,El.p){var bh=El.p;El.p=new Array(El.lit);for(var Dh=0;Dh<El.lit-1;++Dh)El.p[Dh]=bh[Dh]}else El.p=new Array(1);El.p[El.lit-1]=ni}else if(zs)for(var af=0,Dh=1<<14-zs;Dh>0;Dh--){var El=ls[(es<<14-zs)+af];if(El.len||El.p)throw"Invalid table entry";El.len=zs,El.lit=ni,af++}}return!0}const Dr={c:0,lc:0};function Pn(rs,ni,ha,ls){rs=rs<<8|uf(ha,ls),ni+=8,Dr.c=rs,Dr.lc=ni}const si={c:0,lc:0};function ea(rs,ni,ha,ls,es,zs,El,bh,Dh,af){if(rs==ni){ls<8&&(Pn(ha,ls,es,El),ha=Dr.c,ls=Dr.lc),ls-=8;var vf=ha>>ls,vf=new Uint8Array([vf])[0];if(Dh.value+vf>af)return!1;for(var Bh=bh[Dh.value-1];vf-- >0;)bh[Dh.value++]=Bh}else if(Dh.value<af)bh[Dh.value++]=rs;else return!1;si.c=ha,si.lc=ls}function Ra(rs){return rs&65535}function as(rs){var ni=Ra(rs);return ni>32767?ni-65536:ni}const ua={a:0,b:0};function ho(rs,ni){var ha=as(rs),ls=as(ni),es=ls,zs=ha+(es&1)+(es>>1),El=zs,bh=zs-es;ua.a=El,ua.b=bh}function tl(rs,ni){var ha=Ra(rs),ls=Ra(ni),es=ha-(ls>>1)&65535,zs=ls+es-32768&65535;ua.a=zs,ua.b=es}function ll(rs,ni,ha,ls,es,zs,El){for(var bh=El<16384,Dh=ha>es?es:ha,af=1,vf;af<=Dh;)af<<=1;for(af>>=1,vf=af,af>>=1;af>=1;){for(var Bh=0,My=Bh+zs*(es-vf),Cy=zs*af,Xf=zs*vf,UA=ls*af,YA=ls*vf,OA,wy,GR,hC;Bh<=My;Bh+=Xf){for(var sC=Bh,JI=Bh+ls*(ha-vf);sC<=JI;sC+=YA){var mb=sC+UA,jR=sC+Cy,dC=jR+UA;bh?(ho(rs[sC+ni],rs[jR+ni]),OA=ua.a,GR=ua.b,ho(rs[mb+ni],rs[dC+ni]),wy=ua.a,hC=ua.b,ho(OA,wy),rs[sC+ni]=ua.a,rs[mb+ni]=ua.b,ho(GR,hC),rs[jR+ni]=ua.a,rs[dC+ni]=ua.b):(tl(rs[sC+ni],rs[jR+ni]),OA=ua.a,GR=ua.b,tl(rs[mb+ni],rs[dC+ni]),wy=ua.a,hC=ua.b,tl(OA,wy),rs[sC+ni]=ua.a,rs[mb+ni]=ua.b,tl(GR,hC),rs[jR+ni]=ua.a,rs[dC+ni]=ua.b)}if(ha&af){var jR=sC+Cy;bh?ho(rs[sC+ni],rs[jR+ni]):tl(rs[sC+ni],rs[jR+ni]),OA=ua.a,rs[jR+ni]=ua.b,rs[sC+ni]=OA}}if(es&af)for(var sC=Bh,JI=Bh+ls*(ha-vf);sC<=JI;sC+=YA){var mb=sC+UA;bh?ho(rs[sC+ni],rs[mb+ni]):tl(rs[sC+ni],rs[mb+ni]),OA=ua.a,rs[mb+ni]=ua.b,rs[sC+ni]=OA}vf=af,af>>=1}return Bh}function _c(rs,ni,ha,ls,es,zs,El,bh,Dh,af){for(var vf=0,Bh=0,My=bh,Cy=Math.trunc(es.value+(zs+7)/8);es.value<Cy;)for(Pn(vf,Bh,ha,es),vf=Dr.c,Bh=Dr.lc;Bh>=14;){var Xf=vf>>Bh-14&16383,UA=ni[Xf];if(UA.len)Bh-=UA.len,ea(UA.lit,El,vf,Bh,ha,ls,es,Dh,af,My),vf=si.c,Bh=si.lc;else{if(!UA.p)throw"hufDecode issues";var YA;for(YA=0;YA<UA.lit;YA++){for(var OA=hr(rs[UA.p[YA]]);Bh<OA&&es.value<Cy;)Pn(vf,Bh,ha,es),vf=Dr.c,Bh=Dr.lc;if(Bh>=OA&&zn(rs[UA.p[YA]])==(vf>>Bh-OA&(1<<OA)-1)){Bh-=OA,ea(UA.p[YA],El,vf,Bh,ha,ls,es,Dh,af,My),vf=si.c,Bh=si.lc;break}}if(YA==UA.lit)throw"hufDecode issues"}}var wy=8-zs&7;for(vf>>=wy,Bh-=wy;Bh>0;){var UA=ni[vf<<14-Bh&16383];if(UA.len)Bh-=UA.len,ea(UA.lit,El,vf,Bh,ha,ls,es,Dh,af,My),vf=si.c,Bh=si.lc;else throw"hufDecode issues"}return!0}function Al(rs,ni,ha,ls,es,zs){var El={value:0},bh=ha.value,Dh=Kc(ni,ha),af=Kc(ni,ha);ha.value+=4;var vf=Kc(ni,ha);if(ha.value+=4,Dh<0||Dh>=65537||af<0||af>=65537)throw"Something wrong with HUF_ENCSIZE";var Bh=new Array(65537),My=new Array(16384);rn(My);var Cy=ls-(ha.value-bh);if(lr(rs,ni,ha,Cy,Dh,af,Bh),vf>8*(ls-(ha.value-bh)))throw"Something wrong with hufUncompress";ar(Bh,Dh,af,My),_c(Bh,My,rs,ni,ha,vf,af,zs,es,El)}function da(rs,ni,ha){for(var ls=0;ls<ha;++ls)ni[ls]=rs[ni[ls]]}function ul(rs){for(var ni=1;ni<rs.length;ni++){var ha=rs[ni-1]+rs[ni]-128;rs[ni]=ha}}function nl(rs,ni){for(var ha=0,ls=Math.floor((rs.length+1)/2),es=0,zs=rs.length-1;!(es>zs||(ni[es++]=rs[ha++],es>zs));)ni[es++]=rs[ls++]}function kc(rs){for(var ni=rs.byteLength,ha=new Array,ls=0,es=new DataView(rs);ni>0;){var zs=es.getInt8(ls++);if(zs<0){var El=-zs;ni-=El+1;for(var bh=0;bh<El;bh++)ha.push(es.getUint8(ls++))}else{var El=zs;ni-=2;for(var Dh=es.getUint8(ls++),bh=0;bh<El+1;bh++)ha.push(Dh)}}return ha}function gl(rs,ni,ha,ls,es,zs){var mb=new DataView(zs.buffer),El=ha[rs.idx[0]].width,bh=ha[rs.idx[0]].height,Dh=3,af=Math.floor(El/8),vf=Math.ceil(El/8),Bh=Math.ceil(bh/8),My=El-(vf-1)*8,Cy=bh-(Bh-1)*8,Xf={value:0},UA=new Array(Dh),YA=new Array(Dh),OA=new Array(Dh),wy=new Array(Dh),GR=new Array(Dh);for(let XA=0;XA<Dh;++XA)GR[XA]=ni[rs.idx[XA]],UA[XA]=XA<1?0:UA[XA-1]+vf*Bh,YA[XA]=new Float32Array(64),OA[XA]=new Uint16Array(64),wy[XA]=new Uint16Array(vf*64);for(let XA=0;XA<Bh;++XA){var hC=8;XA==Bh-1&&(hC=Cy);var sC=8;for(let FC=0;FC<vf;++FC){FC==vf-1&&(sC=My);for(let NC=0;NC<Dh;++NC)OA[NC].fill(0),OA[NC][0]=es[UA[NC]++],Ef(Xf,ls,OA[NC]),dl(OA[NC],YA[NC]),vl(YA[NC]);Ph(YA);for(let NC=0;NC<Dh;++NC)pf(YA[NC],wy[NC],FC*64)}let $R=0;for(let FC=0;FC<Dh;++FC){const NC=ha[rs.idx[FC]].type;for(let TD=8*XA;TD<8*XA+hC;++TD){$R=GR[FC][TD];for(let PN=0;PN<af;++PN){const gD=PN*64+(TD&7)*8;mb.setUint16($R+0*2*NC,wy[FC][gD+0],!0),mb.setUint16($R+1*2*NC,wy[FC][gD+1],!0),mb.setUint16($R+2*2*NC,wy[FC][gD+2],!0),mb.setUint16($R+3*2*NC,wy[FC][gD+3],!0),mb.setUint16($R+4*2*NC,wy[FC][gD+4],!0),mb.setUint16($R+5*2*NC,wy[FC][gD+5],!0),mb.setUint16($R+6*2*NC,wy[FC][gD+6],!0),mb.setUint16($R+7*2*NC,wy[FC][gD+7],!0),$R+=8*2*NC}}if(af!=vf)for(let TD=8*XA;TD<8*XA+hC;++TD){const PN=GR[FC][TD]+8*af*2*NC,gD=af*64+(TD&7)*8;for(let ZN=0;ZN<sC;++ZN)mb.setUint16(PN+ZN*2*NC,wy[FC][gD+ZN],!0)}}}for(var JI=new Uint16Array(El),mb=new DataView(zs.buffer),jR=0;jR<Dh;++jR){ha[rs.idx[jR]].decoded=!0;var dC=ha[rs.idx[jR]].type;if(ha[jR].type==2)for(var NI=0;NI<bh;++NI){const XA=GR[jR][NI];for(var RI=0;RI<El;++RI)JI[RI]=mb.getUint16(XA+RI*2*dC,!0);for(var RI=0;RI<El;++RI)mb.setFloat32(XA+RI*2*dC,yl(JI[RI]),!0)}}}function Ef(rs,ni,ha){for(var ls,es=1;es<64;)ls=ni[rs.value],ls==65280?es=64:ls>>8==255?es+=ls&255:(ha[es]=ls,es++),rs.value++}function dl(rs,ni){ni[0]=yl(rs[0]),ni[1]=yl(rs[1]),ni[2]=yl(rs[5]),ni[3]=yl(rs[6]),ni[4]=yl(rs[14]),ni[5]=yl(rs[15]),ni[6]=yl(rs[27]),ni[7]=yl(rs[28]),ni[8]=yl(rs[2]),ni[9]=yl(rs[4]),ni[10]=yl(rs[7]),ni[11]=yl(rs[13]),ni[12]=yl(rs[16]),ni[13]=yl(rs[26]),ni[14]=yl(rs[29]),ni[15]=yl(rs[42]),ni[16]=yl(rs[3]),ni[17]=yl(rs[8]),ni[18]=yl(rs[12]),ni[19]=yl(rs[17]),ni[20]=yl(rs[25]),ni[21]=yl(rs[30]),ni[22]=yl(rs[41]),ni[23]=yl(rs[43]),ni[24]=yl(rs[9]),ni[25]=yl(rs[11]),ni[26]=yl(rs[18]),ni[27]=yl(rs[24]),ni[28]=yl(rs[31]),ni[29]=yl(rs[40]),ni[30]=yl(rs[44]),ni[31]=yl(rs[53]),ni[32]=yl(rs[10]),ni[33]=yl(rs[19]),ni[34]=yl(rs[23]),ni[35]=yl(rs[32]),ni[36]=yl(rs[39]),ni[37]=yl(rs[45]),ni[38]=yl(rs[52]),ni[39]=yl(rs[54]),ni[40]=yl(rs[20]),ni[41]=yl(rs[22]),ni[42]=yl(rs[33]),ni[43]=yl(rs[38]),ni[44]=yl(rs[46]),ni[45]=yl(rs[51]),ni[46]=yl(rs[55]),ni[47]=yl(rs[60]),ni[48]=yl(rs[21]),ni[49]=yl(rs[34]),ni[50]=yl(rs[37]),ni[51]=yl(rs[47]),ni[52]=yl(rs[50]),ni[53]=yl(rs[56]),ni[54]=yl(rs[59]),ni[55]=yl(rs[61]),ni[56]=yl(rs[35]),ni[57]=yl(rs[36]),ni[58]=yl(rs[48]),ni[59]=yl(rs[49]),ni[60]=yl(rs[57]),ni[61]=yl(rs[58]),ni[62]=yl(rs[62]),ni[63]=yl(rs[63])}function vl(rs){const ni=.5*Math.cos(.7853975),ha=.5*Math.cos(3.14159/16),ls=.5*Math.cos(3.14159/8),es=.5*Math.cos(3*3.14159/16),zs=.5*Math.cos(5*3.14159/16),El=.5*Math.cos(3*3.14159/8),bh=.5*Math.cos(7*3.14159/16);for(var Dh=new Array(4),af=new Array(4),vf=new Array(4),Bh=new Array(4),My=0;My<8;++My){var Cy=My*8;Dh[0]=ls*rs[Cy+2],Dh[1]=El*rs[Cy+2],Dh[2]=ls*rs[Cy+6],Dh[3]=El*rs[Cy+6],af[0]=ha*rs[Cy+1]+es*rs[Cy+3]+zs*rs[Cy+5]+bh*rs[Cy+7],af[1]=es*rs[Cy+1]-bh*rs[Cy+3]-ha*rs[Cy+5]-zs*rs[Cy+7],af[2]=zs*rs[Cy+1]-ha*rs[Cy+3]+bh*rs[Cy+5]+es*rs[Cy+7],af[3]=bh*rs[Cy+1]-zs*rs[Cy+3]+es*rs[Cy+5]-ha*rs[Cy+7],vf[0]=ni*(rs[Cy+0]+rs[Cy+4]),vf[3]=ni*(rs[Cy+0]-rs[Cy+4]),vf[1]=Dh[0]+Dh[3],vf[2]=Dh[1]-Dh[2],Bh[0]=vf[0]+vf[1],Bh[1]=vf[3]+vf[2],Bh[2]=vf[3]-vf[2],Bh[3]=vf[0]-vf[1],rs[Cy+0]=Bh[0]+af[0],rs[Cy+1]=Bh[1]+af[1],rs[Cy+2]=Bh[2]+af[2],rs[Cy+3]=Bh[3]+af[3],rs[Cy+4]=Bh[3]-af[3],rs[Cy+5]=Bh[2]-af[2],rs[Cy+6]=Bh[1]-af[1],rs[Cy+7]=Bh[0]-af[0]}for(var Xf=0;Xf<8;++Xf)Dh[0]=ls*rs[16+Xf],Dh[1]=El*rs[16+Xf],Dh[2]=ls*rs[48+Xf],Dh[3]=El*rs[48+Xf],af[0]=ha*rs[8+Xf]+es*rs[24+Xf]+zs*rs[40+Xf]+bh*rs[56+Xf],af[1]=es*rs[8+Xf]-bh*rs[24+Xf]-ha*rs[40+Xf]-zs*rs[56+Xf],af[2]=zs*rs[8+Xf]-ha*rs[24+Xf]+bh*rs[40+Xf]+es*rs[56+Xf],af[3]=bh*rs[8+Xf]-zs*rs[24+Xf]+es*rs[40+Xf]-ha*rs[56+Xf],vf[0]=ni*(rs[Xf]+rs[32+Xf]),vf[3]=ni*(rs[Xf]-rs[32+Xf]),vf[1]=Dh[0]+Dh[3],vf[2]=Dh[1]-Dh[2],Bh[0]=vf[0]+vf[1],Bh[1]=vf[3]+vf[2],Bh[2]=vf[3]-vf[2],Bh[3]=vf[0]-vf[1],rs[0+Xf]=Bh[0]+af[0],rs[8+Xf]=Bh[1]+af[1],rs[16+Xf]=Bh[2]+af[2],rs[24+Xf]=Bh[3]+af[3],rs[32+Xf]=Bh[3]-af[3],rs[40+Xf]=Bh[2]-af[2],rs[48+Xf]=Bh[1]-af[1],rs[56+Xf]=Bh[0]-af[0]}function Ph(rs){for(var ni=0;ni<64;++ni){var ha=rs[0][ni],ls=rs[1][ni],es=rs[2][ni];rs[0][ni]=ha+1.5747*es,rs[1][ni]=ha-.1873*ls-.4682*es,rs[2][ni]=ha+1.8556*ls}}function pf(rs,ni,ha){for(var ls=0;ls<64;++ls)ni[ha+ls]=DataUtils.toHalfFloat(of(rs[ls]))}function of(rs){return rs<=1?Math.sign(rs)*Math.pow(Math.abs(rs),2.2):Math.sign(rs)*Math.pow(Fe,Math.abs(rs)-1)}function ta(rs){return new DataView(rs.array.buffer,rs.offset.value,rs.size)}function Ii(rs){var ni=rs.viewer.buffer.slice(rs.offset.value,rs.offset.value+rs.size),ha=new Uint8Array(kc(ni)),ls=new Uint8Array(ha.length);return ul(ha),nl(ha,ls),new DataView(ls.buffer)}function el(rs){var ni=rs.array.slice(rs.offset.value,rs.offset.value+rs.size),ha=unzlibSync(ni),ls=new Uint8Array(ha.length);return ul(ha),nl(ha,ls),new DataView(ls.buffer)}function Fc(rs){for(var ni=rs.viewer,ha={value:rs.offset.value},ls=new Uint16Array(rs.width*rs.scanlineBlockSize*(rs.channels*rs.type)),es=new Uint8Array(8192),zs=0,El=new Array(rs.channels),bh=0;bh<rs.channels;bh++)El[bh]={},El[bh].start=zs,El[bh].end=El[bh].start,El[bh].nx=rs.width,El[bh].ny=rs.lines,El[bh].size=rs.type,zs+=El[bh].nx*El[bh].ny*El[bh].size;var Dh=hl(ni,ha),af=hl(ni,ha);if(af>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(Dh<=af)for(var bh=0;bh<af-Dh+1;bh++)es[bh+Dh]=Bf(ni,ha);var vf=new Uint16Array(65536),Bh=Ye(es,vf),My=Kc(ni,ha);Al(rs.array,ni,ha,My,ls,zs);for(var bh=0;bh<rs.channels;++bh)for(var Cy=El[bh],Xf=0;Xf<El[bh].size;++Xf)ll(ls,Cy.start+Xf,Cy.nx,Cy.size,Cy.ny,Cy.nx*Cy.size,Bh);da(vf,ls,zs);for(var UA=0,YA=new Uint8Array(ls.buffer.byteLength),OA=0;OA<rs.lines;OA++)for(var wy=0;wy<rs.channels;wy++){var Cy=El[wy],GR=Cy.nx*Cy.size,hC=new Uint8Array(ls.buffer,Cy.end*2,GR*2);YA.set(hC,UA),UA+=GR*2,Cy.end+=GR}return new DataView(YA.buffer)}function Zl(rs){var ni=rs.array.slice(rs.offset.value,rs.offset.value+rs.size),ha=unzlibSync(ni);const ls=rs.lines*rs.channels*rs.width,es=rs.type==1?new Uint16Array(ls):new Uint32Array(ls);let zs=0,El=0;const bh=new Array(4);for(let Dh=0;Dh<rs.lines;Dh++)for(let af=0;af<rs.channels;af++){let vf=0;switch(rs.type){case 1:bh[0]=zs,bh[1]=bh[0]+rs.width,zs=bh[1]+rs.width;for(let Bh=0;Bh<rs.width;++Bh){const My=ha[bh[0]++]<<8|ha[bh[1]++];vf+=My,es[El]=vf,El++}break;case 2:bh[0]=zs,bh[1]=bh[0]+rs.width,bh[2]=bh[1]+rs.width,zs=bh[2]+rs.width;for(let Bh=0;Bh<rs.width;++Bh){const My=ha[bh[0]++]<<24|ha[bh[1]++]<<16|ha[bh[2]++]<<8;vf+=My,es[El]=vf,El++}break}}return new DataView(es.buffer)}function Yc(rs){var ni=rs.viewer,ha={value:rs.offset.value},ls=new Uint8Array(rs.width*rs.lines*(rs.channels*rs.type*2)),es={version:Yf(ni,ha),unknownUncompressedSize:Yf(ni,ha),unknownCompressedSize:Yf(ni,ha),acCompressedSize:Yf(ni,ha),dcCompressedSize:Yf(ni,ha),rleCompressedSize:Yf(ni,ha),rleUncompressedSize:Yf(ni,ha),rleRawSize:Yf(ni,ha),totalAcUncompressedCount:Yf(ni,ha),totalDcUncompressedCount:Yf(ni,ha),acCompression:Yf(ni,ha)};if(es.version<2)throw"EXRLoader.parse: "+lA.compression+" version "+es.version+" is unsupported";for(var zs=new Array,El=hl(ni,ha)-2;El>0;){var bh=qf(ni.buffer,ha),Dh=Bf(ni,ha),af=Dh>>2&3,vf=(Dh>>4)-1,Bh=new Int8Array([vf])[0],My=Bf(ni,ha);zs.push({name:bh,index:Bh,type:My,compression:af}),El-=bh.length+3}for(var Cy=lA.channels,Xf=new Array(rs.channels),UA=0;UA<rs.channels;++UA){var YA=Xf[UA]={},OA=Cy[UA];YA.name=OA.name,YA.compression=0,YA.decoded=!1,YA.type=OA.pixelType,YA.pLinear=OA.pLinear,YA.width=rs.width,YA.height=rs.lines}for(var wy={idx:new Array(3)},GR=0;GR<rs.channels;++GR)for(var YA=Xf[GR],UA=0;UA<zs.length;++UA){var hC=zs[UA];YA.name==hC.name&&(YA.compression=hC.compression,hC.index>=0&&(wy.idx[hC.index]=GR),YA.offset=GR)}if(es.acCompressedSize>0)switch(es.acCompression){case 0:var mb=new Uint16Array(es.totalAcUncompressedCount);Al(rs.array,ni,ha,es.acCompressedSize,mb,es.totalAcUncompressedCount);break;case 1:var sC=rs.array.slice(ha.value,ha.value+es.totalAcUncompressedCount),JI=unzlibSync(sC),mb=new Uint16Array(JI.buffer);ha.value+=es.totalAcUncompressedCount;break}if(es.dcCompressedSize>0){var jR={array:rs.array,offset:ha,size:es.dcCompressedSize},dC=new Uint16Array(el(jR).buffer);ha.value+=es.dcCompressedSize}if(es.rleRawSize>0){var sC=rs.array.slice(ha.value,ha.value+es.rleCompressedSize),JI=unzlibSync(sC),NI=kc(JI.buffer);ha.value+=es.rleCompressedSize}for(var RI=0,XA=new Array(Xf.length),UA=0;UA<XA.length;++UA)XA[UA]=new Array;for(var $R=0;$R<rs.lines;++$R)for(var FC=0;FC<Xf.length;++FC)XA[FC].push(RI),RI+=Xf[FC].width*rs.type*2;gl(wy,XA,Xf,mb,dC,ls);for(var UA=0;UA<Xf.length;++UA){var YA=Xf[UA];if(!YA.decoded)switch(YA.compression){case 2:for(var NC=0,TD=0,$R=0;$R<rs.lines;++$R){for(var PN=XA[UA][NC],gD=0;gD<YA.width;++gD){for(var ZN=0;ZN<2*YA.type;++ZN)ls[PN++]=NI[TD+ZN*YA.width*YA.height];TD++}NC++}break;case 1:default:throw"EXRLoader.parse: unsupported channel compression"}}return new DataView(ls.buffer)}function qf(rs,ni){for(var ha=new Uint8Array(rs),ls=0;ha[ni.value+ls]!=0;)ls+=1;var es=new TextDecoder().decode(ha.slice(ni.value,ni.value+ls));return ni.value=ni.value+ls+1,es}function Sh(rs,ni,ha){var ls=new TextDecoder().decode(new Uint8Array(rs).slice(ni.value,ni.value+ha));return ni.value=ni.value+ha,ls}function mo(rs,ni){var ha=hf(rs,ni),ls=Kc(rs,ni);return[ha,ls]}function Xc(rs,ni){var ha=Kc(rs,ni),ls=Kc(rs,ni);return[ha,ls]}function hf(rs,ni){var ha=rs.getInt32(ni.value,!0);return ni.value=ni.value+4,ha}function Kc(rs,ni){var ha=rs.getUint32(ni.value,!0);return ni.value=ni.value+4,ha}function uf(rs,ni){var ha=rs[ni.value];return ni.value=ni.value+1,ha}function Bf(rs,ni){var ha=rs.getUint8(ni.value);return ni.value=ni.value+1,ha}const Yf=function(rs,ni){let ha;return"getBigInt64"in DataView.prototype?ha=Number(rs.getBigInt64(ni.value,!0)):ha=rs.getUint32(ni.value+4,!0)+Number(rs.getUint32(ni.value,!0)<<32),ni.value+=8,ha};function yf(rs,ni){var ha=rs.getFloat32(ni.value,!0);return ni.value+=4,ha}function wa(rs,ni){return DataUtils.toHalfFloat(yf(rs,ni))}function yl(rs){var ni=(rs&31744)>>10,ha=rs&1023;return(rs>>15?-1:1)*(ni?ni===31?ha?NaN:1/0:Math.pow(2,ni-15)*(1+ha/1024):6103515625e-14*(ha/1024))}function hl(rs,ni){var ha=rs.getUint16(ni.value,!0);return ni.value+=2,ha}function Jc(rs,ni){return yl(hl(rs,ni))}function ff(rs,ni,ha,ls){for(var es=ha.value,zs=[];ha.value<es+ls-1;){var El=qf(ni,ha),bh=hf(rs,ha),Dh=Bf(rs,ha);ha.value+=3;var af=hf(rs,ha),vf=hf(rs,ha);zs.push({name:El,pixelType:bh,pLinear:Dh,xSampling:af,ySampling:vf})}return ha.value+=1,zs}function wf(rs,ni){var ha=yf(rs,ni),ls=yf(rs,ni),es=yf(rs,ni),zs=yf(rs,ni),El=yf(rs,ni),bh=yf(rs,ni),Dh=yf(rs,ni),af=yf(rs,ni);return{redX:ha,redY:ls,greenX:es,greenY:zs,blueX:El,blueY:bh,whiteX:Dh,whiteY:af}}function aA(rs,ni){var ha=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],ls=Bf(rs,ni);return ha[ls]}function BA(rs,ni){var ha=Kc(rs,ni),ls=Kc(rs,ni),es=Kc(rs,ni),zs=Kc(rs,ni);return{xMin:ha,yMin:ls,xMax:es,yMax:zs}}function A_(rs,ni){var ha=["INCREASING_Y"],ls=Bf(rs,ni);return ha[ls]}function qA(rs,ni){var ha=yf(rs,ni),ls=yf(rs,ni);return[ha,ls]}function UC(rs,ni){var ha=yf(rs,ni),ls=yf(rs,ni),es=yf(rs,ni);return[ha,ls,es]}function rC(rs,ni,ha,ls,es){if(ls==="string"||ls==="stringvector"||ls==="iccProfile")return Sh(ni,ha,es);if(ls==="chlist")return ff(rs,ni,ha,es);if(ls==="chromaticities")return wf(rs,ha);if(ls==="compression")return aA(rs,ha);if(ls==="box2i")return BA(rs,ha);if(ls==="lineOrder")return A_(rs,ha);if(ls==="float")return yf(rs,ha);if(ls==="v2f")return qA(rs,ha);if(ls==="v3f")return UC(rs,ha);if(ls==="int")return hf(rs,ha);if(ls==="rational")return mo(rs,ha);if(ls==="timecode")return Xc(rs,ha);if(ls==="preview")return ha.value+=es,"skipped";ha.value+=es}function wI(rs,ni,ha){const ls={};if(rs.getUint32(0,!0)!=20000630)throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";ls.version=rs.getUint8(4);const es=rs.getUint8(5);ls.spec={singleTile:!!(es&2),longName:!!(es&4),deepFormat:!!(es&8),multiPart:!!(es&16)},ha.value=8;for(var zs=!0;zs;){var El=qf(ni,ha);if(El==0)zs=!1;else{var bh=qf(ni,ha),Dh=Kc(rs,ha),af=rC(rs,ni,ha,bh,Dh);af===void 0?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${bh}'.`):ls[El]=af}}if(es!=0)throw console.error("EXRHeader:",ls),"THREE.EXRLoader: provided file is currently unsupported.";return ls}function bI(rs,ni,ha,ls,es){const zs={size:0,viewer:ni,array:ha,offset:ls,width:rs.dataWindow.xMax-rs.dataWindow.xMin+1,height:rs.dataWindow.yMax-rs.dataWindow.yMin+1,channels:rs.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:rs.channels[0].pixelType,uncompress:null,getter:null,format:null,[hasColorSpace$1?"colorSpace":"encoding"]:null};switch(rs.compression){case"NO_COMPRESSION":zs.lines=1,zs.uncompress=ta;break;case"RLE_COMPRESSION":zs.lines=1,zs.uncompress=Ii;break;case"ZIPS_COMPRESSION":zs.lines=1,zs.uncompress=el;break;case"ZIP_COMPRESSION":zs.lines=16,zs.uncompress=el;break;case"PIZ_COMPRESSION":zs.lines=32,zs.uncompress=Fc;break;case"PXR24_COMPRESSION":zs.lines=16,zs.uncompress=Zl;break;case"DWAA_COMPRESSION":zs.lines=32,zs.uncompress=Yc;break;case"DWAB_COMPRESSION":zs.lines=256,zs.uncompress=Yc;break;default:throw"EXRLoader.parse: "+rs.compression+" is unsupported"}if(zs.scanlineBlockSize=zs.lines,zs.type==1)switch(es){case FloatType:zs.getter=Jc,zs.inputSize=2;break;case HalfFloatType:zs.getter=hl,zs.inputSize=2;break}else if(zs.type==2)switch(es){case FloatType:zs.getter=yf,zs.inputSize=4;break;case HalfFloatType:zs.getter=wa,zs.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+zs.type+" for "+rs.compression+".";zs.blockCount=(rs.dataWindow.yMax+1)/zs.scanlineBlockSize;for(var El=0;El<zs.blockCount;El++)Yf(ni,ls);zs.outputChannels=zs.channels==3?4:zs.channels;const bh=zs.width*zs.height*zs.outputChannels;switch(es){case FloatType:zs.byteArray=new Float32Array(bh),zs.channels<zs.outputChannels&&zs.byteArray.fill(1,0,bh);break;case HalfFloatType:zs.byteArray=new Uint16Array(bh),zs.channels<zs.outputChannels&&zs.byteArray.fill(15360,0,bh);break;default:console.error("THREE.EXRLoader: unsupported type: ",es);break}return zs.bytesPerLine=zs.width*zs.inputSize*zs.channels,zs.outputChannels==4?zs.format=RGBAFormat:zs.format=RedFormat,hasColorSpace$1?zs.colorSpace="srgb-linear":zs.encoding=3e3,zs}const IA=new DataView(e),ml=new Uint8Array(e),gy={value:0},lA=wI(IA,e,gy),By=bI(lA,IA,ml,gy,this.type),aC={value:0},Ab={R:0,G:1,B:2,A:3,Y:0};for(let rs=0;rs<By.height/By.scanlineBlockSize;rs++){const ni=Kc(IA,gy);By.size=Kc(IA,gy),By.lines=ni+By.scanlineBlockSize>By.height?By.height-ni:By.scanlineBlockSize;const ls=By.size<By.lines*By.bytesPerLine?By.uncompress(By):ta(By);gy.value+=By.size;for(let es=0;es<By.scanlineBlockSize;es++){const zs=es+rs*By.scanlineBlockSize;if(zs>=By.height)break;for(let El=0;El<By.channels;El++){const bh=Ab[lA.channels[El].name];for(let Dh=0;Dh<By.width;Dh++){aC.value=(es*(By.channels*By.width)+El*By.width+Dh)*By.inputSize;const af=(By.height-1-zs)*(By.width*By.outputChannels)+Dh*By.outputChannels+bh;By.byteArray[af]=By.getter(ls,aC)}}}}return{header:lA,width:By.width,height:By.height,data:By.byteArray,format:By.format,[hasColorSpace$1?"colorSpace":"encoding"]:By[hasColorSpace$1?"colorSpace":"encoding"],type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,s){function o(v,A){hasColorSpace$1?v.colorSpace=A.colorSpace:v.encoding=A.encoding,v.minFilter=LinearFilter,v.magFilter=LinearFilter,v.generateMipmaps=!1,v.flipY=!1,t&&t(v,A)}return super.load(e,o,n,s)}}const _taskCache=new WeakMap;class DRACOLoader extends Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,s){const o=new FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,v=>{const A={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(v,A).then(t).catch(s)},n,s)}decodeDracoFile(e,t,n,s){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,o).then(t)}decodeGeometry(e,t){for(const b in t.attributeTypes){const T=t.attributeTypes[b];T.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[b]=T.name)}const n=JSON.stringify(t);if(_taskCache.has(e)){const b=_taskCache.get(e);if(b.key===n)return b.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const o=this.workerNextTaskID++,v=e.byteLength,A=this._getWorker(o,v).then(b=>(s=b,new Promise((T,ee)=>{s._callbacks[o]={resolve:T,reject:ee},s.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))).then(b=>this._createGeometry(b.geometry));return A.catch(()=>!0).then(()=>{s&&o&&this._releaseTask(s,o)}),_taskCache.set(e,{key:n,promise:A}),A}_createGeometry(e){const t=new BufferGeometry;e.index&&t.setIndex(new BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n],o=s.name,v=s.array,A=s.itemSize;t.setAttribute(o,new BufferAttribute(v,A))}return t}_loadLibrary(e,t){const n=new FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((s,o)=>{n.load(e,s,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const s=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const o=DRACOWorker.toString(),v=["/* draco decoder */",s,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
8919
- `);this.workerSourceURL=URL.createObjectURL(new Blob([v]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(o){const v=o.data;switch(v.type){case"decode":s._callbacks[v.id].resolve(v);break;case"error":s._callbacks[v.id].reject(v);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+v.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,o){return s._taskLoad>o._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function DRACOWorker(){let a,e;onmessage=function(v){const A=v.data;switch(A.type){case"init":a=A.decoderConfig,e=new Promise(function(ee){a.onModuleLoaded=function(re){ee({draco:re})},DracoDecoderModule(a)});break;case"decode":const b=A.buffer,T=A.taskConfig;e.then(ee=>{const re=ee.draco,ie=new re.Decoder,se=new re.DecoderBuffer;se.Init(new Int8Array(b),b.byteLength);try{const le=t(re,ie,se,T),pe=le.attributes.map(de=>de.array.buffer);le.index&&pe.push(le.index.array.buffer),self.postMessage({type:"decode",id:A.id,geometry:le},pe)}catch(le){console.error(le),self.postMessage({type:"error",id:A.id,error:le.message})}finally{re.destroy(se),re.destroy(ie)}});break}};function t(v,A,b,T){const ee=T.attributeIDs,re=T.attributeTypes;let ie,se;const le=A.GetEncodedGeometryType(b);if(le===v.TRIANGULAR_MESH)ie=new v.Mesh,se=A.DecodeBufferToMesh(b,ie);else if(le===v.POINT_CLOUD)ie=new v.PointCloud,se=A.DecodeBufferToPointCloud(b,ie);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!se.ok()||ie.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+se.error_msg());const pe={index:null,attributes:[]};for(const de in ee){const fe=self[re[de]];let _e,ve;if(T.useUniqueIDs)ve=ee[de],_e=A.GetAttributeByUniqueId(ie,ve);else{if(ve=A.GetAttributeId(ie,v[ee[de]]),ve===-1)continue;_e=A.GetAttribute(ie,ve)}pe.attributes.push(s(v,A,ie,de,fe,_e))}return le===v.TRIANGULAR_MESH&&(pe.index=n(v,A,ie)),v.destroy(ie),pe}function n(v,A,b){const ee=b.num_faces()*3,re=ee*4,ie=v._malloc(re);A.GetTrianglesUInt32Array(b,re,ie);const se=new Uint32Array(v.HEAPF32.buffer,ie,ee).slice();return v._free(ie),{array:se,itemSize:1}}function s(v,A,b,T,ee,re){const ie=re.num_components(),le=b.num_points()*ie,pe=le*ee.BYTES_PER_ELEMENT,de=o(v,ee),fe=v._malloc(pe);A.GetAttributeDataArrayForAllPoints(b,re,de,pe,fe);const _e=new ee(v.HEAPF32.buffer,fe,le).slice();return v._free(fe),{name:T,array:_e,itemSize:ie}}function o(v,A){switch(A){case Float32Array:return v.DT_FLOAT32;case Int8Array:return v.DT_INT8;case Int16Array:return v.DT_INT16;case Int32Array:return v.DT_INT32;case Uint8Array:return v.DT_UINT8;case Uint16Array:return v.DT_UINT16;case Uint32Array:return v.DT_UINT32}}}const ENV={}.VITE_APP_ENV,IS_DEV_ENV=!1;let DISABLE_ANALYTICS_EVENTS=!1,ASSETS_SOURCE_ROOT;const LOGGER=new x2("CORE");ENV==="staging"?(LOGGER.setCurrentMode(TR.Staging),ASSETS_SOURCE_ROOT="https://storage.googleapis.com/epigraph-configurator"):(LOGGER.setCurrentMode(TR.Release),ASSETS_SOURCE_ROOT="https://storage.googleapis.com/epigraph-configurator");LOGGER.info({title:"test"});const DEFAULT_INVENTORY=99999,DEFAULT_PRODUCT_PRICE=99999;let CORE_API=null;function setCoreApi(a){CORE_API=a,CORE_API.disableAnalyticsEvents=DISABLE_ANALYTICS_EVENTS}const ALL_PROJECTS_ASSET_DATA_ROOT_URL=`${ASSETS_SOURCE_ROOT}/projects-asset-data`,GENERIC_PROJECT_ASSET_DATA_ROOT_URL=`${ALL_PROJECTS_ASSET_DATA_ROOT_URL}/generic`;let FETCH_MODULE_DATA_ENDPOINT="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?moduleID=",SAVE_CONFIG_ENDPOINT="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe/saveConfig",FETCH_CONFIG_ENDPOINT="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?configID=",PUBLIC_DESIGN_ASSETS_ENDPOINT="https://storage.googleapis.com/gsc-epigraph-design/product-assets";function setGlobalEndpoints(a){const e=a.SAVE_CONFIG_ENDPOINT;SAVE_CONFIG_ENDPOINT=e||SAVE_CONFIG_ENDPOINT;const t=a.FETCH_CONFIG_ENDPOINT;FETCH_CONFIG_ENDPOINT=t||FETCH_CONFIG_ENDPOINT;const n=a.PUBLIC_DESIGN_ASSETS_ENDPOINT;PUBLIC_DESIGN_ASSETS_ENDPOINT=n||PUBLIC_DESIGN_ASSETS_ENDPOINT;const s=a.ASSETS_SOURCE_ROOT;ASSETS_SOURCE_ROOT=s||ASSETS_SOURCE_ROOT}const ALERT_TYPES=Object.freeze({info:{id:"info",level:1e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/CheckCircle.svg",color:"#65BC6C",cssClass:"alert-success",background:"#DBF0DD",filter:"invert(74%) sepia(3%) saturate(5600%) hue-rotate(75deg) brightness(90%) contrast(90%)"}}),CAMERA_ACTION=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}),CURSORS={GRAB:"grab",POINTER:"pointer",BLOCKED:"blocked",GRABBING:"grabbing",MOVE:"move"},ensureUniqueNames=a=>{const e=[],t=new Set;for(const n of a){let s=n,o=0;for(;t.has(s);)s=n+"."+ ++o;t.add(s),e.push(s)}return e},mappingsArrayToTable=(a,e)=>{const t={};for(const n of a.mappings)for(const s of n.variants)t[e[s]]={material:null,gltfMaterialIndex:n.material};return t},compatibleObject=a=>a.material!==void 0&&a.userData&&a.userData.variantMaterials,traversePair=(a,e,t)=>{t(a,e);for(let n=0;n<a.children.length;n++)traversePair(a.children[n],e.children[n],t)},copyVariantMaterials=(a,e)=>{e.userData.variantMaterials!==void 0&&(a.userData.variantMaterials=Object.assign({},e.userData.variantMaterials)),e.userData.originalMaterial!==void 0&&(a.userData.originalMaterial=e.userData.originalMaterial)};class GLTFMaterialsVariantsExtension{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 o=n.extensions[this.name].variants||[],v=ensureUniqueNames(o.map(T=>T.name));for(const T of e.scenes)T.traverse(ee=>{const re=t.associations.get(ee);if(!re||re.meshes===void 0||re.primitives===void 0)return;const le=n.meshes[re.meshes].primitives[re.primitives].extensions;!le||!le[this.name]||(ee.userData.variantMaterials=mappingsArrayToTable(le[this.name],v))});e.userData.variants=v,e.functions=e.functions||{};const A=async(T,ee,re)=>{T.userData.originalMaterial||(T.userData.originalMaterial=T.material);const ie=T.material;let se=null;if(ee===null||!T.userData.variantMaterials[ee])T.material=T.userData.originalMaterial,t.associations.has(T.material)&&(se=t.associations.get(T.material).index);else{const le=T.userData.variantMaterials[ee];le.material?(T.material=le.material,le.gltfMaterialIndex!==void 0&&(se=le.gltfMaterialIndex)):(se=le.gltfMaterialIndex,T.material=await t.getDependency("material",se),t.assignFinalMaterial(T),le.material=T.material)}re!==null&&re(T,ie,se)},b=T=>{const ee=T.material,re=T.userData.variantMaterials,ie=[];for(const se in re){const le=re[se];if(le.material)continue;const pe=le.gltfMaterialIndex;ie.push(t.getDependency("material",pe).then(de=>{T.material=de,t.assignFinalMaterial(T),re[se].material=T.material}))}return Promise.all(ie).then(()=>{T.material=ee})};e.functions.selectVariant=(T,ee,re=!0,ie=null)=>{const se=[];return re?T.traverse(le=>compatibleObject(le)&&se.push(A(le,ee,ie))):compatibleObject(T)&&se.push(A(T,ee,ie)),Promise.all(se)},e.functions.ensureLoadVariants=(T,ee=!0)=>{const re=[];return ee?T.traverse(ie=>compatibleObject(ie)&&re.push(b(ie))):compatibleObject(T)&&re.push(b(T)),Promise.all(re)},e.functions.copyVariantMaterials=(T,ee,re=!0)=>{re?traversePair(T,ee,(ie,se)=>copyVariantMaterials(ie,se)):copyVariantMaterials(T,ee)}}}var dracoLoader=new DRACOLoader;dracoLoader.setDecoderPath(`${ASSETS_SOURCE_ROOT}/external-libs/draco/`);dracoLoader.setDecoderConfig({type:"js"});const assetStore=create$3((a,e)=>({assets:{items:{}},actions:{async loadAsset(t,n=!1){const{assets:s}=e();let o,v;if(s.items[t]){const re=n?s.items[t].proxy:s.items[t];if(re.isLoaded)return s.items[t];if(re.errorLoading)throw Error((n?"Proxy ":"Model ")+"Loading failed for: "+t,t)}else s.items[t]={isLoaded:!1,errorLoading:!1,proxy:{isLoaded:!1,errorLoading:!1}};const A=productDataStore$1.getState().productData[t];if(!A)throw Error("Data doesn't exists for "+t,t);if(n?(o=s.items[t].proxy,v=CORE_API.getResolvedAssetUrl(A.colliderProxyGLTF)):(o=s.items[t],v=CORE_API.getResolvedAssetUrl(A.gltfURL)),!o||!v)return null;const b=new GLTFLoader;b.register(re=>new GLTFMaterialsVariantsExtension(re)),b.setDRACOLoader(dracoLoader);async function T(re){const ie=re.loaded/re.total*100;o.progress=ie}const ee=await b.loadAsync(v,T).catch(re=>{throw o.isLoaded=!1,o.errorLoading=!0,o.error=re,LOGGER.info(v),Error("Couldn't load "+t,t)});return o.data=ee,o.isLoaded=!0,s.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 replacingNode=null,swappableNodes=[];const ghostStore=create$3((a,e)=>({ghostData:null,ghostsTransform:[],ghostVisibility:!0,ghostParentRef:null,ghostMaterial:null,actions:{spawnGhostsForSkuID:async(t,n=!1,s)=>{const{ghostData:o,ghostsTransform:v}=e();if(o!==null||v.length>0){LOGGER.info("ghosts are already spawned for: "+o.skuID);return}return await new Promise(async(b,T)=>{let ee={};const re=()=>{b(ee)};CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Ghost_Loaded,re,{once:!0});const ie=productDataStore$1.getState().productData,se=attachmentStore$1.getState().attachmentSystem.currentStructure;if(replacingNode=se.getFirstNodeByCategoryID(ie[t].categoryID),ie[t].replace&&replacingNode){if(t==replacingNode.skuID)return;const{transforms:pe,connectablePlugs:de}=se.findGhostTransformForReplacement(t,replacingNode);if(pe==null&&de==null){LOGGER.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+t});return}ee.transforms=pe,ee.newNodes=[replacingNode],ee.connectablePlugs=de,ee.addItemOrSwap=["replace"],replacingNode.setModelVisibility(!1)}else{const{transforms:pe,newNodes:de,connectablePlugs:fe}=se.findGhostTransforms(t,n);let _e=pe,ve=fe,xe=de,De=[];for(let Le=0;Le<pe.length;Le++)De.push("add");if(ie[t].swappable&&!sceneStore.getState().dragging){swappableNodes=se.getNodesByCategoryID(ie[t].categoryID);for(let Le=0;Le<swappableNodes.length;Le++){const Ue=se.findGhostTransformForReplacement(t,swappableNodes[Le]);Ue.transforms&&(_e.push(Ue.transforms[0]),ve.push(Ue.connectablePlugs[0]),xe.push(swappableNodes[Le]),De.push("replace"),swappableNodes[Le].setModelVisibility(!1))}}ee.transforms=_e,ee.newNodes=xe,ee.connectablePlugs=ve,ee.addItemOrSwap=De}if(ee.transforms.length<=0)return;const le=await assetStore.getState().actions.loadAsset(t,!0);a({ghostsTransform:ee.transforms,ghostData:{proxyScene:le.proxy.data.scene,skuID:t,newNodes:ee.newNodes,addItemOrSwap:ee.addItemOrSwap,connectablePlugs:ee.connectablePlugs,count:s||ee.transforms.length}})})},clearAllGhosts:()=>{if(replacingNode&&replacingNode.setModelVisibility(!0),swappableNodes)for(let t=0;t<swappableNodes.length;t++)swappableNodes[t].setModelVisibility(!0);a({ghostVisibility:!0,ghostData:null,ghostsTransform:[]})}}})),cameraStore=create$3((a,e)=>({focusPointPosition:new Vector3(0,0,0),canCameraRotate:!0,sendCameraDetailsTrigger:!1,viewPointPosition:new Vector3(0,0,0),boundsMargin:0,savedState:!1,resetToLastPosition:!0,userDragging:!1,disableAutoRotate:!1,cameraSettings:{truckSpeed:1,fov:35,dollySpeed:1,initialViewPointPosition:new Vector3(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:()=>{a(t=>({sendCameraDetailsTrigger:!t.sendCameraDetailsTrigger}))},setCameraSettings:t=>{const{cameraSettings:n}=e();sceneStore.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(o=>n[o]=t[o]),a({cameraSettings:{...n},viewPointPosition:ArrToVec3(n.initialViewPointPosition)})}}})),hotspotStore$1=create$3((a,e)=>({activeHotspotData:null,lastActiveHotspotData:null,isAnyHotspotActive:!1,hotspotsVisibility:!1,hotspotsTempVisibility:!0,hotspotsHealthCheck:!0,hotspotsSpawned:{},visitedHotspotsID:[],hotspotSpawnedForCategoryIDs:[],actions:{clearAllHotspots:()=>a({isAnyHotspotActive:!1,activeHotspotData:null,lastActiveHotspotData:null,hotspotsSpawned:{}}),removeHotspotForItem(t){const{hotspotsSpawned:n}=e();Object.keys(n).map(s=>{n[s].itemData.guid==t.itemData.guid&&delete n[s]}),a({hotspotsSpawned:{...n}})},checkHotspotHealth(){const{hotspotsHealthCheck:t}=e();a({hotspotsHealthCheck:!t})},toggleHotspotVisibility(){const{hotspotsVisibility:t}=e();a({hotspotsVisibility:!t})},switchHotspotsVisibility(t,n=!1){a(n===!0?{hotspotsTempVisibility:t}:{hotspotsVisibility:t})},clickHotspot(t,n,s,o=!1){const{activeHotspotData:v}=e();a({lastActiveHotspotData:v}),hotspotEnter(t,n,s);let b=itemStore.getState().itemsSpawned[s].itemData.skuID;o===!1&&(CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Hotspot_Enter,{hotspotAbsID:generateHotspotAbsoluteID(b,t),hotspot:hotspotStore$1.getState().activeHotspotData}),CORE_API.fireEvent(CORE_API.EVENTS.UI.UtilityMenu_Hide))},exitHotspot(t=!1){const{activeHotspotData:n,isAnyHotspotActive:s}=e();if(s&&a({isAnyHotspotActive:!1}),!!n&&(a({lastActiveHotspotData:n}),hotspotExit(),t===!1)){const o=Math.round((performance.now()-e().lastActiveHotspotData.hotspotEnterTime)/1e3);CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Hotspot_Exit,{hotspot:e().lastActiveHotspotData,hotspotTimeSpent:o}),CORE_API.fireEvent(CORE_API.EVENTS.UI.UtilityMenu_Show)}}}}));function hotspotExit(){hotspotStore$1.setState({activeHotspotData:null}),sceneStore.getState().actions.triggerAutoFocus()}function hotspotEnter(a,e,t){let n=hotspotStore$1.getState();const o=itemStore.getState().itemsSpawned;let v=n.visitedHotspotsID;const A=o[t].hotspotsData.filter(De=>De.hotspotID==a);if(!A||A.length<=0)return;const b=A[0],T=o[t].itemData.skuID+"_"+a;let re=attachmentStore$1.getState().attachmentSystem.currentStructure.getNodeByGUID(t),ie=new Vector3(0,0,0);re&&re.ref&&re.ref.getWorldPosition(ie);let se=new Quaternion().identity();re&&re.ref&&re.ref.getWorldQuaternion(se);let le=b.focusPointTransform;LOGGER.info(le);let pe=ArrToVec3(le);pe.applyQuaternion(se);let de=b.viewPointTransform,fe=ArrToVec3(de);fe.applyQuaternion(se);let _e=addVector(Vec3ToArr(pe),Vec3ToArr(ie)),ve=addVector(Vec3ToArr(fe),Vec3ToArr(ie));cameraStore.setState({focusPointPosition:_e,viewPointPosition:ve}),hotspotStore$1.setState({activeHotspotData:{hotspotData:{guid:e,...b},itemData:{...o[t],guid:t},domID:"rd_"+T,hotspotEnterTime:performance.now()},isAnyHotspotActive:!0}),v.includes(T)||(v.push(T),hotspotStore$1.setState({visitedIDs:{...v}}))}const itemStore=create$3((a,e)=>({variantChangeAlert:!1,removeItems:[],removeItemTrigger:!1,itemsSpawned:{},itemsCount:0,modelLoadedAlert:0,lastDeletedItemData:null,lastDeletedItemsData:[],hoveredItemRef:{},collidersRef:[],filteredCollidersRef:[],selectedItemData:null,busy:!1,actions:{triggerModelLoaded:()=>a(t=>({modelLoadedAlert:t.modelLoadedAlert+1})),triggerRemoveItem:()=>a(t=>({removeItemTrigger:!t.removeItemTrigger})),addToRemoveItems:t=>{const{removeItems:n}=e();n.push(t)},switchToVariant:async(t,n,s=!1)=>{const{itemsSpawned:o,variantChangeAlert:v}=e(),A=productDataStore$1.getState().categoryData,b=o[t.guid].itemData.clonedScene;var ee=attachmentStore$1.getState().attachmentSystem.currentStructure.getNodeByGUID(t.guid);assetStore.getState().assets.items[t.skuID].data||A.geometryVariants&&A.geometryVariants.map(se=>{se.productsInCategory.map(le=>{let pe=!1;le.products.map(de=>{de==t.skuID&&(pe=!0)}),pe&&le.products.map(de=>{const fe=assetStore.getState().assets.items[de].data;fe&&(assetStore.getState().assets.items[t.skuID].data=fe)})})});const ie=assetStore.getState().assets.items[t.skuID].data;ie&&(await ie.functions.selectVariant(b,n),s?(ee.overrideVariant=n,CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0)):ee.currentVariant=n,a({variantChangeAlert:!v}))},clearAllItems:()=>{a({itemsSpawned:{},itemsCount:0,lastDeletedItemsData:[],hoveredItemRef:[],collidersRef:[],filteredCollidersRef:[],selectedItemData:null})},setItemsSpawned:t=>{a({itemsSpawned:t,itemsCount:Object.keys(t).length})},setHoveredItemRef:t=>a({hoveredItemRef:t}),setCollidersRef:t=>{a({collidersRef:t});let n=[];for(var s=0;s<t.length;s++)t[s].current&&n.push(t[s]);itemStore.setState({filteredCollidersRef:[...n]})},setSelectedItemData:t=>{const{selectedItemData:n,hoveredItemRef:s,actions:o}=e();n&&(delete s[n.itemData.guid],o.setHoveredItemRef({...s})),a({selectedItemData:{...t}}),sceneStore.getState().actions.triggerAutoFocus(),hotspotStore$1.getState().actions.switchHotspotsVisibility(!1,!0),cameraStore.setState({canCameraRotate:!1})},deselectItem:()=>{const{selectedItemData:t}=e();t&&CORE_API.fireEvent(CORE_API.EVENTS.UI.ContextMenu_Hide,t),a(()=>({selectedItemData:null})),sceneStore.getState().actions.triggerAutoFocus(),hotspotStore$1.getState().actions.switchHotspotsVisibility(!0,!0),cameraStore.setState({canCameraRotate:!0}),itemStore.getState().actions.setHoveredItemRef({})},removeItemByGUID:async t=>{const{itemsSpawned:n,actions:s}=e();if(n.hasOwnProperty(t))return new Promise(async(o,v)=>{s.addToRemoveItems(t),s.triggerRemoveItem();const A=b=>{t===b.data.itemData.guid&&o(t)};CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Item_Removed,A,{once:!0})})},addItemBySkuID:async(t,n=0,s=!1,o)=>{a({busy:!0});const{actions:v,itemsSpawned:A}=e(),b=productDataStore$1.getState().productData,T=productDataStore$1.getState().hotspotsData,ee=attachmentStore$1.getState().attachmentSystem;let re=!0;const ie=await new Promise(async(pe,de)=>{if(v.deselectItem(),!b[t]){LOGGER.warn({title:`Product not found: ${t}`}),CORE_API.alert({alertMsg:t+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),re=!1,de(t+": product not found!");return}const fe=[...ghostStore.getState().ghostsTransform],_e={...ghostStore.getState().ghostData};if(ghostStore.getState().actions.clearAllGhosts(),fe.length<=0){CORE_API.alert({alertMsg:"Unable to add item to configuration",alertTime:6e3,alertType:"warn",alertLabel:"Action Unavailable"}),re=!1,de("No available connections for this product to attach to");return}const ve=xe=>{t===xe.data&&pe(_e.newNodes[n].guid)};if(CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Model_Loaded,ve,{once:!0}),_e.addItemOrSwap[n]=="replace")await replaceItem(A,_e.skuID,fe[n],_e.newNodes[n]);else{const xe=_e.newNodes[n];xe.isDependent=s;let De=!0;if(b[_e.skuID].hasOwnProperty("disableInteraction")){const Fe=b[_e.skuID].disableInteraction;(Fe==!0||Fe==!1)&&(De=!Fe)}(o==!0||o==!1)&&(De=o),xe.isInteractive=De;const{position:Le,rotation:Ue}=fe[n];xe.transform={position:Le,rotation:Ue},ee.currentStructure.addNode(xe),ee.currentStructure.connectPlugs(_e.connectablePlugs[n]);const Ge=await assetStore.getState().actions.loadAsset(_e.skuID,!0);LOGGER.info("GHOST NEW NODE: ",xe),A[xe.guid]={itemData:{proxyScene:Ge.proxy.data.scene,guid:_e.newNodes[n].guid,...b[_e.skuID],position:Le,rotation:Ue,hasItemLoaded:!1,isDependent:s,isInteractive:De},hotspotsData:T[_e.skuID],hotspotSpawned:!1},await wait(1),v.setItemsSpawned({...A})}}).catch(pe=>{LOGGER.error({title:pe}),re=!1});if(re===!1)return a({busy:!1}),ie;const se=ee.getCartItems();se&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,se);const le=b[t]?.plugs;if(le){for(const pe of le){const de=pe?.dependencySku;if(!de)continue;LOGGER.info(`Found a dependency: ${de} on the plug: ${pe.name}`);let fe=!0;b[de]&&b[de].hasOwnProperty("ignoreSpawningCollisionAsDependency")&&(fe=b[de].ignoreSpawningCollisionAsDependency),pe.hasOwnProperty("ignoreSpawningCollision")&&(fe=pe.ignoreSpawningCollision);let _e=sceneStore.getState().sceneSettings.ignoreSpawningCollision;b[de].hasOwnProperty("ignoreSpawningCollision")&&(_e=b[de].ignoreSpawningCollision),b[de].ignoreSpawningCollision=fe;const ve=await ghostStore.getState().actions.spawnGhostsForSkuID(de,fe);if(b[de].ignoreSpawningCollision=_e,!ve)continue;const xe=ee.currentStructure.getNodeByGUID(ie),De=xe.getPlugByName(pe.name)?.guid,Le=pe?.isDependencySkuInteractive?pe.isDependencySkuInteractive===1:!1,Ue=ve.connectablePlugs;let Ge=!1;for(let Fe=0;Fe<ve.connectablePlugs.length;Fe++){if(Ue[Fe].receiverPlug.guid!==De)continue;Ge=!0;const Ye=await v.addItemBySkuID(de,Fe,!0,Le);Ye!==null&&xe.addMyDependenciesGUID(Ye)}Ge||ghostStore.getState().actions.clearAllGhosts()}ghostStore.getState().actions.clearAllGhosts()}return a({busy:!1}),ie},async addItemWithTransform(t,n,s,o=!0){return new Promise(async(v,A)=>{const{actions:b,itemsSpawned:T}=e();b.deselectItem();const ee=productDataStore$1.getState().productData,re=productDataStore$1.getState().hotspotsData;if(!ee[n]){CORE_API.alert({alertMsg:n+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"});return}const{position:ie,rotation:se}=t;T[s]!=null&&(hotspotStore$1.getState().actions.removeHotspotForItem({...T[s]}),delete T[s]);const le=de=>{n==de.data&&v(s)};CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Model_Loaded,le,{once:!0});const pe=await assetStore.getState().actions.loadAsset(n,!0);pe!=null&&(await wait(1),T[s]={itemData:{proxyScene:pe.proxy.data.scene,guid:s,...ee[n],position:ie,rotation:se,hasItemLoaded:!1,isInteractive:o},hotspotsData:re[n],hotspotSpawned:!1},a({itemsSpawned:{...T}}))})},async replaceGUIDItemBySKUID(t,n){const{itemsSpawned:s}=e(),o=productDataStore$1.getState().productData,v=productDataStore$1.getState().hotspotsData,A=attachmentStore$1.getState().attachmentSystem.currentStructure,b=A.getNodeByGUID(t);return b.isReplaceableWithSkuId(n)?(await new Promise(async(ee,re)=>{hotspotStore$1.getState().actions.removeHotspotForItem({...s[t]}),delete s[t],b.update(n);const ie=le=>{n===le.data&&ee(!0)};CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Model_Loaded,ie,{once:!0});const se=await assetStore.getState().actions.loadAsset(n,!0);await wait(1),s[t]={itemData:{proxyScene:se.proxy.data.scene,guid:t,...o[n],position:b.transform.position,rotation:b.transform.rotation,hasItemLoaded:!1},hotspotsData:v[n],hotspotSpawned:!1},itemStore.setState({itemsSpawned:{...s}})}),A.recalculateStructureFromNode(b.whichNodeAreWeAttachedTo()),attachmentStore$1.getState().actions.toggleStructureUpdated(),!0):!1}}}));async function replaceItem(a,e,t,n){const{position:s,rotation:o}=t,v=productDataStore$1.getState().productData,A=productDataStore$1.getState().hotspotsData,b=attachmentStore$1.getState().attachmentSystem.currentStructure;return new Promise(async(T,ee)=>{const re=async()=>{const ie=await assetStore.getState().actions.loadAsset(e,!0);a[n.guid]={itemData:{proxyScene:ie.proxy.data.scene,guid:n.guid,...v[e],position:s,rotation:o,hasItemLoaded:!1},hotspotsData:A[e],hotspotSpawned:!1},LOGGER.warn({title:"SWITCHING VARIANT: ",details:n.currentVariant}),n.currentVariant=n.currentVariant,n.transform=t,itemStore.setState({itemsSpawned:{...a}}),b.recalculateStructureFromNode(n),attachmentStore$1.getState().actions.toggleStructureUpdated(),T(n.guid)};hotspotStore$1.getState().actions.removeHotspotForItem({...a[n.guid]}),delete a[n.guid],n.update(e),CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Model_Removed,re,{once:!0})})}const inventoryStore=create$3((a,e)=>({inventoryData:{},actions:{getInventoryInfo:()=>{const{inventoryData:t}=e();return t},updateInventoryForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(s=>{let o=t[s];Object.keys(o).map(v=>{n.updateInventoryForProduct(s,v,o[v].inventory)})}),n.refreshInventory(itemStore.getState().itemsSpawned)},updateInventoryForProduct:(t,n,s)=>{const{inventoryData:o}=e();let v=o[t],A=v[n];!v||!A||(A.inventory=s)},_clearInScene:()=>{const{inventoryData:t}=e();Object.keys(t).map(n=>{const s=t[n];Object.keys(s).map(o=>{s[o].inScene=[]})})},refreshInventory:t=>{if(!t)return;LOGGER.info({title:"Refreshing Inventory"});const{actions:n,inventoryData:s}=e();n._clearInScene();const o=attachmentStore$1.getState().attachmentSystem;if(o===null)return;const v=o.currentStructure;if(v===null)return;Object.keys(t).map(ee=>{const re=v.getNodeByGUID(ee);if(!re)return;const ie=re.overrideVariant?re.overrideVariant:re.currentVariant;if(!ie)return;const se=s[re.skuID];if(!se||!se[ie].inScene)return;se[ie].inScene.push(ee),sceneStore.getState().sceneSettings.disableCart===!0?re.inStock={variantName:ie,newValue:!0}:se[ie].inScene.length>se[ie].inventory?re.inStock={variantName:ie,newValue:!1}:re.inStock={variantName:ie,newValue:!0}});let A=!1;Object.keys(s).map(ee=>{const re=s[ee];Object.keys(re).map(ie=>{re[ie].countAvailable=re[ie].inventory-re[ie].inScene.length,re[ie].countAvailable<0?(re[ie].countUnavailable=re[ie].countAvailable*-1,re[ie].countAvailable=0,A=!0):re[ie].countUnavailable=0})});const b={alertMsg:"Some items selected are out of stock",alertTime:3e3,alertType:"warn",alertLabel:"Stock Alert",alertId:"outOfStock"},T=compareObjects(sceneStore.getState().persistantAlertData,b);A===!1&&T===!0&&CORE_API.removePersistantAlert(),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Inventory_Updated,s)}}})),sceneStore=create$3((a,e)=>({CORE_API:null,frameloop:"always",hoveredGhostIndex:-1,itemDraggedSkuID:null,screenshotRenderer:new WebGLRenderer({antiAlias:!0,preserveDrawingBuffer:!0}),screenshotCamera:new PerspectiveCamera(75,1.33,.1,1e3),builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!1,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,ghostColorOnHoverWithDraggableUi:{r:153,g:252,b:0,a:1},preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,showInstructionsBtn:!1,showInstructionsOnStartup:!1,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",emptySceneTextFontSize:"2rem",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,analyticsEventPrefix:"",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:{default:!0,itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0},screenshotCameras:[{position:new Vector3(-2.5,.6,-5),rotation:new Vector3(-3.1097068566150314,-.6437852162982552,-3.122449778846033)},{position:new Vector3(3,1,-5),rotation:new Vector3(-.5,1,.5)}],instructionsSettings_desktop:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],instructionsSettings_mobile:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],defaultInstructionsSettings:{step1_drag:{mobile:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop_Mobile/Mobile_Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"}},desktop:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop/Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"}}},step1_add:{mobile:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add_Mobile/Mobile_Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add_Mobile/Mobile_Non-furniture_Step_1B.json"}},desktop:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add/Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add/Non-furniture_Step_1B.json"}}},step2:{mobile:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}},desktop:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}}},step3:{mobile:{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}},desktop:{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}}}}},setCSSLoaded:t=>{a({cssLoaded:t})},actions:{popFromAlertQueue:()=>{const{alertQueue:t}=e();return t.shift(),a({alertQueue:t}),t},addToAlertQueue:t=>{const{alertQueue:n}=e();return n.push(t),a({alertQueue:n}),n},getDeviceState:()=>{const{isDesktop:t,isMobile:n,isTablet:s,isTouchDevice:o,isLandscape:v}=e();return{isDesktop:t,isMobile:n,isTablet:s,isTouchDevice:o,isLandscape:v}},enableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!1,inventoryStore.getState().actions.refreshInventory(itemStore.getState().itemsSpawned),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!0,inventoryStore.getState().actions.refreshInventory(itemStore.getState().itemsSpawned),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:t}=e();return t},sendAlert:t=>{a({alertData:{...t}})},switchCursor(t){const{cursorParentRef:n}=e();if(!n)return;let s="";switch(t){default:case CURSORS.GRAB:s="grabCursor";break;case CURSORS.GRABBING:s="grabbingCursor";break;case CURSORS.BLOCKED:s="blockedCursor";break;case CURSORS.POINTER:s="pointerCursor";break;case CURSORS.MOVE:s="moveCursor";break}for(let o=0;o<n.classList.length;o++)n.classList[o].includes("Cursor")&&n.classList.remove(n.classList[o]);n.classList.add(s)},setAlertSettings:t=>{a({alertSettings:t})},async completeDropItem(){const t=attachmentStore$1.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:s,attachedChildrenGuids:o,collidingStatus:v,intersectingGhostObject:A,initPosition:b,initRotation:T,detachedPlugs:ee,attachedNodesToCurrentNode:re}=n;CORE_API.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[pe,de]of o.entries())v[pe]===!0&&await itemStore.getState().actions.removeItemByGUID(de);const ie=A.userData;let se=s.getPlugByName(ie.incomingPlugName),le=t.currentStructure.getPlugByGUID(ie.receiverPlugGUID);s.ref.position.set(A.position.x,A.position.y,A.position.z),s.ref.setRotationFromEuler(A.rotation),s.transform={position:A.position,rotation:A.quaternion},t.currentStructure.connectPlugs({incomingPlug:se,receiverPlug:le}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),re.map(pe=>{s.ref.parent.attach(pe.ref)}),attachmentStore$1.getState().actions.updateFittingSkuIds()},revertDropItem(){const t=attachmentStore$1.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:s,attachedChildrenGuids:o,collidingStatus:v,intersectingGhostObject:A,initPosition:b,initRotation:T,detachedPlugs:ee,attachedNodesToCurrentNode:re}=n;CORE_API.alert({alertMsg:"Position of item"+s.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const ie=ee.neighbourDetachedPlugs;ie&&(ee.neighbourNode.detachNodeFromReceiver(),t.currentStructure.connectPlugs({incomingPlug:ie.incomingPlug,receiverPlug:ie.receiverPlug}));let se=ee.rootDetachedPlugs.incomingPlug,le=ee.rootDetachedPlugs.receiverPlug;s.ref.position.set(b.x,b.y,b.z),s.ref.setRotationFromEuler(T);let pe=new Quaternion().identity();s.ref.getWorldQuaternion(pe),s.transform={position:b,rotation:pe},t.currentStructure.connectPlugs({incomingPlug:se,receiverPlug:le}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),re.map(de=>{s.ref.parent.attach(de.ref)}),attachmentStore$1.getState().actions.updateFittingSkuIds()},setCoreSettings:t=>{const{sceneSettings:n,isMobile:s,isTouchDevice:o,isLandscape:v,actions:A}=e(),b=s===!0?"mobile":"desktop",T=["showSave","showShare","showReset","showDimension","showHotspots","showInstructionsBtn","showViewInYourSpace","showContextMenu","showInstructionsOnStartup","draggableUI","textSettings","alertControl","variantsTabOrder","emptySceneTextFontSize","instructionsSettings"];for(const ee of T)if(ee==="draggableUI"||ee==="emptySceneTextFontSize"||ee==="showInstructionsOnStartup"||ee==="showInstructionsBtn"||ee==="instructionsSettings"){const ie=`${ee}_${v===!1&&o===!0?"mobile":"desktop"}`;t[ie]!==void 0?n[ee]=t[ie]:n[ie]!==void 0&&(n[ee]=n[ie])}else if(ee==="textSettings"||ee==="variantsTabOrder"||ee==="alertControl"){if(t.hasOwnProperty(ee)){let re=n[ee];Object.keys(re).map(ie=>{let se=t[ee];se.hasOwnProperty(ie)||(se[ie]=re[ie])})}}else{const re=`${ee}_${b}`;if(t[re]!==void 0){let ie=`${ee}Btn`;ee=="showContextMenu"&&(ie=`${ee}`),n[ie]=t[re]}}t.disableCart===!0&&A.disableCart(),Object.keys(t).map(ee=>n[ee]=t[ee]),a({sceneSettings:{...n,ghostThreeColor:{r:n.ghostColor.r/255,g:n.ghostColor.g/255,b:n.ghostColor.b/255,a:n.ghostColor.a/255},draggableUiGhostThreeColorOnHover:{r:n.ghostColorOnHoverWithDraggableUi.r/255,g:n.ghostColorOnHoverWithDraggableUi.g/255,b:n.ghostColorOnHoverWithDraggableUi.b/255,a:n.ghostColorOnHoverWithDraggableUi.a/255}}})},triggerAutoFocus:(t=null)=>a(n=>({autoFocusRef:t,autoFocusTrigger:n.autoFocusTrigger+1})),requestNewScreenshot:async(t,n)=>new Promise(async(s,o)=>{LOGGER.info("Taking a screenshot");const{screenshotRenderer:v,sceneRef:A,screenshotCamera:b,canvasSize:T}=e(),ee=await CORE_API.getCurrentCameraDetails();if(v.setClearColor(16777215),b.copy(ee),t!==null&&(b.position.copy(t.position),b.rotation.copy(new Euler(t.rotation.x,t.rotation.y,t.rotation.z))),n==null?v.setSize(T.width,T.height):v.setSize(n.width,n.height),v.render(A.parent,b),v.preserveDrawingBuffer===!1)LOGGER.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),o({success:!1,imageData:null});else{LOGGER.info("Downloading the screenshot");const re=v.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");s({success:!0,imageData:re})}})}})),hotspotIdPrefix="rd",hotspotIdSeparator="_";function generateHotspotAbsoluteID(a,e){return`${hotspotIdPrefix}${hotspotIdSeparator}${a}${hotspotIdSeparator}${e}`}async function wait(a){return LOGGER.info({title:`Waiting for ${a}ms`}),new Promise((e,t)=>{setTimeout(()=>{e(!0)},a)})}function compareObjects(a,e){if(a===null||e===null)return!1;for(let t in a)if(a.hasOwnProperty(t)&&e.hasOwnProperty(t)&&a[t]!==e[t])return!1;return Object.keys(a).length===Object.keys(e).length}const saveStructureToCMS=a=>{const e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)};return fetch(SAVE_CONFIG_ENDPOINT,e)},mobileCheck=function(){let a=!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)))&&(a=!0)}(navigator.userAgent||navigator.vendor||window.opera),a};function isIpadOS(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function tabletCheck(){const a=navigator.userAgent.toLowerCase(),e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(a);return e||isIpadOS()}function touchDeviceCheck(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function getJSONFromEndpoint(a){let e={data:null,report:"",success:!1};try{const n=await(await fetch(a)).text();e.data=JSON.parse(n),e.success=!0,e.report="Successfully fetched JSON data."}catch(t){e.report=t,CORE_API.alert({alertMsg:"",alertTime:5e3,alertType:"warn",alertLabel:"Preload Failed"})}return e}const addVector=(a,e)=>new Vector3(a[0]+e[0],a[1]+e[1],a[2]+e[2]),Vec3ToArr=a=>[a.x,a.y,a.z],ArrToVec3=a=>new Vector3(a[0],a[1],a[2]),findMeshAndCloneMatFromScene=(a,e=!0)=>{let t=[];const n=sceneStore.getState().sceneSettings.outOfStock_EmissiveColor,s=sceneStore.getState().sceneSettings.outOfStock_EmissiveIntensity;return a.traverse(o=>{o.isMesh&&(o.material.userData.cloned?o.material.userData.inStock!==e&&(e?(o.material.emissive.set(new Color$1(255,255,255)),o.material.emissiveIntensity=0):(o.material.emissive.set(new Color$1(n.r,n.g,n.b)),o.material.emissiveIntensity=s),o.material.userData.inStock=e):(o.material=o.material.clone(),o.material.userData.inStock=e,o.material.userData.cloned=!0,e?(o.material.emissive.set(new Color$1(255,255,255)),o.material.emissiveIntensity=0):(o.material.emissive.set(new Color$1(n.r,n.g,n.b)),o.material.emissiveIntensity=s)),t.push(o))}),t},filterArrWithCondition=(a,e)=>{let t=0,n=[];for(let s=0;s<a.length;s++){const o=a[s];e(o)?a[t++]=o:n.push(a[s])}return a.length=t,n},degToRad=a=>a*Math.PI/180,resolveAssetUrl=a=>{if(!a)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(a))return a;let n=a;return n=n.replaceAll("<@all-projects@>",ALL_PROJECTS_ASSET_DATA_ROOT_URL),n=n.replaceAll("<@generic-project@>",GENERIC_PROJECT_ASSET_DATA_ROOT_URL),n};function componentToHex(a){var e=a.toString(16);return e.length==1?"0"+e:e}function rgbToHex(a,e,t){return"#"+componentToHex(a)+componentToHex(e)+componentToHex(t)}function getUrlParameterByName(a,e=window.location.search){const t=new URLSearchParams(e);return Object.fromEntries(t.entries())[a]}const lightStore=create$3((a,e)=>({defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:t=>{a(n=>({envMapUrl:t}))},processLookEnvMapOverride:t=>{const{envMapUrl:n,defaultEnvMapUrl:s,actions:o}=e(),v=productDataStore$1.getState().lookData[t],A=v?.envMapOverride;if(!v||!A){o.setEnvLightMap(s);return}if(A===n){LOGGER.info(`New Env Map Url is the same as the current ${A}`);return}o.setEnvLightMap(A)}}}));var rngBrowser={exports:{}},getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);rngBrowser.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);rngBrowser.exports=function(){for(var e=0,t;e<16;e++)e&3||(t=Math.random()*4294967296),rnds[e]=t>>>((e&3)<<3)&255;return rnds}}var rngBrowserExports=rngBrowser.exports,byteToHex=[];for(var i$2=0;i$2<256;++i$2)byteToHex[i$2]=(i$2+256).toString(16).substr(1);function bytesToUuid$2(a,e){var t=e||0,n=byteToHex;return[n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]]].join("")}var bytesToUuid_1=bytesToUuid$2,rng$1=rngBrowserExports,bytesToUuid$1=bytesToUuid_1,_nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1$2(a,e,t){var n=e&&t||0,s=e||[];a=a||{};var o=a.node||_nodeId,v=a.clockseq!==void 0?a.clockseq:_clockseq;if(o==null||v==null){var A=rng$1();o==null&&(o=_nodeId=[A[0]|1,A[1],A[2],A[3],A[4],A[5]]),v==null&&(v=_clockseq=(A[6]<<8|A[7])&16383)}var b=a.msecs!==void 0?a.msecs:new Date().getTime(),T=a.nsecs!==void 0?a.nsecs:_lastNSecs+1,ee=b-_lastMSecs+(T-_lastNSecs)/1e4;if(ee<0&&a.clockseq===void 0&&(v=v+1&16383),(ee<0||b>_lastMSecs)&&a.nsecs===void 0&&(T=0),T>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=b,_lastNSecs=T,_clockseq=v,b+=122192928e5;var re=((b&268435455)*1e4+T)%4294967296;s[n++]=re>>>24&255,s[n++]=re>>>16&255,s[n++]=re>>>8&255,s[n++]=re&255;var ie=b/4294967296*1e4&268435455;s[n++]=ie>>>8&255,s[n++]=ie&255,s[n++]=ie>>>24&15|16,s[n++]=ie>>>16&255,s[n++]=v>>>8|128,s[n++]=v&255;for(var se=0;se<6;++se)s[n+se]=o[se];return e||bytesToUuid$1(s)}var v1_1=v1$2,rng=rngBrowserExports,bytesToUuid=bytesToUuid_1;function v4$1(a,e,t){var n=e&&t||0;typeof a=="string"&&(e=a==="binary"?new Array(16):null,a=null),a=a||{};var s=a.random||(a.rng||rng)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e)for(var o=0;o<16;++o)e[n+o]=s[o];return e||bytesToUuid(s)}var v4_1=v4$1,v1$1=v1_1,v4=v4_1,uuid=v4;uuid.v1=v1$1;uuid.v4=v4;var uuid_1=uuid;class Plug{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=uuid_1.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 attachedPlugGUID(){return this._attachedPlugGUID}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){this._attachedPlug=e,this._attachedPlugGUID=e.guid,this._isOpen=!1,this._isReceiverPlug=t;const n=this,s=this._node;if(s.isConnectedToRoot&&t){const o=s.whichPlugAreWeAttachedUsing();switch(e.type){case"weighted_hider":o.weight<n.weight&&(s.showNodes(o.affectedNodes)||CORE_API.coreWCRef.addEventListener(s.guid+":modelLoaded",function(){s.showNodes(o.affectedNodes)},{once:!0}));break}}if(t&&e.type!==""&&e.type==n._type)switch(e.type){default:case"weighted_hider":n._weight>e.weight?e.node.hideNodes(e.affectedNodes)||CORE_API.coreWCRef.addEventListener(e.node.guid+":modelLoaded",function(){e.node.hideNodes(e.affectedNodes)},{once:!0}):n._weight<e.weight&&(s.hideNodes(n._affectedNodes)||CORE_API.coreWCRef.addEventListener(s.guid+":modelLoaded",function(){s.hideNodes(n._affectedNodes)},{once:!0}));break}t&&(s.isEndNode=!1)}openPlug(){if(this._node.isConnectedToRoot){const e=this._node.whichPlugAreWeAttachedUsing();if(e&&this._guid!==e.guid)switch(this.type){case"weighted_hider":e.type==="weighted_hider"&&e.weight<this.weight&&this._node.hideNodes(e.affectedNodes);break}}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 Node$1=class{#t="default";#i=!1;#r=!1;#s=!0;#n={};#o=!1;#c={};#u=[];constructor(e,t=null,n,s){let o=productDataStore$1.getState().productData;this._plugs=[],this._skuID=e,this._ref=null,this._modelData=null,this._transform=null,this.#t="default",this._overrideVariant=null,this._followsParent=o[e].followsParent,this._categoryID=o[e].categoryID,this._replace=o[e].replace,this._swappable=o[e].swappable,this._price=this.#a(),this.#i=o[e]?.ignoreInCart,t?(this._guid=t.guid,this._isEndNode=t.isEndNode,this._overrideVariant=t.overrideVariant,this.generatePlugsWithData(e,t.plugs)):(this._guid=uuid_1.v4(),this._isEndNode=!0,this.generatePlugsForNode(e)),n&&Object.keys(n).map(v=>{if(o[e].looks&&o[e].looks.includes(v)){this.#t=v;return}})}get isRoot(){return this._skuID.toLowerCase()==="root"}updateGeometryVariant(e,t){const s=productDataStore$1.getState().categoryData.geometryVariants;let o=null;if(s.map(ee=>{ee.id==e&&(o=ee)}),!o)return;const v=o.productsInCategory,b=o.variants[t].productsToSwitch,T=itemStore.getState().itemsSpawned;v.map(ee=>{ee.products.map(re=>{this.skuID===re&&ee.products.map(ie=>{b.map(se=>{if(se==ie){const le=productDataStore$1.getState().actions.getProductDataById(se);this.skuID=le.skuID;const pe=T[this.guid];pe&&pe.itemData&&Object.keys(le).map(de=>{pe.itemData[de]=le[de]}),this.hideNodes(le.geometriesToHide),this.showNodes(le.geometriesToShow),this.updatePricing(),this.resetInStock(),inventoryStore.getState().actions.refreshInventory(T)}})})})})}resetInStock(){this.#n={},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.#n[e]&&this.#n[e]==t||(this.#n[e]=t,e!==this.#t&&this.#o===!1))return;const n=()=>{this.setInStockForRef(t)};n()||CORE_API.coreWCRef.addEventListener(this.guid+":modelLoaded",n,{once:!0})}get myDependenciesGUID(){return this.#u}set myDependenciesGUID(e){this.#u=e}addMyDependenciesGUID(e){this.#u.push(e)}get isDependent(){return this.#r}set isDependent(e){this.#r=e}get isInteractive(){return this.#s}set isInteractive(e){this.#s=e}update(e){this._skuID=e;const t=productDataStore$1.getState().productData,n=t[e]?.plugs;if(this.ignoreInCart=t[e].ignoreInCart,!!n)for(let s=0;s<this._plugs.length;s++)for(let o=0;o<n.length;o++)this._plugs[s].name==n[o].name&&(this._plugs[s].acceptedPlugTypes=n[o].acceptedPlugTypes,this._plugs[s].connectsToPlugTypes=n[o].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 v=this.whichNodesAreAttachedToUs();if(v.length>0){let A=!0;if(v.map(b=>{b.followsParent===!1&&(A=!1)}),!A)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 v=this.plugs[n].attachedPlug.acceptedPlugTypes;for(var s=0;s<this.plugs.length;s++)if(n!=s)for(var o=0;o<this.plugs[s].connectsToPlugTypes.length;o++)v.includes(this.plugs[s].connectsToPlugTypes[o])&&(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(s=>{if(t){const o=t.getObjectByName(s);o&&(o.visible=!1)}if(n){const o=n.getObjectByName(s);o&&(o.visible=!1)}}),!0}showNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");return e.map(s=>{if(t){const o=t.getObjectByName(s);o&&(o.visible=!0)}if(n){const o=n.getObjectByName(s);o&&(o.visible=!0)}}),!0}canConnectToPlugType(e){let t=!1;return this._plugs.map(n=>{n.connectsToPlugTypes.map(s=>{s==e&&(t=!0)})}),t}isConnectedToSkuID(e){let t=!1;return this._plugs.map(n=>{if(n.isOpen||t===!0)return;let s=n.attachedPlug;!s&&n.attachedPlugGUID&&(s=attachmentStore$1.getState().attachmentSystem.currentStructure.getPlugByGUID(n.attachedPlugGUID)),s.node.skuID==e&&(t=!0)}),t}get isConnectedToRoot(){return this.isConnectedToSkuID("Root")}swapRoot(){if(!this.canSwapRoot)return;const t=attachmentStore$1.getState().attachmentSystem.currentStructure,n=this.whichNodesAreAttachedToUs();let s=null;n.map(T=>{T.followsParent===!1&&(s=T)});const o=s.detachNodeFromReceiver();let v=null;this._plugs.map(T=>{T.isOpen||T.attachedPlug.node.skuID=="Root"&&(v=T.attachedPlug)});const A=this.detachNodeFromReceiver();let b=null;return s.plugs.map(T=>{T.connectsToPlugTypes.includes("root")&&(b=T)}),t.connectPlugs({incomingPlug:b,receiverPlug:v}),{neighbourDetachedPlugs:o,rootDetachedPlugs:A,neighbourNode:s}}get canSwapRoot(){if(sceneStore.getState().sceneSettings.swappableRoot===!1)return!1;let e=!1;if(this.isConnectedToRoot&&!this._isEndNode){const n=this.whichNodesAreAttachedToUs();let s=0,o=null;n.map(v=>{v.followsParent===!1&&(s++,o=v)}),s==1?o.canConnectToPlugType("root")&&(e=!0):s>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.#t==="default"?productDataStore$1.getState().actions.getProductDataById(this._skuID).lookDetails.default.id:this.#t}get price(){return this._price}set price(e){this._price=e}updatePricing(){this._price=this.#a()}#a(){let t=productDataStore$1.getState().actions.getProductDataById(this._skuID).lookDetails[this.#t]?.price;return t||(t=0),t}set currentVariant(e){this.#t=e,this._price=this.#a()}get overrideVariant(){return this._overrideVariant}set overrideVariant(e){this._overrideVariant=e,this.#t=this._overrideVariant,this._price=this.#a()}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}get modelData(){return this._modelData}set modelData(e){this._modelData=e;let t=new CustomEvent(this._guid+":modelLoaded",{bubbles:!0,cancelable:!1,composed:!0});const n=attachmentStore$1.getState().attachmentSystem;n.globalGeometryVariants&&Object.keys(n.globalGeometryVariants).map(s=>{this.updateGeometryVariant(s,n.globalGeometryVariants[s])}),t.data={},CORE_API.coreWCRef?CORE_API.coreWCRef.dispatchEvent(t):LOGGER.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=productDataStore$1.getState().productData[e]?.plugs;let s=0;if(!n)return!1;for(let o=0;o<this._plugs.length;o++)for(let v=0;v<n.length;v++)this._plugs[o].name==n[v].name&&s++;return s==this._plugs.length}whichPlugAreWeAttachedUsing(){for(let e=0;e<this._plugs.length;e++){const t=this._plugs[e];let n=t.attachedPlug;if(!n&&t.attachedPlugGUID&&(n=attachmentStore$1.getState().attachmentSystem.currentStructure.getPlugByGUID(t.attachedPlugGUID)),!t.isOpen&&n.isReceiverPlug)return n}}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=productDataStore$1.getState().productData[e]?.plugs;if(t)for(var n=0;n<t.length;n++){const s=new Plug(t[n],this);this._plugs.push(s)}}generatePlugsWithData(e,t){let n=productDataStore$1.getState().productData[e]?.plugs;if(n)for(var s=0;s<n.length;s++){const o=new Plug(n[s],this,t[n[s].name]);this._plugs.push(o)}}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():itemStore.getState().actions.addToRemoveItems(this._plugs[e].attachedPlug.node.guid))}};class Structure{#t=!1;constructor(e=null,t,n){if(this._nodes=[],this._rootNode=null,LOGGER.info({title:"preloadNodes",details:e}),e){LOGGER.info({title:"PRELOAD Length-----------------:"+e.length});for(var s=0;s<e.length;s++){LOGGER.info({title:"FOUND PRELOAD-----------------"});let o=e[s].skuID,v=new Node$1(o,e[s],t,n);o=="Root"&&(this._rootNode=v),this._nodes.push(v)}}else{const o=new Node$1("Root",null,t,n);this._rootNode=o,this._nodes.push(o)}itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},"Root",this._rootNode.guid,!1),this._boundingBoxLeeway=sceneStore.getState().sceneSettings.boundingBoxLeeway,this.setupCustomLogic()}async customLogic(){if(!["neighbor-bluff","neighbor-terra"].includes(CORE_API.projectId))return;const e={OM:{plugsToConsider:["OM_L_Plug"],geometryNodes:["OM_Legs_root"],rootPlug:"om_root"},ILTable:{plugsToConsider:["iltable_l_plug"],geometryNodes:["IL_Legs_root"],rootPlug:"il_root"}},t=Object.keys(e);for(const n of this._nodes){if(!t.includes(n.skuID))continue;let s=0;for(const o of n.plugs)if(o.name!==e[n.skuID].rootPlug&&(!e[n.skuID].plugsToConsider.includes(o.name)&&o.isOpen===!1&&s++,e[n.skuID].plugsToConsider.includes(o.name)&&o.isOpen===!1)){s=0;break}s>=1?n.hideNodes(e[n.skuID].geometryNodes)||CORE_API.coreWCRef.addEventListener(n.guid+":modelLoaded",()=>{n.hideNodes(e[n.skuID].geometryNodes)},{once:!0}):n.showNodes(e[n.skuID].geometryNodes)||CORE_API.coreWCRef.addEventListener(n.guid+":modelLoaded",()=>{n.showNodes(e[n.skuID].geometryNodes)},{once:!0})}}setupCustomLogic(){CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,()=>{this.customLogic()})}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,s={receiverPlug:e.plugs[t],incomingPlug:e.plugs[t].attachedPlug};if(s){const o=this.findItemTransform(s);o&&(n.ref.position.set(o.position.x,o.position.y,o.position.z),n.ref.setRotationFromQuaternion(o.rotation),n.transform={position:o.position,rotation:o.rotation})}this.recalculateStructureFromNode(n)}}rotateNode(e){const t=this.getNodeByGUID(e);let n=null,s=null;for(let A=0;A<t.plugs.length;A++)if(!s&&!t.plugs[A].isOpen&&t.plugs[A].attachedPlug.isReceiverPlug){const b=t.plugs[A].attachedPlug.acceptedPlugTypes;s=t.plugs[A].attachedPlug;let T=[];for(let ee=A+1;ee<t.plugs.length;ee++)T.push(t.plugs[ee]);for(let ee=0;ee<A;ee++)T.push(t.plugs[ee]);for(let ee=0;ee<T.length;ee++)for(let re=0;re<T[ee].connectsToPlugTypes.length;re++)b.includes(T[ee].connectsToPlugTypes[re])&&(n=T[ee])}if(!n)return;t.detachNodeFromReceiver();const{position:o,rotation:v}=this.findItemTransform({receiverPlug:s,incomingPlug:n});t.ref.position.set(o.x,o.y,o.z),t.ref.setRotationFromQuaternion(v),t.transform={position:t.ref.position,rotation:v},this.connectPlugs({receiverPlug:s,incomingPlug:n}),this.recalculateStructureFromNode(t)}async load(e){this.resolvePlugConnections(e),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=attachmentStore$1.getState().attachmentSystem,s=t.whichPlugAreWeAttachedTo(),o=t.whichPlugAreWeAttachedUsing(),A=new Node$1(e,null,n.globalVariants,n.globalGeometryVariants).getPlugByName(o.name);if(!A)return{transforms:null,connectablePlugs:null};const b={incomingPlug:A,receiverPlug:s};let T=[],ee=this.findItemTransform(b);if(!ee)return{transforms:T,connectablePlugs:b};let{position:re,rotation:ie}=ee;return re&&ie&&T.push({position:re,rotation:ie,incomingPlugName:b.incomingPlug.name,receiverPlugName:b.receiverPlug.name,incomingPlugGUID:b.incomingPlug.guid,receiverPlugGUID:b.receiverPlug.guid}),{transforms:T,connectablePlugs:b}}findGhostTransforms(e,t){const n=this.getOpenPlugs();if(n.length<=0)return{transforms:[]};const s=attachmentStore$1.getState().attachmentSystem,o=productDataStore$1.getState().productData,v=new Node$1(e,null,s.globalVariants,s.globalGeometryVariants),A=this.getConnectablePlugs(v,n);let b=[];if(A.length<=0)return{transforms:[]};let T=[];for(let re=0;re<A.length;re++){let ie=this.findItemTransform(A[re]);if(!ie)continue;let{position:se,rotation:le}=ie;if(se&&le){let pe=t;Array.isArray(t)===!0&&(pe=!1),o[e].hasOwnProperty("ignoreSpawningCollision")&&(pe=o[e].ignoreSpawningCollision),(pe?!1:this.isColliding(v.skuID,ie,A[re].receiverPlug,t))||(T.push({position:se,rotation:le,incomingPlugName:A[re].incomingPlug.name,receiverPlugName:A[re].receiverPlug.name,incomingPlugGUID:A[re].incomingPlug.guid,receiverPlugGUID:A[re].receiverPlug.guid}),b.push(A[re]))}}let ee=[];for(let re=0;re<T.length;re++)ee.push(v);return{transforms:T,newNodes:ee,connectablePlugs:b}}resolvePlugConnections(e){for(let t=0;t<e.length;t++)Object.keys(e[t].plugs).map(n=>{let s=e[t].plugs[n].guid,o=this.getPlugInNodesByGUID(s);if(!o||o.attachedPlug)return;let v=e[t].plugs[n].attachedPlugGUID,A=this.getPlugInNodesByGUID(v);A&&(A.attachedPlug||(o.attachPlug(A,e[t].plugs[n].isReceiverPlug),A.attachPlug(o,!e[t].plugs[n].isReceiverPlug)))});LOGGER.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let e=[this.rootNode];for(let t=0;t<e.length;t++){let s=e[t].whichPlugsAreAttachedToUs();for(let o=0;o<s.length;o++){let v=this.findItemTransformForPreload(s[o],s[o].receiverPlug.node.transform);v?await itemStore.getState().actions.addItemWithTransform(v,s[o].incomingPlug.node.skuID,s[o].incomingPlug.node.guid):LOGGER.warn({title:"Problem finding plug transform! "+s[o].name}),s[o].incomingPlug.node.transform=v,e.push(s[o].incomingPlug.node)}}CORE_API.fireEvent(CORE_API.EVENTS.SCENE.SavedConfiguration_Loaded),sceneStore.getState().actions.triggerAutoFocus(),hotspotStore$1.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.#t=!0,CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Scene_Cleared,s=>e(s.data),{once:!0}),n?CORE_API.removeItemByGUID(n.guid,!0):(await wait(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:s}=e,o=n,v=s;if(o.node.skuID=="Root")return this.findItemTransformRoot(e);let A=null,b=null,T=new Object3D,ee=assetStore.getState().assets.items[o.node.skuID].proxy.data.scene.clone();T.add(ee);let{position:re,rotation:ie}=t;if(ee.position.set(re.x,re.y,re.z),ee.setRotationFromQuaternion(ie),b=ee,!b||(A=b.getObjectByName(o.name),!A))return;let se=new Vector3(0,0,0);A.getWorldPosition(se);let le=new Quaternion().identity();A.getWorldQuaternion(le);let pe=new Object3D;A.add(pe);let de=assetStore.getState().assets.items[v.node.skuID].proxy.data.scene.clone();de.position.set(se.x,se.y,se.z),de.applyQuaternion(le);let fe=new Vector3;fe.copy(ee.up).applyQuaternion(b.quaternion);let _e=new Vector3;_e.copy(de.up).applyQuaternion(le),_e.negate();let ve=new Quaternion().setFromUnitVectors(fe,_e);fe.round(),_e.round();let xe=fe.dot(_e);xe!==1&&xe!==-1&&de.applyQuaternion(ve);let De=de.getObjectByName(v.name),Le=new Quaternion().identity();De.getWorldQuaternion(Le);let Ue=new Vector3(0,1,0);Ue.applyQuaternion(Le);let Ge=new Vector3(0,1,0);Ge.applyQuaternion(le),Ge.negate();let Fe=new Quaternion().setFromUnitVectors(Ue,Ge);if(Ue.round(),Ge.round(),Ue.dot(Ge)!==-1)de.applyQuaternion(Fe);else{let Ur=new Vector3(0,1,0),lr=Ge.dot(Ur);if(lr!==1&&lr!==-1)de.rotateOnAxis(Ur,Math.PI);else{let hr=new Vector3(0,0,1),zn=Ge.dot(hr);if(zn!==1&&zn!==-1)de.rotateOnAxis(hr,Math.PI);else{let ar=new Vector3(1,0,0),Dr=Ge.dot(ar);Dr!==1&&Dr!==-1&&de.rotateOnAxis(ar,Math.PI)}}}let rn=de.getObjectByName(v.name),yn=new Vector3(rn.position.x,rn.position.y,rn.position.z);de.translateX(-yn.x),de.translateY(-yn.y),de.translateZ(-yn.z);let bt=new Vector3(0,0,0);de.getWorldPosition(bt);let sn=new Quaternion().identity();return de.getWorldQuaternion(sn),de=null,{position:bt,rotation:sn}}findItemTransformRoot(e){let{receiverPlug:t,incomingPlug:n}=e,s=n;const o=new Object3D;let v=o,A=new Vector3(0,0,0);v.getWorldPosition(A);let b=new Quaternion().identity(),T=new Object3D;T.position.set(0,0,0),o.add(T);let ee=assetStore.getState().assets.items[s.node.skuID].proxy.data.scene.clone();T.attach(ee),ee.translateX(A.x),ee.translateY(A.y),ee.translateZ(A.z);let re=ee.getObjectByName(s.name),ie=new Quaternion().identity();re.getWorldQuaternion(ie);const se=new Vector3(0,1,0);se.applyQuaternion(ie);const le=new Vector3(0,1,0);le.applyQuaternion(b);const pe=le.angleTo(se),de=new Vector3(0,0,0);de.crossVectors(le,se),de.round(),de.length()!==0&&ee.rotateOnAxis(de,pe);var fe=new Matrix4().extractRotation(ee.matrixWorld);let _e=new Vector3(re.position.x,re.position.y,re.position.z);_e.applyMatrix4(fe),ee.translateX(-_e.x),ee.translateY(-_e.y),ee.translateZ(-_e.z);let ve=new Vector3(0,0,0);ee.getWorldPosition(ve);let xe=new Quaternion().identity();return ee.getWorldQuaternion(xe),T.remove(ee),T=null,ee=null,{position:ve,rotation:xe}}findItemTransform(e){let{receiverPlug:t,incomingPlug:n}=e,s=t,o=n;if(s.node.skuID=="Root")return this.findItemTransformRoot(e);const v=s.node.transform;if(!v)return;const A=assetStore.getState().assets.items[s.node.skuID].proxy.data.scene.clone(),b=new Object3D;b.position.set(v.position.x,v.position.y,v.position.z),b.setRotationFromQuaternion(v.rotation),b.add(A);let T=b.getObjectByName(""+s.name);if(!T){LOGGER.error({title:"Plug: "+s.name+" doesn't exist in "+s.node.skuID});return}let ee=new Vector3(0,1,0);T.getWorldPosition(ee);let re=new Quaternion().identity();T.getWorldQuaternion(re);let ie=assetStore.getState().assets.items[o.node.skuID].proxy.data.scene.clone();ie.position.set(ee.x,ee.y,ee.z),ie.applyQuaternion(re);let se=new Vector3;se.copy(A.up).applyQuaternion(b.quaternion);let le=new Vector3;le.copy(ie.up).applyQuaternion(re),le.negate();let pe=new Quaternion().setFromUnitVectors(se,le);se.round(),le.round();let de=se.dot(le);de!==1&&de!==-1&&ie.applyQuaternion(pe);let fe=ie.getObjectByName(o.name);if(!fe){LOGGER.error({title:"Plug: "+o.name+" doesn't exist in "+o.node.skuID});return}let _e=new Quaternion().identity();fe.getWorldQuaternion(_e);let ve=new Vector3(0,1,0);ve.applyQuaternion(_e);let xe=new Vector3(0,1,0);xe.applyQuaternion(re),xe.negate();let De=new Quaternion().setFromUnitVectors(ve,xe);if(ve.round(),xe.round(),ve.dot(xe)!==-1)ie.applyQuaternion(De);else{let rn=new Vector3(0,1,0),yn=xe.dot(rn);if(yn!==1&&yn!==-1)ie.rotateOnAxis(rn,Math.PI);else{let bt=new Vector3(0,0,1),sn=xe.dot(bt);if(sn!==1&&sn!==-1)ie.rotateOnAxis(bt,Math.PI);else{let Ur=new Vector3(1,0,0),lr=xe.dot(Ur);lr!==1&&lr!==-1&&ie.rotateOnAxis(Ur,Math.PI)}}}let Ue=ie.getObjectByName(o.name),Ge=new Vector3(Ue.position.x,Ue.position.y,Ue.position.z);ie.translateX(-Ge.x),ie.translateY(-Ge.y),ie.translateZ(-Ge.z);let Fe=new Vector3(0,0,0);ie.getWorldPosition(Fe);let Ye=new Quaternion().identity();return ie.getWorldQuaternion(Ye),b.remove(A),ie=null,{position:Fe,rotation:Ye}}getSpawningRequirementForSkuID(e){let t=[];const n=productDataStore$1.getState().productData,s=n[e];if(!s)return t;const o=[];return s.plugs.map(v=>{v.connectsToPlugTypes.map(A=>{o.push(A)})}),Object.keys(n).map(v=>{for(let A=0;A<n[v].plugs.length;A++){const b=n[v].plugs[A].acceptedPlugTypes;for(let T=0;T<b.length;T++)o.map(ee=>{ee==b[T]&&!t.includes(v)&&t.push(v)})}}),t}getConnectablePlugs(e,t){let n=[],s=e.getOpenPlugsWeCanAttachFrom();for(let o=0;o<s.length;o++)for(let v=0;v<t.length;v++){let A=!1;for(let T=0;T<n.length;T++)if(n[T].receiverPlug.guid==t[v].guid){A=!0;break}if(A)continue;s[o].canAttachToPlug(t[v])&&n.push({incomingPlug:s[o],receiverPlug:t[v]})}return n}getOpenPlugs(){let e=[];return this._nodes.map(t=>{let n=t.getOpenPlugsFromNode();e=e.concat(n)}),e}checkCollisionforGUID(e){if(sceneStore.getState().sceneSettings.disableCollider)return!1;const t=itemStore.getState().itemsSpawned,n=productDataStore$1.getState().productData;if(!t[e])return!1;const o=this.getNodeByGUID(e);if(!o||!o.ref||n[o.skuID].disableCollider)return!1;const v={position:o.ref.position,rotation:o.ref.rotation},A=o.whichPlugAreWeAttachedTo();return A==null?!1:this.isColliding(o.skuID,v,A,[])}isColliding(e,{position:t,rotation:n},s,o=[]){const v=assetStore.getState().assets.items[e].proxy.data.scene,A=productDataStore$1.getState().productData;if(!v)return!1;let b=v.clone();b.position.set(t.x,t.y,t.z),b.setRotationFromQuaternion(n);let T=new Box3().setFromObject(b);var ee=new Vector3;T.getCenter(ee);let re=new Object3D;re.position.set(ee.x,ee.y,ee.z),re.attach(b),re.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),T=new Box3().setFromObject(re);const ie=[];if(this._nodes.forEach(le=>{s.node.guid!=le.guid&&(Array.isArray(o)===!0&&o.includes(le.guid)||le.ref&&((A[le.skuID].hasOwnProperty("disableCollider")?A[le.skuID].disableCollider:sceneStore.getState().sceneSettings.disableCollider)||ie.push(le.ref)))}),ie.length<=0)return!1;let se=!1;return ie.forEach(le=>{if(se)return;let pe=new Box3().setFromObject(le);if(T.intersectsBox(pe)){se=!0;return}}),re.clear(),b=null,re=null,T=null,se}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 Vector3(0,0,0);e.getSize(n),n.x*n.y*n.z;let s=new Vector3(0,0,0);t.getSize(s),s.x*s.y*s.z}checkInsideOutCollision(e,t,n){let s=t.position.clone(),o=new Float32Array(n.attributes.position.array),v=o.length/3;for(let A=0;A<v;A++){let b=new Vector3(o[A*3],o[A*3+1],o[A*3+2]),T=b.add(t.position);T=b.applyQuaternion(t.quaternion);let ee=T.sub(t.position);const ie=new Raycaster(s,ee.clone().normalize()).intersectObjects(e),se=ie.length>0,le=ie[0].distance<ee.length();if(se&&le)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),attachmentStore$1.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.#t&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Scene_Cleared,!0),attachmentStore$1.getState().actions.updateFittingSkuIds(),attachmentStore$1.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}attachmentStore$1.getState().actions.toggleStructureUpdated()}}class AttachmentSystem{constructor(){this._globalVariants={},this._globalGeometryVariants={},productDataStore$1.getState().categoryData.geometryVariants.map(e=>{this._globalGeometryVariants[e.id]=e.defaultVariant}),productDataStore$1.getState().categoryData.color.map(e=>{this._globalVariants[e.id]=e.defaultLook}),this._currentStructure=new Structure(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=productDataStore$1.getState()?.productData[e]?.lookDetails[t],n?.clientProductId?n?.clientProductId:""}getCartItems(){let e=[];const t=inventoryStore.getState().inventoryData;this.currentStructure.nodes.map(o=>{if(o.skuID=="Root"||o.ignoreInCart===!0)return;let v=!1;if(e.map(T=>{const ee=t[T.skuID];if(T.skuID==o.skuID&&T.currentVariant==o.currentVariant){T.count++,T.countAvailable=ee[o.currentVariant].countAvailable,T.countUnavailable=ee[o.currentVariant].countUnavailable,T.price=o.price*T.count,v=!0;return}}),v===!0)return;let A={};A.skuID=o.skuID,A.currentVariant=o.currentVariant,A.clientProductId=this.getClientProductId(A.skuID,A.currentVariant),A.count=1;const b=t[A.skuID];A.price=o.price,A.countAvailable=b[o.currentVariant].countAvailable,A.countUnavailable=b[o.currentVariant].countUnavailable,e.push(A)});let n=0;for(const o of e)n=n+o.price;return{cartItems:e,details:{total:n.toFixed(2)}}}getFittingSKUIDs(){const e=productDataStore$1.getState().productData;if(!this.currentStructure)return;let t=this.currentStructure.nodes,n=[],s=[],o=[],v=[];if(t.map(b=>{v.push(b.skuID),b.plugs.map(T=>{if(!T.isOpen){T.attachedPlug.node.replace&&T.acceptedPlugTypes.map(ee=>{s.includes(ee)||s.push(ee)});return}T.acceptedPlugTypes.map(ee=>{n.includes(ee)||n.push(ee)})})}),n.length<=0&&s.length<=0)return[];Object.keys(e).map(b=>{!e[b].plugs||o.includes(b)||e[b].plugs.map(T=>{o.includes(b)||T.connectsToPlugTypes.map(ee=>{if(!o.includes(b)){if(s.includes(ee)){if(!v.includes(b)){let re=!1,ie=this.currentStructure.getFirstNodeByCategoryID(e[b].categoryID),se=!1;ie?.plugs.map(le=>{!le.isOpen&&le.isReceiverPlug&&(se=!0,e[b].plugs.map(pe=>{pe.name==le.name&&le.attachedPlug.connectsToPlugTypes.map(de=>{pe.acceptedPlugTypes.includes(de)&&(re=!0)})}))}),(re||!se)&&o.push(b)}}else if(n.includes(ee)){const re=this.currentStructure.getFirstNodeByCategoryID(e[b].categoryID);if(re&&re.replace)return;o.push(b)}}})})});let A=[];return o.map(b=>{if(A.includes(b))return;if(e[b].replace){A.push(b);return}const{transforms:T,newNodes:ee,connectablePlugs:re}=this.currentStructure.findGhostTransforms(b,sceneStore.getState().sceneSettings.ignoreSpawningCollision);T.length>0&&A.push(b)}),A.map(b=>{e[b].replace}),A}async removeAllVariantOverrides(){let e=this._currentStructure.nodes,t=productDataStore$1.getState().productData,n=itemStore.getState().itemsSpawned;await e.map(async s=>{if(!s.overrideVariant||(s.overrideVariant=null,!t[s.skuID].looks))return;let o=null;Object.keys(this._globalVariants).map(v=>{t[s.skuID].looks.includes(this._globalVariants[v])&&o==null&&(o=this._globalVariants[v])}),o&&await itemStore.getState().actions.switchToVariant(n[s.guid].itemData,o)}),CORE_API.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!1)}async switchGlobalGeometryVariant(e,t){const s=productDataStore$1.getState().categoryData.geometryVariants;let o=null;if(s.map(ie=>{ie.id==e&&(o=ie)}),!o)return;const v=o.productsInCategory,b=o.variants[t].productsToSwitch,T=itemStore.getState().itemsSpawned;let ee=productDataStore$1.getState().categoryData;b.map(ie=>{v.map(se=>{let le=!1;se.products.map(pe=>{ie==pe&&(le=!0)}),le&&ee.build.map(pe=>{se.products.map(de=>{pe.skus.map((fe,_e)=>{pe.skus[_e]==de&&(pe.skus[_e]=ie)})})})})}),this._currentStructure.nodes.map(ie=>{v.map(se=>{se.products.map(le=>{ie.skuID==le&&ie.ref!==null&&se.products.map(pe=>{b.map(de=>{if(de==pe){const fe=productDataStore$1.getState().actions.getProductDataById(de);ie.hideNodes(fe.geometriesToHide),ie.showNodes(fe.geometriesToShow),ie.skuID=de;const _e=T[ie.guid];_e&&_e.itemData&&Object.keys(fe).map(ve=>{_e.itemData[ve]=fe[ve]}),ie.resetInStock(),ie.updatePricing()}})})})})}),this._globalGeometryVariants[e]=t,hotspotStore$1.getState().actions.checkHotspotHealth(),inventoryStore.getState().actions.refreshInventory(T),productDataStore$1.setState({categoryData:ee}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CategoryData_Updated,ee),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const re=this.getCartItems();re&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,re)}async switchGlobalVariant(e,t){this._globalVariants[e]=t;const n=itemStore.getState().actions;let s=itemStore.getState().itemsSpawned;for(let b=0;b<Object.keys(s).length;b++){let T=s[Object.keys(s)[b]];if(T.itemData.looks&&T.itemData.looks.includes(t)){let ee=this._currentStructure.getNodeByGUID(T.itemData.guid);ee&&!ee.overrideVariant&&await n.switchToVariant(T.itemData,t)}}const o=productDataStore$1.getState().lookData;lightStore.getState().actions.processLookEnvMapOverride(t);const v=e;Object.keys(s).length>0&&CORE_API.alert({alertMsg:v.charAt(0).toUpperCase()+v.slice(1)+" was successfully switched to "+o[t].label+".",alertTime:3e3,alertType:"success",alertLabel:`${v} Changed`,alertId:"materialVariantChanged"}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),itemStore.setState({variantChangeAlert:!itemStore.getState().variantChangeAlert});const A=this.getCartItems();A&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,A)}async#t(e){if(!e)return;LOGGER.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 Structure(t,this._globalVariants,this._globalGeometryVariants);for(const[n,s]of Object.entries(this._globalVariants))this.switchGlobalVariant(n,s);for(const[n,s]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(n,s);LOGGER.info({title:"Structure Loading..."}),await this._currentStructure.load(t),LOGGER.info({title:"Structure Loaded."})}async loadStructure(e){e&&(CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),sceneStore.setState({configurationLoaded:!1}),await wait(500),await this._currentStructure.clear(),await this.#t(e),sceneStore.getState().preconfigurationLoaded?CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide):sceneStore.setState({preconfigurationLoaded:!0}),sceneStore.setState({configurationLoaded:!0}),attachmentStore$1.getState().actions.toggleStructureUpdated())}export(){return{structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),this._currentStructure.clear(),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide)}async restart(){LOGGER.warn({title:"Restarting the Scene!!"}),itemStore.getState().selectedItemData&&itemStore.getState().actions.deselectItem(),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),await wait(500),await this._currentStructure.clear();const e=attachmentStore$1.getState().defaultConfig;await this.#t(e),attachmentStore$1.getState().actions.toggleStructureUpdated(),sceneStore.setState({configurationLoaded:!0}),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide)}}const attachmentStore=create$3((a,e)=>({attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async()=>{const{actions:t,defaultConfig:n}=e(),s=await new AttachmentSystem;a({attachmentSystem:s}),t.updateFittingSkuIds(),t.toggleStructureUpdated()},loadSavedStructureFromConfigID:async t=>{const n=await getJSONFromEndpoint(FETCH_CONFIG_ENDPOINT+t);return n.success===!1?null:n.data},loadDefaultStructure:async()=>{const{actions:t,defaultConfig:n,attachmentSystem:s}=e();await t.loadStructure(n)},updateFittingSkuIds:()=>{const t=attachmentStore.getState().attachmentSystem.getFittingSKUIDs();t&&(itemStore.setState({fittingSkuIds:[...t]}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:t}))},toggleStructureUpdated:()=>{const{attachmentSystem:t}=e();a(s=>({structureUpdated:!s.structureUpdated})),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,t.currentStructure.getCurrentItemsInReplaceableCategory());const n=t.getCartItems();n&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,n)},loadStructure:async t=>{const{attachmentSystem:n}=e();n&&sceneStore.getState().configurationLoaded!==!1&&await n.loadStructure(t)},export:()=>{const{attachmentSystem:t}=e();if(t)return t.export()}}})),attachmentStore$1=attachmentStore,productDataStore=create$3((a,e)=>({productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:void 0,actions:{getCurrentPricingInfo:()=>{const{productData:t}=e();let n={};return Object.keys(t).map(s=>{if(s.toLowerCase()==="root")return;let o=t[s].lookDetails,v={};Object.keys(o).map(A=>{A!="default"&&(v[A]=o[A].price)}),n[s]=v}),n},updatePricingForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(s=>{let o=t[s];Object.keys(o).map(v=>{n.updatePricingForProduct(s,v,o[v])})})},updatePricingForProduct:(t,n,s)=>{const{productData:o}=e();let v=o[t];if(!v||!v.lookDetails)return;let A=v.lookDetails[n];if(!A)return;A.price=s,attachmentStore$1.getState().attachmentSystem.currentStructure.getNodesBySKUID(t).map(ee=>ee.updatePricing())},setProductData:t=>{let n={};t&&Object.keys(t).map(s=>{const o=t[s];if(o.skuID=s,o.skuID.toLowerCase()==="root"){o.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},o.defaultVariant="default";return}if(o?.lookDetails){const v=o.lookDetails;let A=Object.keys(o.lookDetails);if(A.includes("default")){const T=A.indexOf("default");A.splice(T,1)}o.looks=A,Object.keys(o.lookDetails).map(T=>{let ee=o.lookDetails[T];ee.inventory===void 0&&(ee.inventory=DEFAULT_INVENTORY),ee.price===void 0&&(ee.price=DEFAULT_PRODUCT_PRICE),n[s]={...n[s],[T]:{inventory:DEFAULT_INVENTORY,inScene:[]}}});let b=o?.defaultVariant;b||(LOGGER.warn({title:`No defaultVariant set for ${o.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),b=Object.keys(o.lookDetails).sort()[0],LOGGER.warn({title:"Auto resolved default look ID: "+b})),A.includes(b)?(o.lookDetails.default=v[b],o.lookDetails.default.id=b):(LOGGER.error({title:`Default look [ ${b} ] doesn't exist for: ${s}. Please make sure to select a default variant in Input Data for this project`}),o.lookDetails.default=null)}}),LOGGER.info("PRODUCT DATA: ",t),inventoryStore.setState({inventoryData:n}),a({productData:t})},setCategoryData:t=>{const{productData:n}=e();t.geometryVariants!==void 0&&t.geometryVariants.map(s=>{s.defaultVariant===void 0&&Object.keys(s.variants).length>0&&(s.defaultVariant=Object.keys(s.variants)[0])}),t.color!==void 0&&t.color.map(s=>{(s.defaultLook===void 0&&s.looks.length>0||!s.looks.includes(s.defaultLook))&&(s.defaultLook=s.looks[0])}),a({categoryData:t}),t.build!==void 0&&t.build.map(s=>{s.skus.map(o=>{n[o].categoryID=s.categoryID,n[o].categoryLabel=s.label,n[o].swappable=s.swappable?s.swappable:!1,n[o].replace=s.replace})})},getProductDataById:t=>{const{productData:n}=e();let s=null;return n[t]&&(s=n[t]),s},setLookData:t=>a({lookData:t}),setHotspotsData:t=>{const{categoryData:n,productData:s}=e();n.geometryVariants&&Object.keys(t).map(o=>{t[o].map(v=>{v.geometryVariantID&&n.geometryVariants.map(A=>{Object.keys(A.variants).map(b=>{v.geometryVariantID==b&&A.productsInCategory.map(T=>{let ee=null;T.products.map(re=>{t.hasOwnProperty(re)&&(ee=t[re])}),T.products.map(re=>{t.hasOwnProperty(re)||(t[re]=ee)})})})})})}),a({hotspotsData:t})},setEndpoints:t=>{a({endpoints:t}),setGlobalEndpoints(t)},setAssetsData:t=>a({assetsData:t})}})),productDataStore$1=productDataStore,UtilityMenu=({handleShareButtonTrigger:a,handleSaveButtonTrigger:e,handleRestartButtonClick:t,handleShowHotspots:n,handleDimensionClick:s,handleInstructionButtonClick:o,utilityMenuVisible:v,hotspotsVisibility:A,viewInYourSpaceMenuBtnVisible:b,restartMenuBtnVisible:T,saveMenuBtnVisible:ee,hotspotsMenuBtnVisible:re,instructionsMenuBtnVisible:ie,dimensionsMenuBtnVisible:se,shareMenuBtnVisible:le,dimensionsVisible:pe,position:de,CORE_API:fe})=>{const[_e,ve]=reactExports.useState("bottom"),xe=productDataStore$1(Le=>Le.assetsData),De={ar:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",restart:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Restart.svg",save:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/save.svg",share:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Share.svg",dimensions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Ruler.svg",hotspots:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Eye.svg",instructions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Info.svg"};return reactExports.useEffect(()=>{switch(de){case"top":ve("top");break;case"bottom":ve("bottom");break;case"left":ve("left");break;case"right":ve("right");break}return()=>{}},[de]),jsxDevRuntimeExports.jsxDEV("div",{className:"shellCanvasContainerParent",id:_e,children:jsxDevRuntimeExports.jsxDEV("div",{className:(v&&(le||b||T||se||re||ie))==!0?"shellCanvasContainer":"shellCanvasContainer shellCanvasContainerInactive",children:[b&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{fe.viewInYourSpace()},buttonLabel:"AR",hoverLabel:"View in Your Space",icon:xe?.icons?.utilityMenu?.viewInYourSpace?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.viewInYourSpace):De.ar},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:81,columnNumber:11},globalThis),T&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{t()},buttonLabel:"Restart",hoverLabel:"Restart",icon:xe?.icons?.utilityMenu?.restart?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.restart):De.restart},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:98,columnNumber:11},globalThis),ee&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{e()},buttonLabel:"Save",hoverLabel:"Save",icon:xe?.icons?.utilityMenu?.save?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.save):De.save},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:115,columnNumber:11},globalThis),le&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{a()},buttonLabel:"Share",hoverLabel:"Share",icon:xe?.icons?.utilityMenu?.share?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.share):De.share},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:132,columnNumber:11},globalThis),se&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{s()},buttonLabel:"Size",hoverLabel:"Size",icon:xe?.icons?.utilityMenu?.dimensions?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.dimensions):De.dimensions,activeCondition:pe},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:149,columnNumber:11},globalThis),re&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{n()},buttonLabel:"Hotspots",hoverLabel:"Hotspots",icon:xe?.icons?.utilityMenu?.hotspots?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.hotspots):De.hotspots,activeCondition:A},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:168,columnNumber:11},globalThis),ie&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{o()},buttonLabel:"Instructions",hoverLabel:"Instructions",icon:xe?.icons?.utilityMenu?.instructions?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.instructions):De.instructions},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:187,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:67,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:66,columnNumber:5},globalThis)};var propTypes$5={exports:{}},reactIs={exports:{}},reactIs_development={};/** @license React v16.13.1
8919
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([v]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(o){const v=o.data;switch(v.type){case"decode":s._callbacks[v.id].resolve(v);break;case"error":s._callbacks[v.id].reject(v);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+v.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,o){return s._taskLoad>o._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function DRACOWorker(){let a,e;onmessage=function(v){const A=v.data;switch(A.type){case"init":a=A.decoderConfig,e=new Promise(function(ee){a.onModuleLoaded=function(re){ee({draco:re})},DracoDecoderModule(a)});break;case"decode":const b=A.buffer,T=A.taskConfig;e.then(ee=>{const re=ee.draco,ie=new re.Decoder,se=new re.DecoderBuffer;se.Init(new Int8Array(b),b.byteLength);try{const le=t(re,ie,se,T),pe=le.attributes.map(de=>de.array.buffer);le.index&&pe.push(le.index.array.buffer),self.postMessage({type:"decode",id:A.id,geometry:le},pe)}catch(le){console.error(le),self.postMessage({type:"error",id:A.id,error:le.message})}finally{re.destroy(se),re.destroy(ie)}});break}};function t(v,A,b,T){const ee=T.attributeIDs,re=T.attributeTypes;let ie,se;const le=A.GetEncodedGeometryType(b);if(le===v.TRIANGULAR_MESH)ie=new v.Mesh,se=A.DecodeBufferToMesh(b,ie);else if(le===v.POINT_CLOUD)ie=new v.PointCloud,se=A.DecodeBufferToPointCloud(b,ie);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!se.ok()||ie.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+se.error_msg());const pe={index:null,attributes:[]};for(const de in ee){const fe=self[re[de]];let _e,ve;if(T.useUniqueIDs)ve=ee[de],_e=A.GetAttributeByUniqueId(ie,ve);else{if(ve=A.GetAttributeId(ie,v[ee[de]]),ve===-1)continue;_e=A.GetAttribute(ie,ve)}pe.attributes.push(s(v,A,ie,de,fe,_e))}return le===v.TRIANGULAR_MESH&&(pe.index=n(v,A,ie)),v.destroy(ie),pe}function n(v,A,b){const ee=b.num_faces()*3,re=ee*4,ie=v._malloc(re);A.GetTrianglesUInt32Array(b,re,ie);const se=new Uint32Array(v.HEAPF32.buffer,ie,ee).slice();return v._free(ie),{array:se,itemSize:1}}function s(v,A,b,T,ee,re){const ie=re.num_components(),le=b.num_points()*ie,pe=le*ee.BYTES_PER_ELEMENT,de=o(v,ee),fe=v._malloc(pe);A.GetAttributeDataArrayForAllPoints(b,re,de,pe,fe);const _e=new ee(v.HEAPF32.buffer,fe,le).slice();return v._free(fe),{name:T,array:_e,itemSize:ie}}function o(v,A){switch(A){case Float32Array:return v.DT_FLOAT32;case Int8Array:return v.DT_INT8;case Int16Array:return v.DT_INT16;case Int32Array:return v.DT_INT32;case Uint8Array:return v.DT_UINT8;case Uint16Array:return v.DT_UINT16;case Uint32Array:return v.DT_UINT32}}}const ENV={}.VITE_APP_ENV,IS_DEV_ENV=!1;let DISABLE_ANALYTICS_EVENTS=!1,ASSETS_SOURCE_ROOT;const LOGGER=new x2("CORE");ENV==="staging"?(LOGGER.setCurrentMode(TR.Staging),ASSETS_SOURCE_ROOT="https://storage.googleapis.com/epigraph-configurator"):(LOGGER.setCurrentMode(TR.Release),ASSETS_SOURCE_ROOT="https://storage.googleapis.com/epigraph-configurator");LOGGER.info({title:"test"});const DEFAULT_INVENTORY=99999,DEFAULT_PRODUCT_PRICE=99999;let CORE_API=null;function setCoreApi(a){CORE_API=a,CORE_API.disableAnalyticsEvents=DISABLE_ANALYTICS_EVENTS}const ALL_PROJECTS_ASSET_DATA_ROOT_URL=`${ASSETS_SOURCE_ROOT}/projects-asset-data`,GENERIC_PROJECT_ASSET_DATA_ROOT_URL=`${ALL_PROJECTS_ASSET_DATA_ROOT_URL}/generic`;let FETCH_MODULE_DATA_ENDPOINT="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?moduleID=",SAVE_CONFIG_ENDPOINT="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe/saveConfig",FETCH_CONFIG_ENDPOINT="https://us-central1-epigraph-product-configurator.cloudfunctions.net/epigraphServe?configID=",PUBLIC_DESIGN_ASSETS_ENDPOINT="https://storage.googleapis.com/gsc-epigraph-design/product-assets";function setGlobalEndpoints(a){const e=a.SAVE_CONFIG_ENDPOINT;SAVE_CONFIG_ENDPOINT=e||SAVE_CONFIG_ENDPOINT;const t=a.FETCH_CONFIG_ENDPOINT;FETCH_CONFIG_ENDPOINT=t||FETCH_CONFIG_ENDPOINT;const n=a.PUBLIC_DESIGN_ASSETS_ENDPOINT;PUBLIC_DESIGN_ASSETS_ENDPOINT=n||PUBLIC_DESIGN_ASSETS_ENDPOINT;const s=a.ASSETS_SOURCE_ROOT;ASSETS_SOURCE_ROOT=s||ASSETS_SOURCE_ROOT}const ALERT_TYPES=Object.freeze({info:{id:"info",level:1e3,src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/Icon/CheckCircle.svg",color:"#65BC6C",cssClass:"alert-success",background:"#DBF0DD",filter:"invert(74%) sepia(3%) saturate(5600%) hue-rotate(75deg) brightness(90%) contrast(90%)"}}),CAMERA_ACTION=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}),CURSORS={GRAB:"grab",POINTER:"pointer",BLOCKED:"blocked",GRABBING:"grabbing",MOVE:"move"},ensureUniqueNames=a=>{const e=[],t=new Set;for(const n of a){let s=n,o=0;for(;t.has(s);)s=n+"."+ ++o;t.add(s),e.push(s)}return e},mappingsArrayToTable=(a,e)=>{const t={};for(const n of a.mappings)for(const s of n.variants)t[e[s]]={material:null,gltfMaterialIndex:n.material};return t},compatibleObject=a=>a.material!==void 0&&a.userData&&a.userData.variantMaterials,traversePair=(a,e,t)=>{t(a,e);for(let n=0;n<a.children.length;n++)traversePair(a.children[n],e.children[n],t)},copyVariantMaterials=(a,e)=>{e.userData.variantMaterials!==void 0&&(a.userData.variantMaterials=Object.assign({},e.userData.variantMaterials)),e.userData.originalMaterial!==void 0&&(a.userData.originalMaterial=e.userData.originalMaterial)};class GLTFMaterialsVariantsExtension{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 o=n.extensions[this.name].variants||[],v=ensureUniqueNames(o.map(T=>T.name));for(const T of e.scenes)T.traverse(ee=>{const re=t.associations.get(ee);if(!re||re.meshes===void 0||re.primitives===void 0)return;const le=n.meshes[re.meshes].primitives[re.primitives].extensions;!le||!le[this.name]||(ee.userData.variantMaterials=mappingsArrayToTable(le[this.name],v))});e.userData.variants=v,e.functions=e.functions||{};const A=async(T,ee,re)=>{T.userData.originalMaterial||(T.userData.originalMaterial=T.material);const ie=T.material;let se=null;if(ee===null||!T.userData.variantMaterials[ee])T.material=T.userData.originalMaterial,t.associations.has(T.material)&&(se=t.associations.get(T.material).index);else{const le=T.userData.variantMaterials[ee];le.material?(T.material=le.material,le.gltfMaterialIndex!==void 0&&(se=le.gltfMaterialIndex)):(se=le.gltfMaterialIndex,T.material=await t.getDependency("material",se),t.assignFinalMaterial(T),le.material=T.material)}re!==null&&re(T,ie,se)},b=T=>{const ee=T.material,re=T.userData.variantMaterials,ie=[];for(const se in re){const le=re[se];if(le.material)continue;const pe=le.gltfMaterialIndex;ie.push(t.getDependency("material",pe).then(de=>{T.material=de,t.assignFinalMaterial(T),re[se].material=T.material}))}return Promise.all(ie).then(()=>{T.material=ee})};e.functions.selectVariant=(T,ee,re=!0,ie=null)=>{const se=[];return re?T.traverse(le=>compatibleObject(le)&&se.push(A(le,ee,ie))):compatibleObject(T)&&se.push(A(T,ee,ie)),Promise.all(se)},e.functions.ensureLoadVariants=(T,ee=!0)=>{const re=[];return ee?T.traverse(ie=>compatibleObject(ie)&&re.push(b(ie))):compatibleObject(T)&&re.push(b(T)),Promise.all(re)},e.functions.copyVariantMaterials=(T,ee,re=!0)=>{re?traversePair(T,ee,(ie,se)=>copyVariantMaterials(ie,se)):copyVariantMaterials(T,ee)}}}var dracoLoader=new DRACOLoader;dracoLoader.setDecoderPath(`${ASSETS_SOURCE_ROOT}/external-libs/draco/`);dracoLoader.setDecoderConfig({type:"js"});const assetStore=create$3((a,e)=>({assets:{items:{}},actions:{async loadAsset(t,n=!1){const{assets:s}=e();let o,v;if(s.items[t]){const re=n?s.items[t].proxy:s.items[t];if(re.isLoaded)return s.items[t];if(re.errorLoading)throw Error((n?"Proxy ":"Model ")+"Loading failed for: "+t,t)}else s.items[t]={isLoaded:!1,errorLoading:!1,proxy:{isLoaded:!1,errorLoading:!1}};const A=productDataStore$1.getState().productData[t];if(!A)throw Error("Data doesn't exists for "+t,t);if(n?(o=s.items[t].proxy,v=CORE_API.getResolvedAssetUrl(A.colliderProxyGLTF)):(o=s.items[t],v=CORE_API.getResolvedAssetUrl(A.gltfURL)),!o||!v)return null;const b=new GLTFLoader;b.register(re=>new GLTFMaterialsVariantsExtension(re)),b.setDRACOLoader(dracoLoader);async function T(re){const ie=re.loaded/re.total*100;o.progress=ie}const ee=await b.loadAsync(v,T).catch(re=>{throw o.isLoaded=!1,o.errorLoading=!0,o.error=re,LOGGER.info(v),Error("Couldn't load "+t,t)});return o.data=ee,o.isLoaded=!0,s.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 replacingNode=null,swappableNodes=[];const ghostStore=create$3((a,e)=>({ghostData:null,ghostsTransform:[],ghostVisibility:!0,ghostParentRef:null,ghostMaterial:null,actions:{spawnGhostsForSkuID:async(t,n=!1,s)=>{const{ghostData:o,ghostsTransform:v}=e();if(o!==null||v.length>0){LOGGER.info("ghosts are already spawned for: "+o.skuID);return}return await new Promise(async(b,T)=>{let ee={};const re=()=>{b(ee)};CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Ghost_Loaded,re,{once:!0});const ie=productDataStore$1.getState().productData,se=attachmentStore$1.getState().attachmentSystem.currentStructure;if(replacingNode=se.getFirstNodeByCategoryID(ie[t].categoryID),ie[t].replace&&replacingNode){if(t==replacingNode.skuID)return;const{transforms:pe,connectablePlugs:de}=se.findGhostTransformForReplacement(t,replacingNode);if(pe==null&&de==null){LOGGER.error({title:"Couldn't Find Ghost transforms and connectablePlugs for "+t});return}ee.transforms=pe,ee.newNodes=[replacingNode],ee.connectablePlugs=de,ee.addItemOrSwap=["replace"],replacingNode.setModelVisibility(!1)}else{const{transforms:pe,newNodes:de,connectablePlugs:fe}=se.findGhostTransforms(t,n);let _e=pe,ve=fe,xe=de,De=[];for(let Le=0;Le<pe.length;Le++)De.push("add");if(ie[t].swappable&&!sceneStore.getState().dragging){swappableNodes=se.getNodesByCategoryID(ie[t].categoryID);for(let Le=0;Le<swappableNodes.length;Le++){const Ue=se.findGhostTransformForReplacement(t,swappableNodes[Le]);Ue.transforms&&(_e.push(Ue.transforms[0]),ve.push(Ue.connectablePlugs[0]),xe.push(swappableNodes[Le]),De.push("replace"),swappableNodes[Le].setModelVisibility(!1))}}ee.transforms=_e,ee.newNodes=xe,ee.connectablePlugs=ve,ee.addItemOrSwap=De}if(ee.transforms.length<=0)return;const le=await assetStore.getState().actions.loadAsset(t,!0);a({ghostsTransform:ee.transforms,ghostData:{proxyScene:le.proxy.data.scene,skuID:t,newNodes:ee.newNodes,addItemOrSwap:ee.addItemOrSwap,connectablePlugs:ee.connectablePlugs,count:s||ee.transforms.length}})})},clearAllGhosts:()=>{if(replacingNode&&replacingNode.setModelVisibility(!0),swappableNodes)for(let t=0;t<swappableNodes.length;t++)swappableNodes[t].setModelVisibility(!0);a({ghostVisibility:!0,ghostData:null,ghostsTransform:[]})}}})),cameraStore=create$3((a,e)=>({focusPointPosition:new Vector3(0,0,0),canCameraRotate:!0,sendCameraDetailsTrigger:!1,viewPointPosition:new Vector3(0,0,0),boundsMargin:0,savedState:!1,resetToLastPosition:!0,userDragging:!1,disableAutoRotate:!1,cameraSettings:{truckSpeed:1,fov:35,dollySpeed:1,initialViewPointPosition:new Vector3(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:()=>{a(t=>({sendCameraDetailsTrigger:!t.sendCameraDetailsTrigger}))},setCameraSettings:t=>{const{cameraSettings:n}=e();sceneStore.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(o=>n[o]=t[o]),a({cameraSettings:{...n},viewPointPosition:ArrToVec3(n.initialViewPointPosition)})}}})),hotspotStore$1=create$3((a,e)=>({activeHotspotData:null,lastActiveHotspotData:null,isAnyHotspotActive:!1,hotspotsVisibility:!1,hotspotsTempVisibility:!0,hotspotsHealthCheck:!0,hotspotsSpawned:{},visitedHotspotsID:[],hotspotSpawnedForCategoryIDs:[],actions:{clearAllHotspots:()=>a({isAnyHotspotActive:!1,activeHotspotData:null,lastActiveHotspotData:null,hotspotsSpawned:{}}),removeHotspotForItem(t){const{hotspotsSpawned:n}=e();Object.keys(n).map(s=>{n[s].itemData.guid==t.itemData.guid&&delete n[s]}),a({hotspotsSpawned:{...n}})},checkHotspotHealth(){const{hotspotsHealthCheck:t}=e();a({hotspotsHealthCheck:!t})},toggleHotspotVisibility(){const{hotspotsVisibility:t}=e();a({hotspotsVisibility:!t})},switchHotspotsVisibility(t,n=!1){a(n===!0?{hotspotsTempVisibility:t}:{hotspotsVisibility:t})},clickHotspot(t,n,s,o=!1){const{activeHotspotData:v}=e();a({lastActiveHotspotData:v}),hotspotEnter(t,n,s);let b=itemStore.getState().itemsSpawned[s].itemData.skuID;o===!1&&(CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Hotspot_Enter,{hotspotAbsID:generateHotspotAbsoluteID(b,t),hotspot:hotspotStore$1.getState().activeHotspotData}),CORE_API.fireEvent(CORE_API.EVENTS.UI.UtilityMenu_Hide))},exitHotspot(t=!1){const{activeHotspotData:n,isAnyHotspotActive:s}=e();if(s&&a({isAnyHotspotActive:!1}),!!n&&(a({lastActiveHotspotData:n}),hotspotExit(),t===!1)){const o=Math.round((performance.now()-e().lastActiveHotspotData.hotspotEnterTime)/1e3);CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Hotspot_Exit,{hotspot:e().lastActiveHotspotData,hotspotTimeSpent:o}),CORE_API.fireEvent(CORE_API.EVENTS.UI.UtilityMenu_Show)}}}}));function hotspotExit(){hotspotStore$1.setState({activeHotspotData:null}),sceneStore.getState().actions.triggerAutoFocus()}function hotspotEnter(a,e,t){let n=hotspotStore$1.getState();const o=itemStore.getState().itemsSpawned;let v=n.visitedHotspotsID;const A=o[t].hotspotsData.filter(De=>De.hotspotID==a);if(!A||A.length<=0)return;const b=A[0],T=o[t].itemData.skuID+"_"+a;let re=attachmentStore$1.getState().attachmentSystem.currentStructure.getNodeByGUID(t),ie=new Vector3(0,0,0);re&&re.ref&&re.ref.getWorldPosition(ie);let se=new Quaternion().identity();re&&re.ref&&re.ref.getWorldQuaternion(se);let le=b.focusPointTransform;LOGGER.info(le);let pe=ArrToVec3(le);pe.applyQuaternion(se);let de=b.viewPointTransform,fe=ArrToVec3(de);fe.applyQuaternion(se);let _e=addVector(Vec3ToArr(pe),Vec3ToArr(ie)),ve=addVector(Vec3ToArr(fe),Vec3ToArr(ie));cameraStore.setState({focusPointPosition:_e,viewPointPosition:ve}),hotspotStore$1.setState({activeHotspotData:{hotspotData:{guid:e,...b},itemData:{...o[t],guid:t},domID:"rd_"+T,hotspotEnterTime:performance.now()},isAnyHotspotActive:!0}),v.includes(T)||(v.push(T),hotspotStore$1.setState({visitedIDs:{...v}}))}const itemStore=create$3((a,e)=>({variantChangeAlert:!1,removeItems:[],removeItemTrigger:!1,itemsSpawned:{},itemsCount:0,modelLoadedAlert:0,lastDeletedItemData:null,lastDeletedItemsData:[],hoveredItemRef:{},collidersRef:[],filteredCollidersRef:[],selectedItemData:null,busy:!1,actions:{triggerModelLoaded:()=>a(t=>({modelLoadedAlert:t.modelLoadedAlert+1})),triggerRemoveItem:()=>a(t=>({removeItemTrigger:!t.removeItemTrigger})),addToRemoveItems:t=>{const{removeItems:n}=e();n.push(t)},switchToVariant:async(t,n,s=!1)=>{const{itemsSpawned:o,variantChangeAlert:v}=e(),A=productDataStore$1.getState().categoryData,b=o[t.guid].itemData.clonedScene;var ee=attachmentStore$1.getState().attachmentSystem.currentStructure.getNodeByGUID(t.guid);assetStore.getState().assets.items[t.skuID].data||A.geometryVariants&&A.geometryVariants.map(se=>{se.productsInCategory.map(le=>{let pe=!1;le.products.map(de=>{de==t.skuID&&(pe=!0)}),pe&&le.products.map(de=>{const fe=assetStore.getState().assets.items[de].data;fe&&(assetStore.getState().assets.items[t.skuID].data=fe)})})});const ie=assetStore.getState().assets.items[t.skuID].data;ie&&(await ie.functions.selectVariant(b,n),s?(ee.overrideVariant=n,CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0)):ee.currentVariant=n,a({variantChangeAlert:!v}))},clearAllItems:()=>{a({itemsSpawned:{},itemsCount:0,lastDeletedItemsData:[],hoveredItemRef:[],collidersRef:[],filteredCollidersRef:[],selectedItemData:null})},setItemsSpawned:t=>{a({itemsSpawned:t,itemsCount:Object.keys(t).length})},setHoveredItemRef:t=>a({hoveredItemRef:t}),setCollidersRef:t=>{a({collidersRef:t});let n=[];for(var s=0;s<t.length;s++)t[s].current&&n.push(t[s]);itemStore.setState({filteredCollidersRef:[...n]})},setSelectedItemData:t=>{const{selectedItemData:n,hoveredItemRef:s,actions:o}=e();n&&(delete s[n.itemData.guid],o.setHoveredItemRef({...s})),a({selectedItemData:{...t}}),sceneStore.getState().actions.triggerAutoFocus(),hotspotStore$1.getState().actions.switchHotspotsVisibility(!1,!0),cameraStore.setState({canCameraRotate:!1})},deselectItem:()=>{const{selectedItemData:t}=e();t&&CORE_API.fireEvent(CORE_API.EVENTS.UI.ContextMenu_Hide,t),a(()=>({selectedItemData:null})),sceneStore.getState().actions.triggerAutoFocus(),hotspotStore$1.getState().actions.switchHotspotsVisibility(!0,!0),cameraStore.setState({canCameraRotate:!0}),itemStore.getState().actions.setHoveredItemRef({})},removeItemByGUID:async t=>{const{itemsSpawned:n,actions:s}=e();if(n.hasOwnProperty(t))return new Promise(async(o,v)=>{s.addToRemoveItems(t),s.triggerRemoveItem();const A=b=>{t===b.data.itemData.guid&&o(t)};CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Item_Removed,A,{once:!0})})},addItemBySkuID:async(t,n=0,s=!1,o)=>{a({busy:!0});const{actions:v,itemsSpawned:A}=e(),b=productDataStore$1.getState().productData,T=productDataStore$1.getState().hotspotsData,ee=attachmentStore$1.getState().attachmentSystem;let re=!0;const ie=await new Promise(async(pe,de)=>{if(v.deselectItem(),!b[t]){LOGGER.warn({title:`Product not found: ${t}`}),CORE_API.alert({alertMsg:t+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"}),re=!1,de(t+": product not found!");return}const fe=[...ghostStore.getState().ghostsTransform],_e={...ghostStore.getState().ghostData};if(ghostStore.getState().actions.clearAllGhosts(),fe.length<=0){CORE_API.alert({alertMsg:"Unable to add item to configuration",alertTime:6e3,alertType:"warn",alertLabel:"Action Unavailable"}),re=!1,de("No available connections for this product to attach to");return}const ve=xe=>{t===xe.data&&pe(_e.newNodes[n].guid)};if(CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Model_Loaded,ve,{once:!0}),_e.addItemOrSwap[n]=="replace")await replaceItem(A,_e.skuID,fe[n],_e.newNodes[n]);else{const xe=_e.newNodes[n];xe.isDependent=s;let De=!0;if(b[_e.skuID].hasOwnProperty("disableInteraction")){const Fe=b[_e.skuID].disableInteraction;(Fe==!0||Fe==!1)&&(De=!Fe)}(o==!0||o==!1)&&(De=o),xe.isInteractive=De;const{position:Le,rotation:Ue}=fe[n];xe.transform={position:Le,rotation:Ue},ee.currentStructure.addNode(xe),ee.currentStructure.connectPlugs(_e.connectablePlugs[n]);const Ge=await assetStore.getState().actions.loadAsset(_e.skuID,!0);LOGGER.info("GHOST NEW NODE: ",xe),A[xe.guid]={itemData:{proxyScene:Ge.proxy.data.scene,guid:_e.newNodes[n].guid,...b[_e.skuID],position:Le,rotation:Ue,hasItemLoaded:!1,isDependent:s,isInteractive:De},hotspotsData:T[_e.skuID],hotspotSpawned:!1},await wait(1),v.setItemsSpawned({...A})}}).catch(pe=>{LOGGER.error({title:pe}),re=!1});if(re===!1)return a({busy:!1}),ie;const se=ee.getCartItems();se&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,se);const le=b[t]?.plugs;if(le){for(const pe of le){const de=pe?.dependencySku;if(!de)continue;LOGGER.info(`Found a dependency: ${de} on the plug: ${pe.name}`);let fe=!0;b[de]&&b[de].hasOwnProperty("ignoreSpawningCollisionAsDependency")&&(fe=b[de].ignoreSpawningCollisionAsDependency),pe.hasOwnProperty("ignoreSpawningCollision")&&(fe=pe.ignoreSpawningCollision);let _e=sceneStore.getState().sceneSettings.ignoreSpawningCollision;b[de].hasOwnProperty("ignoreSpawningCollision")&&(_e=b[de].ignoreSpawningCollision),b[de].ignoreSpawningCollision=fe;const ve=await ghostStore.getState().actions.spawnGhostsForSkuID(de,fe);if(b[de].ignoreSpawningCollision=_e,!ve)continue;const xe=ee.currentStructure.getNodeByGUID(ie),De=xe.getPlugByName(pe.name)?.guid,Le=pe?.isDependencySkuInteractive?pe.isDependencySkuInteractive===1:!1,Ue=ve.connectablePlugs;let Ge=!1;for(let Fe=0;Fe<ve.connectablePlugs.length;Fe++){if(Ue[Fe].receiverPlug.guid!==De)continue;Ge=!0;const Ye=await v.addItemBySkuID(de,Fe,!0,Le);Ye!==null&&xe.addMyDependenciesGUID(Ye)}Ge||ghostStore.getState().actions.clearAllGhosts()}ghostStore.getState().actions.clearAllGhosts()}return a({busy:!1}),ie},async addItemWithTransform(t,n,s,o=!0){return new Promise(async(v,A)=>{const{actions:b,itemsSpawned:T}=e();b.deselectItem();const ee=productDataStore$1.getState().productData,re=productDataStore$1.getState().hotspotsData;if(!ee[n]){CORE_API.alert({alertMsg:n+": product not found!",alertTime:5e3,alertType:"warn",alertLabel:"Not Found"});return}const{position:ie,rotation:se}=t;T[s]!=null&&(hotspotStore$1.getState().actions.removeHotspotForItem({...T[s]}),delete T[s]);const le=de=>{n==de.data&&v(s)};CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Model_Loaded,le,{once:!0});const pe=await assetStore.getState().actions.loadAsset(n,!0);pe!=null&&(await wait(1),T[s]={itemData:{proxyScene:pe.proxy.data.scene,guid:s,...ee[n],position:ie,rotation:se,hasItemLoaded:!1,isInteractive:o},hotspotsData:re[n],hotspotSpawned:!1},a({itemsSpawned:{...T}}))})},async replaceGUIDItemBySKUID(t,n){const{itemsSpawned:s}=e(),o=productDataStore$1.getState().productData,v=productDataStore$1.getState().hotspotsData,A=attachmentStore$1.getState().attachmentSystem.currentStructure,b=A.getNodeByGUID(t);return b.isReplaceableWithSkuId(n)?(await new Promise(async(ee,re)=>{hotspotStore$1.getState().actions.removeHotspotForItem({...s[t]}),delete s[t],b.update(n);const ie=le=>{n===le.data&&ee(!0)};CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Model_Loaded,ie,{once:!0});const se=await assetStore.getState().actions.loadAsset(n,!0);await wait(1),s[t]={itemData:{proxyScene:se.proxy.data.scene,guid:t,...o[n],position:b.transform.position,rotation:b.transform.rotation,hasItemLoaded:!1},hotspotsData:v[n],hotspotSpawned:!1},itemStore.setState({itemsSpawned:{...s}})}),A.recalculateStructureFromNode(b.whichNodeAreWeAttachedTo()),attachmentStore$1.getState().actions.toggleStructureUpdated(),!0):!1}}}));async function replaceItem(a,e,t,n){const{position:s,rotation:o}=t,v=productDataStore$1.getState().productData,A=productDataStore$1.getState().hotspotsData,b=attachmentStore$1.getState().attachmentSystem.currentStructure;return new Promise(async(T,ee)=>{const re=async()=>{const ie=await assetStore.getState().actions.loadAsset(e,!0);a[n.guid]={itemData:{proxyScene:ie.proxy.data.scene,guid:n.guid,...v[e],position:s,rotation:o,hasItemLoaded:!1},hotspotsData:A[e],hotspotSpawned:!1},LOGGER.warn({title:"SWITCHING VARIANT: ",details:n.currentVariant}),n.currentVariant=n.currentVariant,n.transform=t,itemStore.setState({itemsSpawned:{...a}}),b.recalculateStructureFromNode(n),attachmentStore$1.getState().actions.toggleStructureUpdated(),T(n.guid)};hotspotStore$1.getState().actions.removeHotspotForItem({...a[n.guid]}),delete a[n.guid],n.update(e),CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Model_Removed,re,{once:!0})})}const inventoryStore=create$3((a,e)=>({inventoryData:{},actions:{getInventoryInfo:()=>{const{inventoryData:t}=e();return t},updateInventoryForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(s=>{let o=t[s];Object.keys(o).map(v=>{n.updateInventoryForProduct(s,v,o[v].inventory)})}),n.refreshInventory(itemStore.getState().itemsSpawned)},updateInventoryForProduct:(t,n,s)=>{const{inventoryData:o}=e();let v=o[t],A=v[n];!v||!A||(A.inventory=s)},_clearInScene:()=>{const{inventoryData:t}=e();Object.keys(t).map(n=>{const s=t[n];Object.keys(s).map(o=>{s[o].inScene=[]})})},refreshInventory:t=>{if(!t)return;LOGGER.info({title:"Refreshing Inventory"});const{actions:n,inventoryData:s}=e();n._clearInScene();const o=attachmentStore$1.getState().attachmentSystem;if(o===null)return;const v=o.currentStructure;if(v===null)return;Object.keys(t).map(ee=>{const re=v.getNodeByGUID(ee);if(!re)return;const ie=re.overrideVariant?re.overrideVariant:re.currentVariant;if(!ie)return;const se=s[re.skuID];if(!se||!se[ie].inScene)return;se[ie].inScene.push(ee),sceneStore.getState().sceneSettings.disableCart===!0?re.inStock={variantName:ie,newValue:!0}:se[ie].inScene.length>se[ie].inventory?re.inStock={variantName:ie,newValue:!1}:re.inStock={variantName:ie,newValue:!0}});let A=!1;Object.keys(s).map(ee=>{const re=s[ee];Object.keys(re).map(ie=>{re[ie].countAvailable=re[ie].inventory-re[ie].inScene.length,re[ie].countAvailable<0?(re[ie].countUnavailable=re[ie].countAvailable*-1,re[ie].countAvailable=0,A=!0):re[ie].countUnavailable=0})});const b={alertMsg:"Some items selected are out of stock",alertTime:3e3,alertType:"warn",alertLabel:"Stock Alert",alertId:"outOfStock"},T=compareObjects(sceneStore.getState().persistantAlertData,b);A===!1&&T===!0&&CORE_API.removePersistantAlert(),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Inventory_Updated,s)}}})),sceneStore=create$3((a,e)=>({CORE_API:null,frameloop:"always",hoveredGhostIndex:-1,itemDraggedSkuID:null,screenshotRenderer:new WebGLRenderer({antiAlias:!0,preserveDrawingBuffer:!0}),screenshotCamera:new PerspectiveCamera(75,1.33,.1,1e3),builderMode:!1,dragging:!1,bbox:null,draggingItemGUID:null,sceneRef:null,cssLoaded:!1,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,ghostColorOnHoverWithDraggableUi:{r:153,g:252,b:0,a:1},preserveDrawingBuffer:!1,showSaveBtn:!0,showShareBtn:!0,showResetBtn:!0,showDimensionBtn:!0,showViewInYourSpaceBtn:!0,showDependencyOnHover:!1,showContextMenu:!0,showHotspotsBtn:!0,showInstructionsBtn:!1,showInstructionsOnStartup:!1,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",emptySceneTextFontSize:"2rem",addToCartCTAText:"Add To Cart",ignoreCollisionPostDragging:!1,disableCart:!1,dimensionColor:{r:0,g:0,b:0},disableLocalColorOverride:!1,analyticsEventPrefix:"",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:{default:!0,itemAdded:!0,geometryVariantChanged:!0,overridesRemoved:!0,materialVariantChanged:!0,itemRemoved:!0,itemRepositioned:!0,configurationSaved:!0,linkCopied:!0,outOfStock:!0},screenshotCameras:[{position:new Vector3(-2.5,.6,-5),rotation:new Vector3(-3.1097068566150314,-.6437852162982552,-3.122449778846033)},{position:new Vector3(3,1,-5),rotation:new Vector3(-.5,1,.5)}],instructionsSettings_desktop:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],instructionsSettings_mobile:[{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"},{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"},{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}],defaultInstructionsSettings:{step1_drag:{mobile:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop_Mobile/Mobile_Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop_Mobile/Mobile_Non-furniture_Step_1A.json"}},desktop:{header:"Add to Scene",description:"Drag & drop individual modules to add to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1A_Drag_Drop/Furniture_Step_1A.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1A_Drag_Drop/Non-furniture_Step_1A.json"}}},step1_add:{mobile:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add_Mobile/Mobile_Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add_Mobile/Mobile_Non-furniture_Step_1B.json"}},desktop:{header:"Add to Scene",description:"Click to add individual modules to the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_1B_Click_Add/Furniture_Step_1B.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_1B_Click_Add/Non-furniture_Step_1B.json"}}},step2:{mobile:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}},desktop:{header:"Rearrange Modules",description:"Drag & drop individual modules in the scene to rearrange.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_2/Furniture_Step_2.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_2/Non-furniture_Step_2.json"}}},step3:{mobile:{header:"Remove Modules",description:"Tap to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}},desktop:{header:"Remove Modules",description:"Click to select and remove individual modules from the scene.",lottieURL:{furniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Furniture/Furniture_Step_3/Furniture_Step_3.json",nonFurniture:"<@all-projects@>/common-assets/instructions-assets/lottie-animations/Non-Furniture/Non-furniture_Step_3/Non-furniture_Step_3.json"}}}}},setCSSLoaded:t=>{a({cssLoaded:t})},actions:{popFromAlertQueue:()=>{const{alertQueue:t}=e();return t.shift(),a({alertQueue:t}),t},addToAlertQueue:t=>{const{alertQueue:n}=e();return n.push(t),a({alertQueue:n}),n},getDeviceState:()=>{const{isDesktop:t,isMobile:n,isTablet:s,isTouchDevice:o,isLandscape:v}=e();return{isDesktop:t,isMobile:n,isTablet:s,isTouchDevice:o,isLandscape:v}},enableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!1,inventoryStore.getState().actions.refreshInventory(itemStore.getState().itemsSpawned),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!1})},disableCart:()=>{const{sceneSettings:t}=e();t.disableCart=!0,inventoryStore.getState().actions.refreshInventory(itemStore.getState().itemsSpawned),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Cart_StatusUpdated,{disableCart:!0})},getSceneSettings:()=>{const{sceneSettings:t}=e();return t},sendAlert:t=>{a({alertData:{...t}})},switchCursor(t){const{cursorParentRef:n}=e();if(!n)return;let s="";switch(t){default:case CURSORS.GRAB:s="grabCursor";break;case CURSORS.GRABBING:s="grabbingCursor";break;case CURSORS.BLOCKED:s="blockedCursor";break;case CURSORS.POINTER:s="pointerCursor";break;case CURSORS.MOVE:s="moveCursor";break}for(let o=0;o<n.classList.length;o++)n.classList[o].includes("Cursor")&&n.classList.remove(n.classList[o]);n.classList.add(s)},setAlertSettings:t=>{a({alertSettings:t})},async completeDropItem(){const t=attachmentStore$1.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:s,attachedChildrenGuids:o,collidingStatus:v,intersectingGhostObject:A,initPosition:b,initRotation:T,detachedPlugs:ee,attachedNodesToCurrentNode:re}=n;CORE_API.alert({alertMsg:"Item(s) have been removed",alertTime:7e3,alertType:"info",alertLabel:"Item(s) Removed",alertId:"itemRemoved"});for(const[pe,de]of o.entries())v[pe]===!0&&await itemStore.getState().actions.removeItemByGUID(de);const ie=A.userData;let se=s.getPlugByName(ie.incomingPlugName),le=t.currentStructure.getPlugByGUID(ie.receiverPlugGUID);s.ref.position.set(A.position.x,A.position.y,A.position.z),s.ref.setRotationFromEuler(A.rotation),s.transform={position:A.position,rotation:A.quaternion},t.currentStructure.connectPlugs({incomingPlug:se,receiverPlug:le}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),re.map(pe=>{s.ref.parent.attach(pe.ref)}),attachmentStore$1.getState().actions.updateFittingSkuIds()},revertDropItem(){const t=attachmentStore$1.getState().attachmentSystem,{draggingOnDropCollisionData:n}=e(),{node:s,attachedChildrenGuids:o,collidingStatus:v,intersectingGhostObject:A,initPosition:b,initRotation:T,detachedPlugs:ee,attachedNodesToCurrentNode:re}=n;CORE_API.alert({alertMsg:"Position of item"+s.skuID+"is being moved to it's original position",alertTime:4e3,alertType:"info",alertLabel:"Repositioning",alertId:"itemRepositioned"});const ie=ee.neighbourDetachedPlugs;ie&&(ee.neighbourNode.detachNodeFromReceiver(),t.currentStructure.connectPlugs({incomingPlug:ie.incomingPlug,receiverPlug:ie.receiverPlug}));let se=ee.rootDetachedPlugs.incomingPlug,le=ee.rootDetachedPlugs.receiverPlug;s.ref.position.set(b.x,b.y,b.z),s.ref.setRotationFromEuler(T);let pe=new Quaternion().identity();s.ref.getWorldQuaternion(pe),s.transform={position:b,rotation:pe},t.currentStructure.connectPlugs({incomingPlug:se,receiverPlug:le}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),re.map(de=>{s.ref.parent.attach(de.ref)}),attachmentStore$1.getState().actions.updateFittingSkuIds()},setCoreSettings:t=>{const{sceneSettings:n,isMobile:s,isTouchDevice:o,isLandscape:v,actions:A}=e(),b=s===!0?"mobile":"desktop",T=["showSave","showShare","showReset","showDimension","showHotspots","showInstructionsBtn","showViewInYourSpace","showContextMenu","showInstructionsOnStartup","draggableUI","textSettings","alertControl","variantsTabOrder","emptySceneTextFontSize","instructionsSettings"];for(const ee of T)if(ee==="draggableUI"||ee==="emptySceneTextFontSize"||ee==="showInstructionsOnStartup"||ee==="showInstructionsBtn"||ee==="instructionsSettings"){const ie=`${ee}_${v===!1&&o===!0?"mobile":"desktop"}`;t[ie]!==void 0?n[ee]=t[ie]:n[ie]!==void 0&&(n[ee]=n[ie])}else if(ee==="textSettings"||ee==="variantsTabOrder"||ee==="alertControl"){if(t.hasOwnProperty(ee)){let re=n[ee];Object.keys(re).map(ie=>{let se=t[ee];se.hasOwnProperty(ie)||(se[ie]=re[ie])})}}else{const re=`${ee}_${b}`;if(t[re]!==void 0){let ie=`${ee}Btn`;ee=="showContextMenu"&&(ie=`${ee}`),n[ie]=t[re]}}t.disableCart===!0&&A.disableCart(),Object.keys(t).map(ee=>n[ee]=t[ee]),a({sceneSettings:{...n,ghostThreeColor:{r:n.ghostColor.r/255,g:n.ghostColor.g/255,b:n.ghostColor.b/255,a:n.ghostColor.a/255},draggableUiGhostThreeColorOnHover:{r:n.ghostColorOnHoverWithDraggableUi.r/255,g:n.ghostColorOnHoverWithDraggableUi.g/255,b:n.ghostColorOnHoverWithDraggableUi.b/255,a:n.ghostColorOnHoverWithDraggableUi.a/255}}})},triggerAutoFocus:(t=null)=>a(n=>({autoFocusRef:t,autoFocusTrigger:n.autoFocusTrigger+1})),requestNewScreenshot:async(t,n)=>new Promise(async(s,o)=>{LOGGER.info("Taking a screenshot");const{screenshotRenderer:v,sceneRef:A,screenshotCamera:b,canvasSize:T}=e(),ee=await CORE_API.getCurrentCameraDetails();if(v.setClearColor(16777215),b.copy(ee),t!==null&&(b.position.copy(t.position),b.rotation.copy(new Euler(t.rotation.x,t.rotation.y,t.rotation.z))),n==null?v.setSize(T.width,T.height):v.setSize(n.width,n.height),v.render(A.parent,b),v.preserveDrawingBuffer===!1)LOGGER.warn({title:"Preserve Drawing Buffer must be enabled to take a screenshot. Please make sure to enable this within the project input data coreSettings"}),o({success:!1,imageData:null});else{LOGGER.info("Downloading the screenshot");const re=v.domElement.toDataURL("image/png").replace("image/png","image/octet-stream");s({success:!0,imageData:re})}})}})),hotspotIdPrefix="rd",hotspotIdSeparator="_";function generateHotspotAbsoluteID(a,e){return`${hotspotIdPrefix}${hotspotIdSeparator}${a}${hotspotIdSeparator}${e}`}async function wait(a){return LOGGER.info({title:`Waiting for ${a}ms`}),new Promise((e,t)=>{setTimeout(()=>{e(!0)},a)})}function compareObjects(a,e){if(a===null||e===null)return!1;for(let t in a)if(a.hasOwnProperty(t)&&e.hasOwnProperty(t)&&a[t]!==e[t])return!1;return Object.keys(a).length===Object.keys(e).length}const saveStructureToCMS=a=>{const e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)};return fetch(SAVE_CONFIG_ENDPOINT,e)},mobileCheck=function(){let a=!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)))&&(a=!0)}(navigator.userAgent||navigator.vendor||window.opera),a};function isIpadOS(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}function tabletCheck(){const a=navigator.userAgent.toLowerCase(),e=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(a);return e||isIpadOS()}function touchDeviceCheck(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}async function getJSONFromEndpoint(a){let e={data:null,report:"",success:!1};try{const n=await(await fetch(a)).text();e.data=JSON.parse(n),e.success=!0,e.report="Successfully fetched JSON data."}catch(t){e.report=t,CORE_API.alert({alertMsg:"",alertTime:5e3,alertType:"warn",alertLabel:"Preload Failed"})}return e}const addVector=(a,e)=>new Vector3(a[0]+e[0],a[1]+e[1],a[2]+e[2]),Vec3ToArr=a=>[a.x,a.y,a.z],ArrToVec3=a=>new Vector3(a[0],a[1],a[2]),findMeshAndCloneMatFromScene=(a,e=!0)=>{let t=[];const n=sceneStore.getState().sceneSettings.outOfStock_EmissiveColor,s=sceneStore.getState().sceneSettings.outOfStock_EmissiveIntensity;return a.traverse(o=>{o.isMesh&&(o.material.userData.cloned?o.material.userData.inStock!==e&&(e?(o.material.emissive.set(new Color$1(255,255,255)),o.material.emissiveIntensity=0):(o.material.emissive.set(new Color$1(n.r,n.g,n.b)),o.material.emissiveIntensity=s),o.material.userData.inStock=e):(o.material=o.material.clone(),o.material.userData.inStock=e,o.material.userData.cloned=!0,e?(o.material.emissive.set(new Color$1(255,255,255)),o.material.emissiveIntensity=0):(o.material.emissive.set(new Color$1(n.r,n.g,n.b)),o.material.emissiveIntensity=s)),t.push(o))}),t},filterArrWithCondition=(a,e)=>{let t=0,n=[];for(let s=0;s<a.length;s++){const o=a[s];e(o)?a[t++]=o:n.push(a[s])}return a.length=t,n},degToRad=a=>a*Math.PI/180,resolveAssetUrl=a=>{if(!a)return;if(new RegExp("^(?:[a-z+]+:)?//","i").test(a))return a;let n=a;return n=n.replaceAll("<@all-projects@>",ALL_PROJECTS_ASSET_DATA_ROOT_URL),n=n.replaceAll("<@generic-project@>",GENERIC_PROJECT_ASSET_DATA_ROOT_URL),n};function componentToHex(a){var e=a.toString(16);return e.length==1?"0"+e:e}function rgbToHex(a,e,t){return"#"+componentToHex(a)+componentToHex(e)+componentToHex(t)}function getUrlParameterByName(a,e=window.location.search){const t=new URLSearchParams(e);return Object.fromEntries(t.entries())[a]}const lightStore=create$3((a,e)=>({defaultEnvMapUrl:"<@generic-project@>/env-map/neutral.hdr",envMapUrl:"",actions:{setEnvLightMap:t=>{a(n=>({envMapUrl:t}))},processLookEnvMapOverride:t=>{const{envMapUrl:n,defaultEnvMapUrl:s,actions:o}=e(),v=productDataStore$1.getState().lookData[t],A=v?.envMapOverride;if(!v||!A){o.setEnvLightMap(s);return}if(A===n){LOGGER.info(`New Env Map Url is the same as the current ${A}`);return}o.setEnvLightMap(A)}}}));var rngBrowser={exports:{}},getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);rngBrowser.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);rngBrowser.exports=function(){for(var e=0,t;e<16;e++)e&3||(t=Math.random()*4294967296),rnds[e]=t>>>((e&3)<<3)&255;return rnds}}var rngBrowserExports=rngBrowser.exports,byteToHex=[];for(var i$2=0;i$2<256;++i$2)byteToHex[i$2]=(i$2+256).toString(16).substr(1);function bytesToUuid$2(a,e){var t=e||0,n=byteToHex;return[n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],"-",n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]],n[a[t++]]].join("")}var bytesToUuid_1=bytesToUuid$2,rng$1=rngBrowserExports,bytesToUuid$1=bytesToUuid_1,_nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1$2(a,e,t){var n=e&&t||0,s=e||[];a=a||{};var o=a.node||_nodeId,v=a.clockseq!==void 0?a.clockseq:_clockseq;if(o==null||v==null){var A=rng$1();o==null&&(o=_nodeId=[A[0]|1,A[1],A[2],A[3],A[4],A[5]]),v==null&&(v=_clockseq=(A[6]<<8|A[7])&16383)}var b=a.msecs!==void 0?a.msecs:new Date().getTime(),T=a.nsecs!==void 0?a.nsecs:_lastNSecs+1,ee=b-_lastMSecs+(T-_lastNSecs)/1e4;if(ee<0&&a.clockseq===void 0&&(v=v+1&16383),(ee<0||b>_lastMSecs)&&a.nsecs===void 0&&(T=0),T>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=b,_lastNSecs=T,_clockseq=v,b+=122192928e5;var re=((b&268435455)*1e4+T)%4294967296;s[n++]=re>>>24&255,s[n++]=re>>>16&255,s[n++]=re>>>8&255,s[n++]=re&255;var ie=b/4294967296*1e4&268435455;s[n++]=ie>>>8&255,s[n++]=ie&255,s[n++]=ie>>>24&15|16,s[n++]=ie>>>16&255,s[n++]=v>>>8|128,s[n++]=v&255;for(var se=0;se<6;++se)s[n+se]=o[se];return e||bytesToUuid$1(s)}var v1_1=v1$2,rng=rngBrowserExports,bytesToUuid=bytesToUuid_1;function v4$1(a,e,t){var n=e&&t||0;typeof a=="string"&&(e=a==="binary"?new Array(16):null,a=null),a=a||{};var s=a.random||(a.rng||rng)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e)for(var o=0;o<16;++o)e[n+o]=s[o];return e||bytesToUuid(s)}var v4_1=v4$1,v1$1=v1_1,v4=v4_1,uuid=v4;uuid.v1=v1$1;uuid.v4=v4;var uuid_1=uuid;class Plug{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=uuid_1.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 attachedPlugGUID(){return this._attachedPlugGUID}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){this._attachedPlug=e,this._attachedPlugGUID=e.guid,this._isOpen=!1,this._isReceiverPlug=t;const n=this,s=this._node;if(s.isConnectedToRoot&&t){const o=s.whichPlugAreWeAttachedUsing();switch(e.type){case"weighted_hider":o.weight<n.weight&&(s.showNodes(o.affectedNodes)||CORE_API.coreWCRef.addEventListener(s.guid+":modelLoaded",function(){s.showNodes(o.affectedNodes)},{once:!0}));break}}if(t&&e.type!==""&&e.type==n._type)switch(e.type){default:case"weighted_hider":n._weight>e.weight?e.node.hideNodes(e.affectedNodes)||CORE_API.coreWCRef.addEventListener(e.node.guid+":modelLoaded",function(){e.node.hideNodes(e.affectedNodes)},{once:!0}):n._weight<e.weight&&(s.hideNodes(n._affectedNodes)||CORE_API.coreWCRef.addEventListener(s.guid+":modelLoaded",function(){s.hideNodes(n._affectedNodes)},{once:!0}));break}t&&(s.isEndNode=!1)}openPlug(){if(this._node.isConnectedToRoot){const e=this._node.whichPlugAreWeAttachedUsing();if(e&&this._guid!==e.guid)switch(this.type){case"weighted_hider":e.type==="weighted_hider"&&e.weight<this.weight&&this._node.hideNodes(e.affectedNodes);break}}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 Node$1=class{#t="default";#i=!1;#r=!1;#s=!0;#n={};#o=!1;#c={};#u=[];constructor(e,t=null,n,s){let o=productDataStore$1.getState().productData;this._plugs=[],this._skuID=e,this._ref=null,this._modelData=null,this._transform=null,this.#t="default",this._overrideVariant=null,this._followsParent=o[e].followsParent,this._categoryID=o[e].categoryID,this._replace=o[e].replace,this._swappable=o[e].swappable,this._price=this.#a(),this.#i=o[e]?.ignoreInCart,t?(this._guid=t.guid,this._isEndNode=t.isEndNode,this._overrideVariant=t.overrideVariant,this.generatePlugsWithData(e,t.plugs)):(this._guid=uuid_1.v4(),this._isEndNode=!0,this.generatePlugsForNode(e)),n&&Object.keys(n).map(v=>{if(o[e].looks&&o[e].looks.includes(v)){this.#t=v;return}})}get isRoot(){return this._skuID.toLowerCase()==="root"}updateGeometryVariant(e,t){const s=productDataStore$1.getState().categoryData.geometryVariants;let o=null;if(s.map(ee=>{ee.id==e&&(o=ee)}),!o)return;const v=o.productsInCategory,b=o.variants[t].productsToSwitch,T=itemStore.getState().itemsSpawned;v.map(ee=>{ee.products.map(re=>{this.skuID===re&&ee.products.map(ie=>{b.map(se=>{if(se==ie){const le=productDataStore$1.getState().actions.getProductDataById(se);this.skuID=le.skuID;const pe=T[this.guid];pe&&pe.itemData&&Object.keys(le).map(de=>{pe.itemData[de]=le[de]}),this.hideNodes(le.geometriesToHide),this.showNodes(le.geometriesToShow),this.updatePricing(),this.resetInStock(),inventoryStore.getState().actions.refreshInventory(T)}})})})})}resetInStock(){this.#n={},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.#n[e]&&this.#n[e]==t||(this.#n[e]=t,e!==this.#t&&this.#o===!1))return;const n=()=>{this.setInStockForRef(t)};n()||CORE_API.coreWCRef.addEventListener(this.guid+":modelLoaded",n,{once:!0})}get myDependenciesGUID(){return this.#u}set myDependenciesGUID(e){this.#u=e}addMyDependenciesGUID(e){this.#u.push(e)}get isDependent(){return this.#r}set isDependent(e){this.#r=e}get isInteractive(){return this.#s}set isInteractive(e){this.#s=e}update(e){this._skuID=e;const t=productDataStore$1.getState().productData,n=t[e]?.plugs;if(this.ignoreInCart=t[e].ignoreInCart,!!n)for(let s=0;s<this._plugs.length;s++)for(let o=0;o<n.length;o++)this._plugs[s].name==n[o].name&&(this._plugs[s].acceptedPlugTypes=n[o].acceptedPlugTypes,this._plugs[s].connectsToPlugTypes=n[o].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 v=this.whichNodesAreAttachedToUs();if(v.length>0){let A=!0;if(v.map(b=>{b.followsParent===!1&&(A=!1)}),!A)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 v=this.plugs[n].attachedPlug.acceptedPlugTypes;for(var s=0;s<this.plugs.length;s++)if(n!=s)for(var o=0;o<this.plugs[s].connectsToPlugTypes.length;o++)v.includes(this.plugs[s].connectsToPlugTypes[o])&&(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(s=>{if(t){const o=t.getObjectByName(s);o&&(o.visible=!1)}if(n){const o=n.getObjectByName(s);o&&(o.visible=!1)}}),!0}showNodes(e){if(!this.ref)return!1;const t=this.ref.getObjectByName("GRP_RenderGeometry"),n=this.ref.getObjectByName("GRP_ProxyMesh");return e.map(s=>{if(t){const o=t.getObjectByName(s);o&&(o.visible=!0)}if(n){const o=n.getObjectByName(s);o&&(o.visible=!0)}}),!0}canConnectToPlugType(e){let t=!1;return this._plugs.map(n=>{n.connectsToPlugTypes.map(s=>{s==e&&(t=!0)})}),t}isConnectedToSkuID(e){let t=!1;return this._plugs.map(n=>{if(n.isOpen||t===!0)return;let s=n.attachedPlug;!s&&n.attachedPlugGUID&&(s=attachmentStore$1.getState().attachmentSystem.currentStructure.getPlugByGUID(n.attachedPlugGUID)),s.node.skuID==e&&(t=!0)}),t}get isConnectedToRoot(){return this.isConnectedToSkuID("Root")}swapRoot(){if(!this.canSwapRoot)return;const t=attachmentStore$1.getState().attachmentSystem.currentStructure,n=this.whichNodesAreAttachedToUs();let s=null;n.map(T=>{T.followsParent===!1&&(s=T)});const o=s.detachNodeFromReceiver();let v=null;this._plugs.map(T=>{T.isOpen||T.attachedPlug.node.skuID=="Root"&&(v=T.attachedPlug)});const A=this.detachNodeFromReceiver();let b=null;return s.plugs.map(T=>{T.connectsToPlugTypes.includes("root")&&(b=T)}),t.connectPlugs({incomingPlug:b,receiverPlug:v}),{neighbourDetachedPlugs:o,rootDetachedPlugs:A,neighbourNode:s}}get canSwapRoot(){if(sceneStore.getState().sceneSettings.swappableRoot===!1)return!1;let e=!1;if(this.isConnectedToRoot&&!this._isEndNode){const n=this.whichNodesAreAttachedToUs();let s=0,o=null;n.map(v=>{v.followsParent===!1&&(s++,o=v)}),s==1?o.canConnectToPlugType("root")&&(e=!0):s>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.#t==="default"?productDataStore$1.getState().actions.getProductDataById(this._skuID).lookDetails.default.id:this.#t}get price(){return this._price}set price(e){this._price=e}updatePricing(){this._price=this.#a()}#a(){let t=productDataStore$1.getState().actions.getProductDataById(this._skuID).lookDetails[this.#t]?.price;return t||(t=0),t}set currentVariant(e){this.#t=e,this._price=this.#a()}get overrideVariant(){return this._overrideVariant}set overrideVariant(e){this._overrideVariant=e,this.#t=this._overrideVariant,this._price=this.#a()}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}get modelData(){return this._modelData}set modelData(e){this._modelData=e;let t=new CustomEvent(this._guid+":modelLoaded",{bubbles:!0,cancelable:!1,composed:!0});const n=attachmentStore$1.getState().attachmentSystem;n.globalGeometryVariants&&Object.keys(n.globalGeometryVariants).map(s=>{this.updateGeometryVariant(s,n.globalGeometryVariants[s])}),t.data={},CORE_API.coreWCRef?CORE_API.coreWCRef.dispatchEvent(t):LOGGER.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=productDataStore$1.getState().productData[e]?.plugs;let s=0;if(!n)return!1;for(let o=0;o<this._plugs.length;o++)for(let v=0;v<n.length;v++)this._plugs[o].name==n[v].name&&s++;return s==this._plugs.length}whichPlugAreWeAttachedUsing(){for(let e=0;e<this._plugs.length;e++){const t=this._plugs[e];let n=t.attachedPlug;if(!n&&t.attachedPlugGUID&&(n=attachmentStore$1.getState().attachmentSystem.currentStructure.getPlugByGUID(t.attachedPlugGUID)),!t.isOpen&&n.isReceiverPlug)return t}}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=productDataStore$1.getState().productData[e]?.plugs;if(t)for(var n=0;n<t.length;n++){const s=new Plug(t[n],this);this._plugs.push(s)}}generatePlugsWithData(e,t){let n=productDataStore$1.getState().productData[e]?.plugs;if(n)for(var s=0;s<n.length;s++){const o=new Plug(n[s],this,t[n[s].name]);this._plugs.push(o)}}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():itemStore.getState().actions.addToRemoveItems(this._plugs[e].attachedPlug.node.guid))}};class Structure{#t=!1;constructor(e=null,t,n){if(this._nodes=[],this._rootNode=null,LOGGER.info({title:"preloadNodes",details:e}),e){LOGGER.info({title:"PRELOAD Length-----------------:"+e.length});for(var s=0;s<e.length;s++){LOGGER.info({title:"FOUND PRELOAD-----------------"});let o=e[s].skuID,v=new Node$1(o,e[s],t,n);o=="Root"&&(this._rootNode=v),this._nodes.push(v)}}else{const o=new Node$1("Root",null,t,n);this._rootNode=o,this._nodes.push(o)}itemStore.getState().actions.addItemWithTransform({position:new Vector3(0,0,0),rotation:new Quaternion().identity()},"Root",this._rootNode.guid,!1),this._boundingBoxLeeway=sceneStore.getState().sceneSettings.boundingBoxLeeway,this.setupCustomLogic()}async customLogic(){if(!["neighbor-bluff","neighbor-terra"].includes(CORE_API.projectId))return;const e={OM:{plugsToConsider:["OM_L_Plug"],geometryNodes:["OM_Legs_root"],rootPlug:"om_root"},ILTable:{plugsToConsider:["iltable_l_plug"],geometryNodes:["IL_Legs_root"],rootPlug:"il_root"}},t=Object.keys(e);for(const n of this._nodes){if(!t.includes(n.skuID))continue;let s=0;for(const o of n.plugs)if(o.name!==e[n.skuID].rootPlug&&(!e[n.skuID].plugsToConsider.includes(o.name)&&o.isOpen===!1&&s++,e[n.skuID].plugsToConsider.includes(o.name)&&o.isOpen===!1)){s=0;break}s>=1?n.hideNodes(e[n.skuID].geometryNodes)||CORE_API.coreWCRef.addEventListener(n.guid+":modelLoaded",()=>{n.hideNodes(e[n.skuID].geometryNodes)},{once:!0}):n.showNodes(e[n.skuID].geometryNodes)||CORE_API.coreWCRef.addEventListener(n.guid+":modelLoaded",()=>{n.showNodes(e[n.skuID].geometryNodes)},{once:!0})}}setupCustomLogic(){CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,()=>{this.customLogic()})}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,s={receiverPlug:e.plugs[t],incomingPlug:e.plugs[t].attachedPlug};if(s){const o=this.findItemTransform(s);o&&(n.ref.position.set(o.position.x,o.position.y,o.position.z),n.ref.setRotationFromQuaternion(o.rotation),n.transform={position:o.position,rotation:o.rotation})}this.recalculateStructureFromNode(n)}}rotateNode(e){const t=this.getNodeByGUID(e);let n=null,s=null;for(let A=0;A<t.plugs.length;A++)if(!s&&!t.plugs[A].isOpen&&t.plugs[A].attachedPlug.isReceiverPlug){const b=t.plugs[A].attachedPlug.acceptedPlugTypes;s=t.plugs[A].attachedPlug;let T=[];for(let ee=A+1;ee<t.plugs.length;ee++)T.push(t.plugs[ee]);for(let ee=0;ee<A;ee++)T.push(t.plugs[ee]);for(let ee=0;ee<T.length;ee++)for(let re=0;re<T[ee].connectsToPlugTypes.length;re++)b.includes(T[ee].connectsToPlugTypes[re])&&(n=T[ee])}if(!n)return;t.detachNodeFromReceiver();const{position:o,rotation:v}=this.findItemTransform({receiverPlug:s,incomingPlug:n});t.ref.position.set(o.x,o.y,o.z),t.ref.setRotationFromQuaternion(v),t.transform={position:t.ref.position,rotation:v},this.connectPlugs({receiverPlug:s,incomingPlug:n}),this.recalculateStructureFromNode(t)}async load(e){this.resolvePlugConnections(e),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=attachmentStore$1.getState().attachmentSystem,s=t.whichPlugAreWeAttachedTo(),o=t.whichPlugAreWeAttachedUsing(),A=new Node$1(e,null,n.globalVariants,n.globalGeometryVariants).getPlugByName(o.name);if(!A)return{transforms:null,connectablePlugs:null};const b={incomingPlug:A,receiverPlug:s};let T=[],ee=this.findItemTransform(b);if(!ee)return{transforms:T,connectablePlugs:b};let{position:re,rotation:ie}=ee;return re&&ie&&T.push({position:re,rotation:ie,incomingPlugName:b.incomingPlug.name,receiverPlugName:b.receiverPlug.name,incomingPlugGUID:b.incomingPlug.guid,receiverPlugGUID:b.receiverPlug.guid}),{transforms:T,connectablePlugs:b}}findGhostTransforms(e,t){const n=this.getOpenPlugs();if(n.length<=0)return{transforms:[]};const s=attachmentStore$1.getState().attachmentSystem,o=productDataStore$1.getState().productData,v=new Node$1(e,null,s.globalVariants,s.globalGeometryVariants),A=this.getConnectablePlugs(v,n);let b=[];if(A.length<=0)return{transforms:[]};let T=[];for(let re=0;re<A.length;re++){let ie=this.findItemTransform(A[re]);if(!ie)continue;let{position:se,rotation:le}=ie;if(se&&le){let pe=t;Array.isArray(t)===!0&&(pe=!1),o[e].hasOwnProperty("ignoreSpawningCollision")&&(pe=o[e].ignoreSpawningCollision),(pe?!1:this.isColliding(v.skuID,ie,A[re].receiverPlug,t))||(T.push({position:se,rotation:le,incomingPlugName:A[re].incomingPlug.name,receiverPlugName:A[re].receiverPlug.name,incomingPlugGUID:A[re].incomingPlug.guid,receiverPlugGUID:A[re].receiverPlug.guid}),b.push(A[re]))}}let ee=[];for(let re=0;re<T.length;re++)ee.push(v);return{transforms:T,newNodes:ee,connectablePlugs:b}}resolvePlugConnections(e){for(let t=0;t<e.length;t++)Object.keys(e[t].plugs).map(n=>{let s=e[t].plugs[n].guid,o=this.getPlugInNodesByGUID(s);if(!o||o.attachedPlug)return;let v=e[t].plugs[n].attachedPlugGUID,A=this.getPlugInNodesByGUID(v);A&&(A.attachedPlug||(o.attachPlug(A,e[t].plugs[n].isReceiverPlug),A.attachPlug(o,!e[t].plugs[n].isReceiverPlug)))});LOGGER.info({title:"RESOLVED PLUG CONNECTION: ",details:this})}async respawnItems(){let e=[this.rootNode];for(let t=0;t<e.length;t++){let s=e[t].whichPlugsAreAttachedToUs();for(let o=0;o<s.length;o++){let v=this.findItemTransformForPreload(s[o],s[o].receiverPlug.node.transform);v?await itemStore.getState().actions.addItemWithTransform(v,s[o].incomingPlug.node.skuID,s[o].incomingPlug.node.guid):LOGGER.warn({title:"Problem finding plug transform! "+s[o].name}),s[o].incomingPlug.node.transform=v,e.push(s[o].incomingPlug.node)}}CORE_API.fireEvent(CORE_API.EVENTS.SCENE.SavedConfiguration_Loaded),sceneStore.getState().actions.triggerAutoFocus(),hotspotStore$1.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.#t=!0,CORE_API.coreWCRef.addEventListener(CORE_API.EVENTS.SCENE.Scene_Cleared,s=>e(s.data),{once:!0}),n?CORE_API.removeItemByGUID(n.guid,!0):(await wait(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:s}=e,o=n,v=s;if(o.node.skuID=="Root")return this.findItemTransformRoot(e);let A=null,b=null,T=new Object3D,ee=assetStore.getState().assets.items[o.node.skuID].proxy.data.scene.clone();T.add(ee);let{position:re,rotation:ie}=t;if(ee.position.set(re.x,re.y,re.z),ee.setRotationFromQuaternion(ie),b=ee,!b||(A=b.getObjectByName(o.name),!A))return;let se=new Vector3(0,0,0);A.getWorldPosition(se);let le=new Quaternion().identity();A.getWorldQuaternion(le);let pe=new Object3D;A.add(pe);let de=assetStore.getState().assets.items[v.node.skuID].proxy.data.scene.clone();de.position.set(se.x,se.y,se.z),de.applyQuaternion(le);let fe=new Vector3;fe.copy(ee.up).applyQuaternion(b.quaternion);let _e=new Vector3;_e.copy(de.up).applyQuaternion(le),_e.negate();let ve=new Quaternion().setFromUnitVectors(fe,_e);fe.round(),_e.round();let xe=fe.dot(_e);xe!==1&&xe!==-1&&de.applyQuaternion(ve);let De=de.getObjectByName(v.name),Le=new Quaternion().identity();De.getWorldQuaternion(Le);let Ue=new Vector3(0,1,0);Ue.applyQuaternion(Le);let Ge=new Vector3(0,1,0);Ge.applyQuaternion(le),Ge.negate();let Fe=new Quaternion().setFromUnitVectors(Ue,Ge);if(Ue.round(),Ge.round(),Ue.dot(Ge)!==-1)de.applyQuaternion(Fe);else{let Ur=new Vector3(0,1,0),lr=Ge.dot(Ur);if(lr!==1&&lr!==-1)de.rotateOnAxis(Ur,Math.PI);else{let hr=new Vector3(0,0,1),zn=Ge.dot(hr);if(zn!==1&&zn!==-1)de.rotateOnAxis(hr,Math.PI);else{let ar=new Vector3(1,0,0),Dr=Ge.dot(ar);Dr!==1&&Dr!==-1&&de.rotateOnAxis(ar,Math.PI)}}}let rn=de.getObjectByName(v.name),yn=new Vector3(rn.position.x,rn.position.y,rn.position.z);de.translateX(-yn.x),de.translateY(-yn.y),de.translateZ(-yn.z);let bt=new Vector3(0,0,0);de.getWorldPosition(bt);let sn=new Quaternion().identity();return de.getWorldQuaternion(sn),de=null,{position:bt,rotation:sn}}findItemTransformRoot(e){let{receiverPlug:t,incomingPlug:n}=e,s=n;const o=new Object3D;let v=o,A=new Vector3(0,0,0);v.getWorldPosition(A);let b=new Quaternion().identity(),T=new Object3D;T.position.set(0,0,0),o.add(T);let ee=assetStore.getState().assets.items[s.node.skuID].proxy.data.scene.clone();T.attach(ee),ee.translateX(A.x),ee.translateY(A.y),ee.translateZ(A.z);let re=ee.getObjectByName(s.name),ie=new Quaternion().identity();re.getWorldQuaternion(ie);const se=new Vector3(0,1,0);se.applyQuaternion(ie);const le=new Vector3(0,1,0);le.applyQuaternion(b);const pe=le.angleTo(se),de=new Vector3(0,0,0);de.crossVectors(le,se),de.round(),de.length()!==0&&ee.rotateOnAxis(de,pe);var fe=new Matrix4().extractRotation(ee.matrixWorld);let _e=new Vector3(re.position.x,re.position.y,re.position.z);_e.applyMatrix4(fe),ee.translateX(-_e.x),ee.translateY(-_e.y),ee.translateZ(-_e.z);let ve=new Vector3(0,0,0);ee.getWorldPosition(ve);let xe=new Quaternion().identity();return ee.getWorldQuaternion(xe),T.remove(ee),T=null,ee=null,{position:ve,rotation:xe}}findItemTransform(e){let{receiverPlug:t,incomingPlug:n}=e,s=t,o=n;if(s.node.skuID=="Root")return this.findItemTransformRoot(e);const v=s.node.transform;if(!v)return;const A=assetStore.getState().assets.items[s.node.skuID].proxy.data.scene.clone(),b=new Object3D;b.position.set(v.position.x,v.position.y,v.position.z),b.setRotationFromQuaternion(v.rotation),b.add(A);let T=b.getObjectByName(""+s.name);if(!T){LOGGER.error({title:"Plug: "+s.name+" doesn't exist in "+s.node.skuID});return}let ee=new Vector3(0,1,0);T.getWorldPosition(ee);let re=new Quaternion().identity();T.getWorldQuaternion(re);let ie=assetStore.getState().assets.items[o.node.skuID].proxy.data.scene.clone();ie.position.set(ee.x,ee.y,ee.z),ie.applyQuaternion(re);let se=new Vector3;se.copy(A.up).applyQuaternion(b.quaternion);let le=new Vector3;le.copy(ie.up).applyQuaternion(re),le.negate();let pe=new Quaternion().setFromUnitVectors(se,le);se.round(),le.round();let de=se.dot(le);de!==1&&de!==-1&&ie.applyQuaternion(pe);let fe=ie.getObjectByName(o.name);if(!fe){LOGGER.error({title:"Plug: "+o.name+" doesn't exist in "+o.node.skuID});return}let _e=new Quaternion().identity();fe.getWorldQuaternion(_e);let ve=new Vector3(0,1,0);ve.applyQuaternion(_e);let xe=new Vector3(0,1,0);xe.applyQuaternion(re),xe.negate();let De=new Quaternion().setFromUnitVectors(ve,xe);if(ve.round(),xe.round(),ve.dot(xe)!==-1)ie.applyQuaternion(De);else{let rn=new Vector3(0,1,0),yn=xe.dot(rn);if(yn!==1&&yn!==-1)ie.rotateOnAxis(rn,Math.PI);else{let bt=new Vector3(0,0,1),sn=xe.dot(bt);if(sn!==1&&sn!==-1)ie.rotateOnAxis(bt,Math.PI);else{let Ur=new Vector3(1,0,0),lr=xe.dot(Ur);lr!==1&&lr!==-1&&ie.rotateOnAxis(Ur,Math.PI)}}}let Ue=ie.getObjectByName(o.name),Ge=new Vector3(Ue.position.x,Ue.position.y,Ue.position.z);ie.translateX(-Ge.x),ie.translateY(-Ge.y),ie.translateZ(-Ge.z);let Fe=new Vector3(0,0,0);ie.getWorldPosition(Fe);let Ye=new Quaternion().identity();return ie.getWorldQuaternion(Ye),b.remove(A),ie=null,{position:Fe,rotation:Ye}}getSpawningRequirementForSkuID(e){let t=[];const n=productDataStore$1.getState().productData,s=n[e];if(!s)return t;const o=[];return s.plugs.map(v=>{v.connectsToPlugTypes.map(A=>{o.push(A)})}),Object.keys(n).map(v=>{for(let A=0;A<n[v].plugs.length;A++){const b=n[v].plugs[A].acceptedPlugTypes;for(let T=0;T<b.length;T++)o.map(ee=>{ee==b[T]&&!t.includes(v)&&t.push(v)})}}),t}getConnectablePlugs(e,t){let n=[],s=e.getOpenPlugsWeCanAttachFrom();for(let o=0;o<s.length;o++)for(let v=0;v<t.length;v++){let A=!1;for(let T=0;T<n.length;T++)if(n[T].receiverPlug.guid==t[v].guid){A=!0;break}if(A)continue;s[o].canAttachToPlug(t[v])&&n.push({incomingPlug:s[o],receiverPlug:t[v]})}return n}getOpenPlugs(){let e=[];return this._nodes.map(t=>{let n=t.getOpenPlugsFromNode();e=e.concat(n)}),e}checkCollisionforGUID(e){if(sceneStore.getState().sceneSettings.disableCollider)return!1;const t=itemStore.getState().itemsSpawned,n=productDataStore$1.getState().productData;if(!t[e])return!1;const o=this.getNodeByGUID(e);if(!o||!o.ref||n[o.skuID].disableCollider)return!1;const v={position:o.ref.position,rotation:o.ref.rotation},A=o.whichPlugAreWeAttachedTo();return A==null?!1:this.isColliding(o.skuID,v,A,[])}isColliding(e,{position:t,rotation:n},s,o=[]){const v=assetStore.getState().assets.items[e].proxy.data.scene,A=productDataStore$1.getState().productData;if(!v)return!1;let b=v.clone();b.position.set(t.x,t.y,t.z),b.setRotationFromQuaternion(n);let T=new Box3().setFromObject(b);var ee=new Vector3;T.getCenter(ee);let re=new Object3D;re.position.set(ee.x,ee.y,ee.z),re.attach(b),re.scale.set(this._boundingBoxLeeway,this._boundingBoxLeeway,this._boundingBoxLeeway),T=new Box3().setFromObject(re);const ie=[];if(this._nodes.forEach(le=>{s.node.guid!=le.guid&&(Array.isArray(o)===!0&&o.includes(le.guid)||le.ref&&((A[le.skuID].hasOwnProperty("disableCollider")?A[le.skuID].disableCollider:sceneStore.getState().sceneSettings.disableCollider)||ie.push(le.ref)))}),ie.length<=0)return!1;let se=!1;return ie.forEach(le=>{if(se)return;let pe=new Box3().setFromObject(le);if(T.intersectsBox(pe)){se=!0;return}}),re.clear(),b=null,re=null,T=null,se}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 Vector3(0,0,0);e.getSize(n),n.x*n.y*n.z;let s=new Vector3(0,0,0);t.getSize(s),s.x*s.y*s.z}checkInsideOutCollision(e,t,n){let s=t.position.clone(),o=new Float32Array(n.attributes.position.array),v=o.length/3;for(let A=0;A<v;A++){let b=new Vector3(o[A*3],o[A*3+1],o[A*3+2]),T=b.add(t.position);T=b.applyQuaternion(t.quaternion);let ee=T.sub(t.position);const ie=new Raycaster(s,ee.clone().normalize()).intersectObjects(e),se=ie.length>0,le=ie[0].distance<ee.length();if(se&&le)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),attachmentStore$1.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.#t&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Scene_Cleared,!0),attachmentStore$1.getState().actions.updateFittingSkuIds(),attachmentStore$1.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}attachmentStore$1.getState().actions.toggleStructureUpdated()}}class AttachmentSystem{constructor(){this._globalVariants={},this._globalGeometryVariants={},productDataStore$1.getState().categoryData.geometryVariants.map(e=>{this._globalGeometryVariants[e.id]=e.defaultVariant}),productDataStore$1.getState().categoryData.color.map(e=>{this._globalVariants[e.id]=e.defaultLook}),this._currentStructure=new Structure(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=productDataStore$1.getState()?.productData[e]?.lookDetails[t],n?.clientProductId?n?.clientProductId:""}getCartItems(){let e=[];const t=inventoryStore.getState().inventoryData;this.currentStructure.nodes.map(o=>{if(o.skuID=="Root"||o.ignoreInCart===!0)return;let v=!1;if(e.map(T=>{const ee=t[T.skuID];if(T.skuID==o.skuID&&T.currentVariant==o.currentVariant){T.count++,T.countAvailable=ee[o.currentVariant].countAvailable,T.countUnavailable=ee[o.currentVariant].countUnavailable,T.price=o.price*T.count,v=!0;return}}),v===!0)return;let A={};A.skuID=o.skuID,A.currentVariant=o.currentVariant,A.clientProductId=this.getClientProductId(A.skuID,A.currentVariant),A.count=1;const b=t[A.skuID];A.price=o.price,A.countAvailable=b[o.currentVariant].countAvailable,A.countUnavailable=b[o.currentVariant].countUnavailable,e.push(A)});let n=0;for(const o of e)n=n+o.price;return{cartItems:e,details:{total:n.toFixed(2)}}}getFittingSKUIDs(){const e=productDataStore$1.getState().productData;if(!this.currentStructure)return;let t=this.currentStructure.nodes,n=[],s=[],o=[],v=[];if(t.map(b=>{v.push(b.skuID),b.plugs.map(T=>{if(!T.isOpen){T.attachedPlug.node.replace&&T.acceptedPlugTypes.map(ee=>{s.includes(ee)||s.push(ee)});return}T.acceptedPlugTypes.map(ee=>{n.includes(ee)||n.push(ee)})})}),n.length<=0&&s.length<=0)return[];Object.keys(e).map(b=>{!e[b].plugs||o.includes(b)||e[b].plugs.map(T=>{o.includes(b)||T.connectsToPlugTypes.map(ee=>{if(!o.includes(b)){if(s.includes(ee)){if(!v.includes(b)){let re=!1,ie=this.currentStructure.getFirstNodeByCategoryID(e[b].categoryID),se=!1;ie?.plugs.map(le=>{!le.isOpen&&le.isReceiverPlug&&(se=!0,e[b].plugs.map(pe=>{pe.name==le.name&&le.attachedPlug.connectsToPlugTypes.map(de=>{pe.acceptedPlugTypes.includes(de)&&(re=!0)})}))}),(re||!se)&&o.push(b)}}else if(n.includes(ee)){const re=this.currentStructure.getFirstNodeByCategoryID(e[b].categoryID);if(re&&re.replace)return;o.push(b)}}})})});let A=[];return o.map(b=>{if(A.includes(b))return;if(e[b].replace){A.push(b);return}const{transforms:T,newNodes:ee,connectablePlugs:re}=this.currentStructure.findGhostTransforms(b,sceneStore.getState().sceneSettings.ignoreSpawningCollision);T.length>0&&A.push(b)}),A.map(b=>{e[b].replace}),A}async removeAllVariantOverrides(){let e=this._currentStructure.nodes,t=productDataStore$1.getState().productData,n=itemStore.getState().itemsSpawned;await e.map(async s=>{if(!s.overrideVariant||(s.overrideVariant=null,!t[s.skuID].looks))return;let o=null;Object.keys(this._globalVariants).map(v=>{t[s.skuID].looks.includes(this._globalVariants[v])&&o==null&&(o=this._globalVariants[v])}),o&&await itemStore.getState().actions.switchToVariant(n[s.guid].itemData,o)}),CORE_API.alert({alertMsg:"Changes to individual items in the scene have been cleared",alertTime:6e3,alertType:"info",alertLabel:"Overrides Removed",alertId:"overridesRemoved"}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!1)}async switchGlobalGeometryVariant(e,t){const s=productDataStore$1.getState().categoryData.geometryVariants;let o=null;if(s.map(ie=>{ie.id==e&&(o=ie)}),!o)return;const v=o.productsInCategory,b=o.variants[t].productsToSwitch,T=itemStore.getState().itemsSpawned;let ee=productDataStore$1.getState().categoryData;b.map(ie=>{v.map(se=>{let le=!1;se.products.map(pe=>{ie==pe&&(le=!0)}),le&&ee.build.map(pe=>{se.products.map(de=>{pe.skus.map((fe,_e)=>{pe.skus[_e]==de&&(pe.skus[_e]=ie)})})})})}),this._currentStructure.nodes.map(ie=>{v.map(se=>{se.products.map(le=>{ie.skuID==le&&ie.ref!==null&&se.products.map(pe=>{b.map(de=>{if(de==pe){const fe=productDataStore$1.getState().actions.getProductDataById(de);ie.hideNodes(fe.geometriesToHide),ie.showNodes(fe.geometriesToShow),ie.skuID=de;const _e=T[ie.guid];_e&&_e.itemData&&Object.keys(fe).map(ve=>{_e.itemData[ve]=fe[ve]}),ie.resetInStock(),ie.updatePricing()}})})})})}),this._globalGeometryVariants[e]=t,hotspotStore$1.getState().actions.checkHotspotHealth(),inventoryStore.getState().actions.refreshInventory(T),productDataStore$1.setState({categoryData:ee}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CategoryData_Updated,ee),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.GlobalGeometryVariant_Updated,this._globalGeometryVariants);const re=this.getCartItems();re&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,re)}async switchGlobalVariant(e,t){this._globalVariants[e]=t;const n=itemStore.getState().actions;let s=itemStore.getState().itemsSpawned;for(let b=0;b<Object.keys(s).length;b++){let T=s[Object.keys(s)[b]];if(T.itemData.looks&&T.itemData.looks.includes(t)){let ee=this._currentStructure.getNodeByGUID(T.itemData.guid);ee&&!ee.overrideVariant&&await n.switchToVariant(T.itemData,t)}}const o=productDataStore$1.getState().lookData;lightStore.getState().actions.processLookEnvMapOverride(t);const v=e;Object.keys(s).length>0&&CORE_API.alert({alertMsg:v.charAt(0).toUpperCase()+v.slice(1)+" was successfully switched to "+o[t].label+".",alertTime:3e3,alertType:"success",alertLabel:`${v} Changed`,alertId:"materialVariantChanged"}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.GlobalVariant_Updated,this._globalVariants),itemStore.setState({variantChangeAlert:!itemStore.getState().variantChangeAlert});const A=this.getCartItems();A&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,A)}async#t(e){if(!e)return;LOGGER.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 Structure(t,this._globalVariants,this._globalGeometryVariants);for(const[n,s]of Object.entries(this._globalVariants))this.switchGlobalVariant(n,s);for(const[n,s]of Object.entries(this._globalGeometryVariants))this.switchGlobalGeometryVariant(n,s);LOGGER.info({title:"Structure Loading..."}),await this._currentStructure.load(t),LOGGER.info({title:"Structure Loaded."})}async loadStructure(e){e&&(CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),sceneStore.setState({configurationLoaded:!1}),await wait(500),await this._currentStructure.clear(),await this.#t(e),sceneStore.getState().preconfigurationLoaded?CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide):sceneStore.setState({preconfigurationLoaded:!0}),sceneStore.setState({configurationLoaded:!0}),attachmentStore$1.getState().actions.toggleStructureUpdated())}export(){return{structure:this._currentStructure.export(),globalVariants:this._globalVariants,globalGeometryVariants:this._globalGeometryVariants}}async clear(){CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),this._currentStructure.clear(),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide)}async restart(){LOGGER.warn({title:"Restarting the Scene!!"}),itemStore.getState().selectedItemData&&itemStore.getState().actions.deselectItem(),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Show),await wait(500),await this._currentStructure.clear();const e=attachmentStore$1.getState().defaultConfig;await this.#t(e),attachmentStore$1.getState().actions.toggleStructureUpdated(),sceneStore.setState({configurationLoaded:!0}),CORE_API.fireEvent(CORE_API.EVENTS.UI.PreloadScreen_Hide)}}const attachmentStore=create$3((a,e)=>({attachmentSystem:null,defaultConfig:null,structureUpdated:!1,colliderMeshRef:null,placeholderRef:null,draggingItem:null,snappingThreshold:.5,actions:{initializeAttachmentSystem:async()=>{const{actions:t,defaultConfig:n}=e(),s=await new AttachmentSystem;a({attachmentSystem:s}),t.updateFittingSkuIds(),t.toggleStructureUpdated()},loadSavedStructureFromConfigID:async t=>{const n=await getJSONFromEndpoint(FETCH_CONFIG_ENDPOINT+t);return n.success===!1?null:n.data},loadDefaultStructure:async()=>{const{actions:t,defaultConfig:n,attachmentSystem:s}=e();await t.loadStructure(n)},updateFittingSkuIds:()=>{const t=attachmentStore.getState().attachmentSystem.getFittingSKUIDs();t&&(itemStore.setState({fittingSkuIds:[...t]}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.FittingSkuIds_Updated,{skuids:t}))},toggleStructureUpdated:()=>{const{attachmentSystem:t}=e();a(s=>({structureUpdated:!s.structureUpdated})),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,t.currentStructure.getCurrentItemsInReplaceableCategory());const n=t.getCartItems();n&&CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,n)},loadStructure:async t=>{const{attachmentSystem:n}=e();n&&sceneStore.getState().configurationLoaded!==!1&&await n.loadStructure(t)},export:()=>{const{attachmentSystem:t}=e();if(t)return t.export()}}})),attachmentStore$1=attachmentStore,productDataStore=create$3((a,e)=>({productData:{},categoryData:{},lookData:{},hotspotsData:{},endpoints:{},assetsData:void 0,actions:{getCurrentPricingInfo:()=>{const{productData:t}=e();let n={};return Object.keys(t).map(s=>{if(s.toLowerCase()==="root")return;let o=t[s].lookDetails,v={};Object.keys(o).map(A=>{A!="default"&&(v[A]=o[A].price)}),n[s]=v}),n},updatePricingForAllProducts:t=>{const{actions:n}=e();Object.keys(t).map(s=>{let o=t[s];Object.keys(o).map(v=>{n.updatePricingForProduct(s,v,o[v])})})},updatePricingForProduct:(t,n,s)=>{const{productData:o}=e();let v=o[t];if(!v||!v.lookDetails)return;let A=v.lookDetails[n];if(!A)return;A.price=s,attachmentStore$1.getState().attachmentSystem.currentStructure.getNodesBySKUID(t).map(ee=>ee.updatePricing())},setProductData:t=>{let n={};t&&Object.keys(t).map(s=>{const o=t[s];if(o.skuID=s,o.skuID.toLowerCase()==="root"){o.lookDetails={default:{title:"",description:"",productPageUrl:"",thumbnails:{high:"",low:""},price:0}},o.defaultVariant="default";return}if(o?.lookDetails){const v=o.lookDetails;let A=Object.keys(o.lookDetails);if(A.includes("default")){const T=A.indexOf("default");A.splice(T,1)}o.looks=A,Object.keys(o.lookDetails).map(T=>{let ee=o.lookDetails[T];ee.inventory===void 0&&(ee.inventory=DEFAULT_INVENTORY),ee.price===void 0&&(ee.price=DEFAULT_PRODUCT_PRICE),n[s]={...n[s],[T]:{inventory:DEFAULT_INVENTORY,inScene:[]}}});let b=o?.defaultVariant;b||(LOGGER.warn({title:`No defaultVariant set for ${o.skuID}. Attempting to auto resolve but the colour variants behaviour might be unexpected!`}),b=Object.keys(o.lookDetails).sort()[0],LOGGER.warn({title:"Auto resolved default look ID: "+b})),A.includes(b)?(o.lookDetails.default=v[b],o.lookDetails.default.id=b):(LOGGER.error({title:`Default look [ ${b} ] doesn't exist for: ${s}. Please make sure to select a default variant in Input Data for this project`}),o.lookDetails.default=null)}}),LOGGER.info("PRODUCT DATA: ",t),inventoryStore.setState({inventoryData:n}),a({productData:t})},setCategoryData:t=>{const{productData:n}=e();t.geometryVariants!==void 0&&t.geometryVariants.map(s=>{s.defaultVariant===void 0&&Object.keys(s.variants).length>0&&(s.defaultVariant=Object.keys(s.variants)[0])}),t.color!==void 0&&t.color.map(s=>{(s.defaultLook===void 0&&s.looks.length>0||!s.looks.includes(s.defaultLook))&&(s.defaultLook=s.looks[0])}),a({categoryData:t}),t.build!==void 0&&t.build.map(s=>{s.skus.map(o=>{n[o].categoryID=s.categoryID,n[o].categoryLabel=s.label,n[o].swappable=s.swappable?s.swappable:!1,n[o].replace=s.replace})})},getProductDataById:t=>{const{productData:n}=e();let s=null;return n[t]&&(s=n[t]),s},setLookData:t=>a({lookData:t}),setHotspotsData:t=>{const{categoryData:n,productData:s}=e();n.geometryVariants&&Object.keys(t).map(o=>{t[o].map(v=>{v.geometryVariantID&&n.geometryVariants.map(A=>{Object.keys(A.variants).map(b=>{v.geometryVariantID==b&&A.productsInCategory.map(T=>{let ee=null;T.products.map(re=>{t.hasOwnProperty(re)&&(ee=t[re])}),T.products.map(re=>{t.hasOwnProperty(re)||(t[re]=ee)})})})})})}),a({hotspotsData:t})},setEndpoints:t=>{a({endpoints:t}),setGlobalEndpoints(t)},setAssetsData:t=>a({assetsData:t})}})),productDataStore$1=productDataStore,UtilityMenu=({handleShareButtonTrigger:a,handleSaveButtonTrigger:e,handleRestartButtonClick:t,handleShowHotspots:n,handleDimensionClick:s,handleInstructionButtonClick:o,utilityMenuVisible:v,hotspotsVisibility:A,viewInYourSpaceMenuBtnVisible:b,restartMenuBtnVisible:T,saveMenuBtnVisible:ee,hotspotsMenuBtnVisible:re,instructionsMenuBtnVisible:ie,dimensionsMenuBtnVisible:se,shareMenuBtnVisible:le,dimensionsVisible:pe,position:de,CORE_API:fe})=>{const[_e,ve]=reactExports.useState("bottom"),xe=productDataStore$1(Le=>Le.assetsData),De={ar:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/AR.svg",restart:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Restart.svg",save:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/save.svg",share:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Share.svg",dimensions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Ruler.svg",hotspots:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Eye.svg",instructions:"https://storage.googleapis.com/gsc-epigraph-design/product-assets/Icon/Info.svg"};return reactExports.useEffect(()=>{switch(de){case"top":ve("top");break;case"bottom":ve("bottom");break;case"left":ve("left");break;case"right":ve("right");break}return()=>{}},[de]),jsxDevRuntimeExports.jsxDEV("div",{className:"shellCanvasContainerParent",id:_e,children:jsxDevRuntimeExports.jsxDEV("div",{className:(v&&(le||b||T||se||re||ie))==!0?"shellCanvasContainer":"shellCanvasContainer shellCanvasContainerInactive",children:[b&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{fe.viewInYourSpace()},buttonLabel:"AR",hoverLabel:"View in Your Space",icon:xe?.icons?.utilityMenu?.viewInYourSpace?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.viewInYourSpace):De.ar},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:81,columnNumber:11},globalThis),T&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{t()},buttonLabel:"Restart",hoverLabel:"Restart",icon:xe?.icons?.utilityMenu?.restart?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.restart):De.restart},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:98,columnNumber:11},globalThis),ee&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{e()},buttonLabel:"Save",hoverLabel:"Save",icon:xe?.icons?.utilityMenu?.save?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.save):De.save},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:115,columnNumber:11},globalThis),le&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{a()},buttonLabel:"Share",hoverLabel:"Share",icon:xe?.icons?.utilityMenu?.share?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.share):De.share},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:132,columnNumber:11},globalThis),se&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{s()},buttonLabel:"Size",hoverLabel:"Size",icon:xe?.icons?.utilityMenu?.dimensions?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.dimensions):De.dimensions,activeCondition:pe},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:149,columnNumber:11},globalThis),re&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{n()},buttonLabel:"Hotspots",hoverLabel:"Hotspots",icon:xe?.icons?.utilityMenu?.hotspots?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.hotspots):De.hotspots,activeCondition:A},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:168,columnNumber:11},globalThis),ie&&jsxDevRuntimeExports.jsxDEV(UtilityMenuButton,{buttonAction:()=>{o()},buttonLabel:"Instructions",hoverLabel:"Instructions",icon:xe?.icons?.utilityMenu?.instructions?fe.getResolvedAssetUrl(xe?.icons?.utilityMenu?.instructions):De.instructions},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:187,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:67,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/ui/scripts/components/reactComponents/UtilityMenu.js",lineNumber:66,columnNumber:5},globalThis)};var propTypes$5={exports:{}},reactIs={exports:{}},reactIs_development={};/** @license React v16.13.1
8920
8920
  * react-is.development.js
8921
8921
  *
8922
8922
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -9146,7 +9146,7 @@ Check the render method of %s.`,yf(kN)||"Unknown"));var go=LL(Ui,Ba);go.payload=
9146
9146
  * Released under the MIT License.
9147
9147
  */const MOUSE_BUTTON={LEFT:1,RIGHT:2,MIDDLE:4},ACTION=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}),DOLLY_DIRECTION={NONE:0,IN:1,OUT:-1};function isPerspectiveCamera(a){return a.isPerspectiveCamera}function isOrthographicCamera(a){return a.isOrthographicCamera}const PI_2=Math.PI*2,PI_HALF=Math.PI/2,EPSILON=1e-5,DEG2RAD=Math.PI/180;function clamp(a,e,t){return Math.max(e,Math.min(t,a))}function approxZero(a,e=EPSILON){return Math.abs(a)<e}function approxEquals(a,e,t=EPSILON){return approxZero(a-e,t)}function roundToStep(a,e){return Math.round(a/e)*e}function infinityToMaxNumber(a){return isFinite(a)?a:a<0?-Number.MAX_VALUE:Number.MAX_VALUE}function maxNumberToInfinity(a){return Math.abs(a)<Number.MAX_VALUE?a:a*(1/0)}function smoothDamp(a,e,t,n,s=1/0,o){n=Math.max(1e-4,n);const v=2/n,A=v*o,b=1/(1+A+.48*A*A+.235*A*A*A);let T=a-e;const ee=e,re=s*n;T=clamp(T,-re,re),e=a-T;const ie=(t.value+v*T)*o;t.value=(t.value-v*ie)*b;let se=e+(T+ie)*b;return ee-a>0==se>ee&&(se=ee,t.value=(se-ee)/o),se}function smoothDampVec3(a,e,t,n,s=1/0,o,v){n=Math.max(1e-4,n);const A=2/n,b=A*o,T=1/(1+b+.48*b*b+.235*b*b*b);let ee=e.x,re=e.y,ie=e.z,se=a.x-ee,le=a.y-re,pe=a.z-ie;const de=ee,fe=re,_e=ie,ve=s*n,xe=ve*ve,De=se*se+le*le+pe*pe;if(De>xe){const Ur=Math.sqrt(De);se=se/Ur*ve,le=le/Ur*ve,pe=pe/Ur*ve}ee=a.x-se,re=a.y-le,ie=a.z-pe;const Le=(t.x+A*se)*o,Ue=(t.y+A*le)*o,Ge=(t.z+A*pe)*o;t.x=(t.x-A*Le)*T,t.y=(t.y-A*Ue)*T,t.z=(t.z-A*Ge)*T,v.x=ee+(se+Le)*T,v.y=re+(le+Ue)*T,v.z=ie+(pe+Ge)*T;const Fe=de-a.x,Ye=fe-a.y,rn=_e-a.z,yn=v.x-de,bt=v.y-fe,sn=v.z-_e;return Fe*yn+Ye*bt+rn*sn>0&&(v.x=de,v.y=fe,v.z=_e,t.x=(v.x-de)/o,t.y=(v.y-fe)/o,t.z=(v.z-_e)/o),v}function extractClientCoordFromEvent(a,e){e.set(0,0),a.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=a.length,e.y/=a.length}function notSupportedInOrthographicCamera(a,e){return isOrthographicCamera(a)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}let EventDispatcher$1=class{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 s=this._listeners[e];if(s!==void 0){const o=s.indexOf(t);o!==-1&&s.splice(o,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 s=n.slice(0);for(let o=0,v=s.length;o<v;o++)s[o].call(this,e)}}};const VERSION="2.7.3",TOUCH_DOLLY_FACTOR=1/8,isBrowser=typeof window<"u",isMac=isBrowser&&/Mac/.test(navigator.platform),isPointerEventsNotSupported=!(isBrowser&&"PointerEvent"in window);let THREE,_ORIGIN,_AXIS_Y,_AXIS_Z,_v2,_v3A,_v3B,_v3C,_cameraDirection,_xColumn,_yColumn,_zColumn,_deltaTarget,_deltaOffset,_sphericalA,_sphericalB,_box3A,_box3B,_sphere,_quaternionA,_quaternionB,_rotationMatrix,_raycaster,CameraControls$1=class eW extends EventDispatcher$1{static install(e){THREE=e.THREE,_ORIGIN=Object.freeze(new THREE.Vector3(0,0,0)),_AXIS_Y=Object.freeze(new THREE.Vector3(0,1,0)),_AXIS_Z=Object.freeze(new THREE.Vector3(0,0,1)),_v2=new THREE.Vector2,_v3A=new THREE.Vector3,_v3B=new THREE.Vector3,_v3C=new THREE.Vector3,_cameraDirection=new THREE.Vector3,_xColumn=new THREE.Vector3,_yColumn=new THREE.Vector3,_zColumn=new THREE.Vector3,_deltaTarget=new THREE.Vector3,_deltaOffset=new THREE.Vector3,_sphericalA=new THREE.Spherical,_sphericalB=new THREE.Spherical,_box3A=new THREE.Box3,_box3B=new THREE.Box3,_sphere=new THREE.Sphere,_quaternionA=new THREE.Quaternion,_quaternionB=new THREE.Quaternion,_rotationMatrix=new THREE.Matrix4,_raycaster=new THREE.Raycaster}static get ACTION(){return ACTION}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=ACTION.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=DOLLY_DIRECTION.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new THREE.Vector3,this._focalOffsetVelocity=new THREE.Vector3,this._zoomVelocity={value:0},this._truckInternal=(xe,De,Le)=>{let Ue,Ge;if(isPerspectiveCamera(this._camera)){const Fe=_v3A.copy(this._camera.position).sub(this._target),Ye=this._camera.getEffectiveFOV()*DEG2RAD,rn=Fe.length()*Math.tan(Ye*.5);Ue=this.truckSpeed*xe*rn/this._elementRect.height,Ge=this.truckSpeed*De*rn/this._elementRect.height}else if(isOrthographicCamera(this._camera)){const Fe=this._camera;Ue=xe*(Fe.right-Fe.left)/Fe.zoom/this._elementRect.width,Ge=De*(Fe.top-Fe.bottom)/Fe.zoom/this._elementRect.height}else return;this.verticalDragToForward?(Le?this.setFocalOffset(this._focalOffsetEnd.x+Ue,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(Ue,0,!0),this.forward(-Ge,!0)):Le?this.setFocalOffset(this._focalOffsetEnd.x+Ue,this._focalOffsetEnd.y+Ge,this._focalOffsetEnd.z,!0):this.truck(Ue,Ge,!0)},this._rotateInternal=(xe,De)=>{const Le=PI_2*this.azimuthRotateSpeed*xe/this._elementRect.height,Ue=PI_2*this.polarRotateSpeed*De/this._elementRect.height;this.rotate(Le,Ue,!0)},this._dollyInternal=(xe,De,Le)=>{const Ue=Math.pow(.95,-xe*this.dollySpeed),Ge=this._sphericalEnd.radius,Fe=this._sphericalEnd.radius*Ue,Ye=clamp(Fe,this.minDistance,this.maxDistance),rn=Ye-Fe;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(Fe,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(rn,!0),this._dollyToNoClamp(Ye,!0)):this._dollyToNoClamp(Ye,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?Fe:Ye)-Ge,this._dollyControlCoord.set(De,Le)),this._lastDollyDirection=Math.sign(-xe)},this._zoomInternal=(xe,De,Le)=>{const Ue=Math.pow(.95,xe*this.dollySpeed),Ge=this._zoom,Fe=this._zoom*Ue;this.zoomTo(Fe,!0),this.dollyToCursor&&(this._changedZoom+=Fe-Ge,this._dollyControlCoord.set(De,Le))},typeof THREE>"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 THREE.Quaternion().setFromUnitVectors(this._camera.up,_AXIS_Y),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=ACTION.NONE,this._target=new THREE.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new THREE.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new THREE.Spherical().setFromVector3(_v3A.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 THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3],this._updateNearPlaneCorners(),this._boundary=new THREE.Box3(new THREE.Vector3(-1/0,-1/0,-1/0),new THREE.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 THREE.Vector2,this.mouseButtons={left:ACTION.ROTATE,middle:ACTION.DOLLY,right:ACTION.TRUCK,wheel:isPerspectiveCamera(this._camera)?ACTION.DOLLY:isOrthographicCamera(this._camera)?ACTION.ZOOM:ACTION.NONE},this.touches={one:ACTION.TOUCH_ROTATE,two:isPerspectiveCamera(this._camera)?ACTION.TOUCH_DOLLY_TRUCK:isOrthographicCamera(this._camera)?ACTION.TOUCH_ZOOM_TRUCK:ACTION.NONE,three:ACTION.TOUCH_TRUCK};const n=new THREE.Vector2,s=new THREE.Vector2,o=new THREE.Vector2,v=xe=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const Ue=this._domElement.getBoundingClientRect(),Ge=xe.clientX/Ue.width,Fe=xe.clientY/Ue.height;if(Ge<this._interactiveArea.left||Ge>this._interactiveArea.right||Fe<this._interactiveArea.top||Fe>this._interactiveArea.bottom)return}const De=xe.pointerType!=="mouse"?null:(xe.buttons&MOUSE_BUTTON.LEFT)===MOUSE_BUTTON.LEFT?MOUSE_BUTTON.LEFT:(xe.buttons&MOUSE_BUTTON.MIDDLE)===MOUSE_BUTTON.MIDDLE?MOUSE_BUTTON.MIDDLE:(xe.buttons&MOUSE_BUTTON.RIGHT)===MOUSE_BUTTON.RIGHT?MOUSE_BUTTON.RIGHT:null;if(De!==null){const Ue=this._findPointerByMouseButton(De);Ue&&this._disposePointer(Ue)}if((xe.buttons&MOUSE_BUTTON.LEFT)===MOUSE_BUTTON.LEFT&&this._lockedPointer)return;const Le={pointerId:xe.pointerId,clientX:xe.clientX,clientY:xe.clientY,deltaX:0,deltaY:0,mouseButton:De};this._activePointers.push(Le),this._domElement.ownerDocument.removeEventListener("pointermove",b,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",ee),this._domElement.ownerDocument.addEventListener("pointermove",b,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",ee),this._isDragging=!0,pe(xe)},A=xe=>{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 Ue=this._domElement.getBoundingClientRect(),Ge=xe.clientX/Ue.width,Fe=xe.clientY/Ue.height;if(Ge<this._interactiveArea.left||Ge>this._interactiveArea.right||Fe<this._interactiveArea.top||Fe>this._interactiveArea.bottom)return}const De=(xe.buttons&MOUSE_BUTTON.LEFT)===MOUSE_BUTTON.LEFT?MOUSE_BUTTON.LEFT:(xe.buttons&MOUSE_BUTTON.MIDDLE)===MOUSE_BUTTON.MIDDLE?MOUSE_BUTTON.MIDDLE:(xe.buttons&MOUSE_BUTTON.RIGHT)===MOUSE_BUTTON.RIGHT?MOUSE_BUTTON.RIGHT:null;if(De!==null){const Ue=this._findPointerByMouseButton(De);Ue&&this._disposePointer(Ue)}const Le={pointerId:1,clientX:xe.clientX,clientY:xe.clientY,deltaX:0,deltaY:0,mouseButton:(xe.buttons&MOUSE_BUTTON.LEFT)===MOUSE_BUTTON.LEFT?MOUSE_BUTTON.LEFT:(xe.buttons&MOUSE_BUTTON.MIDDLE)===MOUSE_BUTTON.LEFT?MOUSE_BUTTON.MIDDLE:(xe.buttons&MOUSE_BUTTON.RIGHT)===MOUSE_BUTTON.LEFT?MOUSE_BUTTON.RIGHT:null};this._activePointers.push(Le),this._domElement.ownerDocument.removeEventListener("mousemove",T),this._domElement.ownerDocument.removeEventListener("mouseup",re),this._domElement.ownerDocument.addEventListener("mousemove",T),this._domElement.ownerDocument.addEventListener("mouseup",re),this._isDragging=!0,pe(xe)},b=xe=>{xe.cancelable&&xe.preventDefault();const De=xe.pointerId,Le=this._lockedPointer||this._findPointerById(De);if(Le){if(Le.clientX=xe.clientX,Le.clientY=xe.clientY,Le.deltaX=xe.movementX,Le.deltaY=xe.movementY,this._state=0,xe.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&&(xe.buttons&MOUSE_BUTTON.LEFT)===MOUSE_BUTTON.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(xe.buttons&MOUSE_BUTTON.MIDDLE)===MOUSE_BUTTON.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(xe.buttons&MOUSE_BUTTON.RIGHT)===MOUSE_BUTTON.RIGHT&&(this._state=this._state|this.mouseButtons.right);de()}},T=xe=>{const De=this._lockedPointer||this._findPointerById(1);De&&(De.clientX=xe.clientX,De.clientY=xe.clientY,De.deltaX=xe.movementX,De.deltaY=xe.movementY,this._state=0,(this._lockedPointer||(xe.buttons&MOUSE_BUTTON.LEFT)===MOUSE_BUTTON.LEFT)&&(this._state=this._state|this.mouseButtons.left),(xe.buttons&MOUSE_BUTTON.MIDDLE)===MOUSE_BUTTON.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(xe.buttons&MOUSE_BUTTON.RIGHT)===MOUSE_BUTTON.RIGHT&&(this._state=this._state|this.mouseButtons.right),de())},ee=xe=>{const De=this._findPointerById(xe.pointerId);if(!(De&&De===this._lockedPointer)){if(De&&this._disposePointer(De),xe.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=ACTION.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=ACTION.NONE;fe()}},re=()=>{const xe=this._findPointerById(1);xe&&xe===this._lockedPointer||(xe&&this._disposePointer(xe),this._state=ACTION.NONE,fe())};let ie=-1;const se=xe=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===ACTION.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const Fe=this._domElement.getBoundingClientRect(),Ye=xe.clientX/Fe.width,rn=xe.clientY/Fe.height;if(Ye<this._interactiveArea.left||Ye>this._interactiveArea.right||rn<this._interactiveArea.top||rn>this._interactiveArea.bottom)return}if(xe.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===ACTION.ROTATE||this.mouseButtons.wheel===ACTION.TRUCK){const Fe=performance.now();ie-Fe<1e3&&this._getClientRect(this._elementRect),ie=Fe}const De=isMac?-1:-3,Le=xe.deltaMode===1?xe.deltaY/De:xe.deltaY/(De*10),Ue=this.dollyToCursor?(xe.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,Ge=this.dollyToCursor?(xe.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case ACTION.ROTATE:{this._rotateInternal(xe.deltaX,xe.deltaY),this._isUserControllingRotate=!0;break}case ACTION.TRUCK:{this._truckInternal(xe.deltaX,xe.deltaY,!1),this._isUserControllingTruck=!0;break}case ACTION.OFFSET:{this._truckInternal(xe.deltaX,xe.deltaY,!0),this._isUserControllingOffset=!0;break}case ACTION.DOLLY:{this._dollyInternal(-Le,Ue,Ge),this._isUserControllingDolly=!0;break}case ACTION.ZOOM:{this._zoomInternal(-Le,Ue,Ge),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},le=xe=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===eW.ACTION.NONE){const De=xe instanceof PointerEvent?xe.pointerId:(xe instanceof MouseEvent,0),Le=this._findPointerById(De);Le&&this._disposePointer(Le),this._domElement.ownerDocument.removeEventListener("pointermove",b,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",ee),this._domElement.ownerDocument.removeEventListener("mousemove",T),this._domElement.ownerDocument.removeEventListener("mouseup",re);return}xe.preventDefault()}},pe=xe=>{if(!this._enabled)return;if(extractClientCoordFromEvent(this._activePointers,_v2),this._getClientRect(this._elementRect),n.copy(_v2),s.copy(_v2),this._activePointers.length>=2){const Le=_v2.x-this._activePointers[1].clientX,Ue=_v2.y-this._activePointers[1].clientY,Ge=Math.sqrt(Le*Le+Ue*Ue);o.set(0,Ge);const Fe=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,Ye=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(Fe,Ye)}if(this._state=0,!xe)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in xe&&xe.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&&(xe.buttons&MOUSE_BUTTON.LEFT)===MOUSE_BUTTON.LEFT&&(this._state=this._state|this.mouseButtons.left),(xe.buttons&MOUSE_BUTTON.MIDDLE)===MOUSE_BUTTON.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(xe.buttons&MOUSE_BUTTON.RIGHT)===MOUSE_BUTTON.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&ACTION.ROTATE)===ACTION.ROTATE||(this._state&ACTION.TOUCH_ROTATE)===ACTION.TOUCH_ROTATE||(this._state&ACTION.TOUCH_DOLLY_ROTATE)===ACTION.TOUCH_DOLLY_ROTATE||(this._state&ACTION.TOUCH_ZOOM_ROTATE)===ACTION.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&ACTION.TRUCK)===ACTION.TRUCK||(this._state&ACTION.TOUCH_TRUCK)===ACTION.TOUCH_TRUCK||(this._state&ACTION.TOUCH_DOLLY_TRUCK)===ACTION.TOUCH_DOLLY_TRUCK||(this._state&ACTION.TOUCH_ZOOM_TRUCK)===ACTION.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&ACTION.DOLLY)===ACTION.DOLLY||(this._state&ACTION.TOUCH_DOLLY)===ACTION.TOUCH_DOLLY||(this._state&ACTION.TOUCH_DOLLY_TRUCK)===ACTION.TOUCH_DOLLY_TRUCK||(this._state&ACTION.TOUCH_DOLLY_OFFSET)===ACTION.TOUCH_DOLLY_OFFSET||(this._state&ACTION.TOUCH_DOLLY_ROTATE)===ACTION.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&ACTION.ZOOM)===ACTION.ZOOM||(this._state&ACTION.TOUCH_ZOOM)===ACTION.TOUCH_ZOOM||(this._state&ACTION.TOUCH_ZOOM_TRUCK)===ACTION.TOUCH_ZOOM_TRUCK||(this._state&ACTION.TOUCH_ZOOM_OFFSET)===ACTION.TOUCH_ZOOM_OFFSET||(this._state&ACTION.TOUCH_ZOOM_ROTATE)===ACTION.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&ACTION.OFFSET)===ACTION.OFFSET||(this._state&ACTION.TOUCH_OFFSET)===ACTION.TOUCH_OFFSET||(this._state&ACTION.TOUCH_DOLLY_OFFSET)===ACTION.TOUCH_DOLLY_OFFSET||(this._state&ACTION.TOUCH_ZOOM_OFFSET)===ACTION.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},de=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,extractClientCoordFromEvent(this._activePointers,_v2);const De=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,Le=De?-De.deltaX:s.x-_v2.x,Ue=De?-De.deltaY:s.y-_v2.y;if(s.copy(_v2),((this._state&ACTION.ROTATE)===ACTION.ROTATE||(this._state&ACTION.TOUCH_ROTATE)===ACTION.TOUCH_ROTATE||(this._state&ACTION.TOUCH_DOLLY_ROTATE)===ACTION.TOUCH_DOLLY_ROTATE||(this._state&ACTION.TOUCH_ZOOM_ROTATE)===ACTION.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(Le,Ue),this._isUserControllingRotate=!0),(this._state&ACTION.DOLLY)===ACTION.DOLLY||(this._state&ACTION.ZOOM)===ACTION.ZOOM){const Ge=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,Fe=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,Ye=this.dollyDragInverted?-1:1;(this._state&ACTION.DOLLY)===ACTION.DOLLY?(this._dollyInternal(Ye*Ue*TOUCH_DOLLY_FACTOR,Ge,Fe),this._isUserControllingDolly=!0):(this._zoomInternal(Ye*Ue*TOUCH_DOLLY_FACTOR,Ge,Fe),this._isUserControllingZoom=!0)}if((this._state&ACTION.TOUCH_DOLLY)===ACTION.TOUCH_DOLLY||(this._state&ACTION.TOUCH_ZOOM)===ACTION.TOUCH_ZOOM||(this._state&ACTION.TOUCH_DOLLY_TRUCK)===ACTION.TOUCH_DOLLY_TRUCK||(this._state&ACTION.TOUCH_ZOOM_TRUCK)===ACTION.TOUCH_ZOOM_TRUCK||(this._state&ACTION.TOUCH_DOLLY_OFFSET)===ACTION.TOUCH_DOLLY_OFFSET||(this._state&ACTION.TOUCH_ZOOM_OFFSET)===ACTION.TOUCH_ZOOM_OFFSET||(this._state&ACTION.TOUCH_DOLLY_ROTATE)===ACTION.TOUCH_DOLLY_ROTATE||(this._state&ACTION.TOUCH_ZOOM_ROTATE)===ACTION.TOUCH_ZOOM_ROTATE){const Ge=_v2.x-this._activePointers[1].clientX,Fe=_v2.y-this._activePointers[1].clientY,Ye=Math.sqrt(Ge*Ge+Fe*Fe),rn=o.y-Ye;o.set(0,Ye);const yn=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,bt=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&ACTION.TOUCH_DOLLY)===ACTION.TOUCH_DOLLY||(this._state&ACTION.TOUCH_DOLLY_ROTATE)===ACTION.TOUCH_DOLLY_ROTATE||(this._state&ACTION.TOUCH_DOLLY_TRUCK)===ACTION.TOUCH_DOLLY_TRUCK||(this._state&ACTION.TOUCH_DOLLY_OFFSET)===ACTION.TOUCH_DOLLY_OFFSET?(this._dollyInternal(rn*TOUCH_DOLLY_FACTOR,yn,bt),this._isUserControllingDolly=!0):(this._zoomInternal(rn*TOUCH_DOLLY_FACTOR,yn,bt),this._isUserControllingZoom=!0)}((this._state&ACTION.TRUCK)===ACTION.TRUCK||(this._state&ACTION.TOUCH_TRUCK)===ACTION.TOUCH_TRUCK||(this._state&ACTION.TOUCH_DOLLY_TRUCK)===ACTION.TOUCH_DOLLY_TRUCK||(this._state&ACTION.TOUCH_ZOOM_TRUCK)===ACTION.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(Le,Ue,!1),this._isUserControllingTruck=!0),((this._state&ACTION.OFFSET)===ACTION.OFFSET||(this._state&ACTION.TOUCH_OFFSET)===ACTION.TOUCH_OFFSET||(this._state&ACTION.TOUCH_DOLLY_OFFSET)===ACTION.TOUCH_DOLLY_OFFSET||(this._state&ACTION.TOUCH_ZOOM_OFFSET)===ACTION.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(Le,Ue,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},fe=()=>{extractClientCoordFromEvent(this._activePointers,_v2),s.copy(_v2),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",b,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",T),this._domElement.ownerDocument.removeEventListener("pointerup",ee),this._domElement.ownerDocument.removeEventListener("mouseup",re),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",b,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",ee),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",_e),this._domElement.ownerDocument.addEventListener("pointerlockerror",ve),this._domElement.ownerDocument.addEventListener("pointermove",b,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",ee),pe())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",_e),this._domElement.ownerDocument.removeEventListener("pointerlockerror",ve))};const _e=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},ve=()=>{this.unlockPointer()};this._addAllEventListeners=xe=>{this._domElement=xe,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",v),isPointerEventsNotSupported&&this._domElement.addEventListener("mousedown",A),this._domElement.addEventListener("pointercancel",ee),this._domElement.addEventListener("wheel",se,{passive:!1}),this._domElement.addEventListener("contextmenu",le)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",v),this._domElement.removeEventListener("mousedown",A),this._domElement.removeEventListener("pointercancel",ee),this._domElement.removeEventListener("wheel",se,{passive:!1}),this._domElement.removeEventListener("contextmenu",le),this._domElement.ownerDocument.removeEventListener("pointermove",b,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",T),this._domElement.ownerDocument.removeEventListener("pointerup",ee),this._domElement.ownerDocument.removeEventListener("mouseup",re),this._domElement.ownerDocument.removeEventListener("pointerlockchange",_e),this._domElement.ownerDocument.removeEventListener("pointerlockerror",ve))},this.cancel=()=>{this._state!==ACTION.NONE&&(this._state=ACTION.NONE,this._activePointers.length=0,fe())},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=clamp(e.width,0,1),this._interactiveArea.height=clamp(e.height,0,1),this._interactiveArea.x=clamp(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=clamp(e.y,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 s=clamp(e,this.minAzimuthAngle,this.maxAzimuthAngle),o=clamp(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=o,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const v=!n||approxEquals(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&approxEquals(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(v)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=DOLLY_DIRECTION.NONE,this._changedDolly=0,this._dollyToNoClamp(clamp(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const v=this._collisionTest(),A=approxEquals(v,this._spherical.radius);if(!(n>e)&&A)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,v)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const o=!t||approxEquals(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(o)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(_cameraDirection).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||approxEquals(this._target.x,this._targetEnd.x,this.restThreshold)&&approxEquals(this._target.y,this._targetEnd.y,this.restThreshold)&&approxEquals(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=clamp(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||approxEquals(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(),_xColumn.setFromMatrixColumn(this._camera.matrix,0),_yColumn.setFromMatrixColumn(this._camera.matrix,1),_xColumn.multiplyScalar(e),_yColumn.multiplyScalar(-t);const s=_v3A.copy(_xColumn).add(_yColumn),o=_v3B.copy(this._targetEnd).add(s);return this.moveTo(o.x,o.y,o.z,n)}forward(e,t=!1){_v3A.setFromMatrixColumn(this._camera.matrix,0),_v3A.crossVectors(this._camera.up,_v3A),_v3A.multiplyScalar(e);const n=_v3B.copy(this._targetEnd).add(_v3A);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return _v3A.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+_v3A.x,this._targetEnd.y+_v3A.y,this._targetEnd.z+_v3A.z,t)}moveTo(e,t,n,s=!1){this._isUserControllingTruck=!1;const o=_v3A.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,o,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const v=!s||approxEquals(this._target.x,this._targetEnd.x,this.restThreshold)&&approxEquals(this._target.y,this._targetEnd.y,this.restThreshold)&&approxEquals(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(v)}lookInDirectionOf(e,t,n,s=!1){const A=_v3A.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(A.x,A.y,A.z,s)}fitToBox(e,t,{cover:n=!1,paddingLeft:s=0,paddingRight:o=0,paddingBottom:v=0,paddingTop:A=0}={}){const b=[],T=e.isBox3?_box3A.copy(e):_box3A.setFromObject(e);T.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const ee=roundToStep(this._sphericalEnd.theta,PI_HALF),re=roundToStep(this._sphericalEnd.phi,PI_HALF);b.push(this.rotateTo(ee,re,t));const ie=_v3A.setFromSpherical(this._sphericalEnd).normalize(),se=_quaternionA.setFromUnitVectors(ie,_AXIS_Z),le=approxEquals(Math.abs(ie.y),1);le&&se.multiply(_quaternionB.setFromAxisAngle(_AXIS_Y,ee)),se.multiply(this._yAxisUpSpaceInverse);const pe=_box3B.makeEmpty();_v3B.copy(T.min).applyQuaternion(se),pe.expandByPoint(_v3B),_v3B.copy(T.min).setX(T.max.x).applyQuaternion(se),pe.expandByPoint(_v3B),_v3B.copy(T.min).setY(T.max.y).applyQuaternion(se),pe.expandByPoint(_v3B),_v3B.copy(T.max).setZ(T.min.z).applyQuaternion(se),pe.expandByPoint(_v3B),_v3B.copy(T.min).setZ(T.max.z).applyQuaternion(se),pe.expandByPoint(_v3B),_v3B.copy(T.max).setY(T.min.y).applyQuaternion(se),pe.expandByPoint(_v3B),_v3B.copy(T.max).setX(T.min.x).applyQuaternion(se),pe.expandByPoint(_v3B),_v3B.copy(T.max).applyQuaternion(se),pe.expandByPoint(_v3B),pe.min.x-=s,pe.min.y-=v,pe.max.x+=o,pe.max.y+=A,se.setFromUnitVectors(_AXIS_Z,ie),le&&se.premultiply(_quaternionB.invert()),se.premultiply(this._yAxisUpSpace);const de=pe.getSize(_v3A),fe=pe.getCenter(_v3B).applyQuaternion(se);if(isPerspectiveCamera(this._camera)){const _e=this.getDistanceToFitBox(de.x,de.y,de.z,n);b.push(this.moveTo(fe.x,fe.y,fe.z,t)),b.push(this.dollyTo(_e,t)),b.push(this.setFocalOffset(0,0,0,t))}else if(isOrthographicCamera(this._camera)){const _e=this._camera,ve=_e.right-_e.left,xe=_e.top-_e.bottom,De=n?Math.max(ve/de.x,xe/de.y):Math.min(ve/de.x,xe/de.y);b.push(this.moveTo(fe.x,fe.y,fe.z,t)),b.push(this.zoomTo(De,t)),b.push(this.setFocalOffset(0,0,0,t))}return Promise.all(b)}fitToSphere(e,t){const n=[],o=e instanceof THREE.Sphere?_sphere.copy(e):eW.createBoundingSphere(e,_sphere);if(n.push(this.moveTo(o.center.x,o.center.y,o.center.z,t)),isPerspectiveCamera(this._camera)){const v=this.getDistanceToFitSphere(o.radius);n.push(this.dollyTo(v,t))}else if(isOrthographicCamera(this._camera)){const v=this._camera.right-this._camera.left,A=this._camera.top-this._camera.bottom,b=2*o.radius,T=Math.min(v/b,A/b);n.push(this.zoomTo(T,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,s,o,v,A=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=DOLLY_DIRECTION.NONE,this._changedDolly=0;const b=_v3B.set(s,o,v),T=_v3A.set(e,t,n);this._targetEnd.copy(b),this._sphericalEnd.setFromVector3(T.sub(b).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,A||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const ee=!A||approxEquals(this._target.x,this._targetEnd.x,this.restThreshold)&&approxEquals(this._target.y,this._targetEnd.y,this.restThreshold)&&approxEquals(this._target.z,this._targetEnd.z,this.restThreshold)&&approxEquals(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&approxEquals(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&approxEquals(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(ee)}lerpLookAt(e,t,n,s,o,v,A,b,T,ee,re,ie,se,le=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=DOLLY_DIRECTION.NONE,this._changedDolly=0;const pe=_v3A.set(s,o,v),de=_v3B.set(e,t,n);_sphericalA.setFromVector3(de.sub(pe).applyQuaternion(this._yAxisUpSpace));const fe=_v3C.set(ee,re,ie),_e=_v3B.set(A,b,T);_sphericalB.setFromVector3(_e.sub(fe).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(pe.lerp(fe,se));const ve=_sphericalB.theta-_sphericalA.theta,xe=_sphericalB.phi-_sphericalA.phi,De=_sphericalB.radius-_sphericalA.radius;this._sphericalEnd.set(_sphericalA.radius+De*se,_sphericalA.phi+xe*se,_sphericalA.theta+ve*se),this.normalizeRotations(),this._needsUpdate=!0,le||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const Le=!le||approxEquals(this._target.x,this._targetEnd.x,this.restThreshold)&&approxEquals(this._target.y,this._targetEnd.y,this.restThreshold)&&approxEquals(this._target.z,this._targetEnd.z,this.restThreshold)&&approxEquals(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&approxEquals(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&approxEquals(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(Le)}setPosition(e,t,n,s=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,s)}setTarget(e,t,n,s=!1){const o=this.getPosition(_v3A),v=this.setLookAt(o.x,o.y,o.z,e,t,n,s);return this._sphericalEnd.phi=clamp(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),v}setFocalOffset(e,t,n,s=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,s||this._focalOffset.copy(this._focalOffsetEnd);const o=!s||approxEquals(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&approxEquals(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&approxEquals(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),_xColumn.setFromMatrixColumn(this._camera.matrixWorldInverse,0),_yColumn.setFromMatrixColumn(this._camera.matrixWorldInverse,1),_zColumn.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=_v3A.set(e,t,n),o=s.distanceTo(this._camera.position),v=s.sub(this._camera.position);_xColumn.multiplyScalar(v.x),_yColumn.multiplyScalar(v.y),_zColumn.multiplyScalar(v.z),_v3A.copy(_xColumn).add(_yColumn).add(_zColumn),_v3A.z=_v3A.z+o,this.dollyTo(o,!1),this.setFocalOffset(-_v3A.x,_v3A.y,-_v3A.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,s){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new THREE.Vector4,typeof e=="number"?this._viewport.set(e,t,n,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,s=!1){if(notSupportedInOrthographicCamera(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const o=e/t,v=this._camera.getEffectiveFOV()*DEG2RAD,A=this._camera.aspect;return((s?o>A:o<A)?t:e/A)*.5/Math.tan(v*.5)+n*.5}getDistanceToFitSphere(e){if(notSupportedInOrthographicCamera(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*DEG2RAD,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,s=1<this._camera.aspect?t:n;return e/Math.sin(s*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new THREE.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new THREE.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof THREE.Spherical?e:new THREE.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new THREE.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%PI_2,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=PI_2),this._spherical.theta+=PI_2*Math.round((this._sphericalEnd.theta-this._spherical.theta)/PI_2)}reset(e=!1){if(!approxEquals(this._camera.up.x,this._cameraUp0.x)||!approxEquals(this._camera.up.y,this._cameraUp0.y)||!approxEquals(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(_v3A);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,_AXIS_Y),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=_v3A.subVectors(this._target,this._camera.position).normalize(),t=_v3B.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const n=this.getPosition(_v3A);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,s=this._sphericalEnd.radius-this._spherical.radius,o=_deltaTarget.subVectors(this._targetEnd,this._target),v=_deltaOffset.subVectors(this._focalOffsetEnd,this._focalOffset),A=this._zoomEnd-this._zoom;if(approxZero(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const re=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=smoothDamp(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,re,1/0,e),this._needsUpdate=!0}if(approxZero(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const re=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=smoothDamp(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,re,1/0,e),this._needsUpdate=!0}if(approxZero(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const re=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=smoothDamp(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,re,this.maxSpeed,e),this._needsUpdate=!0}if(approxZero(o.x)&&approxZero(o.y)&&approxZero(o.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const re=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;smoothDampVec3(this._target,this._targetEnd,this._targetVelocity,re,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(approxZero(v.x)&&approxZero(v.y)&&approxZero(v.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const re=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;smoothDampVec3(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,re,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(approxZero(A))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const re=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=smoothDamp(this._zoom,this._zoomEnd,this._zoomVelocity,re,1/0,e)}if(this.dollyToCursor){if(isPerspectiveCamera(this._camera)&&this._changedDolly!==0){const re=this._spherical.radius-this._lastDistance,ie=this._camera,se=this._getCameraDirection(_cameraDirection),le=_v3A.copy(se).cross(ie.up).normalize();le.lengthSq()===0&&(le.x=1);const pe=_v3B.crossVectors(le,se),de=this._sphericalEnd.radius*Math.tan(ie.getEffectiveFOV()*DEG2RAD*.5),_e=(this._sphericalEnd.radius-re-this._sphericalEnd.radius)/this._sphericalEnd.radius,ve=_v3C.copy(this._targetEnd).add(le.multiplyScalar(this._dollyControlCoord.x*de*ie.aspect)).add(pe.multiplyScalar(this._dollyControlCoord.y*de)),xe=_v3A.copy(this._targetEnd).lerp(ve,_e),De=this._lastDollyDirection===DOLLY_DIRECTION.IN&&this._spherical.radius<=this.minDistance,Le=this._lastDollyDirection===DOLLY_DIRECTION.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(De||Le)){this._sphericalEnd.radius-=re,this._spherical.radius-=re;const Ge=_v3B.copy(se).multiplyScalar(-re);xe.add(Ge)}this._boundary.clampPoint(xe,xe);const Ue=_v3B.subVectors(xe,this._targetEnd);this._targetEnd.copy(xe),this._target.add(Ue),this._changedDolly-=re,approxZero(this._changedDolly)&&(this._changedDolly=0)}else if(isOrthographicCamera(this._camera)&&this._changedZoom!==0){const re=this._zoom-this._lastZoom,ie=this._camera,se=_v3A.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(ie.near+ie.far)/(ie.near-ie.far)).unproject(ie),le=_v3B.set(0,0,-1).applyQuaternion(ie.quaternion),pe=_v3C.copy(se).add(le.multiplyScalar(-se.dot(ie.up))),fe=-(this._zoom-re-this._zoom)/this._zoom,_e=this._getCameraDirection(_cameraDirection),ve=this._targetEnd.dot(_e),xe=_v3A.copy(this._targetEnd).lerp(pe,fe),De=xe.dot(_e),Le=_e.multiplyScalar(De-ve);xe.sub(Le),this._boundary.clampPoint(xe,xe);const Ue=_v3B.subVectors(xe,this._targetEnd);this._targetEnd.copy(xe),this._target.add(Ue),this._changedZoom-=re,approxZero(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const b=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,b),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!approxZero(this._focalOffset.x)||!approxZero(this._focalOffset.y)||!approxZero(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),_xColumn.setFromMatrixColumn(this._camera.matrix,0),_yColumn.setFromMatrixColumn(this._camera.matrix,1),_zColumn.setFromMatrixColumn(this._camera.matrix,2),_xColumn.multiplyScalar(this._focalOffset.x),_yColumn.multiplyScalar(-this._focalOffset.y),_zColumn.multiplyScalar(this._focalOffset.z),_v3A.copy(_xColumn).add(_yColumn).add(_zColumn),this._camera.position.add(_v3A)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),_v3A.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const ee=this._needsUpdate;return ee&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):ee?(this.dispatchEvent({type:"update"}),approxZero(t,this.restThreshold)&&approxZero(n,this.restThreshold)&&approxZero(s,this.restThreshold)&&approxZero(o.x,this.restThreshold)&&approxZero(o.y,this.restThreshold)&&approxZero(o.z,this.restThreshold)&&approxZero(v.x,this.restThreshold)&&approxZero(v.y,this.restThreshold)&&approxZero(v.z,this.restThreshold)&&approxZero(A,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!ee&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=ee,this._needsUpdate=!1,ee}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:infinityToMaxNumber(this.maxDistance),minZoom:this.minZoom,maxZoom:infinityToMaxNumber(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:infinityToMaxNumber(this.maxPolarAngle),minAzimuthAngle:infinityToMaxNumber(this.minAzimuthAngle),maxAzimuthAngle:infinityToMaxNumber(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:_v3A.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=maxNumberToInfinity(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=maxNumberToInfinity(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=maxNumberToInfinity(n.maxPolarAngle),this.minAzimuthAngle=maxNumberToInfinity(n.minAzimuthAngle),this.maxAzimuthAngle=maxNumberToInfinity(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),_sphericalA.setFromVector3(_v3A.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(_sphericalA.theta,_sphericalA.phi,t),this.dollyTo(_sphericalA.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",VERSION),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,n){const s=t.lengthSq();if(s===0)return e;const o=_v3B.copy(t).add(e),A=this._boundary.clampPoint(o,_v3C).sub(o),b=A.lengthSq();if(b===0)return e.add(t);if(b===s)return e;if(n===0)return e.add(t).add(A);{const T=1+n*b/t.dot(A);return e.add(_v3B.copy(t).multiplyScalar(T)).add(A.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(isPerspectiveCamera(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*DEG2RAD,s=Math.tan(n*.5)*t,o=s*e.aspect;this._nearPlaneCorners[0].set(-o,-s,0),this._nearPlaneCorners[1].set(o,-s,0),this._nearPlaneCorners[2].set(o,s,0),this._nearPlaneCorners[3].set(-o,s,0)}else if(isOrthographicCamera(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,s=e.right*t,o=e.top*t,v=e.bottom*t;this._nearPlaneCorners[0].set(n,o,0),this._nearPlaneCorners[1].set(s,o,0),this._nearPlaneCorners[2].set(s,v,0),this._nearPlaneCorners[3].set(n,v,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||notSupportedInOrthographicCamera(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(_cameraDirection);_rotationMatrix.lookAt(_ORIGIN,n,this._camera.up);for(let s=0;s<4;s++){const o=_v3B.copy(this._nearPlaneCorners[s]);o.applyMatrix4(_rotationMatrix);const v=_v3C.addVectors(this._target,o);_raycaster.set(v,n),_raycaster.far=this._spherical.radius+1;const A=_raycaster.intersectObjects(this.colliderMeshes);A.length!==0&&A[0].distance<e&&(e=A[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 THREE.Sphere){const n=t,s=n.center;_box3A.makeEmpty(),e.traverseVisible(v=>{v.isMesh&&_box3A.expandByObject(v)}),_box3A.getCenter(s);let o=0;return e.traverseVisible(v=>{if(!v.isMesh)return;const A=v,b=A.geometry.clone();b.applyMatrix4(A.matrixWorld);const ee=b.attributes.position;for(let re=0,ie=ee.count;re<ie;re++)_v3A.fromBufferAttribute(ee,re),o=Math.max(o,s.distanceToSquared(_v3A))}),n.radius=Math.sqrt(o),n}};const CameraControls=reactExports.forwardRef((a,e)=>{reactExports.useMemo(()=>{const De={Box3,MathUtils:{clamp:MathUtils.clamp},Matrix4,Quaternion,Raycaster,Sphere,Spherical,Vector2,Vector3,Vector4};CameraControls$1.install({THREE:De}),extend({CameraControlsImpl:CameraControls$1})},[]);const{camera:t,domElement:n,makeDefault:s,onStart:o,onEnd:v,onChange:A,regress:b,...T}=a,ee=useThree(De=>De.camera),re=useThree(De=>De.gl),ie=useThree(De=>De.invalidate),se=useThree(De=>De.events),le=useThree(De=>De.setEvents),pe=useThree(De=>De.set),de=useThree(De=>De.get),fe=useThree(De=>De.performance),_e=t||ee,ve=n||se.connected||re.domElement,xe=reactExports.useMemo(()=>new CameraControls$1(_e),[_e]);return useFrame((De,Le)=>{xe.enabled&&xe.update(Le)},-1),reactExports.useEffect(()=>(xe.connect(ve),()=>void xe.disconnect()),[ve,xe]),reactExports.useEffect(()=>{const De=Ge=>{ie(),b&&fe.regress(),A&&A(Ge)},Le=Ge=>{o&&o(Ge)},Ue=Ge=>{v&&v(Ge)};return xe.addEventListener("update",De),xe.addEventListener("controlstart",Le),xe.addEventListener("controlend",Ue),xe.addEventListener("control",De),xe.addEventListener("transitionstart",De),xe.addEventListener("wake",De),()=>{xe.removeEventListener("update",De),xe.removeEventListener("controlstart",Le),xe.removeEventListener("controlend",Ue),xe.removeEventListener("control",De),xe.removeEventListener("transitionstart",De),xe.removeEventListener("wake",De)}},[xe,o,v,ie,le,b,A]),reactExports.useEffect(()=>{if(s){const De=de().controls;return pe({controls:xe}),()=>pe({controls:De})}},[s,xe]),reactExports.createElement("primitive",_extends$1({ref:e,object:xe},T))});function useAnimations(a,e){const t=reactExports.useRef(),[n]=reactExports.useState(()=>e?e instanceof Object3D?{current:e}:e:t),[s]=reactExports.useState(()=>new AnimationMixer(void 0));reactExports.useLayoutEffect(()=>{e&&(n.current=e instanceof Object3D?e:e.current),s._root=n.current});const o=reactExports.useRef({}),v=reactExports.useMemo(()=>{const A={};return a.forEach(b=>Object.defineProperty(A,b.name,{enumerable:!0,get(){if(n.current)return o.current[b.name]||(o.current[b.name]=s.clipAction(b,n.current))},configurable:!0})),{ref:n,clips:a,actions:A,names:a.map(b=>b.name),mixer:s}},[a]);return useFrame((A,b)=>s.update(b)),reactExports.useEffect(()=>{const A=n.current;return()=>{o.current={},s.stopAllAction(),Object.values(v.actions).forEach(b=>{A&&s.uncacheAction(b,A)})}},[a]),v}function create(a,e){const t=a+"Geometry";return reactExports.forwardRef(({args:n,children:s,...o},v)=>{const A=reactExports.useRef(null);return reactExports.useImperativeHandle(v,()=>A.current),reactExports.useLayoutEffect(()=>void e?.(A.current)),reactExports.createElement("mesh",_extends$1({ref:A},o),reactExports.createElement(t,{attach:"geometry",args:n}),s)})}const Box=create("box"),eps=1e-5;function createShape(a,e,t){const n=new Shape,s=t-eps;return n.absarc(eps,eps,eps,-Math.PI/2,-Math.PI,!0),n.absarc(eps,e-s*2,eps,Math.PI,Math.PI/2,!0),n.absarc(a-s*2,e-s*2,eps,Math.PI/2,0,!0),n.absarc(a-s*2,eps,eps,0,-Math.PI/2,!0),n}const RoundedBox=reactExports.forwardRef(function a({args:[e=1,t=1,n=1]=[],radius:s=.05,steps:o=1,smoothness:v=4,bevelSegments:A=4,creaseAngle:b=.4,children:T,...ee},re){const ie=reactExports.useMemo(()=>createShape(e,t,s),[e,t,s]),se=reactExports.useMemo(()=>({depth:n-s*2,bevelEnabled:!0,bevelSegments:A*2,steps:o,bevelSize:s-eps,bevelThickness:s,curveSegments:v}),[n,s,v]),le=reactExports.useRef(null);return reactExports.useLayoutEffect(()=>{le.current&&(le.current.center(),toCreasedNormals(le.current,b))},[ie,se]),reactExports.createElement("mesh",_extends$1({ref:re},ee),reactExports.createElement("extrudeGeometry",{ref:le,args:[ie,se]}),T)}),presetsObj={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},CUBEMAP_ROOT="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",isArray=a=>Array.isArray(a);function useEnvironment({files:a=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"],path:e="",preset:t=void 0,encoding:n=void 0,extensions:s}={}){var o;let v=null,A=!1,b;if(t){if(!(t in presetsObj))throw new Error("Preset must be one of: "+Object.keys(presetsObj).join(", "));a=presetsObj[t],e=CUBEMAP_ROOT}if(A=isArray(a),b=isArray(a)?"cube":a.startsWith("data:application/exr")?"exr":a.startsWith("data:application/hdr")?"hdr":(o=a.split(".").pop())==null||(o=o.split("?"))==null||(o=o.shift())==null?void 0:o.toLowerCase(),v=A?CubeTextureLoader:b==="hdr"?RGBELoader:b==="exr"?EXRLoader:null,!v)throw new Error("useEnvironment: Unrecognized file extension: "+a);const T=useLoader(v,A?[a]:a,se=>{se.setPath==null||se.setPath(e),s&&s(se)}),ee=A?T[0]:T;ee.mapping=A?CubeReflectionMapping:EquirectangularReflectionMapping;const re=3001,ie=3e3;return"colorSpace"in ee?ee.colorSpace=n??A?"srgb":"srgb-linear":ee.encoding=n??A?re:ie,ee}const isRef$1=a=>a.current&&a.current.isScene,resolveScene=a=>isRef$1(a)?a.current:a;function setEnvProps(a,e,t,n,s=0){const o=resolveScene(e||t),v=o.background,A=o.environment,b=o.backgroundBlurriness||0;return a!=="only"&&(o.environment=n),a&&(o.background=n),a&&o.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=s),()=>{a!=="only"&&(o.environment=A),a&&(o.background=v),a&&o.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=b)}}function EnvironmentMap({scene:a,background:e=!1,blur:t,map:n}){const s=useThree(o=>o.scene);return reactExports.useLayoutEffect(()=>{if(n)return setEnvProps(e,a,s,n,t)},[s,a,n,e,t]),null}function EnvironmentCube({background:a=!1,scene:e,blur:t,...n}){const s=useEnvironment(n),o=useThree(v=>v.scene);return reactExports.useLayoutEffect(()=>setEnvProps(a,e,o,s,t),[s,a,e,o,t]),null}function EnvironmentPortal({children:a,near:e=1,far:t=1e3,resolution:n=256,frames:s=1,map:o,background:v=!1,blur:A,scene:b,files:T,path:ee,preset:re=void 0,extensions:ie}){const se=useThree(ve=>ve.gl),le=useThree(ve=>ve.scene),pe=reactExports.useRef(null),[de]=reactExports.useState(()=>new Scene),fe=reactExports.useMemo(()=>{const ve=new WebGLCubeRenderTarget(n);return ve.texture.type=HalfFloatType,ve},[n]);reactExports.useLayoutEffect(()=>(s===1&&pe.current.update(se,de),setEnvProps(v,b,le,fe.texture,A)),[a,de,fe.texture,b,le,v,s,se]);let _e=1;return useFrame(()=>{(s===1/0||_e<s)&&(pe.current.update(se,de),_e++)}),reactExports.createElement(reactExports.Fragment,null,createPortal(reactExports.createElement(reactExports.Fragment,null,a,reactExports.createElement("cubeCamera",{ref:pe,args:[e,t,fe]}),T||re?reactExports.createElement(EnvironmentCube,{background:!0,files:T,preset:re,path:ee,extensions:ie}):o?reactExports.createElement(EnvironmentMap,{background:!0,map:o,extensions:ie}):null),de))}function EnvironmentGround(a){var e,t,n,s;const o=useEnvironment(a),v=a.map||o;reactExports.useMemo(()=>extend({GroundProjectedEnvImpl:GroundProjectedEnv}),[]);const A=reactExports.useMemo(()=>[v],[v]),b=(e=a.ground)==null?void 0:e.height,T=(t=a.ground)==null?void 0:t.radius,ee=(n=(s=a.ground)==null?void 0:s.scale)!==null&&n!==void 0?n:1e3;return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement(EnvironmentMap,_extends$1({},a,{map:v})),reactExports.createElement("groundProjectedEnvImpl",{args:A,scale:ee,height:b,radius:T}))}function Environment(a){return a.ground?reactExports.createElement(EnvironmentGround,a):a.map?reactExports.createElement(EnvironmentMap,a):a.children?reactExports.createElement(EnvironmentPortal,a):reactExports.createElement(EnvironmentCube,a)}const ContactShadows=reactExports.forwardRef(({scale:a=10,frames:e=1/0,opacity:t=1,width:n=1,height:s=1,blur:o=1,near:v=0,far:A=10,resolution:b=512,smooth:T=!0,color:ee="#000000",depthWrite:re=!1,renderOrder:ie,...se},le)=>{const pe=reactExports.useRef(null),de=useThree(sn=>sn.scene),fe=useThree(sn=>sn.gl),_e=reactExports.useRef(null);n=n*(Array.isArray(a)?a[0]:a||1),s=s*(Array.isArray(a)?a[1]:a||1);const[ve,xe,De,Le,Ue,Ge,Fe]=reactExports.useMemo(()=>{const sn=new WebGLRenderTarget(b,b),Ur=new WebGLRenderTarget(b,b);Ur.texture.generateMipmaps=sn.texture.generateMipmaps=!1;const lr=new PlaneGeometry(n,s).rotateX(Math.PI/2),hr=new Mesh(lr),zn=new MeshDepthMaterial;zn.depthTest=zn.depthWrite=!1,zn.onBeforeCompile=Pn=>{Pn.uniforms={...Pn.uniforms,ucolor:{value:new Color$1(ee)}},Pn.fragmentShader=Pn.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
9148
9148
  void main() {
9149
- `),Pn.fragmentShader=Pn.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const ar=new ShaderMaterial(HorizontalBlurShader),Dr=new ShaderMaterial(VerticalBlurShader);return Dr.depthTest=ar.depthTest=!1,[sn,lr,zn,hr,ar,Dr,Ur]},[b,n,s,a,ee]),Ye=sn=>{Le.visible=!0,Le.material=Ue,Ue.uniforms.tDiffuse.value=ve.texture,Ue.uniforms.h.value=sn*1/256,fe.setRenderTarget(Fe),fe.render(Le,_e.current),Le.material=Ge,Ge.uniforms.tDiffuse.value=Fe.texture,Ge.uniforms.v.value=sn*1/256,fe.setRenderTarget(ve),fe.render(Le,_e.current),Le.visible=!1};let rn=0,yn,bt;return useFrame(()=>{_e.current&&(e===1/0||rn<e)&&(rn++,yn=de.background,bt=de.overrideMaterial,pe.current.visible=!1,de.background=null,de.overrideMaterial=De,fe.setRenderTarget(ve),fe.render(de,_e.current),Ye(o),T&&Ye(o*.4),fe.setRenderTarget(null),pe.current.visible=!0,de.overrideMaterial=bt,de.background=yn)}),reactExports.useImperativeHandle(le,()=>pe.current,[]),reactExports.createElement("group",_extends$1({"rotation-x":Math.PI/2},se,{ref:pe}),reactExports.createElement("mesh",{renderOrder:ie,geometry:xe,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},reactExports.createElement("meshBasicMaterial",{transparent:!0,map:ve.texture,opacity:t,depthWrite:re})),reactExports.createElement("orthographicCamera",{ref:_e,args:[-n/2,n/2,s/2,-s/2,v,A]}))}),LightManager=()=>{const[a,e]=reactExports.useState(!1),t=productDataStore$1(v=>v),n=lightStore(v=>v),[s,o]=reactExports.useState(1);return reactExports.useEffect(()=>{const v=t.assetsData,A=v?.sceneMoodSettings?.envMap;A&&(lightStore.setState({defaultEnvMapUrl:A}),n.actions.setEnvLightMap(A)),n.envMapUrl===""&&n.actions.setEnvLightMap(lightStore.getState().defaultEnvMapUrl);const b=v?.sceneMoodSettings?.ambientLightIntensity;b!==void 0&&o(b),e(!0)},[]),reactExports.useEffect(()=>{a!==!1&&(LOGGER.groupCollapsed("SCENE LIGHTING INFO:"),LOGGER.table({title:"Scene Lights",details:{"Environment Map":n.envMapUrl,"Ambient Light Intensity":s}}),LOGGER.groupEnd())},[a]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:a===!0&&jsxDevRuntimeExports.jsxDEV("group",{name:"GRP_LIGHTS",children:[jsxDevRuntimeExports.jsxDEV("ambientLight",{intensity:s},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:70,columnNumber:11},globalThis),jsxDevRuntimeExports.jsxDEV(Environment,{background:!1,files:CORE_API.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 Draggable({children:a,guid:e,onDragStartHandler:t,onDragEndHandler:n,onItemClickHandler:s,onPointerEnter:o,onPointerLeave:v,dragging:A=!1,intersectingGhostObject:b=null,isInteractive:T=!0,initialIntersectedGhostUUID:ee=null,isSnapAllowed:re=!1,...ie}){const se=reactExports.useRef(),le=reactExports.useRef(-1),pe=reactExports.useRef([]),de=reactExports.useRef([]),{raycaster:fe,size:_e,camera:ve}=useThree(),xe=hotspotStore$1(Dr=>Dr.isAnyHotspotActive),De=sceneStore(Dr=>Dr.multipleTouchDetected),[Le,Ue]=reactExports.useState(null),{raycasterGhost:Ge}=reactExports.useMemo(()=>({raycasterGhost:new Raycaster})),Fe=Dr=>{let Pn;return Dr.isGhost===!0?Pn=Dr:Dr.parent?Dr.parent.isGhost===!0?Pn=Dr.parent:Pn=Fe(Dr.parent):Pn=null,Pn},Ye=Dr=>{Ge.setFromCamera(Dr,ve);const Pn=Ge.intersectObject(ghostStore.getState().ghostParentRef);let si=null;return Pn.length>0&&(si=Fe(Pn[0].object)),si},rn=Dr=>{let Pn=Dr.whichNodesAreAttachedToUs();return Pn.map(si=>{rn(si).map(Ra=>{Pn.push(Ra)})}),Pn},{initialMouse2D:yn,mouse2D:bt,mouse3D:sn,offset:Ur,normal:lr,plane:hr,pointerDownPos:zn}=reactExports.useMemo(()=>({initialMouse2D:new Vector2,mouse2D:new Vector2,mouse3D:new Vector3,offset:new Vector3,normal:new Vector3,plane:new Plane,pointerDownPos:new Vector2}),[]);reactExports.useEffect(()=>{let Dr=attachmentStore$1.getState().attachmentSystem.currentStructure.getNodeByGUID(e);Ue(Dr)},[]);const ar=useGesture({onPointerEnter:Dr=>{De||sceneStore.getState().sceneSettings.disableDragDrop&&sceneStore.getState().sceneSettings.disableContextMenu||sceneStore.getState().itemDraggedSkuID||sceneStore.getState().cameraActive!==!0&&!sceneStore.getState().dragging&&!xe&&(Le&&!Le.isEndNode?CORE_API.switchCursor(CURSORS.POINTER):CORE_API.switchCursor(CURSORS.GRAB),o(Dr.event))},onPointerLeave:Dr=>{De||sceneStore.getState().sceneSettings.disableDragDrop&&sceneStore.getState().sceneSettings.disableContextMenu||sceneStore.getState().itemDraggedSkuID||sceneStore.getState().cameraActive!==!0&&!sceneStore.getState().dragging&&!xe&&(CORE_API.switchCursor(CURSORS.GRAB),v(Dr.event))},onClick:Dr=>{if(Dr.event.stopPropagation(),!De){if(sceneStore.getState().builderMode){const{eventObject:Pn,point:si}=Dr.event;Pn.getWorldPosition(Ur).sub(si),sn.copy(si);const ea=Dr.event.offsetX,Ra=Dr.event.offsetY,as=ea/_e.width*2-1,ua=-Ra/_e.height*2+1;bt.set(as,ua);const ho=new Raycaster;ho.setFromCamera(bt,ve);const tl=ho.intersectObject(sceneStore.getState().sceneRef.getObjectByName("proxyGeometry"));tl.length>0&&CORE_API.fireEvent(CORE_API.EVENTS.CONFIGURATION.OnClickItem,{point:tl[0].point,camera:ho.camera})}if(!sceneStore.getState().sceneSettings.disableContextMenu)if(!Dr.dragging&&!xe){if(Math.abs(Dr.event.x-zn.x)>1)return;s(Dr.event.offsetX,Dr.event.offsetY,e)}else hotspotStore$1.getState().actions.exitHotspot(!0)}},onDrag:async Dr=>{if(sceneStore.getState().simulateDragEnd===!0||sceneStore.getState().dragging&&sceneStore.getState().draggingItemGUID!==Le.guid||sceneStore.getState().sceneSettings.disableDragDrop)return;const Pn=Dr.event;if(Pn.stopPropagation(),xe){CORE_API.switchCursor(CURSORS.BLOCKED);return}if(itemStore.getState().selectedItemData){CORE_API.switchCursor(CURSORS.BLOCKED);return}if(Object.keys(itemStore.getState().itemsSpawned).length<2){CORE_API.switchCursor(CURSORS.BLOCKED);return}const ea=Dr.event.offsetX,Ra=Dr.event.offsetY;if(!sceneStore.getState().dragging){if(itemStore.setState({busy:!0}),Math.abs(Pn.x-zn.x)<=1)return;if(Le&&!Le.canDrag){CORE_API.switchCursor(CURSORS.BLOCKED);return}const _c=Le.whichPlugAreWeAttachedUsing().attachedPlug.guid;let Al=Le.swapRoot();Al||(Al={rootDetachedPlugs:Le.detachNodeFromReceiver()}),pe.current=rn(Le),de.current=[],pe.current.map(kc=>{de.current.push(kc.guid),Le.ref.attach(kc.ref)}),CORE_API.switchCursor(CURSORS.MOVE),sceneStore.setState({dragging:!0}),sceneStore.setState({draggingItemGUID:Le.guid}),re=!1,b=null,ee=null,le.current=-1;const da=ea/_e.width*2-1,ul=-Ra/_e.height*2+1;yn.set(da,ul);const nl=await t({guid:e,node:Le,detachedData:Al,attachedChildrenGuids:de.current});if(nl.length<=0||nl.transforms===void 0)return;nl.transforms.map((kc,gl)=>{kc.receiverPlugGUID===_c&&(le.current=gl)})}const as=ea/_e.width*2-1,ua=-Ra/_e.height*2+1;bt.set(as,ua),fe.setFromCamera(bt,ve),ve.getWorldDirection(lr).negate(),hr.setFromNormalAndCoplanarPoint(lr,sn),fe.ray.intersectPlane(hr,sn);const ho=ghostStore.getState().ghostParentRef;ho.children.length>0&&(b=Ye(bt),ee===null&&le.current!==-1&&le.current<ho.children.length&&ho.children[le.current]!==void 0&&(ee=ho.children[le.current].children[0].uuid),b&&ee!==null&&ee!==b.uuid&&!re&&(re=!0),!re&&!b&&(re=!0)),b&&re?(ghostStore.setState({ghostVisibility:!1}),Le.ref.position.set(b.position.x,b.position.y,b.position.z),Le.ref.setRotationFromEuler(b.rotation)):(ghostStore.setState({ghostVisibility:!0}),Le.ref.position.copy(sn).add(Ur)),(as>1||as<-1||ua<-1||ua>1)&&(sceneStore.setState({simulateDragEnd:!0}),sceneStore.setState({dragging:!1}),sceneStore.setState({draggingItemGUID:null}),itemStore.setState({busy:!1}),CORE_API.switchCursor(CURSORS.GRAB),n({node:Le,intersectingGhostObject:b,attachedChildrenGuids:de.current,attachedNodesToCurrentNode:pe.current}))},onDragStart:({event:Dr})=>{if(sceneStore.setState({simulateDragEnd:!1}),De||sceneStore.getState().sceneSettings.disableDragDrop&&sceneStore.getState().sceneSettings.disableContextMenu)return;Dr.stopPropagation();const{eventObject:Pn,point:si}=Dr;Pn.getWorldPosition(Ur).sub(si),sn.copy(si),zn.set(Dr.x,Dr.y)},onDragEnd:({event:Dr})=>{sceneStore.setState({simulateDragEnd:!1}),!(sceneStore.getState().dragging&&sceneStore.getState().draggingItemGUID!==Le.guid)&&(sceneStore.getState().sceneSettings.disableDragDrop&&sceneStore.getState().sceneSettings.disableContextMenu||(Dr.stopPropagation(),sceneStore.setState({dragging:!1}),sceneStore.setState({draggingItemGUID:null}),itemStore.setState({busy:!1}),CORE_API.switchCursor(CURSORS.GRAB),n({node:Le,intersectingGhostObject:b,attachedChildrenGuids:de.current,attachedNodesToCurrentNode:pe.current}),attachmentStore$1.getState().attachmentSystem.currentStructure.customLogic()))}});return jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:T?jsxDevRuntimeExports.jsxDEV("group",{ref:se,...ar(),...ie,children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:483,columnNumber:9},this):jsxDevRuntimeExports.jsxDEV("group",{ref:se,...ie,children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:487,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:481,columnNumber:5},this)}const Model=({modelData:a,clonedMesh:e,clonedProxyMesh:t,itemKey:n,scale:s,onItemClickHandler:o,onDragEndHandler:v,onDragStartHandler:A,stockAlert:b=!0})=>{const T=hotspotStore$1(lr=>lr),ee=itemStore(lr=>lr),re=itemStore(lr=>lr.hoveredItemRef),ie=reactExports.useRef(null),se=reactExports.useRef(null),le=reactExports.useRef([]),pe=reactExports.useRef(null),[de,fe]=reactExports.useState(e),[_e,ve]=reactExports.useState(t),xe=reactExports.useRef(0),De=reactExports.useRef(0),{ref:Le,actions:Ue,names:Ge}=useAnimations(a.data.animations),Fe=reactExports.useCallback((lr,hr,zn,ar)=>playAnimation(lr,hr,zn,ar,Ge,Ue),[Ge,Ue]),Ye=reactExports.useCallback(lr=>stopAnimation(lr,Ge,Ue),[Ge,Ue]);reactExports.useEffect(()=>{if(ie.current===n.itemData.guid){ie.current=null;let lr=T.lastActiveHotspotData.hotspotData;if(!lr)return;if(lr.exitAnim?Fe(lr.exitAnim,!1,!1,!1):lr.entryAnim&&Fe(lr.entryAnim,!1,!0,!1),lr.activeAnim&&Ye(lr.activeAnim),T.activeHotspotData){if(n.itemData.guid===T.activeHotspotData.itemData.guid){ie.current=n.itemData.guid;let hr=T.activeHotspotData.hotspotData;if(!hr)return;hr.entryAnim&&Fe(hr.entryAnim,!1,!1,!0),hr.activeAnim&&Fe(hr.activeAnim,!0,!1,!1)}}else return}else if(T.activeHotspotData){if(n.itemData.guid===T.activeHotspotData.itemData.guid){ie.current=n.itemData.guid;let lr=T.activeHotspotData.hotspotData;if(!lr)return;lr.entryAnim&&Fe(lr.entryAnim,!1,!1,!0),lr.activeAnim&&Fe(lr.activeAnim,!0,!1,!1)}}else return},[T.activeHotspotData]),reactExports.useEffect(()=>{sceneStore.getState().actions.triggerAutoFocus(),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Item_Added,{...n})},[]);const rn=reactExports.useCallback(()=>{if(!Le.current||(le.current=findMeshAndCloneMatFromScene(Le.current,Le.current.inStock),le.current.length==0))return;if(Le.current.inStock===!1){b==!0&&(b=!1,CORE_API.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:lr}=De;for(let hr=0;hr<le.current.length;hr++){const zn=le.current[hr].material;zn.emissiveIntensity=lr}},[De,Le]),yn=reactExports.useCallback(()=>{xe.current=0},[le]),bt=reactExports.useCallback(()=>{xe.current=.005},[le,de]);useFrame(()=>{sceneStore.getState().builderMode||(De.current=MathUtils.lerp(De.current,xe.current,.1),rn())}),reactExports.useEffect(()=>{const lr=attachmentStore$1.getState().attachmentSystem.currentStructure,hr=lr.getNodeByGUID(n.itemData.guid);if(hr?.isDependent&&!hr.isInteractive&&Object.keys(re).length>0){const zn=lr.getNodeByGUID(Object.keys(re)[0]);if(!zn||!zn.myDependenciesGUID)return;zn.myDependenciesGUID.includes(n.itemData.guid)?yn():bt()}else re.hasOwnProperty(n.itemData.guid)||Object.keys(re).length==0?yn():bt()},[re]);const sn=reactExports.useCallback(lr=>{lr.stopPropagation();const hr=ee.selectedItemData;sceneStore.setState({canvasTooltipText:"-"+n.itemData.name+"-"}),hr||itemStore.setState({hoveredItemRef:{}});let zn=itemStore.getState().hoveredItemRef;zn.hasOwnProperty(n.itemData.guid)||(zn[n.itemData.guid]={instance:Le.current},ee.actions.setHoveredItemRef({...zn}))},[ee,re,se]),Ur=reactExports.useCallback(lr=>{lr.stopPropagation();const hr=ee.selectedItemData;if(sceneStore.setState({canvasTooltipText:""}),hr){if(hr.itemData.guid==n.itemData.guid)return;re[n.itemData.guid]&&(delete re[n.itemData.guid],ee.actions.setHoveredItemRef({...re}))}else itemStore.setState({hoveredItemRef:{}})},[se,ee,re]);return reactExports.useEffect(()=>{if(pe.current)return ee.collidersRef.push(pe),ee.actions.setCollidersRef([...ee.collidersRef]),()=>{const lr=ee.collidersRef.indexOf(pe);lr>-1&&ee.collidersRef.splice(lr,1),ee.actions.setCollidersRef([...ee.collidersRef])}},[pe]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[de&&jsxDevRuntimeExports.jsxDEV(Clone,{name:"GRP_RenderGeometry",ref:Le,object:de,scale:s,inStock:!0},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:263,columnNumber:9},globalThis),(n.itemData.hasOwnProperty("disableCollider")?!n.itemData.disableCollider:!sceneStore.getState().sceneSettings.disableCollider)&&jsxDevRuntimeExports.jsxDEV("group",{name:"GRP_LoadingPlaceholder",children:jsxDevRuntimeExports.jsxDEV("group",{position:n.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:jsxDevRuntimeExports.jsxDEV(Box,{ref:pe,scale:Vec3ToArr(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:283,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:278,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:277,columnNumber:9},globalThis),a.proxy.isLoaded&&jsxDevRuntimeExports.jsxDEV(Draggable,{guid:n.itemData.guid,onDragStartHandler:A,onDragEndHandler:v,onItemClickHandler:o,onPointerEnter:sn,onPointerLeave:Ur,name:"GRP_ProxyMesh",isInteractive:n.itemData.isInteractive,children:jsxDevRuntimeExports.jsxDEV("primitive",{name:"proxyGeometry",object:_e,scale:s,visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:303,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:293,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:261,columnNumber:5},globalThis)};function playAnimation(a,e,t,n,s,o){if(!s.includes(a))return;const v=o[a];v.setLoop(e?LoopRepeat:LoopOnce),v.clampWhenFinished=!e,n&&v.reset(),t?v.fadeOut(.5).play():v.fadeIn(.5).play()}function stopAnimation(a,e,t){if(!e.includes(a))return;t[a].stop()}function LoadingBox({distanceFactor:a,position:e,proxymodel:t,scale:n}){return jsxDevRuntimeExports.jsxDEV("primitive",{position:[0,0,0],name:"proxyLoader",object:t,scale:n,visible:!0,wireframe:!0,children:jsxDevRuntimeExports.jsxDEV(Html,{center:!0,position:e,distanceFactor:a,zIndexRange:[29,0],children:jsxDevRuntimeExports.jsxDEV("img",{alt:"Loading...",draggable:"false",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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 ProxyModelOnly({proxymodel:a,itemKey:e,scale:t}){return reactExports.useEffect(()=>{attachmentStore$1.getState().actions.updateFittingSkuIds()},[]),jsxDevRuntimeExports.jsxDEV("group",{children:[(e.itemData.hasOwnProperty("disableCollider")?!e.itemData.disableCollider:!sceneStore.getState().sceneSettings.disableCollider)&&jsxDevRuntimeExports.jsxDEV("group",{name:"GRP_LoadingPlaceholder",children:jsxDevRuntimeExports.jsxDEV("group",{position:e.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:jsxDevRuntimeExports.jsxDEV(Box,{scale:Vec3ToArr(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),jsxDevRuntimeExports.jsxDEV("group",{name:"GRP_ProxyMesh",children:jsxDevRuntimeExports.jsxDEV("primitive",{name:"proxyGeometry",object:a.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 Item=({position:a,rotation:e,itemKey:t,scale:n,rejectFunc:s,onItemClickHandler:o,onDragEndHandler:v,onDragStartHandler:A,itemIndex:b,proxyScene:T})=>{const ee=sceneStore(_e=>_e.sceneRef),re=assetStore(_e=>_e),[ie,se]=reactExports.useState(null),[le,pe]=reactExports.useState(T.clone()),de=reactExports.useRef(null);reactExports.useEffect(()=>((async()=>{let _e=await re.actions.loadAsset(t.itemData.skuID).catch((Le,Ue)=>{s(Le,Ue,t.itemData.guid)});if(!_e||!_e.data){se({data:null,clonedMesh:null,mainModelReady:!1});return}const ve=_e.data,De=t.itemData.replace===!0||CORE_API.sceneSettings.disableLocalColorOverride?ve.scene:ve.scene.clone();t.itemData.clonedScene=De,ve.functions&&(ve.functions.copyVariantMaterials(De,ve.scene),await fe(ve,De)),LOGGER.info({title:"model loaded: "+t.itemData.skuID}),t.itemData.hasItemLoaded=!0,itemStore.getState().actions.triggerModelLoaded(),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Model_Loaded,t.itemData.skuID),se({data:_e,clonedMesh:De,mainModelReady:!0})})(),()=>{CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Model_Removed,t.itemData.skuID)}),[]);const fe=reactExports.useCallback(async(_e,ve)=>{const xe=attachmentStore$1.getState().attachmentSystem;var De=xe.currentStructure.getNodeByGUID(t.itemData.guid);if(!De)return;let Le="";if(De.overrideVariant)Le=De.overrideVariant,CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0);else{const Ue=xe.globalVariants;if(!Ue||Ue.Count<=0)return;let Ge=[];Object.keys(Ue).map((Fe,Ye)=>{Ge.push(Ue[Fe])}),t.itemData.looks?.map(Fe=>{Ge.includes(Fe)&&(Le=Fe)}),Le||(Le=t.itemData.looks[0])}return Le&&(De.currentVariant=Le,await _e.functions.selectVariant(ve,Le),itemStore.setState({variantChangeAlert:!itemStore.getState().variantChangeAlert})),Le},[]);return reactExports.useEffect(()=>{if(!de.current)return;const _e=attachmentStore$1.getState().attachmentSystem.currentStructure.getNodeByGUID(t.itemData.guid);_e.ref!==de.current&&(_e.ref=de.current,_e.transform={position:a,rotation:e}),_e&&ie!==null&&(_e.modelData=ie,attachmentStore$1.getState().actions.updateFittingSkuIds())},[de,ie]),reactExports.useEffect(()=>{if(de.current&&ee&&t.itemData.hasOwnProperty("excludeFromSceneBounds")&&t.itemData.excludeFromSceneBounds){const _e=ee.getObjectByName("#GRP_EXCLUDED");_e!==void 0&&_e.attach(de.current)}},[ee,de]),jsxDevRuntimeExports.jsxDEV("group",{ref:de,position:a,quaternion:e,name:`GRP_${t.itemData.name}_`+b.toString().padStart(2,"0"),children:[ie!==null&&(ie.mainModelReady?jsxDevRuntimeExports.jsxDEV(Model,{modelData:ie.data,clonedMesh:ie.clonedMesh,clonedProxyMesh:le,itemKey:t,scale:n,onDragStartHandler:A,onDragEndHandler:v,onItemClickHandler:o},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:269,columnNumber:11},globalThis):jsxDevRuntimeExports.jsxDEV(ProxyModelOnly,{itemKey:t,proxymodel:le,scale:n},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:280,columnNumber:11},globalThis)),ie==null&&le&&jsxDevRuntimeExports.jsxDEV(LoadingBox,{proxymodel:le,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:288,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:259,columnNumber:5},globalThis)};function GhostEventHandler({index:a,children:e,...t}){const n=reactExports.useRef(),s=useGesture({onPointerEnter:o=>{o.event.stopPropagation(),sceneStore.getState().itemDraggedSkuID&&sceneStore.setState({hoveredGhostIndex:a})},onPointerLeave:o=>{o.event.stopPropagation(),sceneStore.getState().itemDraggedSkuID&&sceneStore.setState({hoveredGhostIndex:-1})}});return jsxDevRuntimeExports.jsxDEV("group",{ref:n,...s(),...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 Ghost=({ghostData:a,ghostTransform:e,index:t})=>{const n=reactExports.useRef(),s=reactExports.useMemo(()=>a.proxyScene.clone(),[a]),o=sceneStore(v=>v.hoveredGhostIndex);return reactExports.useEffect(()=>{const{current:v}=n;v&&(v.userData.incomingPlugName=e.incomingPlugName,v.userData.receiverPlugName=e.receiverPlugName,v.userData.incomingPlugGUID=e.incomingPlugGUID,v.userData.receiverPlugGUID=e.receiverPlugGUID,CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Ghost_Loaded,{ghostData:a,ghostTransform:e}))},[n]),reactExports.useEffect(()=>{if(!s||!sceneStore.getState().itemDraggedSkuID)return;let v;o===t?v=sceneStore.getState().sceneSettings.draggableUiGhostThreeColorOnHover:v=sceneStore.getState().sceneSettings.ghostThreeColor,s.traverse(A=>{A.isMesh===!0&&(A.material=A.material.clone(),A.material.emissive=v)})},[o,s]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:jsxDevRuntimeExports.jsxDEV(GhostEventHandler,{index:t,children:jsxDevRuntimeExports.jsxDEV("primitive",{isGhost:!0,ref:n,index:t,position:e.position,quaternion:e.rotation,object:s,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:58,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:57,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:56,columnNumber:5},globalThis)},GhostManager=({intersectingGhostObject:a=null})=>{const{camera:e}=useThree(),t=ghostStore(b=>b.ghostVisibility),n=ghostStore(b=>b.ghostData),s=ghostStore(b=>b.ghostsTransform),o=reactExports.useRef(),{_touch2D:v}=reactExports.useMemo(()=>({_touch2D:new Vector2}),[]);reactExports.useEffect(()=>{const{current:b}=o;b&&ghostStore.setState({ghostParentRef:b})},[o]);const A=b=>{let T=0,ee=0;if(b.touches&&b.touches[0])T=b.touches[0].clientX,ee=b.touches[0].clientY;else return;if(!sceneStore.getState().itemDraggedSkuID)return;const re=sceneStore.getState().cursorParentRef,ie=sceneStore.getState().canvasSize;if(!re)return;const se=re.getBoundingClientRect(),le=se.top,pe=se.left,de=(T-pe)/ie.width*2-1,fe=(-ee+le)/ie.height*2+1;v.set(de,fe);const _e=new Raycaster;_e.setFromCamera(v,e);const ve=_e.intersectObject(ghostStore.getState().ghostParentRef);ve.length>0?(a=ve[0].object,sceneStore.setState({hoveredGhostIndex:a.parent.index})):(a=null,sceneStore.setState({hoveredGhostIndex:-1}))};return reactExports.useEffect(()=>{window.addEventListener("touchmove",A,!1),LOGGER.info({title:"Ghost Manager Mounted!"})},[]),jsxDevRuntimeExports.jsxDEV("group",{name:"#GRP_GhostParent",visible:t,ref:o,children:n&&jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:s.map((b,T)=>T<n.count&&jsxDevRuntimeExports.jsxDEV(Ghost,{ghostData:n,ghostTransform:b,index:T},"ghosts"+T,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:88,columnNumber:17},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:84,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:78,columnNumber:5},globalThis)},ItemManager=()=>{const a=attachmentStore$1(Ge=>Ge.attachmentSystem),e=attachmentStore$1(Ge=>Ge),t=itemStore(Ge=>Ge.removeItemTrigger),n=itemStore(Ge=>Ge.variantChangeAlert),s=hotspotStore$1(Ge=>Ge),o=sceneStore(Ge=>Ge.showDimensions);sceneStore(Ge=>Ge.sceneSettings);const v=itemStore(Ge=>Ge),A=itemStore(Ge=>Ge.lastDeletedItemData),b=cameraStore(Ge=>Ge),T=itemStore(Ge=>Ge.selectedItemData),ee=itemStore(Ge=>Ge.itemsSpawned),re=reactExports.useRef(null),ie=reactExports.useRef(null),se=reactExports.useRef(!1),le=reactExports.useRef(null),pe=reactExports.useRef(null),de=reactExports.useRef(!1),fe=reactExports.useRef(!1);reactExports.useRef(!1),reactExports.useRef(!1);const _e=reactExports.useCallback(({guid:Ge,node:Fe,detachedData:Ye,attachedChildrenGuids:rn})=>{if(se.current!==!0)return se.current=!0,cameraStore.setState({canCameraRotate:!1}),s.actions.switchHotspotsVisibility(!1,!0),le.current={position:Fe.ref.position.clone(),rotation:Fe.ref.rotation.clone()},pe.current=Ye,a.currentStructure.removeNodeFromStructure(Fe),rn.length<=0&&(rn=!1),ghostStore.getState().actions.spawnGhostsForSkuID(ee[Ge].itemData.skuID,rn)},[b,ee]),ve=reactExports.useCallback(({node:Ge,intersectingGhostObject:Fe,attachedChildrenGuids:Ye,attachedNodesToCurrentNode:rn})=>{if(!se.current)return;se.current=!1,cameraStore.setState({canCameraRotate:!0}),s.actions.switchHotspotsVisibility(!0,!0);function yn(){Ge.ref.position.set(0,0,0),ghostStore.getState().actions.clearAllGhosts()}if(!ghostStore.getState().ghostData?.connectablePlugs){yn();return}a.currentStructure.addNode(Ge);let sn=null,Ur=null,lr=!1,hr=[],zn={};if(sceneStore.getState().sceneSettings.ignoreCollisionPostDragging===!1&&Ye.map((ar,Dr)=>{hr[Dr]=a.currentStructure.checkCollisionforGUID(ar),hr[Dr]&&(zn[ar]=ee[ar])}),hr.map(ar=>{lr||(lr=ar)}),Fe&&lr){sceneStore.setState({draggingOnDropCollisionData:{node:Ge,attachedChildrenGuids:Ye,collidingStatus:hr,intersectingGhostObject:Fe,initPosition:le.current.position,initRotation:le.current.rotation,detachedPlugs:pe.current,attachedNodesToCurrentNode:rn}}),Ge.ref.position.set(Fe.position.x,Fe.position.y,Fe.position.z),Ge.ref.setRotationFromEuler(Fe.rotation),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.DraggingOnDrop_CollsionDetected,zn);return}if(Fe){const ar=Fe.userData;sn=Ge.getPlugByName(ar.incomingPlugName),Ur=a.currentStructure.getPlugByGUID(ar.receiverPlugGUID),Ge.ref.position.set(Fe.position.x,Fe.position.y,Fe.position.z),Ge.ref.setRotationFromEuler(Fe.rotation),Ge.transform={position:Fe.position,rotation:Fe.quaternion}}else{const ar=pe.current.neighbourDetachedPlugs;ar&&(pe.current.neighbourNode.detachNodeFromReceiver(),a.currentStructure.connectPlugs({incomingPlug:ar.incomingPlug,receiverPlug:ar.receiverPlug})),sn=pe.current.rootDetachedPlugs.incomingPlug,Ur=pe.current.rootDetachedPlugs.receiverPlug,Ge.ref.position.set(le.current.position.x,le.current.position.y,le.current.position.z),Ge.ref.setRotationFromEuler(le.current.rotation);let Dr=new Quaternion().identity();Ge.ref.getWorldQuaternion(Dr),Ge.transform={position:le.current.position,rotation:Dr}}a.currentStructure.connectPlugs({incomingPlug:sn,receiverPlug:Ur}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),rn.map(ar=>{Ge.ref.parent.attach(ar.ref)}),attachmentStore$1.getState().actions.updateFittingSkuIds()},[b,sceneStore,ghostStore,a,e,ee]),xe=reactExports.useCallback((Ge,Fe,Ye)=>{if(sceneStore.getState().sceneSettings.disableContextMenu)return;const rn=attachmentStore$1.getState().attachmentSystem.currentStructure,yn=rn.getNodeByGUID(Ye);let bt=[];if(!yn.myDependenciesGUID)return;yn.myDependenciesGUID.map(lr=>{const hr=rn.getNodeByGUID(lr);let zn={guid:lr,name:ee[lr].itemData.guid,data:{...ee[lr],overrideVariant:hr.overrideVariant,currentVariant:hr.currentVariant,offsetX:Ge,offsetY:Fe}};bt.push(zn)}),bt.sort((lr,hr)=>lr.name>hr.name?1:hr.name>lr.name?-1:0);let sn=inventoryStore.getState().inventoryData[ee[Ye].itemData.skuID];const Ur={primary:{guid:Ye,name:ee[Ye].itemData.name,data:{inventory:sn,...ee[Ye],overrideVariant:yn.overrideVariant,currentVariant:yn.currentVariant,offsetX:Ge,offsetY:Fe}},dependencies:bt};v.actions.setSelectedItemData(Ur.primary.data),CORE_API.fireEvent(CORE_API.EVENTS.UI.ContextMenu_Show,Ur)},[ee]),De=reactExports.useCallback(Ge=>{Ge&&(itemStore.setState({lastDeletedItemData:{...ee[Ge]}}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Item_Removed,{...ee[Ge]}),delete ee[Ge],v.actions.setItemsSpawned({...ee}))},[v,itemStore,ee]);reactExports.useEffect(()=>{let Ge=itemStore.getState().removeItems;if(Ge.length<=0&&!A)return;let Fe=Ge.pop();De(Fe)},[t,A]);const Le=reactExports.useCallback(function(Ge,Fe){const Ye=Ge>1?!0:!(Ge===1&&Object.values(ee)[0].itemData.skuID.toLowerCase()==="root"),rn=Ge<=0;LOGGER.groupCollapsed("Resolving buttons visibility"),LOGGER.table({sceneIsEmpty:rn,sceneIsNotEmpty:Ye}),LOGGER.groupEnd(),Fe.showViewInYourSpaceBtn===!0&&(Ye&&de.current===!1?(CORE_API.fireEvent(CORE_API.EVENTS.UI.ViewInYourSpaceButton_Show),de.current=!0):rn&&de.current===!0&&(CORE_API.fireEvent(CORE_API.EVENTS.UI.ViewInYourSpaceButton_Hide),de.current=!1)),Fe.showShareBtn===!0&&(Ye&&fe.current===!1?(CORE_API.fireEvent(CORE_API.EVENTS.UI.ShareButton_Show),fe.current=!0):rn&&fe.current===!0&&(CORE_API.fireEvent(CORE_API.EVENTS.UI.ShareButton_Hide),fe.current=!1))},[ee]);reactExports.useEffect(()=>{CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:ee});const Ge=sceneStore.getState().sceneSettings;Le(Object.keys(ee).length,Ge),Object.keys(ee).length==0?sceneStore.setState({canvasTooltipText:Ge.textSettings.tooltipEmptySceneText}):Object.keys(ee).length==1&&sceneStore.setState({canvasTooltipText:Ge.textSettings.tooltipInstructionText})},[ee]),reactExports.useEffect(()=>{const Ge=attachmentStore$1.getState().attachmentSystem;if(!Ge)return;inventoryStore.getState().actions.refreshInventory(ee);const Fe=Ge.getCartItems();CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,Fe),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,Ge.currentStructure.getCurrentItemsInReplaceableCategory())},[ee,n]);const Ue=reactExports.useCallback((Ge,Fe,Ye)=>{CORE_API.removeItemByGUID(Ye),CORE_API.alert({alertMsg:Fe+": "+Ge,alertTime:5e3,alertType:"error",alertLabel:"Error",persistant:!0})},[]);return reactExports.useEffect(()=>{const{current:Ge}=ie;Ge&&attachmentStore$1.setState({colliderMeshRef:Ge})},[ie]),reactExports.useEffect(()=>{const{current:Ge}=re;Ge&&sceneStore.setState({sceneRef:Ge})},[re]),reactExports.useEffect(()=>{let Ge=T?cameraStore.getState().cameraSettings.zoomingMultiplier:cameraStore.getState().cameraSettings.zoomingMultiplier+.1;Ge+=o?.3:.1,cameraStore.setState({boundsMargin:Ge}),sceneStore.getState().actions.triggerAutoFocus()},[o,T]),reactExports.useEffect(()=>{LOGGER.info({title:"item Manager mounted"}),sceneStore.getState().preconfigurationLoaded||attachmentStore$1.getState().actions.loadDefaultStructure()},[]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV("group",{name:"Scene",ref:re,onPointerMissed:()=>{T&&v.actions.deselectItem(),hotspotStore$1.getState().isAnyHotspotActive&&hotspotStore$1.getState().actions.exitHotspot()},children:[IS_DEV_ENV,jsxDevRuntimeExports.jsxDEV("group",{name:"#GRP_EXCLUDED"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:473,columnNumber:9},globalThis),jsxDevRuntimeExports.jsxDEV("group",{name:"#ITEMSANDGHOSTS",children:[jsxDevRuntimeExports.jsxDEV("group",{name:"#ITEMS",children:Object.keys(ee).map((Ge,Fe)=>jsxDevRuntimeExports.jsxDEV(Item,{scale:[1,1,1],onDragStartHandler:_e,onDragEndHandler:ve,onItemClickHandler:xe,itemKey:ee[Ge],position:ee[Ge].itemData.position,rotation:ee[Ge].itemData.rotation,itemIndex:Fe,proxyScene:ee[Ge].itemData.proxyScene,rejectFunc:Ue},Ge,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:477,columnNumber:15},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:475,columnNumber:11},globalThis),jsxDevRuntimeExports.jsxDEV(GhostManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:492,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:474,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:463,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV("group",{name:"#Parent_ColliderMesh",children:jsxDevRuntimeExports.jsxDEV("mesh",{ref:ie,visible:!1,enabled:!0,name:"#COLLIDER_MESH",children:jsxDevRuntimeExports.jsxDEV("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:502,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:496,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:495,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:462,columnNumber:5},globalThis)},EffectsComposer=({...a})=>{const[e,t]=reactExports.useState(10),n=sceneStore(o=>o.bbox),s=sceneStore(o=>o.sceneSettings);return reactExports.useEffect(()=>{if(!n||!n.isBox3){t(10);return}const o=new Vector3(0,0,0);let v=o.distanceTo(n.min)*2,A=o.distanceTo(n.max)*2,b=A>v?A:v;b!=1/0&&b!=-1/0&&(b+=5,t(b||10))},[n]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:s.contactShadowVisibility&&jsxDevRuntimeExports.jsxDEV(ContactShadows,{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 Hotspot({hotspotKey:a}){const e=attachmentStore$1(fe=>fe.attachmentSystem),t=hotspotStore$1(fe=>fe),n=hotspotStore$1(fe=>fe.activeHotspotData),s=itemStore(fe=>fe.lastDeletedItemData),o=ghostStore(fe=>fe.ghostData),v=hotspotStore$1(fe=>fe.actions),A=hotspotStore$1(fe=>fe.hotspotsVisibility),b=hotspotStore$1(fe=>fe.hotspotsTempVisibility),[T,ee]=reactExports.useState(null),[re,ie]=reactExports.useState(!1),se=reactExports.useRef(null),le=reactExports.useRef(null),pe=reactExports.useRef(null),de=reactExports.useCallback(fe=>{fe.includes(a.itemData.skuID+"_"+a.hotspotData.hotspotID)&&ie(!0)},[a]);return reactExports.useEffect(()=>de(t.visitedHotspotsID),[t,de]),reactExports.useEffect(()=>{ee(n?n.hotspotData.guid:null)},[n]),reactExports.useEffect(()=>{le.current&&(T===a.hotspotData.guid?le.current.parentNode.classList.add("topmostActive"):le.current.parentNode.classList.remove("topmostActive"))},[T]),reactExports.useEffect(()=>{se.current&&T===a.hotspotData.guid&&(se.current.style.opacity=1)},[T,se]),reactExports.useEffect(()=>{if(!(!pe.current&&!s)){var fe=e.currentStructure.getNodeByGUID(a.itemData.guid);fe?.ref&&(pe.current.parent=fe.ref)}},[pe,e,A,s]),jsxDevRuntimeExports.jsxDEV("group",{ref:pe,position:a.hotspotData.hotspotPointTransform,children:jsxDevRuntimeExports.jsxDEV(Html,{ref:le,zIndexRange:[6,0],style:A&&b&&!o?{opacity:"1",pointerEvents:"all",transition:"0.5s"}:{opacity:"0",pointerEvents:"none",transition:"0.5s"},children:jsxDevRuntimeExports.jsxDEV("button",{style:{display:a.hotspotData.visibleInScene==!1?"none":"block"},ref:se,className:T===a.hotspotData.guid?"hotspot hotspot-0 active":re?"hotspot hotspot-0 visited":"hotspot hotspot-0",onPointerEnter:fe=>{fe.stopPropagation(),se.current&&T!==a.hotspotData.guid&&(se.current.getClientRects()[0].left>sceneStore.getState().canvasSize.width/1.6?se.current.classList.add("left"):se.current.classList.remove("left")),le.current&&le.current.parentNode.classList.add("topmostHover")},onPointerLeave:fe=>{fe.stopPropagation(),le.current&&le.current.parentNode.classList.remove("topmostHover")},id:"hotspot3D_"+a.itemData.skuID+"_"+a.hotspotData.hotspotID,onClick:fe=>{if(fe.stopPropagation(),t.isAnyHotspotActive&&t.activeHotspotData.hotspotData.guid===a.hotspotData.guid){v.exitHotspot();return}v.clickHotspot(a.hotspotData.hotspotID,a.hotspotData.guid,a.itemData.guid)},children:[jsxDevRuntimeExports.jsxDEV("span",{className:"inner-circle"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:141,columnNumber:11},this),jsxDevRuntimeExports.jsxDEV("span",{className:"hotspot-annotation",children:a.hotspotData.title},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:142,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:87,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:78,columnNumber:7},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:77,columnNumber:5},this)}const HotspotManager=()=>{const a=hotspotStore$1(de=>de),e=hotspotStore$1(de=>de.hotspotsHealthCheck),t=itemStore(de=>de.lastDeletedItemData),n=hotspotStore$1(de=>de.hotspotsSpawned),s=itemStore(de=>de.itemsSpawned),o=hotspotStore$1(de=>de.activeHotspotData),[v,A]=reactExports.useState(null),{camera:b}=useThree(),T=reactExports.useRef(null),ee=reactExports.useCallback(()=>{const de=hotspotStore$1.getState().hotspotSpawnedForCategoryIDs,fe=attachmentStore$1.getState().attachmentSystem.globalGeometryVariants;Object.keys(s).map(_e=>{let ve=s[_e];if(!ve.hotspotsData)return;let xe=!1;Object.keys(n).map(De=>{const Le=n[De].hotspotData.geometryVariantID;if(Le){let Ue=!1;if(Object.keys(fe).map(Ge=>{Le==fe[Ge]&&(Ue=!0)}),Ue===!1){xe=!0;let Ge=[];Ge.push(n[De].hotspotData.categoryID);const Fe=new Set(Ge);filterArrWithCondition(de,Ye=>!Fe.has(Ye)),delete n[De]}}}),xe===!0&&(hotspotStore$1.setState({hotspotSpawned:{...n}}),hotspotStore$1.setState({hotspotSpawnedForCategoryIDs:de})),ve.hotspotsData.map(De=>{const Le=hotspotStore$1.getState().hotspotSpawnedForCategoryIDs;if(De.geometryVariantID){let Ue=!1;if(Object.keys(fe).map(Ge=>{De.geometryVariantID==fe[Ge]&&(Ue=!0)}),Ue===!1)return}De.categoryID!==""&&Le.includes(De.categoryID)||(ve.hotspotSpawned=!0,Le.push(De.categoryID),re(_e,De))})})},[s,n]),re=reactExports.useCallback((de,fe)=>{let _e=s[de].itemData.skuID+"_"+fe.hotspotID;n[_e]={itemData:{guid:de,...s[de].itemData},hotspotData:{guid:_e,...fe}},hotspotStore$1.setState({hotspotsSpawned:{...n}})},[s,a,n]);reactExports.useEffect(()=>{if(!t)return;if(t.hotspotSpawned){hotspotStore$1.getState().actions.removeHotspotForItem({...t});const fe=hotspotStore$1.getState().hotspotSpawnedForCategoryIDs;let _e=[];t.hotspotsData.map(xe=>{_e.push(xe.categoryID)});const ve=new Set(_e);filterArrWithCondition(fe,xe=>!ve.has(xe)),hotspotStore$1.setState({hotspotSpawnedForCategoryIDs:fe})}itemStore.setState({lastDeletedItemData:null});const de=attachmentStore$1.getState().attachmentSystem;de.currentStructure.removeNodeByGUID(t.itemData.guid),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,de.currentStructure.materialOverrideExists())},[t]);const{raycasterHotspot:ie,worldPos:se}=reactExports.useMemo(()=>({raycasterHotspot:new Raycaster,worldPos:new Vector3}),[]),le=(de,fe)=>{let _e=de;_e.sub(b.position);const ve=_e.length();ie.set(b.position,_e);const xe=ie.intersectObject(sceneStore.getState().sceneRef);if(xe.length>0&&xe[0].distance<ve){fe.style.opacity=.5;return}fe.style.opacity=v?.5:1};reactExports.useEffect(()=>{A(o?o.hotspotData.guid:null)},[o]);const pe=reactExports.useRef(0);return useFrame(()=>{if(T.current===null||T.current.children.length<=0)return;pe.current<T.current.children.length-1?pe.current+=1:pe.current=0;const de=Object.keys(n)[pe.current],fe="hotspot3D_"+n[de].itemData.skuID+"_"+n[de].hotspotData.hotspotID,_e=CORE_API.coreWCRef.shadowRootRef.getElementById(fe);v===de||_e===null||(T.current.children[pe.current].getWorldPosition(se),le(se,_e))},[]),reactExports.useEffect(()=>{ee()},[Object.keys(s).length,e]),a.hotspotsVisibility===!0&&jsxDevRuntimeExports.jsxDEV("group",{name:"#GRP_HotspotManager",ref:T,children:Object.keys(n).map(de=>jsxDevRuntimeExports.jsxDEV(Hotspot,{hotspotKey:n[de]},de,!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 objectTypes$3={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},lodash__objecttypes=objectTypes$3,objectTypes$2=lodash__objecttypes;function isObject$4(a){return!!(a&&objectTypes$2[typeof a])}var lodash_isobject=isObject$4,objectProto$1=Object.prototype,toString=objectProto$1.toString,reNative$4=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),lodash__renative=reNative$4,objectTypes$1=lodash__objecttypes,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,shimKeys$1=function(a){var e,t=a,n=[];if(!t||!objectTypes$1[typeof a])return n;for(e in t)hasOwnProperty.call(t,e)&&n.push(e);return n},lodash__shimkeys=shimKeys$1,isObject$3=lodash_isobject,reNative$3=lodash__renative,shimKeys=lodash__shimkeys,nativeKeys=reNative$3.test(nativeKeys=Object.keys)&&nativeKeys,keys$2=nativeKeys?function(a){return isObject$3(a)?nativeKeys(a):[]}:shimKeys,lodash_keys=keys$2;function noop$1(){}var lodash_noop=noop$1,isObject$2=lodash_isobject,reNative$2=lodash__renative,nativeCreate=reNative$2.test(nativeCreate=Object.create)&&nativeCreate;function baseCreate$2(a,e){return isObject$2(a)?nativeCreate(a):{}}nativeCreate||(baseCreate$2=function(){function a(){}return function(e){if(isObject$2(e)){a.prototype=e;var t=new a;a.prototype=null}return t||commonjsGlobal.Object()}}());var lodash__basecreate=baseCreate$2,noop=lodash_noop,reNative$1=lodash__renative,descriptor={configurable:!1,enumerable:!1,value:null,writable:!1},defineProperty=function(){try{var a={},e=reNative$1.test(e=Object.defineProperty)&&e,t=e(a,a,a)&&e}catch{}return t}(),setBindData$3=defineProperty?function(a,e){descriptor.value=e,defineProperty(a,"__bindData__",descriptor)}:noop,lodash__setbinddata=setBindData$3,baseCreate$1=lodash__basecreate,isObject$1=lodash_isobject,setBindData$2=lodash__setbinddata,arrayRef$2=[],push$2=arrayRef$2.push;function baseBind$1(a){var e=a[0],t=a[2],n=a[4];function s(){if(t){var o=t.slice();push$2.apply(o,arguments)}if(this instanceof s){var v=baseCreate$1(e.prototype),A=e.apply(v,o||arguments);return isObject$1(A)?A:v}return e.apply(n,o||arguments)}return setBindData$2(s,a),s}var lodash__basebind=baseBind$1;function slice$2(a,e,t){e||(e=0),typeof t>"u"&&(t=a?a.length:0);for(var n=-1,s=t-e||0,o=Array(s<0?0:s);++n<s;)o[n]=a[e+n];return o}var lodash__slice=slice$2,baseCreate=lodash__basecreate,isObject=lodash_isobject,setBindData$1=lodash__setbinddata,slice$1=lodash__slice,arrayRef$1=[],push$1=arrayRef$1.push;function baseCreateWrapper$1(a){var e=a[0],t=a[1],n=a[2],s=a[3],o=a[4],v=a[5],A=t&1,b=t&2,T=t&4,ee=t&8,re=e;function ie(){var se=A?o:this;if(n){var le=n.slice();push$1.apply(le,arguments)}if((s||T)&&(le||(le=slice$1(arguments)),s&&push$1.apply(le,s),T&&le.length<v))return t|=16,baseCreateWrapper$1([e,ee?t:t&-4,le,null,o,v]);if(le||(le=arguments),b&&(e=se[re]),this instanceof ie){se=baseCreate(e.prototype);var pe=e.apply(se,le);return isObject(pe)?pe:se}return e.apply(se,le)}return setBindData$1(ie,a),ie}var lodash__basecreatewrapper=baseCreateWrapper$1;function isFunction$1(a){return typeof a=="function"}var lodash_isfunction=isFunction$1,baseBind=lodash__basebind,baseCreateWrapper=lodash__basecreatewrapper,isFunction=lodash_isfunction,arrayRef=[],push=arrayRef.push;function createWrapper$1(a,e,t,n,s,o){var v=e&1,A=e&2,b=e&4,T=e&16,ee=e&32;if(!A&&!isFunction(a))throw new TypeError;T&&!t.length&&(e&=-17,T=t=!1),ee&&!n.length&&(e&=-33,ee=n=!1);var re=a&&a.__bindData__;if(re&&re!==!0)return re=re.slice(),v&&!(re[1]&1)&&(re[4]=s),!v&&re[1]&1&&(e|=8),b&&!(re[1]&4)&&(re[5]=o),T&&push.apply(re[2]||(re[2]=[]),t),ee&&push.apply(re[3]||(re[3]=[]),n),re[1]|=e,createWrapper$1.apply(null,re);var ie=e==1||e===17?baseBind:baseCreateWrapper;return ie([a,e,t,n,s,o])}var lodash__createwrapper=createWrapper$1,createWrapper=lodash__createwrapper,slice=lodash__slice;function bind$1(a,e){return arguments.length>2?createWrapper(a,17,slice(arguments,2),null,e):createWrapper(a,1,null,null,e)}var lodash_bind=bind$1;function identity$1(a){return a}var lodash_identity=identity$1,reNative=lodash__renative,reThis$1=/\bthis\b/,support$1={};support$1.funcDecomp=!reNative.test(commonjsGlobal.WinRTError)&&reThis$1.test(function(){return this});support$1.funcNames=typeof Function.name=="string";var lodash_support=support$1,bind=lodash_bind,identity=lodash_identity,setBindData=lodash__setbinddata,support=lodash_support,reFuncName=/^\s*function[ \n\r\t]+\w/,reThis=/\bthis\b/,fnToString=Function.prototype.toString;function baseCreateCallback$2(a,e,t){if(typeof a!="function")return identity;if(typeof e>"u"||!("prototype"in a))return a;var n=a.__bindData__;if(typeof n>"u"&&(support.funcNames&&(n=!a.name),n=n||!support.funcDecomp,!n)){var s=fnToString.call(a);support.funcNames||(n=!reFuncName.test(s)),n||(n=reThis.test(s),setBindData(a,n))}if(n===!1||n!==!0&&n[1]&1)return a;switch(t){case 1:return function(o){return a.call(e,o)};case 2:return function(o,v){return a.call(e,o,v)};case 3:return function(o,v,A){return a.call(e,o,v,A)};case 4:return function(o,v,A,b){return a.call(e,o,v,A,b)}}return bind(a,e)}var lodash__basecreatecallback=baseCreateCallback$2,baseCreateCallback$1=lodash__basecreatecallback,keys$1=lodash_keys,objectTypes=lodash__objecttypes,forOwn$1=function(a,e,t){var n,s=a,o=s;if(!s||!objectTypes[typeof s])return o;e=e&&typeof t>"u"?e:baseCreateCallback$1(e,t,3);for(var v=-1,A=objectTypes[typeof s]&&keys$1(s),b=A?A.length:0;++v<b;)if(n=A[v],e(s[n],n,a)===!1)return o;return o},lodash_forown=forOwn$1,baseCreateCallback=lodash__basecreatecallback,forOwn=lodash_forown;function forEach(a,e,t){var n=-1,s=a?a.length:0;if(e=e&&typeof t>"u"?e:baseCreateCallback(e,t,3),typeof s=="number")for(;++n<s&&e(a[n],n,a)!==!1;);else forOwn(a,e);return a}var lodash_foreach=forEach,metric$b,imperial$9;metric$b={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}};imperial$9={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 length={metric:metric$b,imperial:imperial$9,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},metric$a,imperial$8;metric$a={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}};imperial$8={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 area={metric:metric$a,imperial:imperial$8,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},metric$9,imperial$7;metric$9={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}};imperial$7={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 mass={metric:metric$9,imperial:imperial$7,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},metric$8,imperial$6;metric$8={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}};imperial$6={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 volume={metric:metric$8,imperial:imperial$6,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},metric$7;metric$7={ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}};var each$1={metric:metric$7,imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},metric$6,imperial$5;metric$6={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}};imperial$5={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 temperature={metric:metric$6,imperial:imperial$5,_anchors:{metric:{unit:"C",transform:function(a){return a/(5/9)+32}},imperial:{unit:"F",transform:function(a){return(a-32)*(5/9)}}}},time,daysInYear=365.25;time={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*daysInYear/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:60*60*24*daysInYear}};var time_1={metric:time,_anchors:{metric:{unit:"s",ratio:1}}},bits,bytes;bits={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}};bytes={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 digital={bits,bytes,_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},metric$5;metric$5={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 partsPer={metric:metric$5,imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},metric$4,imperial$4;metric$4={"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}};imperial$4={"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 speed={metric:metric$4,imperial:imperial$4,_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},metric$3,imperial$3;metric$3={"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}};imperial$3={"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 pace={metric:metric$3,imperial:imperial$3,_anchors:{metric:{unit:"s/m",ratio:.3048},imperial:{unit:"s/ft",ratio:1/.3048}}},metric$2,imperial$2;metric$2={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}};imperial$2={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 pressure={metric:metric$2,imperial:imperial$2,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},current;current={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 current_1={metric:current,_anchors:{metric:{unit:"A",ratio:1}}},voltage;voltage={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 voltage_1={metric:voltage,_anchors:{metric:{unit:"V",ratio:1}}},power;power={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 power_1={metric:power,_anchors:{metric:{unit:"W",ratio:1}}},reactivePower;reactivePower={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 reactivePower_1={metric:reactivePower,_anchors:{metric:{unit:"VAR",ratio:1}}},apparentPower;apparentPower={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 apparentPower_1={metric:apparentPower,_anchors:{metric:{unit:"VA",ratio:1}}},energy;energy={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 energy_1={metric:energy,_anchors:{metric:{unit:"J",ratio:1}}},reactiveEnergy;reactiveEnergy={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 reactiveEnergy_1={metric:reactiveEnergy,_anchors:{metric:{unit:"VARh",ratio:1}}},metric$1,imperial$1;metric$1={"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}};imperial$1={"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 volumeFlowRate={metric:metric$1,imperial:imperial$1,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},metric,imperial;metric={lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}};imperial={"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}};var illuminance={metric,imperial,_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},frequency;frequency={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 frequency_1={metric:frequency,_anchors:{frequency:{unit:"hz",ratio:1}}},angle;angle={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 angle_1={metric:angle,_anchors:{metric:{unit:"deg",ratio:1}}},convert,keys=lodash_keys,each=lodash_foreach,measures={length,area,mass,volume,each:each$1,temperature,time:time_1,digital,partsPer,speed,pace,pressure,current:current_1,voltage:voltage_1,power:power_1,reactivePower:reactivePower_1,apparentPower:apparentPower_1,energy:energy_1,reactiveEnergy:reactiveEnergy_1,volumeFlowRate,illuminance,frequency:frequency_1,angle:angle_1},Converter;Converter=function(a,e){e?this.val=a/e:this.val=a};Converter.prototype.from=function(a){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(a),this.origin||this.throwUnsupportedUnitError(a),this};Converter.prototype.to=function(a){if(!this.origin)throw new Error(".to must be called after .from");this.destination=this.getUnit(a);var e,t;if(this.destination||this.throwUnsupportedUnitError(a),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=measures[this.origin.measure]._anchors[this.origin.system].transform,typeof t=="function"?e=t(e):e*=measures[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};Converter.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 each(this.possibilities(),function(n){var s=this.describe(n),o=e.exclude.indexOf(n)===-1;if(o&&s.system===this.origin.system){var v=this.to(n);(!t||v>=e.cutOffNumber&&v<t.val)&&(t={val:v,unit:n,singular:s.singular,plural:s.plural})}}.bind(this)),t};Converter.prototype.getUnit=function(a){var e;return each(measures,function(t,n){if(each(t,function(s,o){if(o=="_anchors"||(each(s,function(v,A){if(A==a)return e={abbr:a,measure:n,system:o,unit:v},!1}),e))return!1}),e)return!1}),e};var describe=function(a){return{abbr:a.abbr,measure:a.measure,system:a.system,singular:a.unit.name.singular,plural:a.unit.name.plural}};Converter.prototype.describe=function(a){var e=Converter.prototype.getUnit(a),t=null;try{t=describe(e)}catch{this.throwUnsupportedUnitError(a)}return t};Converter.prototype.list=function(a){var e=[];return each(measures,function(t,n){a&&a!==n||each(t,function(s,o){if(o=="_anchors")return!1;each(s,function(v,A){e=e.concat(describe({abbr:A,measure:n,system:o,unit:v}))})})}),e};Converter.prototype.throwUnsupportedUnitError=function(a){var e=[];throw each(measures,function(t,n){each(t,function(s,o){if(o=="_anchors")return!1;e=e.concat(keys(s))})}),new Error("Unsupported unit "+a+", use one of: "+e.join(", "))};Converter.prototype.possibilities=function(a){var e=[];return!this.origin&&!a?each(keys(measures),function(t){each(measures[t],function(n,s){if(s=="_anchors")return!1;e=e.concat(keys(n))})}):(a=a||this.origin.measure,each(measures[a],function(t,n){if(n=="_anchors")return!1;e=e.concat(keys(t))})),e};Converter.prototype.measures=function(){return keys(measures)};convert=function(a){return new Converter(a)};var lib=convert;const convert$1=getDefaultExportFromCjs(lib),DimensionsManager=()=>{const a=itemStore(le=>le.itemsSpawned),e=sceneStore(le=>le.showDimensions),t=sceneStore(le=>le.sceneSettings),n=sceneStore(le=>le.boundData),s=sceneStore(le=>le.sceneSettings.sceneScaleUnit),o=sceneStore(le=>le.sceneSettings.sceneScaleDisplayUnit),[v,A]=reactExports.useState(.2),[b,T]=reactExports.useState("#000000"),[ee,re]=reactExports.useState(.01),ie=reactExports.useRef(null);reactExports.useRef(null);const se=reactExports.useRef(0);return reactExports.useEffect(()=>{if(t==null)return;const le=t.dimensionColor,pe=rgbToHex(le.r,le.g,le.b);T(pe)},[t]),reactExports.useEffect(()=>{if(t==null)return;const le=t.dimensionColor,pe=rgbToHex(le.r,le.g,le.b);T(pe)},[t]),reactExports.useEffect(()=>{if(!n||!n.size)return;let le=n.size.x;le>n.size.z&&(le=n.size.z);let pe=le/20;re(pe<.005?pe:.005),A(le<.2?le:.2)},[n]),reactExports.useEffect(()=>{se.current=0},[e]),useFrame(()=>{ie.current!==null&&se.current<1&&(se.current+=.05,ie.current.scale.x=se.current,ie.current.scale.y=se.current,ie.current.scale.z=se.current)}),e===!0&&jsxDevRuntimeExports.jsxDEV("group",{ref:ie,children:n!==null&&n.size.x!==0&&n.size.y!==0&&n.size.z!==0&&Object.keys(a).length>0&&jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[n.center.x,n.center.y-n.size.y/2,n.center.z+n.size.z/2+v],rotation:[0,0,degToRad(90)],scale:[ee,n.size.x,ee],visible:!0,children:[jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,.5,0],scale:[1,ee,7],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,-.5,0],scale:[1,ee,7],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:116,columnNumber:17},globalThis),jsxDevRuntimeExports.jsxDEV(Html,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[convert$1(n.size.x).from("m").to(s).toFixed(t.measurementPrecision),o??s]},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[n.center.x-n.size.x/2-v,n.center.y,n.center.z+n.size.z/2+v],rotation:[0,0,0],scale:[ee,n.size.y,ee],visible:!0,children:[jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,.5,0],scale:[1,ee,7],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,-.5,0],scale:[1,ee,7],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:161,columnNumber:17},globalThis),jsxDevRuntimeExports.jsxDEV(Html,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[convert$1(n.size.y).from("m").to(s).toFixed(t.measurementPrecision),o??s]},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[n.center.x+n.size.x/2+v,n.center.y-n.size.y/2,n.center.z],rotation:[degToRad(90),0,0],scale:[ee,n.size.z,ee],visible:!0,children:[jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,.5,0],scale:[7,ee,1],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,-.5,0],scale:[7,ee,1],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:206,columnNumber:17},globalThis),jsxDevRuntimeExports.jsxDEV(Html,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[convert$1(n.size.z).from("m").to(s).toFixed(t.measurementPrecision),o??s]},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)},BaseScene=({...a})=>jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV(HotspotManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:11,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(DimensionsManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:12,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(ItemManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:13,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(EffectsComposer,{},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),CameraManager=()=>{const a=reactExports.useRef(null),e=itemStore(le=>le.itemsSpawned),t=hotspotStore$1(le=>le.isAnyHotspotActive),n=cameraStore(le=>le.canCameraRotate),s=cameraStore(le=>le.cameraSettings),o=cameraStore(le=>le.disableAutoRotate),v=sceneStore(le=>le.autoFocusTrigger),A=sceneStore(le=>le.dragging),b=cameraStore(le=>le.sendCameraDetailsTrigger),T=cameraStore(le=>le.focusPointPosition),ee=cameraStore(le=>le.viewPointPosition),{camera:re}=useThree(),ie=ghostStore(le=>le.ghostsTransform),se=()=>{if(a.current===null)return;const pe=1/a.current._lastZoom,de=cameraStore.getState().boundsMargin,fe=sceneStore.getState().autoFocusRef,_e=sceneStore.getState().sceneRef.getObjectByName("#ITEMSANDGHOSTS"),ve=fe||_e,xe=new Box3().setFromObject(ve);fe||sceneStore.setState({bbox:xe});const De=new Vector3;if(xe.getSize(De),De.x>0){const Le=new Vector3;xe.getCenter(Le);const Ue=new Vector3(xe.max.x,xe.max.y,xe.max.z);Ue.sub(xe.min),sceneStore.setState({boundData:{center:Le,size:Ue}}),a.current.setBoundary(xe);const Ge=new Box3(xe.min,xe.max);Ge.min=new Vector3((Ge.min.x-de/2)*pe,(Ge.min.y-de/2)*pe,(Ge.min.z-de/2)*pe),Ge.max=new Vector3((Ge.max.x+de/2)*pe,(Ge.max.y+de/2)*pe,(Ge.max.z+de/2)*pe);const Fe=Ge.getBoundingSphere(new Sphere(Le));Fe.radius>0&&a.current.fitToSphere(Fe,!0)}else{const Le=new Vector3(0,0,0),Ue=new Vector3(0,0,0);sceneStore.setState({boundData:{center:Le,size:Ue}})}a.current.zoomTo(1,!0)};return reactExports.useEffect(()=>{se()},[v,Object.keys(e).length]),reactExports.useEffect(()=>{CORE_API!=null&&(sceneStore.getState().sceneSettings.focusCameraOnGhosts===!0?CORE_API.focusOnGhosts():CORE_API.refocus())},[ie]),reactExports.useEffect(()=>{const le=cameraStore.getState().savedState,pe=cameraStore.getState().resetToLastPosition;if(t===!1){le===!0&&(pe===!0?a.current.reset(!0):cameraStore.setState({resetToLastPosition:!0}),cameraStore.setState({savedState:!1}));return}le===!1&&pe===!0&&(a.current.saveState(),cameraStore.setState({savedState:!0})),a.current.setLookAt(ee.x,ee.y,ee.z,T.x,T.y,T.z,!0)},[t,ee,T]),reactExports.useEffect(()=>{CORE_API.fireEvent(CORE_API.EVENTS.CONFIGURATION.CameraDetails_Update,re)},[b]),useFrame(le=>{s.canAutoRotate===!1||a.current===null||o===!1&&t===!1&&(a.current.azimuthAngle+=20*le*MathUtils.DEG2RAD*s.autoRotateSpeed)}),reactExports.useEffect(()=>{a.current!==null&&(n===!0?(a.current.mouseButtons.left=CAMERA_ACTION.ROTATE,a.current.touches.one=CAMERA_ACTION.TOUCH_ROTATE):(a.current.mouseButtons.left=CAMERA_ACTION.NONE,a.current.touches.one=CAMERA_ACTION.NONE),s.canZoom===!0&&A===!1?(a.current.mouseButtons.wheel=CAMERA_ACTION.ZOOM,a.current.mouseButtons.middle=CAMERA_ACTION.ZOOM):(a.current.mouseButtons.wheel=CAMERA_ACTION.NONE,a.current.mouseButtons.middle=CAMERA_ACTION.NONE),s.canPan===!0&&A===!1?(a.current.mouseButtons.right=CAMERA_ACTION.OFFSET,s.canZoom===!0&&A===!1?(a.current.touches.two=CAMERA_ACTION.TOUCH_ZOOM_OFFSET,a.current.touches.three=CAMERA_ACTION.TOUCH_ZOOM_OFFSET):(a.current.touches.two=CAMERA_ACTION.TOUCH_OFFSET,a.current.touches.three=CAMERA_ACTION.TOUCH_OFFSET)):(a.current.mouseButtons.right=CAMERA_ACTION.NONE,s.canZoom===!0&&A===!1?(a.current.touches.two=CAMERA_ACTION.TOUCH_ZOOM,a.current.touches.three=CAMERA_ACTION.TOUCH_ZOOM):(a.current.touches.two=CAMERA_ACTION.NONE,a.current.touches.three=CAMERA_ACTION.NONE)))},[a,s,A,n]),reactExports.useEffect(()=>{if(a.current===null)return;re.fov=s.fov,re.updateProjectionMatrix();const le=()=>{a.current.removeEventListener("rest",le),cameraStore.setState({userDragging:!1,disableAutoRotate:!1})};a.current.addEventListener("controlstart",()=>{hotspotStore$1.getState().isAnyHotspotActive&&hotspotStore$1.getState().actions.exitHotspot(),a.current.removeEventListener("rest",le),cameraStore.setState({userDragging:!0,disableAutoRotate:!0})}),a.current.addEventListener("controlend",()=>{a.current.active?a.current.addEventListener("rest",le):le()}),a.current.addEventListener("transitionstart",()=>{cameraStore.getState().userDragging!==!0&&(cameraStore.setState({disableAutoRotate:!0}),a.current.addEventListener("rest",le))})},[a]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:jsxDevRuntimeExports.jsxDEV(CameraControls,{ref:a,makeDefault:!0,dollySpeed:s.dollySpeed,truckSpeed:s.truckSpeed,minZoom:s.minZoom,maxZoom:s.maxZoom,minPolarAngle:t?-Math.PI:degToRad(s.minPolarAngle),maxPolarAngle:t?Math.PI:degToRad(s.maxPolarAngle)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/CameraManager.js",lineNumber:234,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/CameraManager.js",lineNumber:233,columnNumber:5},globalThis)},Root=()=>{const a=useThree(e=>e.gl);return reactExports.useEffect(()=>{sceneStore.setState({glContext:a})},[]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV(BaseScene,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:16,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(CameraManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:17,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(LightManager,{},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)},Alert=({handleCloseAlert:a,alertData:e})=>{const t=reactExports.useRef(null),n=reactExports.useRef(null),s=reactExports.useRef(null),o=()=>{clearTimeout(t.current),s.current.style="",n.current.style="",a()};return reactExports.useEffect(()=>{if(s.current===null||n.current===null)return;const v=e.alertTime?e.alertTime:1e3;s.current.style="animation: loader "+v+"ms; animation-timing-function: linear;",n.current.style="animation: loader "+v+"ms; animation-timing-function: linear;",t.current=setTimeout(o,v)},[s,n,e]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-bg ".concat(ALERT_TYPES[e.alertType].cssClass),children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-icon-bg ".concat(ALERT_TYPES[e.alertType].cssClass),children:jsxDevRuntimeExports.jsxDEV("img",{src:ALERT_TYPES[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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-msg-cross-timer-bg",children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-msg-cross-bg",children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-msg-bg",style:e.alertLabel?{}:{display:"flex",alignItems:"center"},children:[e.alertLabel&&jsxDevRuntimeExports.jsxDEV("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),jsxDevRuntimeExports.jsxDEV("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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-close-btn-bg",children:jsxDevRuntimeExports.jsxDEV("img",{onClick:o,className:"alert-cross-btn",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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),jsxDevRuntimeExports.jsxDEV("div",{ref:n,className:"alert-timer ".concat(ALERT_TYPES[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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-bg alert-mobile ".concat(ALERT_TYPES[e.alertType].cssClass),children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-icon-msg-cross-bg",children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-icon-bg ".concat(ALERT_TYPES[e.alertType].cssClass),children:jsxDevRuntimeExports.jsxDEV("img",{src:ALERT_TYPES[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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-msg-bg",children:[e.alertLabel&&jsxDevRuntimeExports.jsxDEV("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),jsxDevRuntimeExports.jsxDEV("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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-close-btn-bg",children:jsxDevRuntimeExports.jsxDEV("img",{onClick:o,className:"alert-cross-btn",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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),jsxDevRuntimeExports.jsxDEV("div",{ref:s,className:"alert-timer ".concat(ALERT_TYPES[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)},AlertManager=()=>{const[a,e]=reactExports.useState(null),t=sceneStore(A=>A.alertData),n=sceneStore(A=>A.persistantAlertData);reactExports.useEffect(()=>{!t||!t.alertMsg||s(t)},[t]),reactExports.useEffect(()=>{const A=sceneStore.getState().alertQueue;A.length<=0||(a===null&&(e(A[0]),A[0].persistant===!0&&sceneStore.setState({persistantAlertData:A[0]})),sceneStore.getState().actions.popFromAlertQueue())},[a]);const s=reactExports.useCallback(A=>{if(sceneStore.getState().sceneSettings.disableAlerts===!0)return;let b=A.alertType,T=A.alertId;const ee=sceneStore.getState().sceneSettings.alertControl;let re=!1;Object.keys(ee).map(le=>{le==T&&(re=!0)}),re==!1&&(T="default");let ie=!1;if(Object.keys(ALERT_TYPES).map(le=>{le==b.toLowerCase()&&(ie=!0)}),ie==!1&&(b=ALERT_TYPES.info.id,A.alertType=b),ALERT_TYPES[A.alertType].level<sceneStore.getState().sceneSettings.alertLevel||sceneStore.getState().sceneSettings.alertControl[T]!==!0)return;const se=sceneStore.getState().actions.addToAlertQueue(A);a===null&&se.length===1&&(e(A),A.persistant===!0&&sceneStore.setState({persistantAlertData:A}))},[a]),o=reactExports.useCallback(()=>{e(n)},[n]),v=reactExports.useCallback(async()=>{e(null)},[]);return reactExports.useEffect(()=>{async function A(){await wait(1500);let b=null,T={alertMsg:"Add items by selecting from the panel",alertMsg_Mobile:"Add items by selecting from the panel",alertTime:8e3,alertType:"info",alertLabel:"Get Started"};sceneStore.getState().alertSettings&&(sceneStore.getState().alertSettings.welcomeMessage&&(b=sceneStore.getState().alertSettings.welcomeMessage),sceneStore.getState().alertSettings.instructionMessage&&(T=sceneStore.getState().alertSettings.instructionMessage)),b!==null&&s(b),s(T)}A()},[]),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-space",children:[a===null&&n&&jsxDevRuntimeExports.jsxDEV("div",{onClick:o,className:"alert-persistant-btn-bg",style:{background:ALERT_TYPES[n.alertType].background,border:"1px solid "+ALERT_TYPES[n.alertType].color},children:jsxDevRuntimeExports.jsxDEV("img",{style:{filter:ALERT_TYPES[n.alertType].filter},className:"alert-persistant-btn",src:ALERT_TYPES[n.alertType].src},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:155,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:146,columnNumber:9},globalThis),a&&jsxDevRuntimeExports.jsxDEV(Alert,{handleCloseAlert:v,alertData:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:165,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:144,columnNumber:5},globalThis)},OverlayUIManager=()=>{const a=sceneStore(n=>n.canvasTooltipText),e=sceneStore(n=>n.sceneSettings),t=ghostStore(n=>n.ghostData);return jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:jsxDevRuntimeExports.jsxDEV("div",{children:[jsxDevRuntimeExports.jsxDEV(AlertManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:16,columnNumber:9},globalThis),CORE_API.getSceneItemCount()<=0&&!t&&jsxDevRuntimeExports.jsxDEV("div",{style:{fontSize:e.emptySceneTextFontSize},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),jsxDevRuntimeExports.jsxDEV("div",{className:"canvasTooltip",children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:27,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 getPlugAttributesFromObject(a){let e={};if(a.type.toLowerCase()==="object3d"){const t=a.userData;if(t?.isPlug===1){const n=t.name;n&&typeof n=="string"&&(e.name=n);const s=t.type;s&&typeof s=="string"?e.type=s:e.type="";const o=t.weight;o&&typeof o=="number"?e.weight=o:e.weight=1;const v=t.affectedNodes;v&&typeof v=="string"?e.affectedNodes=v.replaceAll(" ","").split(","):e.affectedNodes=[];const A=t.acceptedPlugTypes;A&&typeof A=="string"?e.acceptedPlugTypes=A.replaceAll(" ","").split(","):e.acceptedPlugTypes=[];const b=t.connectsToPlugTypes;b&&typeof b=="string"?e.connectsToPlugTypes=b.replaceAll(" ","").split(","):e.connectsToPlugTypes=[];const T=t.dependencySku;T&&typeof T=="string"?e.dependencySku=T:e.dependencySku="";const ee=t.isDependencySkuInteractive;T!==void 0&&typeof ee=="number"?e.isDependencySkuInteractive=ee:e.isDependencySkuInteractive=1}}return e}async function loadAllProxies(a){const e=assetStore.getState().actions;for(let t=0;t<Object.keys(a).length;t++){const n=Object.keys(a)[t];LOGGER.info({title:"loading proxy: "+n});const s=performance.now(),o=await e.loadAsset(n,!0),v=performance.now();if(LOGGER.info({title:`${n} proxy: ${((v-s)/1e3).toFixed(2)} seconds to load.`}),LOGGER.info({title:"loaded proxy: "+n}),LOGGER.info({title:"waitingForAsset",details:o}),!o||!o.proxy.data)continue;const A=a[n]?.plugs,b=A===void 0||Array.isArray(A)&&A.length===0;b===!0&&LOGGER.info({title:`Collecting plugs information for ${n} from the proxy mesh`});let T=[];o.proxy.data.scene.traverse(ie=>{if(b===!0){const se=getPlugAttributesFromObject(ie);Object.keys(se).length>0&&T.push(se)}if(ie.isMesh){ie.material.color=new Color$1(0/255,0/255,0/255);const se=sceneStore.getState().sceneSettings.ghostColor;ie.material.emissive=new Color$1(se.r/255,se.g/255,se.b/255),ie.material.emissiveIntensity=.75,ie.material.alphaTest=se.a,ie.material.transparent=!0,ie.material.opacity=se.a,ie.material.depthTest=!1,ie.material.reflectivity=0,ie.material.metalness=0,ie.material.wireframe=sceneStore.getState().sceneSettings.ghostAsWireframe}}),T.length>0&&(a[n].plugs=T);const{boundingBox:ee,boundingSphere:re}=computeProxyBoundingBox(o);if(ee&&re){const ie=calculateBoundingBoxSize(ee);a[n].boundingBox=ee,a[n].boundingSphereCenter=re.center,a[n].boundingBoxSize=ie}else a[n].boundingSphereCenter={x:0,y:0,z:0},a[n].boundingBoxSize={x:0,y:0,z:0}}}function calculateBoundingBoxSize(a){return{x:a.max.x-a.min.x,y:a.max.y-a.min.y,z:a.max.z-a.min.z}}function computeProxyBoundingBox(a){const e=a.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 AlertStyles=`.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}}
9149
+ `),Pn.fragmentShader=Pn.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const ar=new ShaderMaterial(HorizontalBlurShader),Dr=new ShaderMaterial(VerticalBlurShader);return Dr.depthTest=ar.depthTest=!1,[sn,lr,zn,hr,ar,Dr,Ur]},[b,n,s,a,ee]),Ye=sn=>{Le.visible=!0,Le.material=Ue,Ue.uniforms.tDiffuse.value=ve.texture,Ue.uniforms.h.value=sn*1/256,fe.setRenderTarget(Fe),fe.render(Le,_e.current),Le.material=Ge,Ge.uniforms.tDiffuse.value=Fe.texture,Ge.uniforms.v.value=sn*1/256,fe.setRenderTarget(ve),fe.render(Le,_e.current),Le.visible=!1};let rn=0,yn,bt;return useFrame(()=>{_e.current&&(e===1/0||rn<e)&&(rn++,yn=de.background,bt=de.overrideMaterial,pe.current.visible=!1,de.background=null,de.overrideMaterial=De,fe.setRenderTarget(ve),fe.render(de,_e.current),Ye(o),T&&Ye(o*.4),fe.setRenderTarget(null),pe.current.visible=!0,de.overrideMaterial=bt,de.background=yn)}),reactExports.useImperativeHandle(le,()=>pe.current,[]),reactExports.createElement("group",_extends$1({"rotation-x":Math.PI/2},se,{ref:pe}),reactExports.createElement("mesh",{renderOrder:ie,geometry:xe,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},reactExports.createElement("meshBasicMaterial",{transparent:!0,map:ve.texture,opacity:t,depthWrite:re})),reactExports.createElement("orthographicCamera",{ref:_e,args:[-n/2,n/2,s/2,-s/2,v,A]}))}),LightManager=()=>{const[a,e]=reactExports.useState(!1),t=productDataStore$1(v=>v),n=lightStore(v=>v),[s,o]=reactExports.useState(1);return reactExports.useEffect(()=>{const v=t.assetsData,A=v?.sceneMoodSettings?.envMap;A&&(lightStore.setState({defaultEnvMapUrl:A}),n.actions.setEnvLightMap(A)),n.envMapUrl===""&&n.actions.setEnvLightMap(lightStore.getState().defaultEnvMapUrl);const b=v?.sceneMoodSettings?.ambientLightIntensity;b!==void 0&&o(b),e(!0)},[]),reactExports.useEffect(()=>{a!==!1&&(LOGGER.groupCollapsed("SCENE LIGHTING INFO:"),LOGGER.table({title:"Scene Lights",details:{"Environment Map":n.envMapUrl,"Ambient Light Intensity":s}}),LOGGER.groupEnd())},[a]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:a===!0&&jsxDevRuntimeExports.jsxDEV("group",{name:"GRP_LIGHTS",children:[jsxDevRuntimeExports.jsxDEV("ambientLight",{intensity:s},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/LightManager.js",lineNumber:70,columnNumber:11},globalThis),jsxDevRuntimeExports.jsxDEV(Environment,{background:!1,files:CORE_API.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 Draggable({children:a,guid:e,onDragStartHandler:t,onDragEndHandler:n,onItemClickHandler:s,onPointerEnter:o,onPointerLeave:v,dragging:A=!1,intersectingGhostObject:b=null,isInteractive:T=!0,initialIntersectedGhostUUID:ee=null,isSnapAllowed:re=!1,...ie}){const se=reactExports.useRef(),le=reactExports.useRef(-1),pe=reactExports.useRef([]),de=reactExports.useRef([]),{raycaster:fe,size:_e,camera:ve}=useThree(),xe=hotspotStore$1(Dr=>Dr.isAnyHotspotActive),De=sceneStore(Dr=>Dr.multipleTouchDetected),[Le,Ue]=reactExports.useState(null),{raycasterGhost:Ge}=reactExports.useMemo(()=>({raycasterGhost:new Raycaster})),Fe=Dr=>{let Pn;return Dr.isGhost===!0?Pn=Dr:Dr.parent?Dr.parent.isGhost===!0?Pn=Dr.parent:Pn=Fe(Dr.parent):Pn=null,Pn},Ye=Dr=>{Ge.setFromCamera(Dr,ve);const Pn=Ge.intersectObject(ghostStore.getState().ghostParentRef);let si=null;return Pn.length>0&&(si=Fe(Pn[0].object)),si},rn=Dr=>{let Pn=Dr.whichNodesAreAttachedToUs();return Pn.map(si=>{rn(si).map(Ra=>{Pn.push(Ra)})}),Pn},{initialMouse2D:yn,mouse2D:bt,mouse3D:sn,offset:Ur,normal:lr,plane:hr,pointerDownPos:zn}=reactExports.useMemo(()=>({initialMouse2D:new Vector2,mouse2D:new Vector2,mouse3D:new Vector3,offset:new Vector3,normal:new Vector3,plane:new Plane,pointerDownPos:new Vector2}),[]);reactExports.useEffect(()=>{let Dr=attachmentStore$1.getState().attachmentSystem.currentStructure.getNodeByGUID(e);Ue(Dr)},[]);const ar=useGesture({onPointerEnter:Dr=>{De||sceneStore.getState().sceneSettings.disableDragDrop&&sceneStore.getState().sceneSettings.disableContextMenu||sceneStore.getState().itemDraggedSkuID||sceneStore.getState().cameraActive!==!0&&!sceneStore.getState().dragging&&!xe&&(Le&&!Le.isEndNode?CORE_API.switchCursor(CURSORS.POINTER):CORE_API.switchCursor(CURSORS.GRAB),o(Dr.event))},onPointerLeave:Dr=>{De||sceneStore.getState().sceneSettings.disableDragDrop&&sceneStore.getState().sceneSettings.disableContextMenu||sceneStore.getState().itemDraggedSkuID||sceneStore.getState().cameraActive!==!0&&!sceneStore.getState().dragging&&!xe&&(CORE_API.switchCursor(CURSORS.GRAB),v(Dr.event))},onClick:Dr=>{if(Dr.event.stopPropagation(),!De){if(sceneStore.getState().builderMode){const{eventObject:Pn,point:si}=Dr.event;Pn.getWorldPosition(Ur).sub(si),sn.copy(si);const ea=Dr.event.offsetX,Ra=Dr.event.offsetY,as=ea/_e.width*2-1,ua=-Ra/_e.height*2+1;bt.set(as,ua);const ho=new Raycaster;ho.setFromCamera(bt,ve);const tl=ho.intersectObject(sceneStore.getState().sceneRef.getObjectByName("proxyGeometry"));tl.length>0&&CORE_API.fireEvent(CORE_API.EVENTS.CONFIGURATION.OnClickItem,{point:tl[0].point,camera:ho.camera})}if(!sceneStore.getState().sceneSettings.disableContextMenu)if(!Dr.dragging&&!xe){if(Math.abs(Dr.event.x-zn.x)>1)return;s(Dr.event.offsetX,Dr.event.offsetY,e)}else hotspotStore$1.getState().actions.exitHotspot(!0)}},onDrag:async Dr=>{if(sceneStore.getState().simulateDragEnd===!0||sceneStore.getState().dragging&&sceneStore.getState().draggingItemGUID!==Le.guid||sceneStore.getState().sceneSettings.disableDragDrop)return;const Pn=Dr.event;if(Pn.stopPropagation(),xe){CORE_API.switchCursor(CURSORS.BLOCKED);return}if(itemStore.getState().selectedItemData){CORE_API.switchCursor(CURSORS.BLOCKED);return}if(Object.keys(itemStore.getState().itemsSpawned).length<2){CORE_API.switchCursor(CURSORS.BLOCKED);return}const ea=Dr.event.offsetX,Ra=Dr.event.offsetY;if(!sceneStore.getState().dragging){if(itemStore.setState({busy:!0}),Math.abs(Pn.x-zn.x)<=1)return;if(Le&&!Le.canDrag){CORE_API.switchCursor(CURSORS.BLOCKED);return}const _c=Le.whichPlugAreWeAttachedUsing().attachedPlug.guid;let Al=Le.swapRoot();Al||(Al={rootDetachedPlugs:Le.detachNodeFromReceiver()}),pe.current=rn(Le),de.current=[],pe.current.map(kc=>{de.current.push(kc.guid),Le.ref.attach(kc.ref)}),CORE_API.switchCursor(CURSORS.MOVE),sceneStore.setState({dragging:!0}),sceneStore.setState({draggingItemGUID:Le.guid}),re=!1,b=null,ee=null,le.current=-1;const da=ea/_e.width*2-1,ul=-Ra/_e.height*2+1;yn.set(da,ul);const nl=await t({guid:e,node:Le,detachedData:Al,attachedChildrenGuids:de.current});if(nl.length<=0||nl.transforms===void 0)return;nl.transforms.map((kc,gl)=>{kc.receiverPlugGUID===_c&&(le.current=gl)})}const as=ea/_e.width*2-1,ua=-Ra/_e.height*2+1;bt.set(as,ua),fe.setFromCamera(bt,ve),ve.getWorldDirection(lr).negate(),hr.setFromNormalAndCoplanarPoint(lr,sn),fe.ray.intersectPlane(hr,sn);const ho=ghostStore.getState().ghostParentRef;ho.children.length>0&&(b=Ye(bt),ee===null&&le.current!==-1&&le.current<ho.children.length&&ho.children[le.current]!==void 0&&(ee=ho.children[le.current].children[0].uuid),b&&ee!==null&&ee!==b.uuid&&!re&&(re=!0),!re&&!b&&(re=!0)),b&&re?(ghostStore.setState({ghostVisibility:!1}),Le.ref.position.set(b.position.x,b.position.y,b.position.z),Le.ref.setRotationFromEuler(b.rotation)):(ghostStore.setState({ghostVisibility:!0}),Le.ref.position.copy(sn).add(Ur)),(as>1||as<-1||ua<-1||ua>1)&&(sceneStore.setState({simulateDragEnd:!0}),sceneStore.setState({dragging:!1}),sceneStore.setState({draggingItemGUID:null}),itemStore.setState({busy:!1}),CORE_API.switchCursor(CURSORS.GRAB),n({node:Le,intersectingGhostObject:b,attachedChildrenGuids:de.current,attachedNodesToCurrentNode:pe.current}))},onDragStart:({event:Dr})=>{if(sceneStore.setState({simulateDragEnd:!1}),De||sceneStore.getState().sceneSettings.disableDragDrop&&sceneStore.getState().sceneSettings.disableContextMenu)return;Dr.stopPropagation();const{eventObject:Pn,point:si}=Dr;Pn.getWorldPosition(Ur).sub(si),sn.copy(si),zn.set(Dr.x,Dr.y)},onDragEnd:({event:Dr})=>{sceneStore.setState({simulateDragEnd:!1}),!(sceneStore.getState().dragging&&sceneStore.getState().draggingItemGUID!==Le.guid)&&(sceneStore.getState().sceneSettings.disableDragDrop&&sceneStore.getState().sceneSettings.disableContextMenu||(Dr.stopPropagation(),sceneStore.setState({dragging:!1}),sceneStore.setState({draggingItemGUID:null}),itemStore.setState({busy:!1}),CORE_API.switchCursor(CURSORS.GRAB),n({node:Le,intersectingGhostObject:b,attachedChildrenGuids:de.current,attachedNodesToCurrentNode:pe.current}),attachmentStore$1.getState().attachmentSystem.currentStructure.customLogic()))}});return jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:T?jsxDevRuntimeExports.jsxDEV("group",{ref:se,...ar(),...ie,children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:483,columnNumber:9},this):jsxDevRuntimeExports.jsxDEV("group",{ref:se,...ie,children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:487,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/generic/Draggable.js",lineNumber:481,columnNumber:5},this)}const Model=({modelData:a,clonedMesh:e,clonedProxyMesh:t,itemKey:n,scale:s,onItemClickHandler:o,onDragEndHandler:v,onDragStartHandler:A,stockAlert:b=!0})=>{const T=hotspotStore$1(lr=>lr),ee=itemStore(lr=>lr),re=itemStore(lr=>lr.hoveredItemRef),ie=reactExports.useRef(null),se=reactExports.useRef(null),le=reactExports.useRef([]),pe=reactExports.useRef(null),[de,fe]=reactExports.useState(e),[_e,ve]=reactExports.useState(t),xe=reactExports.useRef(0),De=reactExports.useRef(0),{ref:Le,actions:Ue,names:Ge}=useAnimations(a.data.animations),Fe=reactExports.useCallback((lr,hr,zn,ar)=>playAnimation(lr,hr,zn,ar,Ge,Ue),[Ge,Ue]),Ye=reactExports.useCallback(lr=>stopAnimation(lr,Ge,Ue),[Ge,Ue]);reactExports.useEffect(()=>{if(ie.current===n.itemData.guid){ie.current=null;let lr=T.lastActiveHotspotData.hotspotData;if(!lr)return;if(lr.exitAnim?Fe(lr.exitAnim,!1,!1,!1):lr.entryAnim&&Fe(lr.entryAnim,!1,!0,!1),lr.activeAnim&&Ye(lr.activeAnim),T.activeHotspotData){if(n.itemData.guid===T.activeHotspotData.itemData.guid){ie.current=n.itemData.guid;let hr=T.activeHotspotData.hotspotData;if(!hr)return;hr.entryAnim&&Fe(hr.entryAnim,!1,!1,!0),hr.activeAnim&&Fe(hr.activeAnim,!0,!1,!1)}}else return}else if(T.activeHotspotData){if(n.itemData.guid===T.activeHotspotData.itemData.guid){ie.current=n.itemData.guid;let lr=T.activeHotspotData.hotspotData;if(!lr)return;lr.entryAnim&&Fe(lr.entryAnim,!1,!1,!0),lr.activeAnim&&Fe(lr.activeAnim,!0,!1,!1)}}else return},[T.activeHotspotData]),reactExports.useEffect(()=>{sceneStore.getState().actions.triggerAutoFocus(),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Item_Added,{...n})},[]);const rn=reactExports.useCallback(()=>{if(!Le.current||(le.current=findMeshAndCloneMatFromScene(Le.current,Le.current.inStock),le.current.length==0))return;if(Le.current.inStock===!1){b==!0&&(b=!1,CORE_API.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:lr}=De;for(let hr=0;hr<le.current.length;hr++){const zn=le.current[hr].material;zn.emissiveIntensity=lr}},[De,Le]),yn=reactExports.useCallback(()=>{xe.current=0},[le]),bt=reactExports.useCallback(()=>{xe.current=.005},[le,de]);useFrame(()=>{if(sceneStore.getState().builderMode)return;const lr=cameraStore.getState().userDragging,hr=0;De.current=MathUtils.lerp(De.current,lr?hr:xe.current,.1),rn()}),reactExports.useEffect(()=>{const lr=attachmentStore$1.getState().attachmentSystem.currentStructure,hr=lr.getNodeByGUID(n.itemData.guid);if(hr?.isDependent&&!hr.isInteractive&&Object.keys(re).length>0){const zn=lr.getNodeByGUID(Object.keys(re)[0]);if(!zn||!zn.myDependenciesGUID)return;zn.myDependenciesGUID.includes(n.itemData.guid)?yn():bt()}else re.hasOwnProperty(n.itemData.guid)||Object.keys(re).length==0?yn():bt()},[re]);const sn=reactExports.useCallback(lr=>{lr.stopPropagation();const hr=ee.selectedItemData;sceneStore.setState({canvasTooltipText:"-"+n.itemData.name+"-"}),hr||itemStore.setState({hoveredItemRef:{}});let zn=itemStore.getState().hoveredItemRef;zn.hasOwnProperty(n.itemData.guid)||(zn[n.itemData.guid]={instance:Le.current},ee.actions.setHoveredItemRef({...zn}))},[ee,re,se]),Ur=reactExports.useCallback(lr=>{lr.stopPropagation();const hr=ee.selectedItemData;if(sceneStore.setState({canvasTooltipText:""}),hr){if(hr.itemData.guid==n.itemData.guid)return;re[n.itemData.guid]&&(delete re[n.itemData.guid],ee.actions.setHoveredItemRef({...re}))}else itemStore.setState({hoveredItemRef:{}})},[se,ee,re]);return reactExports.useEffect(()=>{if(pe.current)return ee.collidersRef.push(pe),ee.actions.setCollidersRef([...ee.collidersRef]),()=>{const lr=ee.collidersRef.indexOf(pe);lr>-1&&ee.collidersRef.splice(lr,1),ee.actions.setCollidersRef([...ee.collidersRef])}},[pe]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[de&&jsxDevRuntimeExports.jsxDEV(Clone,{name:"GRP_RenderGeometry",ref:Le,object:de,scale:s,inStock:!0},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:269,columnNumber:9},globalThis),(n.itemData.hasOwnProperty("disableCollider")?!n.itemData.disableCollider:!sceneStore.getState().sceneSettings.disableCollider)&&jsxDevRuntimeExports.jsxDEV("group",{name:"GRP_LoadingPlaceholder",children:jsxDevRuntimeExports.jsxDEV("group",{position:n.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:jsxDevRuntimeExports.jsxDEV(Box,{ref:pe,scale:Vec3ToArr(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:289,columnNumber:13},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:284,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:283,columnNumber:9},globalThis),a.proxy.isLoaded&&jsxDevRuntimeExports.jsxDEV(Draggable,{guid:n.itemData.guid,onDragStartHandler:A,onDragEndHandler:v,onItemClickHandler:o,onPointerEnter:sn,onPointerLeave:Ur,name:"GRP_ProxyMesh",isInteractive:n.itemData.isInteractive,children:jsxDevRuntimeExports.jsxDEV("primitive",{name:"proxyGeometry",object:_e,scale:s,visible:!1},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:309,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:299,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Model.js",lineNumber:267,columnNumber:5},globalThis)};function playAnimation(a,e,t,n,s,o){if(!s.includes(a))return;const v=o[a];v.setLoop(e?LoopRepeat:LoopOnce),v.clampWhenFinished=!e,n&&v.reset(),t?v.fadeOut(.5).play():v.fadeIn(.5).play()}function stopAnimation(a,e,t){if(!e.includes(a))return;t[a].stop()}function LoadingBox({distanceFactor:a,position:e,proxymodel:t,scale:n}){return jsxDevRuntimeExports.jsxDEV("primitive",{position:[0,0,0],name:"proxyLoader",object:t,scale:n,visible:!0,wireframe:!0,children:jsxDevRuntimeExports.jsxDEV(Html,{center:!0,position:e,distanceFactor:a,zIndexRange:[29,0],children:jsxDevRuntimeExports.jsxDEV("img",{alt:"Loading...",draggable:"false",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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 ProxyModelOnly({proxymodel:a,itemKey:e,scale:t}){return reactExports.useEffect(()=>{attachmentStore$1.getState().actions.updateFittingSkuIds()},[]),jsxDevRuntimeExports.jsxDEV("group",{children:[(e.itemData.hasOwnProperty("disableCollider")?!e.itemData.disableCollider:!sceneStore.getState().sceneSettings.disableCollider)&&jsxDevRuntimeExports.jsxDEV("group",{name:"GRP_LoadingPlaceholder",children:jsxDevRuntimeExports.jsxDEV("group",{position:e.itemData.boundingSphereCenter,scale:[.9,.9,.9],name:"boxGeometry",children:jsxDevRuntimeExports.jsxDEV(Box,{scale:Vec3ToArr(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),jsxDevRuntimeExports.jsxDEV("group",{name:"GRP_ProxyMesh",children:jsxDevRuntimeExports.jsxDEV("primitive",{name:"proxyGeometry",object:a.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 Item=({position:a,rotation:e,itemKey:t,scale:n,rejectFunc:s,onItemClickHandler:o,onDragEndHandler:v,onDragStartHandler:A,itemIndex:b,proxyScene:T})=>{const ee=sceneStore(_e=>_e.sceneRef),re=assetStore(_e=>_e),[ie,se]=reactExports.useState(null),[le,pe]=reactExports.useState(T.clone()),de=reactExports.useRef(null);reactExports.useEffect(()=>((async()=>{let _e=await re.actions.loadAsset(t.itemData.skuID).catch((Le,Ue)=>{s(Le,Ue,t.itemData.guid)});if(!_e||!_e.data){se({data:null,clonedMesh:null,mainModelReady:!1});return}const ve=_e.data,De=t.itemData.replace===!0||CORE_API.sceneSettings.disableLocalColorOverride?ve.scene:ve.scene.clone();t.itemData.clonedScene=De,ve.functions&&(ve.functions.copyVariantMaterials(De,ve.scene),await fe(ve,De)),LOGGER.info({title:"model loaded: "+t.itemData.skuID}),t.itemData.hasItemLoaded=!0,itemStore.getState().actions.triggerModelLoaded(),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Model_Loaded,t.itemData.skuID),se({data:_e,clonedMesh:De,mainModelReady:!0})})(),()=>{CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Model_Removed,t.itemData.skuID)}),[]);const fe=reactExports.useCallback(async(_e,ve)=>{const xe=attachmentStore$1.getState().attachmentSystem;var De=xe.currentStructure.getNodeByGUID(t.itemData.guid);if(!De)return;let Le="";if(De.overrideVariant)Le=De.overrideVariant,CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,!0);else{const Ue=xe.globalVariants;if(!Ue||Ue.Count<=0)return;let Ge=[];Object.keys(Ue).map((Fe,Ye)=>{Ge.push(Ue[Fe])}),t.itemData.looks?.map(Fe=>{Ge.includes(Fe)&&(Le=Fe)}),Le||(Le=t.itemData.looks[0])}return Le&&(De.currentVariant=Le,await _e.functions.selectVariant(ve,Le),itemStore.setState({variantChangeAlert:!itemStore.getState().variantChangeAlert})),Le},[]);return reactExports.useEffect(()=>{if(!de.current)return;const _e=attachmentStore$1.getState().attachmentSystem.currentStructure.getNodeByGUID(t.itemData.guid);_e.ref!==de.current&&(_e.ref=de.current,_e.transform={position:a,rotation:e}),_e&&ie!==null&&(_e.modelData=ie,attachmentStore$1.getState().actions.updateFittingSkuIds())},[de,ie]),reactExports.useEffect(()=>{if(de.current&&ee&&t.itemData.hasOwnProperty("excludeFromSceneBounds")&&t.itemData.excludeFromSceneBounds){const _e=ee.getObjectByName("#GRP_EXCLUDED");_e!==void 0&&_e.attach(de.current)}},[ee,de]),jsxDevRuntimeExports.jsxDEV("group",{ref:de,position:a,quaternion:e,name:`GRP_${t.itemData.name}_`+b.toString().padStart(2,"0"),children:[ie!==null&&(ie.mainModelReady?jsxDevRuntimeExports.jsxDEV(Model,{modelData:ie.data,clonedMesh:ie.clonedMesh,clonedProxyMesh:le,itemKey:t,scale:n,onDragStartHandler:A,onDragEndHandler:v,onItemClickHandler:o},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:269,columnNumber:11},globalThis):jsxDevRuntimeExports.jsxDEV(ProxyModelOnly,{itemKey:t,proxymodel:le,scale:n},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:280,columnNumber:11},globalThis)),ie==null&&le&&jsxDevRuntimeExports.jsxDEV(LoadingBox,{proxymodel:le,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:288,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Item.js",lineNumber:259,columnNumber:5},globalThis)};function GhostEventHandler({index:a,children:e,...t}){const n=reactExports.useRef(),s=useGesture({onPointerEnter:o=>{o.event.stopPropagation(),sceneStore.getState().itemDraggedSkuID&&sceneStore.setState({hoveredGhostIndex:a})},onPointerLeave:o=>{o.event.stopPropagation(),sceneStore.getState().itemDraggedSkuID&&sceneStore.setState({hoveredGhostIndex:-1})}});return jsxDevRuntimeExports.jsxDEV("group",{ref:n,...s(),...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 Ghost=({ghostData:a,ghostTransform:e,index:t})=>{const n=reactExports.useRef(),s=reactExports.useMemo(()=>a.proxyScene.clone(),[a]),o=sceneStore(v=>v.hoveredGhostIndex);return reactExports.useEffect(()=>{const{current:v}=n;v&&(v.userData.incomingPlugName=e.incomingPlugName,v.userData.receiverPlugName=e.receiverPlugName,v.userData.incomingPlugGUID=e.incomingPlugGUID,v.userData.receiverPlugGUID=e.receiverPlugGUID,CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Ghost_Loaded,{ghostData:a,ghostTransform:e}))},[n]),reactExports.useEffect(()=>{if(!s||!sceneStore.getState().itemDraggedSkuID)return;let v;o===t?v=sceneStore.getState().sceneSettings.draggableUiGhostThreeColorOnHover:v=sceneStore.getState().sceneSettings.ghostThreeColor,s.traverse(A=>{A.isMesh===!0&&(A.material=A.material.clone(),A.material.emissive=v)})},[o,s]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:jsxDevRuntimeExports.jsxDEV(GhostEventHandler,{index:t,children:jsxDevRuntimeExports.jsxDEV("primitive",{isGhost:!0,ref:n,index:t,position:e.position,quaternion:e.rotation,object:s,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:58,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:57,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Ghost.js",lineNumber:56,columnNumber:5},globalThis)},GhostManager=({intersectingGhostObject:a=null})=>{const{camera:e}=useThree(),t=ghostStore(b=>b.ghostVisibility),n=ghostStore(b=>b.ghostData),s=ghostStore(b=>b.ghostsTransform),o=reactExports.useRef(),{_touch2D:v}=reactExports.useMemo(()=>({_touch2D:new Vector2}),[]);reactExports.useEffect(()=>{const{current:b}=o;b&&ghostStore.setState({ghostParentRef:b})},[o]);const A=b=>{let T=0,ee=0;if(b.touches&&b.touches[0])T=b.touches[0].clientX,ee=b.touches[0].clientY;else return;if(!sceneStore.getState().itemDraggedSkuID)return;const re=sceneStore.getState().cursorParentRef,ie=sceneStore.getState().canvasSize;if(!re)return;const se=re.getBoundingClientRect(),le=se.top,pe=se.left,de=(T-pe)/ie.width*2-1,fe=(-ee+le)/ie.height*2+1;v.set(de,fe);const _e=new Raycaster;_e.setFromCamera(v,e);const ve=_e.intersectObject(ghostStore.getState().ghostParentRef);ve.length>0?(a=ve[0].object,sceneStore.setState({hoveredGhostIndex:a.parent.index})):(a=null,sceneStore.setState({hoveredGhostIndex:-1}))};return reactExports.useEffect(()=>{window.addEventListener("touchmove",A,!1),LOGGER.info({title:"Ghost Manager Mounted!"})},[]),jsxDevRuntimeExports.jsxDEV("group",{name:"#GRP_GhostParent",visible:t,ref:o,children:n&&jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:s.map((b,T)=>T<n.count&&jsxDevRuntimeExports.jsxDEV(Ghost,{ghostData:n,ghostTransform:b,index:T},"ghosts"+T,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:88,columnNumber:17},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:84,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/GhostManager.js",lineNumber:78,columnNumber:5},globalThis)},ItemManager=()=>{const a=attachmentStore$1(Ge=>Ge.attachmentSystem),e=attachmentStore$1(Ge=>Ge),t=itemStore(Ge=>Ge.removeItemTrigger),n=itemStore(Ge=>Ge.variantChangeAlert),s=hotspotStore$1(Ge=>Ge),o=sceneStore(Ge=>Ge.showDimensions);sceneStore(Ge=>Ge.sceneSettings);const v=itemStore(Ge=>Ge),A=itemStore(Ge=>Ge.lastDeletedItemData),b=cameraStore(Ge=>Ge),T=itemStore(Ge=>Ge.selectedItemData),ee=itemStore(Ge=>Ge.itemsSpawned),re=reactExports.useRef(null),ie=reactExports.useRef(null),se=reactExports.useRef(!1),le=reactExports.useRef(null),pe=reactExports.useRef(null),de=reactExports.useRef(!1),fe=reactExports.useRef(!1);reactExports.useRef(!1),reactExports.useRef(!1);const _e=reactExports.useCallback(({guid:Ge,node:Fe,detachedData:Ye,attachedChildrenGuids:rn})=>{if(se.current!==!0)return se.current=!0,cameraStore.setState({canCameraRotate:!1}),s.actions.switchHotspotsVisibility(!1,!0),le.current={position:Fe.ref.position.clone(),rotation:Fe.ref.rotation.clone()},pe.current=Ye,a.currentStructure.removeNodeFromStructure(Fe),rn.length<=0&&(rn=!1),ghostStore.getState().actions.spawnGhostsForSkuID(ee[Ge].itemData.skuID,rn)},[b,ee]),ve=reactExports.useCallback(({node:Ge,intersectingGhostObject:Fe,attachedChildrenGuids:Ye,attachedNodesToCurrentNode:rn})=>{if(!se.current)return;se.current=!1,cameraStore.setState({canCameraRotate:!0}),s.actions.switchHotspotsVisibility(!0,!0);function yn(){Ge.ref.position.set(0,0,0),ghostStore.getState().actions.clearAllGhosts()}if(!ghostStore.getState().ghostData?.connectablePlugs){yn();return}a.currentStructure.addNode(Ge);let sn=null,Ur=null,lr=!1,hr=[],zn={};if(sceneStore.getState().sceneSettings.ignoreCollisionPostDragging===!1&&Ye.map((ar,Dr)=>{hr[Dr]=a.currentStructure.checkCollisionforGUID(ar),hr[Dr]&&(zn[ar]=ee[ar])}),hr.map(ar=>{lr||(lr=ar)}),Fe&&lr){sceneStore.setState({draggingOnDropCollisionData:{node:Ge,attachedChildrenGuids:Ye,collidingStatus:hr,intersectingGhostObject:Fe,initPosition:le.current.position,initRotation:le.current.rotation,detachedPlugs:pe.current,attachedNodesToCurrentNode:rn}}),Ge.ref.position.set(Fe.position.x,Fe.position.y,Fe.position.z),Ge.ref.setRotationFromEuler(Fe.rotation),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.DraggingOnDrop_CollsionDetected,zn);return}if(Fe){const ar=Fe.userData;sn=Ge.getPlugByName(ar.incomingPlugName),Ur=a.currentStructure.getPlugByGUID(ar.receiverPlugGUID),Ge.ref.position.set(Fe.position.x,Fe.position.y,Fe.position.z),Ge.ref.setRotationFromEuler(Fe.rotation),Ge.transform={position:Fe.position,rotation:Fe.quaternion}}else{const ar=pe.current.neighbourDetachedPlugs;ar&&(pe.current.neighbourNode.detachNodeFromReceiver(),a.currentStructure.connectPlugs({incomingPlug:ar.incomingPlug,receiverPlug:ar.receiverPlug})),sn=pe.current.rootDetachedPlugs.incomingPlug,Ur=pe.current.rootDetachedPlugs.receiverPlug,Ge.ref.position.set(le.current.position.x,le.current.position.y,le.current.position.z),Ge.ref.setRotationFromEuler(le.current.rotation);let Dr=new Quaternion().identity();Ge.ref.getWorldQuaternion(Dr),Ge.transform={position:le.current.position,rotation:Dr}}a.currentStructure.connectPlugs({incomingPlug:sn,receiverPlug:Ur}),ghostStore.getState().actions.clearAllGhosts(),itemStore.getState().actions.deselectItem(),rn.map(ar=>{Ge.ref.parent.attach(ar.ref)}),attachmentStore$1.getState().actions.updateFittingSkuIds()},[b,sceneStore,ghostStore,a,e,ee]),xe=reactExports.useCallback((Ge,Fe,Ye)=>{if(sceneStore.getState().sceneSettings.disableContextMenu)return;const rn=attachmentStore$1.getState().attachmentSystem.currentStructure,yn=rn.getNodeByGUID(Ye);let bt=[];if(!yn.myDependenciesGUID)return;yn.myDependenciesGUID.map(lr=>{const hr=rn.getNodeByGUID(lr);let zn={guid:lr,name:ee[lr].itemData.guid,data:{...ee[lr],overrideVariant:hr.overrideVariant,currentVariant:hr.currentVariant,offsetX:Ge,offsetY:Fe}};bt.push(zn)}),bt.sort((lr,hr)=>lr.name>hr.name?1:hr.name>lr.name?-1:0);let sn=inventoryStore.getState().inventoryData[ee[Ye].itemData.skuID];const Ur={primary:{guid:Ye,name:ee[Ye].itemData.name,data:{inventory:sn,...ee[Ye],overrideVariant:yn.overrideVariant,currentVariant:yn.currentVariant,offsetX:Ge,offsetY:Fe}},dependencies:bt};v.actions.setSelectedItemData(Ur.primary.data),CORE_API.fireEvent(CORE_API.EVENTS.UI.ContextMenu_Show,Ur)},[ee]),De=reactExports.useCallback(Ge=>{Ge&&(itemStore.setState({lastDeletedItemData:{...ee[Ge]}}),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Item_Removed,{...ee[Ge]}),delete ee[Ge],v.actions.setItemsSpawned({...ee}))},[v,itemStore,ee]);reactExports.useEffect(()=>{let Ge=itemStore.getState().removeItems;if(Ge.length<=0&&!A)return;let Fe=Ge.pop();De(Fe)},[t,A]);const Le=reactExports.useCallback(function(Ge,Fe){const Ye=Ge>1?!0:!(Ge===1&&Object.values(ee)[0].itemData.skuID.toLowerCase()==="root"),rn=Ge<=0;LOGGER.groupCollapsed("Resolving buttons visibility"),LOGGER.table({sceneIsEmpty:rn,sceneIsNotEmpty:Ye}),LOGGER.groupEnd(),Fe.showViewInYourSpaceBtn===!0&&(Ye&&de.current===!1?(CORE_API.fireEvent(CORE_API.EVENTS.UI.ViewInYourSpaceButton_Show),de.current=!0):rn&&de.current===!0&&(CORE_API.fireEvent(CORE_API.EVENTS.UI.ViewInYourSpaceButton_Hide),de.current=!1)),Fe.showShareBtn===!0&&(Ye&&fe.current===!1?(CORE_API.fireEvent(CORE_API.EVENTS.UI.ShareButton_Show),fe.current=!0):rn&&fe.current===!0&&(CORE_API.fireEvent(CORE_API.EVENTS.UI.ShareButton_Hide),fe.current=!1))},[ee]);reactExports.useEffect(()=>{CORE_API.fireEvent(CORE_API.EVENTS.SCENE.Items_Updated,{itemsSpawned:ee});const Ge=sceneStore.getState().sceneSettings;Le(Object.keys(ee).length,Ge),Object.keys(ee).length==0?sceneStore.setState({canvasTooltipText:Ge.textSettings.tooltipEmptySceneText}):Object.keys(ee).length==1&&sceneStore.setState({canvasTooltipText:Ge.textSettings.tooltipInstructionText})},[ee]),reactExports.useEffect(()=>{const Ge=attachmentStore$1.getState().attachmentSystem;if(!Ge)return;inventoryStore.getState().actions.refreshInventory(ee);const Fe=Ge.getCartItems();CORE_API.fireEvent(CORE_API.EVENTS.SCENE.CartItems_Updated,Fe),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.ReplaceableCategory_Updated,Ge.currentStructure.getCurrentItemsInReplaceableCategory())},[ee,n]);const Ue=reactExports.useCallback((Ge,Fe,Ye)=>{CORE_API.removeItemByGUID(Ye),CORE_API.alert({alertMsg:Fe+": "+Ge,alertTime:5e3,alertType:"error",alertLabel:"Error",persistant:!0})},[]);return reactExports.useEffect(()=>{const{current:Ge}=ie;Ge&&attachmentStore$1.setState({colliderMeshRef:Ge})},[ie]),reactExports.useEffect(()=>{const{current:Ge}=re;Ge&&sceneStore.setState({sceneRef:Ge})},[re]),reactExports.useEffect(()=>{let Ge=T?cameraStore.getState().cameraSettings.zoomingMultiplier:cameraStore.getState().cameraSettings.zoomingMultiplier+.1;Ge+=o?.3:.1,cameraStore.setState({boundsMargin:Ge}),sceneStore.getState().actions.triggerAutoFocus()},[o,T]),reactExports.useEffect(()=>{LOGGER.info({title:"item Manager mounted"}),sceneStore.getState().preconfigurationLoaded||attachmentStore$1.getState().actions.loadDefaultStructure()},[]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV("group",{name:"Scene",ref:re,onPointerMissed:()=>{T&&v.actions.deselectItem(),hotspotStore$1.getState().isAnyHotspotActive&&hotspotStore$1.getState().actions.exitHotspot()},children:[IS_DEV_ENV,jsxDevRuntimeExports.jsxDEV("group",{name:"#GRP_EXCLUDED"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:473,columnNumber:9},globalThis),jsxDevRuntimeExports.jsxDEV("group",{name:"#ITEMSANDGHOSTS",children:[jsxDevRuntimeExports.jsxDEV("group",{name:"#ITEMS",children:Object.keys(ee).map((Ge,Fe)=>jsxDevRuntimeExports.jsxDEV(Item,{scale:[1,1,1],onDragStartHandler:_e,onDragEndHandler:ve,onItemClickHandler:xe,itemKey:ee[Ge],position:ee[Ge].itemData.position,rotation:ee[Ge].itemData.rotation,itemIndex:Fe,proxyScene:ee[Ge].itemData.proxyScene,rejectFunc:Ue},Ge,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:477,columnNumber:15},globalThis))},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:475,columnNumber:11},globalThis),jsxDevRuntimeExports.jsxDEV(GhostManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:492,columnNumber:11},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:474,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:463,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV("group",{name:"#Parent_ColliderMesh",children:jsxDevRuntimeExports.jsxDEV("mesh",{ref:ie,visible:!1,enabled:!0,name:"#COLLIDER_MESH",children:jsxDevRuntimeExports.jsxDEV("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:502,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:496,columnNumber:9},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:495,columnNumber:7},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/ItemManager.js",lineNumber:462,columnNumber:5},globalThis)},EffectsComposer=({...a})=>{const[e,t]=reactExports.useState(10),n=sceneStore(o=>o.bbox),s=sceneStore(o=>o.sceneSettings);return reactExports.useEffect(()=>{if(!n||!n.isBox3){t(10);return}const o=new Vector3(0,0,0);let v=o.distanceTo(n.min)*2,A=o.distanceTo(n.max)*2,b=A>v?A:v;b!=1/0&&b!=-1/0&&(b+=5,t(b||10))},[n]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:s.contactShadowVisibility&&jsxDevRuntimeExports.jsxDEV(ContactShadows,{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 Hotspot({hotspotKey:a}){const e=attachmentStore$1(fe=>fe.attachmentSystem),t=hotspotStore$1(fe=>fe),n=hotspotStore$1(fe=>fe.activeHotspotData),s=itemStore(fe=>fe.lastDeletedItemData),o=ghostStore(fe=>fe.ghostData),v=hotspotStore$1(fe=>fe.actions),A=hotspotStore$1(fe=>fe.hotspotsVisibility),b=hotspotStore$1(fe=>fe.hotspotsTempVisibility),[T,ee]=reactExports.useState(null),[re,ie]=reactExports.useState(!1),se=reactExports.useRef(null),le=reactExports.useRef(null),pe=reactExports.useRef(null),de=reactExports.useCallback(fe=>{fe.includes(a.itemData.skuID+"_"+a.hotspotData.hotspotID)&&ie(!0)},[a]);return reactExports.useEffect(()=>de(t.visitedHotspotsID),[t,de]),reactExports.useEffect(()=>{ee(n?n.hotspotData.guid:null)},[n]),reactExports.useEffect(()=>{le.current&&(T===a.hotspotData.guid?le.current.parentNode.classList.add("topmostActive"):le.current.parentNode.classList.remove("topmostActive"))},[T]),reactExports.useEffect(()=>{se.current&&T===a.hotspotData.guid&&(se.current.style.opacity=1)},[T,se]),reactExports.useEffect(()=>{if(!(!pe.current&&!s)){var fe=e.currentStructure.getNodeByGUID(a.itemData.guid);fe?.ref&&(pe.current.parent=fe.ref)}},[pe,e,A,s]),jsxDevRuntimeExports.jsxDEV("group",{ref:pe,position:a.hotspotData.hotspotPointTransform,children:jsxDevRuntimeExports.jsxDEV(Html,{ref:le,zIndexRange:[6,0],style:A&&b&&!o?{opacity:"1",pointerEvents:"all",transition:"0.5s"}:{opacity:"0",pointerEvents:"none",transition:"0.5s"},children:jsxDevRuntimeExports.jsxDEV("button",{style:{display:a.hotspotData.visibleInScene==!1?"none":"block"},ref:se,className:T===a.hotspotData.guid?"hotspot hotspot-0 active":re?"hotspot hotspot-0 visited":"hotspot hotspot-0",onPointerEnter:fe=>{fe.stopPropagation(),se.current&&T!==a.hotspotData.guid&&(se.current.getClientRects()[0].left>sceneStore.getState().canvasSize.width/1.6?se.current.classList.add("left"):se.current.classList.remove("left")),le.current&&le.current.parentNode.classList.add("topmostHover")},onPointerLeave:fe=>{fe.stopPropagation(),le.current&&le.current.parentNode.classList.remove("topmostHover")},id:"hotspot3D_"+a.itemData.skuID+"_"+a.hotspotData.hotspotID,onClick:fe=>{if(fe.stopPropagation(),t.isAnyHotspotActive&&t.activeHotspotData.hotspotData.guid===a.hotspotData.guid){v.exitHotspot();return}v.clickHotspot(a.hotspotData.hotspotID,a.hotspotData.guid,a.itemData.guid)},children:[jsxDevRuntimeExports.jsxDEV("span",{className:"inner-circle"},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:141,columnNumber:11},this),jsxDevRuntimeExports.jsxDEV("span",{className:"hotspot-annotation",children:a.hotspotData.title},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:142,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:87,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:78,columnNumber:7},this)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/components/Hotspot.js",lineNumber:77,columnNumber:5},this)}const HotspotManager=()=>{const a=hotspotStore$1(de=>de),e=hotspotStore$1(de=>de.hotspotsHealthCheck),t=itemStore(de=>de.lastDeletedItemData),n=hotspotStore$1(de=>de.hotspotsSpawned),s=itemStore(de=>de.itemsSpawned),o=hotspotStore$1(de=>de.activeHotspotData),[v,A]=reactExports.useState(null),{camera:b}=useThree(),T=reactExports.useRef(null),ee=reactExports.useCallback(()=>{const de=hotspotStore$1.getState().hotspotSpawnedForCategoryIDs,fe=attachmentStore$1.getState().attachmentSystem.globalGeometryVariants;Object.keys(s).map(_e=>{let ve=s[_e];if(!ve.hotspotsData)return;let xe=!1;Object.keys(n).map(De=>{const Le=n[De].hotspotData.geometryVariantID;if(Le){let Ue=!1;if(Object.keys(fe).map(Ge=>{Le==fe[Ge]&&(Ue=!0)}),Ue===!1){xe=!0;let Ge=[];Ge.push(n[De].hotspotData.categoryID);const Fe=new Set(Ge);filterArrWithCondition(de,Ye=>!Fe.has(Ye)),delete n[De]}}}),xe===!0&&(hotspotStore$1.setState({hotspotSpawned:{...n}}),hotspotStore$1.setState({hotspotSpawnedForCategoryIDs:de})),ve.hotspotsData.map(De=>{const Le=hotspotStore$1.getState().hotspotSpawnedForCategoryIDs;if(De.geometryVariantID){let Ue=!1;if(Object.keys(fe).map(Ge=>{De.geometryVariantID==fe[Ge]&&(Ue=!0)}),Ue===!1)return}De.categoryID!==""&&Le.includes(De.categoryID)||(ve.hotspotSpawned=!0,Le.push(De.categoryID),re(_e,De))})})},[s,n]),re=reactExports.useCallback((de,fe)=>{let _e=s[de].itemData.skuID+"_"+fe.hotspotID;n[_e]={itemData:{guid:de,...s[de].itemData},hotspotData:{guid:_e,...fe}},hotspotStore$1.setState({hotspotsSpawned:{...n}})},[s,a,n]);reactExports.useEffect(()=>{if(!t)return;if(t.hotspotSpawned){hotspotStore$1.getState().actions.removeHotspotForItem({...t});const fe=hotspotStore$1.getState().hotspotSpawnedForCategoryIDs;let _e=[];t.hotspotsData.map(xe=>{_e.push(xe.categoryID)});const ve=new Set(_e);filterArrWithCondition(fe,xe=>!ve.has(xe)),hotspotStore$1.setState({hotspotSpawnedForCategoryIDs:fe})}itemStore.setState({lastDeletedItemData:null});const de=attachmentStore$1.getState().attachmentSystem;de.currentStructure.removeNodeByGUID(t.itemData.guid),CORE_API.fireEvent(CORE_API.EVENTS.SCENE.MaterialOverrides_Exists,de.currentStructure.materialOverrideExists())},[t]);const{raycasterHotspot:ie,worldPos:se}=reactExports.useMemo(()=>({raycasterHotspot:new Raycaster,worldPos:new Vector3}),[]),le=(de,fe)=>{let _e=de;_e.sub(b.position);const ve=_e.length();ie.set(b.position,_e);const xe=ie.intersectObject(sceneStore.getState().sceneRef);if(xe.length>0&&xe[0].distance<ve){fe.style.opacity=.5;return}fe.style.opacity=v?.5:1};reactExports.useEffect(()=>{A(o?o.hotspotData.guid:null)},[o]);const pe=reactExports.useRef(0);return useFrame(()=>{if(T.current===null||T.current.children.length<=0)return;pe.current<T.current.children.length-1?pe.current+=1:pe.current=0;const de=Object.keys(n)[pe.current],fe="hotspot3D_"+n[de].itemData.skuID+"_"+n[de].hotspotData.hotspotID,_e=CORE_API.coreWCRef.shadowRootRef.getElementById(fe);v===de||_e===null||(T.current.children[pe.current].getWorldPosition(se),le(se,_e))},[]),reactExports.useEffect(()=>{ee()},[Object.keys(s).length,e]),a.hotspotsVisibility===!0&&jsxDevRuntimeExports.jsxDEV("group",{name:"#GRP_HotspotManager",ref:T,children:Object.keys(n).map(de=>jsxDevRuntimeExports.jsxDEV(Hotspot,{hotspotKey:n[de]},de,!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 objectTypes$3={boolean:!1,function:!0,object:!0,number:!1,string:!1,undefined:!1},lodash__objecttypes=objectTypes$3,objectTypes$2=lodash__objecttypes;function isObject$4(a){return!!(a&&objectTypes$2[typeof a])}var lodash_isobject=isObject$4,objectProto$1=Object.prototype,toString=objectProto$1.toString,reNative$4=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),lodash__renative=reNative$4,objectTypes$1=lodash__objecttypes,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,shimKeys$1=function(a){var e,t=a,n=[];if(!t||!objectTypes$1[typeof a])return n;for(e in t)hasOwnProperty.call(t,e)&&n.push(e);return n},lodash__shimkeys=shimKeys$1,isObject$3=lodash_isobject,reNative$3=lodash__renative,shimKeys=lodash__shimkeys,nativeKeys=reNative$3.test(nativeKeys=Object.keys)&&nativeKeys,keys$2=nativeKeys?function(a){return isObject$3(a)?nativeKeys(a):[]}:shimKeys,lodash_keys=keys$2;function noop$1(){}var lodash_noop=noop$1,isObject$2=lodash_isobject,reNative$2=lodash__renative,nativeCreate=reNative$2.test(nativeCreate=Object.create)&&nativeCreate;function baseCreate$2(a,e){return isObject$2(a)?nativeCreate(a):{}}nativeCreate||(baseCreate$2=function(){function a(){}return function(e){if(isObject$2(e)){a.prototype=e;var t=new a;a.prototype=null}return t||commonjsGlobal.Object()}}());var lodash__basecreate=baseCreate$2,noop=lodash_noop,reNative$1=lodash__renative,descriptor={configurable:!1,enumerable:!1,value:null,writable:!1},defineProperty=function(){try{var a={},e=reNative$1.test(e=Object.defineProperty)&&e,t=e(a,a,a)&&e}catch{}return t}(),setBindData$3=defineProperty?function(a,e){descriptor.value=e,defineProperty(a,"__bindData__",descriptor)}:noop,lodash__setbinddata=setBindData$3,baseCreate$1=lodash__basecreate,isObject$1=lodash_isobject,setBindData$2=lodash__setbinddata,arrayRef$2=[],push$2=arrayRef$2.push;function baseBind$1(a){var e=a[0],t=a[2],n=a[4];function s(){if(t){var o=t.slice();push$2.apply(o,arguments)}if(this instanceof s){var v=baseCreate$1(e.prototype),A=e.apply(v,o||arguments);return isObject$1(A)?A:v}return e.apply(n,o||arguments)}return setBindData$2(s,a),s}var lodash__basebind=baseBind$1;function slice$2(a,e,t){e||(e=0),typeof t>"u"&&(t=a?a.length:0);for(var n=-1,s=t-e||0,o=Array(s<0?0:s);++n<s;)o[n]=a[e+n];return o}var lodash__slice=slice$2,baseCreate=lodash__basecreate,isObject=lodash_isobject,setBindData$1=lodash__setbinddata,slice$1=lodash__slice,arrayRef$1=[],push$1=arrayRef$1.push;function baseCreateWrapper$1(a){var e=a[0],t=a[1],n=a[2],s=a[3],o=a[4],v=a[5],A=t&1,b=t&2,T=t&4,ee=t&8,re=e;function ie(){var se=A?o:this;if(n){var le=n.slice();push$1.apply(le,arguments)}if((s||T)&&(le||(le=slice$1(arguments)),s&&push$1.apply(le,s),T&&le.length<v))return t|=16,baseCreateWrapper$1([e,ee?t:t&-4,le,null,o,v]);if(le||(le=arguments),b&&(e=se[re]),this instanceof ie){se=baseCreate(e.prototype);var pe=e.apply(se,le);return isObject(pe)?pe:se}return e.apply(se,le)}return setBindData$1(ie,a),ie}var lodash__basecreatewrapper=baseCreateWrapper$1;function isFunction$1(a){return typeof a=="function"}var lodash_isfunction=isFunction$1,baseBind=lodash__basebind,baseCreateWrapper=lodash__basecreatewrapper,isFunction=lodash_isfunction,arrayRef=[],push=arrayRef.push;function createWrapper$1(a,e,t,n,s,o){var v=e&1,A=e&2,b=e&4,T=e&16,ee=e&32;if(!A&&!isFunction(a))throw new TypeError;T&&!t.length&&(e&=-17,T=t=!1),ee&&!n.length&&(e&=-33,ee=n=!1);var re=a&&a.__bindData__;if(re&&re!==!0)return re=re.slice(),v&&!(re[1]&1)&&(re[4]=s),!v&&re[1]&1&&(e|=8),b&&!(re[1]&4)&&(re[5]=o),T&&push.apply(re[2]||(re[2]=[]),t),ee&&push.apply(re[3]||(re[3]=[]),n),re[1]|=e,createWrapper$1.apply(null,re);var ie=e==1||e===17?baseBind:baseCreateWrapper;return ie([a,e,t,n,s,o])}var lodash__createwrapper=createWrapper$1,createWrapper=lodash__createwrapper,slice=lodash__slice;function bind$1(a,e){return arguments.length>2?createWrapper(a,17,slice(arguments,2),null,e):createWrapper(a,1,null,null,e)}var lodash_bind=bind$1;function identity$1(a){return a}var lodash_identity=identity$1,reNative=lodash__renative,reThis$1=/\bthis\b/,support$1={};support$1.funcDecomp=!reNative.test(commonjsGlobal.WinRTError)&&reThis$1.test(function(){return this});support$1.funcNames=typeof Function.name=="string";var lodash_support=support$1,bind=lodash_bind,identity=lodash_identity,setBindData=lodash__setbinddata,support=lodash_support,reFuncName=/^\s*function[ \n\r\t]+\w/,reThis=/\bthis\b/,fnToString=Function.prototype.toString;function baseCreateCallback$2(a,e,t){if(typeof a!="function")return identity;if(typeof e>"u"||!("prototype"in a))return a;var n=a.__bindData__;if(typeof n>"u"&&(support.funcNames&&(n=!a.name),n=n||!support.funcDecomp,!n)){var s=fnToString.call(a);support.funcNames||(n=!reFuncName.test(s)),n||(n=reThis.test(s),setBindData(a,n))}if(n===!1||n!==!0&&n[1]&1)return a;switch(t){case 1:return function(o){return a.call(e,o)};case 2:return function(o,v){return a.call(e,o,v)};case 3:return function(o,v,A){return a.call(e,o,v,A)};case 4:return function(o,v,A,b){return a.call(e,o,v,A,b)}}return bind(a,e)}var lodash__basecreatecallback=baseCreateCallback$2,baseCreateCallback$1=lodash__basecreatecallback,keys$1=lodash_keys,objectTypes=lodash__objecttypes,forOwn$1=function(a,e,t){var n,s=a,o=s;if(!s||!objectTypes[typeof s])return o;e=e&&typeof t>"u"?e:baseCreateCallback$1(e,t,3);for(var v=-1,A=objectTypes[typeof s]&&keys$1(s),b=A?A.length:0;++v<b;)if(n=A[v],e(s[n],n,a)===!1)return o;return o},lodash_forown=forOwn$1,baseCreateCallback=lodash__basecreatecallback,forOwn=lodash_forown;function forEach(a,e,t){var n=-1,s=a?a.length:0;if(e=e&&typeof t>"u"?e:baseCreateCallback(e,t,3),typeof s=="number")for(;++n<s&&e(a[n],n,a)!==!1;);else forOwn(a,e);return a}var lodash_foreach=forEach,metric$b,imperial$9;metric$b={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}};imperial$9={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 length={metric:metric$b,imperial:imperial$9,_anchors:{metric:{unit:"m",ratio:3.28084},imperial:{unit:"ft",ratio:1/3.28084}}},metric$a,imperial$8;metric$a={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}};imperial$8={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 area={metric:metric$a,imperial:imperial$8,_anchors:{metric:{unit:"m2",ratio:10.7639},imperial:{unit:"ft2",ratio:1/10.7639}}},metric$9,imperial$7;metric$9={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}};imperial$7={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 mass={metric:metric$9,imperial:imperial$7,_anchors:{metric:{unit:"g",ratio:1/453.592},imperial:{unit:"lb",ratio:453.592}}},metric$8,imperial$6;metric$8={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}};imperial$6={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 volume={metric:metric$8,imperial:imperial$6,_anchors:{metric:{unit:"l",ratio:33.8140226},imperial:{unit:"fl-oz",ratio:1/33.8140226}}},metric$7;metric$7={ea:{name:{singular:"Each",plural:"Each"},to_anchor:1},dz:{name:{singular:"Dozen",plural:"Dozens"},to_anchor:12}};var each$1={metric:metric$7,imperial:{},_anchors:{metric:{unit:"ea",ratio:1}}},metric$6,imperial$5;metric$6={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}};imperial$5={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 temperature={metric:metric$6,imperial:imperial$5,_anchors:{metric:{unit:"C",transform:function(a){return a/(5/9)+32}},imperial:{unit:"F",transform:function(a){return(a-32)*(5/9)}}}},time,daysInYear=365.25;time={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*daysInYear/12},year:{name:{singular:"Year",plural:"Years"},to_anchor:60*60*24*daysInYear}};var time_1={metric:time,_anchors:{metric:{unit:"s",ratio:1}}},bits,bytes;bits={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}};bytes={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 digital={bits,bytes,_anchors:{bits:{unit:"b",ratio:1/8},bytes:{unit:"B",ratio:8}}},metric$5;metric$5={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 partsPer={metric:metric$5,imperial:{},_anchors:{metric:{unit:"ppm",ratio:1e-6}}},metric$4,imperial$4;metric$4={"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}};imperial$4={"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 speed={metric:metric$4,imperial:imperial$4,_anchors:{metric:{unit:"km/h",ratio:1/1.609344},imperial:{unit:"m/h",ratio:1.609344}}},metric$3,imperial$3;metric$3={"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}};imperial$3={"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 pace={metric:metric$3,imperial:imperial$3,_anchors:{metric:{unit:"s/m",ratio:.3048},imperial:{unit:"s/ft",ratio:1/.3048}}},metric$2,imperial$2;metric$2={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}};imperial$2={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 pressure={metric:metric$2,imperial:imperial$2,_anchors:{metric:{unit:"kPa",ratio:.00014503768078},imperial:{unit:"psi",ratio:1/.00014503768078}}},current;current={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 current_1={metric:current,_anchors:{metric:{unit:"A",ratio:1}}},voltage;voltage={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 voltage_1={metric:voltage,_anchors:{metric:{unit:"V",ratio:1}}},power;power={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 power_1={metric:power,_anchors:{metric:{unit:"W",ratio:1}}},reactivePower;reactivePower={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 reactivePower_1={metric:reactivePower,_anchors:{metric:{unit:"VAR",ratio:1}}},apparentPower;apparentPower={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 apparentPower_1={metric:apparentPower,_anchors:{metric:{unit:"VA",ratio:1}}},energy;energy={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 energy_1={metric:energy,_anchors:{metric:{unit:"J",ratio:1}}},reactiveEnergy;reactiveEnergy={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 reactiveEnergy_1={metric:reactiveEnergy,_anchors:{metric:{unit:"VARh",ratio:1}}},metric$1,imperial$1;metric$1={"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}};imperial$1={"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 volumeFlowRate={metric:metric$1,imperial:imperial$1,_anchors:{metric:{unit:"l/s",ratio:33.8140227},imperial:{unit:"fl-oz/s",ratio:1/33.8140227}}},metric,imperial;metric={lx:{name:{singular:"Lux",plural:"Lux"},to_anchor:1}};imperial={"ft-cd":{name:{singular:"Foot-candle",plural:"Foot-candles"},to_anchor:1}};var illuminance={metric,imperial,_anchors:{metric:{unit:"lx",ratio:1/10.76391},imperial:{unit:"ft-cd",ratio:10.76391}}},frequency;frequency={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 frequency_1={metric:frequency,_anchors:{frequency:{unit:"hz",ratio:1}}},angle;angle={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 angle_1={metric:angle,_anchors:{metric:{unit:"deg",ratio:1}}},convert,keys=lodash_keys,each=lodash_foreach,measures={length,area,mass,volume,each:each$1,temperature,time:time_1,digital,partsPer,speed,pace,pressure,current:current_1,voltage:voltage_1,power:power_1,reactivePower:reactivePower_1,apparentPower:apparentPower_1,energy:energy_1,reactiveEnergy:reactiveEnergy_1,volumeFlowRate,illuminance,frequency:frequency_1,angle:angle_1},Converter;Converter=function(a,e){e?this.val=a/e:this.val=a};Converter.prototype.from=function(a){if(this.destination)throw new Error(".from must be called before .to");return this.origin=this.getUnit(a),this.origin||this.throwUnsupportedUnitError(a),this};Converter.prototype.to=function(a){if(!this.origin)throw new Error(".to must be called after .from");this.destination=this.getUnit(a);var e,t;if(this.destination||this.throwUnsupportedUnitError(a),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=measures[this.origin.measure]._anchors[this.origin.system].transform,typeof t=="function"?e=t(e):e*=measures[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};Converter.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 each(this.possibilities(),function(n){var s=this.describe(n),o=e.exclude.indexOf(n)===-1;if(o&&s.system===this.origin.system){var v=this.to(n);(!t||v>=e.cutOffNumber&&v<t.val)&&(t={val:v,unit:n,singular:s.singular,plural:s.plural})}}.bind(this)),t};Converter.prototype.getUnit=function(a){var e;return each(measures,function(t,n){if(each(t,function(s,o){if(o=="_anchors"||(each(s,function(v,A){if(A==a)return e={abbr:a,measure:n,system:o,unit:v},!1}),e))return!1}),e)return!1}),e};var describe=function(a){return{abbr:a.abbr,measure:a.measure,system:a.system,singular:a.unit.name.singular,plural:a.unit.name.plural}};Converter.prototype.describe=function(a){var e=Converter.prototype.getUnit(a),t=null;try{t=describe(e)}catch{this.throwUnsupportedUnitError(a)}return t};Converter.prototype.list=function(a){var e=[];return each(measures,function(t,n){a&&a!==n||each(t,function(s,o){if(o=="_anchors")return!1;each(s,function(v,A){e=e.concat(describe({abbr:A,measure:n,system:o,unit:v}))})})}),e};Converter.prototype.throwUnsupportedUnitError=function(a){var e=[];throw each(measures,function(t,n){each(t,function(s,o){if(o=="_anchors")return!1;e=e.concat(keys(s))})}),new Error("Unsupported unit "+a+", use one of: "+e.join(", "))};Converter.prototype.possibilities=function(a){var e=[];return!this.origin&&!a?each(keys(measures),function(t){each(measures[t],function(n,s){if(s=="_anchors")return!1;e=e.concat(keys(n))})}):(a=a||this.origin.measure,each(measures[a],function(t,n){if(n=="_anchors")return!1;e=e.concat(keys(t))})),e};Converter.prototype.measures=function(){return keys(measures)};convert=function(a){return new Converter(a)};var lib=convert;const convert$1=getDefaultExportFromCjs(lib),DimensionsManager=()=>{const a=itemStore(le=>le.itemsSpawned),e=sceneStore(le=>le.showDimensions),t=sceneStore(le=>le.sceneSettings),n=sceneStore(le=>le.boundData),s=sceneStore(le=>le.sceneSettings.sceneScaleUnit),o=sceneStore(le=>le.sceneSettings.sceneScaleDisplayUnit),[v,A]=reactExports.useState(.2),[b,T]=reactExports.useState("#000000"),[ee,re]=reactExports.useState(.01),ie=reactExports.useRef(null);reactExports.useRef(null);const se=reactExports.useRef(0);return reactExports.useEffect(()=>{if(t==null)return;const le=t.dimensionColor,pe=rgbToHex(le.r,le.g,le.b);T(pe)},[t]),reactExports.useEffect(()=>{if(t==null)return;const le=t.dimensionColor,pe=rgbToHex(le.r,le.g,le.b);T(pe)},[t]),reactExports.useEffect(()=>{if(!n||!n.size)return;let le=n.size.x;le>n.size.z&&(le=n.size.z);let pe=le/20;re(pe<.005?pe:.005),A(le<.2?le:.2)},[n]),reactExports.useEffect(()=>{se.current=0},[e]),useFrame(()=>{ie.current!==null&&se.current<1&&(se.current+=.05,ie.current.scale.x=se.current,ie.current.scale.y=se.current,ie.current.scale.z=se.current)}),e===!0&&jsxDevRuntimeExports.jsxDEV("group",{ref:ie,children:n!==null&&n.size.x!==0&&n.size.y!==0&&n.size.z!==0&&Object.keys(a).length>0&&jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[n.center.x,n.center.y-n.size.y/2,n.center.z+n.size.z/2+v],rotation:[0,0,degToRad(90)],scale:[ee,n.size.x,ee],visible:!0,children:[jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,.5,0],scale:[1,ee,7],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,-.5,0],scale:[1,ee,7],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:116,columnNumber:17},globalThis),jsxDevRuntimeExports.jsxDEV(Html,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[convert$1(n.size.x).from("m").to(s).toFixed(t.measurementPrecision),o??s]},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[n.center.x-n.size.x/2-v,n.center.y,n.center.z+n.size.z/2+v],rotation:[0,0,0],scale:[ee,n.size.y,ee],visible:!0,children:[jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,.5,0],scale:[1,ee,7],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,-.5,0],scale:[1,ee,7],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:161,columnNumber:17},globalThis),jsxDevRuntimeExports.jsxDEV(Html,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[convert$1(n.size.y).from("m").to(s).toFixed(t.measurementPrecision),o??s]},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[n.center.x+n.size.x/2+v,n.center.y-n.size.y/2,n.center.z],rotation:[degToRad(90),0,0],scale:[ee,n.size.z,ee],visible:!0,children:[jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,.5,0],scale:[7,ee,1],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV(RoundedBox,{position:[0,-.5,0],scale:[7,ee,1],visible:!0,children:jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},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),jsxDevRuntimeExports.jsxDEV("meshBasicMaterial",{color:b},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/DimensionsManager.js",lineNumber:206,columnNumber:17},globalThis),jsxDevRuntimeExports.jsxDEV(Html,{center:!0,className:"dimensionsText ignore",style:{opacity:"1"},zIndexRange:[29,0],children:[convert$1(n.size.z).from("m").to(s).toFixed(t.measurementPrecision),o??s]},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)},BaseScene=({...a})=>jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV(HotspotManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:11,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(DimensionsManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:12,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(ItemManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/BaseScene.js",lineNumber:13,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(EffectsComposer,{},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),CameraManager=()=>{const a=reactExports.useRef(null),e=itemStore(le=>le.itemsSpawned),t=hotspotStore$1(le=>le.isAnyHotspotActive),n=cameraStore(le=>le.canCameraRotate),s=cameraStore(le=>le.cameraSettings),o=cameraStore(le=>le.disableAutoRotate),v=sceneStore(le=>le.autoFocusTrigger),A=sceneStore(le=>le.dragging),b=cameraStore(le=>le.sendCameraDetailsTrigger),T=cameraStore(le=>le.focusPointPosition),ee=cameraStore(le=>le.viewPointPosition),{camera:re}=useThree(),ie=ghostStore(le=>le.ghostsTransform),se=()=>{if(a.current===null)return;const pe=1/a.current._lastZoom,de=cameraStore.getState().boundsMargin,fe=sceneStore.getState().autoFocusRef,_e=sceneStore.getState().sceneRef.getObjectByName("#ITEMSANDGHOSTS"),ve=fe||_e,xe=new Box3().setFromObject(ve);fe||sceneStore.setState({bbox:xe});const De=new Vector3;if(xe.getSize(De),De.x>0){const Le=new Vector3;xe.getCenter(Le);const Ue=new Vector3(xe.max.x,xe.max.y,xe.max.z);Ue.sub(xe.min),sceneStore.setState({boundData:{center:Le,size:Ue}}),a.current.setBoundary(xe);const Ge=new Box3(xe.min,xe.max);Ge.min=new Vector3((Ge.min.x-de/2)*pe,(Ge.min.y-de/2)*pe,(Ge.min.z-de/2)*pe),Ge.max=new Vector3((Ge.max.x+de/2)*pe,(Ge.max.y+de/2)*pe,(Ge.max.z+de/2)*pe);const Fe=Ge.getBoundingSphere(new Sphere(Le));Fe.radius>0&&a.current.fitToSphere(Fe,!0)}else{const Le=new Vector3(0,0,0),Ue=new Vector3(0,0,0);sceneStore.setState({boundData:{center:Le,size:Ue}})}a.current.zoomTo(1,!0)};return reactExports.useEffect(()=>{se()},[v,Object.keys(e).length]),reactExports.useEffect(()=>{CORE_API!=null&&(sceneStore.getState().sceneSettings.focusCameraOnGhosts===!0?CORE_API.focusOnGhosts():CORE_API.refocus())},[ie]),reactExports.useEffect(()=>{const le=cameraStore.getState().savedState,pe=cameraStore.getState().resetToLastPosition;if(t===!1){le===!0&&(pe===!0?a.current.reset(!0):cameraStore.setState({resetToLastPosition:!0}),cameraStore.setState({savedState:!1}));return}le===!1&&pe===!0&&(a.current.saveState(),cameraStore.setState({savedState:!0})),a.current.setLookAt(ee.x,ee.y,ee.z,T.x,T.y,T.z,!0)},[t,ee,T]),reactExports.useEffect(()=>{CORE_API.fireEvent(CORE_API.EVENTS.CONFIGURATION.CameraDetails_Update,re)},[b]),useFrame(le=>{s.canAutoRotate===!1||a.current===null||o===!1&&t===!1&&(a.current.azimuthAngle+=20*le*MathUtils.DEG2RAD*s.autoRotateSpeed)}),reactExports.useEffect(()=>{a.current!==null&&(n===!0?(a.current.mouseButtons.left=CAMERA_ACTION.ROTATE,a.current.touches.one=CAMERA_ACTION.TOUCH_ROTATE):(a.current.mouseButtons.left=CAMERA_ACTION.NONE,a.current.touches.one=CAMERA_ACTION.NONE),s.canZoom===!0&&A===!1?(a.current.mouseButtons.wheel=CAMERA_ACTION.ZOOM,a.current.mouseButtons.middle=CAMERA_ACTION.ZOOM):(a.current.mouseButtons.wheel=CAMERA_ACTION.NONE,a.current.mouseButtons.middle=CAMERA_ACTION.NONE),s.canPan===!0&&A===!1?(a.current.mouseButtons.right=CAMERA_ACTION.OFFSET,s.canZoom===!0&&A===!1?(a.current.touches.two=CAMERA_ACTION.TOUCH_ZOOM_OFFSET,a.current.touches.three=CAMERA_ACTION.TOUCH_ZOOM_OFFSET):(a.current.touches.two=CAMERA_ACTION.TOUCH_OFFSET,a.current.touches.three=CAMERA_ACTION.TOUCH_OFFSET)):(a.current.mouseButtons.right=CAMERA_ACTION.NONE,s.canZoom===!0&&A===!1?(a.current.touches.two=CAMERA_ACTION.TOUCH_ZOOM,a.current.touches.three=CAMERA_ACTION.TOUCH_ZOOM):(a.current.touches.two=CAMERA_ACTION.NONE,a.current.touches.three=CAMERA_ACTION.NONE)))},[a,s,A,n]),reactExports.useEffect(()=>{if(a.current===null)return;re.fov=s.fov,re.updateProjectionMatrix();const le=()=>{a.current.removeEventListener("rest",le),cameraStore.setState({userDragging:!1,disableAutoRotate:!1})};a.current.addEventListener("controlstart",()=>{hotspotStore$1.getState().isAnyHotspotActive&&hotspotStore$1.getState().actions.exitHotspot(),a.current.removeEventListener("rest",le),cameraStore.setState({userDragging:!0,disableAutoRotate:!0})}),a.current.addEventListener("controlend",()=>{a.current.active?a.current.addEventListener("rest",le):le()}),a.current.addEventListener("transitionstart",()=>{cameraStore.getState().userDragging!==!0&&(cameraStore.setState({disableAutoRotate:!0}),a.current.addEventListener("rest",le))})},[a]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:jsxDevRuntimeExports.jsxDEV(CameraControls,{ref:a,makeDefault:!0,dollySpeed:s.dollySpeed,truckSpeed:s.truckSpeed,minZoom:s.minZoom,maxZoom:s.maxZoom,minPolarAngle:t?-Math.PI:degToRad(s.minPolarAngle),maxPolarAngle:t?Math.PI:degToRad(s.maxPolarAngle)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/CameraManager.js",lineNumber:234,columnNumber:7},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/CameraManager.js",lineNumber:233,columnNumber:5},globalThis)},Root=()=>{const a=useThree(e=>e.gl);return reactExports.useEffect(()=>{sceneStore.setState({glContext:a})},[]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV(BaseScene,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:16,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(CameraManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/Root.js",lineNumber:17,columnNumber:7},globalThis),jsxDevRuntimeExports.jsxDEV(LightManager,{},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)},Alert=({handleCloseAlert:a,alertData:e})=>{const t=reactExports.useRef(null),n=reactExports.useRef(null),s=reactExports.useRef(null),o=()=>{clearTimeout(t.current),s.current.style="",n.current.style="",a()};return reactExports.useEffect(()=>{if(s.current===null||n.current===null)return;const v=e.alertTime?e.alertTime:1e3;s.current.style="animation: loader "+v+"ms; animation-timing-function: linear;",n.current.style="animation: loader "+v+"ms; animation-timing-function: linear;",t.current=setTimeout(o,v)},[s,n,e]),jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-bg ".concat(ALERT_TYPES[e.alertType].cssClass),children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-icon-bg ".concat(ALERT_TYPES[e.alertType].cssClass),children:jsxDevRuntimeExports.jsxDEV("img",{src:ALERT_TYPES[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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-msg-cross-timer-bg",children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-msg-cross-bg",children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-msg-bg",style:e.alertLabel?{}:{display:"flex",alignItems:"center"},children:[e.alertLabel&&jsxDevRuntimeExports.jsxDEV("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),jsxDevRuntimeExports.jsxDEV("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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-close-btn-bg",children:jsxDevRuntimeExports.jsxDEV("img",{onClick:o,className:"alert-cross-btn",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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),jsxDevRuntimeExports.jsxDEV("div",{ref:n,className:"alert-timer ".concat(ALERT_TYPES[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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-bg alert-mobile ".concat(ALERT_TYPES[e.alertType].cssClass),children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-icon-msg-cross-bg",children:[jsxDevRuntimeExports.jsxDEV("div",{className:"alert-icon-bg ".concat(ALERT_TYPES[e.alertType].cssClass),children:jsxDevRuntimeExports.jsxDEV("img",{src:ALERT_TYPES[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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-msg-bg",children:[e.alertLabel&&jsxDevRuntimeExports.jsxDEV("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),jsxDevRuntimeExports.jsxDEV("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),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-close-btn-bg",children:jsxDevRuntimeExports.jsxDEV("img",{onClick:o,className:"alert-cross-btn",src:PUBLIC_DESIGN_ASSETS_ENDPOINT+"/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),jsxDevRuntimeExports.jsxDEV("div",{ref:s,className:"alert-timer ".concat(ALERT_TYPES[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)},AlertManager=()=>{const[a,e]=reactExports.useState(null),t=sceneStore(A=>A.alertData),n=sceneStore(A=>A.persistantAlertData);reactExports.useEffect(()=>{!t||!t.alertMsg||s(t)},[t]),reactExports.useEffect(()=>{const A=sceneStore.getState().alertQueue;A.length<=0||(a===null&&(e(A[0]),A[0].persistant===!0&&sceneStore.setState({persistantAlertData:A[0]})),sceneStore.getState().actions.popFromAlertQueue())},[a]);const s=reactExports.useCallback(A=>{if(sceneStore.getState().sceneSettings.disableAlerts===!0)return;let b=A.alertType,T=A.alertId;const ee=sceneStore.getState().sceneSettings.alertControl;let re=!1;Object.keys(ee).map(le=>{le==T&&(re=!0)}),re==!1&&(T="default");let ie=!1;if(Object.keys(ALERT_TYPES).map(le=>{le==b.toLowerCase()&&(ie=!0)}),ie==!1&&(b=ALERT_TYPES.info.id,A.alertType=b),ALERT_TYPES[A.alertType].level<sceneStore.getState().sceneSettings.alertLevel||sceneStore.getState().sceneSettings.alertControl[T]!==!0)return;const se=sceneStore.getState().actions.addToAlertQueue(A);a===null&&se.length===1&&(e(A),A.persistant===!0&&sceneStore.setState({persistantAlertData:A}))},[a]),o=reactExports.useCallback(()=>{e(n)},[n]),v=reactExports.useCallback(async()=>{e(null)},[]);return reactExports.useEffect(()=>{async function A(){await wait(1500);let b=null,T={alertMsg:"Add items by selecting from the panel",alertMsg_Mobile:"Add items by selecting from the panel",alertTime:8e3,alertType:"info",alertLabel:"Get Started"};sceneStore.getState().alertSettings&&(sceneStore.getState().alertSettings.welcomeMessage&&(b=sceneStore.getState().alertSettings.welcomeMessage),sceneStore.getState().alertSettings.instructionMessage&&(T=sceneStore.getState().alertSettings.instructionMessage)),b!==null&&s(b),s(T)}A()},[]),jsxDevRuntimeExports.jsxDEV("div",{className:"alert-space",children:[a===null&&n&&jsxDevRuntimeExports.jsxDEV("div",{onClick:o,className:"alert-persistant-btn-bg",style:{background:ALERT_TYPES[n.alertType].background,border:"1px solid "+ALERT_TYPES[n.alertType].color},children:jsxDevRuntimeExports.jsxDEV("img",{style:{filter:ALERT_TYPES[n.alertType].filter},className:"alert-persistant-btn",src:ALERT_TYPES[n.alertType].src},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:155,columnNumber:11},globalThis)},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:146,columnNumber:9},globalThis),a&&jsxDevRuntimeExports.jsxDEV(Alert,{handleCloseAlert:v,alertData:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:165,columnNumber:9},globalThis)]},void 0,!0,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/AlertManager.js",lineNumber:144,columnNumber:5},globalThis)},OverlayUIManager=()=>{const a=sceneStore(n=>n.canvasTooltipText),e=sceneStore(n=>n.sceneSettings),t=ghostStore(n=>n.ghostData);return jsxDevRuntimeExports.jsxDEV(jsxDevRuntimeExports.Fragment,{children:jsxDevRuntimeExports.jsxDEV("div",{children:[jsxDevRuntimeExports.jsxDEV(AlertManager,{},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:16,columnNumber:9},globalThis),CORE_API.getSceneItemCount()<=0&&!t&&jsxDevRuntimeExports.jsxDEV("div",{style:{fontSize:e.emptySceneTextFontSize},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),jsxDevRuntimeExports.jsxDEV("div",{className:"canvasTooltip",children:a},void 0,!1,{fileName:"C:/Users/Tanay/Desktop/TANAY/GIT_REPOS/epigraph-configurator/src/core/scripts/managers/OverlayUIManager.js",lineNumber:27,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 getPlugAttributesFromObject(a){let e={};if(a.type.toLowerCase()==="object3d"){const t=a.userData;if(t?.isPlug===1){const n=t.name;n&&typeof n=="string"&&(e.name=n);const s=t.type;s&&typeof s=="string"?e.type=s:e.type="";const o=t.weight;o&&typeof o=="number"?e.weight=o:e.weight=1;const v=t.affectedNodes;v&&typeof v=="string"?e.affectedNodes=v.replaceAll(" ","").split(","):e.affectedNodes=[];const A=t.acceptedPlugTypes;A&&typeof A=="string"?e.acceptedPlugTypes=A.replaceAll(" ","").split(","):e.acceptedPlugTypes=[];const b=t.connectsToPlugTypes;b&&typeof b=="string"?e.connectsToPlugTypes=b.replaceAll(" ","").split(","):e.connectsToPlugTypes=[];const T=t.dependencySku;T&&typeof T=="string"?e.dependencySku=T:e.dependencySku="";const ee=t.isDependencySkuInteractive;T!==void 0&&typeof ee=="number"?e.isDependencySkuInteractive=ee:e.isDependencySkuInteractive=1}}return e}async function loadAllProxies(a){const e=assetStore.getState().actions;for(let t=0;t<Object.keys(a).length;t++){const n=Object.keys(a)[t];LOGGER.info({title:"loading proxy: "+n});const s=performance.now(),o=await e.loadAsset(n,!0),v=performance.now();if(LOGGER.info({title:`${n} proxy: ${((v-s)/1e3).toFixed(2)} seconds to load.`}),LOGGER.info({title:"loaded proxy: "+n}),LOGGER.info({title:"waitingForAsset",details:o}),!o||!o.proxy.data)continue;const A=a[n]?.plugs,b=A===void 0||Array.isArray(A)&&A.length===0;b===!0&&LOGGER.info({title:`Collecting plugs information for ${n} from the proxy mesh`});let T=[];o.proxy.data.scene.traverse(ie=>{if(b===!0){const se=getPlugAttributesFromObject(ie);Object.keys(se).length>0&&T.push(se)}if(ie.isMesh){ie.material.color=new Color$1(0/255,0/255,0/255);const se=sceneStore.getState().sceneSettings.ghostColor;ie.material.emissive=new Color$1(se.r/255,se.g/255,se.b/255),ie.material.emissiveIntensity=.75,ie.material.alphaTest=se.a,ie.material.transparent=!0,ie.material.opacity=se.a,ie.material.depthTest=!1,ie.material.reflectivity=0,ie.material.metalness=0,ie.material.wireframe=sceneStore.getState().sceneSettings.ghostAsWireframe}}),T.length>0&&(a[n].plugs=T);const{boundingBox:ee,boundingSphere:re}=computeProxyBoundingBox(o);if(ee&&re){const ie=calculateBoundingBoxSize(ee);a[n].boundingBox=ee,a[n].boundingSphereCenter=re.center,a[n].boundingBoxSize=ie}else a[n].boundingSphereCenter={x:0,y:0,z:0},a[n].boundingBoxSize={x:0,y:0,z:0}}}function calculateBoundingBoxSize(a){return{x:a.max.x-a.min.x,y:a.max.y-a.min.y,z:a.max.z-a.min.z}}function computeProxyBoundingBox(a){const e=a.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 AlertStyles=`.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}}
9150
9150
  `,GenericStyles=`#epigraphConfiguratorCore{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}.coreContainer{position:relative;width:100%;height:100%}.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}.uninteractable{pointer-events:none;opacity:.8}.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}.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}
9151
9151
  `,HotspotStyles=`.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}}
9152
9152
  `,DimensionStyles=`.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)}