From 8c5a1b56770626a27a3b56bd563b99b1e9a35ccb Mon Sep 17 00:00:00 2001 From: Gia-Phong Nguyen <43556320+gjnguyen18@users.noreply.github.com> Date: Wed, 29 May 2024 03:31:32 -0700 Subject: [PATCH] Updates --- CNAME | 1 - assets/index-BspYhM4D.css | 1 + assets/index-DRtYWPIR.css | 1 - .../{index-B_B1bxNd.js => index-Dk78figV.js} | 38 +++++++++---------- index.html | 4 +- 5 files changed, 22 insertions(+), 23 deletions(-) delete mode 100644 CNAME create mode 100644 assets/index-BspYhM4D.css delete mode 100644 assets/index-DRtYWPIR.css rename assets/{index-B_B1bxNd.js => index-Dk78figV.js} (94%) diff --git a/CNAME b/CNAME deleted file mode 100644 index 56aab452..00000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -res-lenses.resilientdb.com \ No newline at end of file diff --git a/assets/index-BspYhM4D.css b/assets/index-BspYhM4D.css new file mode 100644 index 00000000..146c301e --- /dev/null +++ b/assets/index-BspYhM4D.css @@ -0,0 +1 @@ +html,body{box-sizing:border-box;margin:0;padding:0;overflow:hidden;font-family:Lucida Console}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-track{background:#ffffff80;border-radius:5px}::-webkit-scrollbar-thumb{background:#055e79cc;border-radius:5px}.horizontalContainer{width:100%}.horizontalContainer>div{width:auto;display:inline-block;margin-right:20px;vertical-align:middle}.checkDiv{text-align:right}.checkDiv>div{display:inline-block}input[type=file]{color:#0000;width:90px;margin-right:0}button{background-color:#0a0a0a;opacity:.8;border:none;color:#fff;font-family:Lucida Console}button:disabled{background-color:#5a5a5a;opacity:.8;border:none;color:#fff;font-family:Lucida Console}button:hover{cursor:pointer;background-color:#a5a5a5;transition:.3s}#tCont{padding:10px}#titleDiv{color:#fff;width:320px!important;height:90px;position:fixed;top:10px;right:10px;padding:10px;font-size:50px;font-family:Impact;text-align:center;background-color:#0000004d}#helpDiv{color:#fff;width:300px!important;height:30px;position:fixed;top:130px;right:10px;padding:20px;font-size:30px;text-align:center;text-overflow:wrap;background-color:#0000004d;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}#helpDiv:hover{cursor:pointer;background-color:#a5a5a5;transition:.3s}#topDiv{color:#fff;width:700px!important;height:90px;position:fixed;font-size:20px;top:10px;left:10px;padding:10px;background-color:#0000004d;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}#sideDiv{color:#fff;height:calc(100% - 240px);position:fixed;overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis;top:130px;left:10px;padding:10px 0;background-color:#0000004d;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;transition:.3s}.tooltip .tooltiptext{visibility:hidden;background-color:#0000004d;color:#fff;padding:10px;opacity:0;transition:opacity .2s;white-space:normal}.tooltip:hover .tooltiptext{opacity:1;visibility:visible}.topTooltip{position:fixed;top:10px;left:740px;width:calc(100% - 1120px);height:20px;font-size:14px;text-align:center}.bottomTooltip{position:fixed;top:60px;left:740px;width:calc(100% - 1120px);height:40px;font-size:14px;text-align:left}#sideDiv>*{overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}#topDiv>*{padding:5px}#bottomDiv{color:#fff;position:fixed;text-align:center;bottom:10px;left:10px;width:calc(100% - 20px);height:50px;padding:10px;font-size:30px;background-color:#0000004d;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}#innerBottom>*{height:30px;width:15%;padding:0;left:0;bottom:0}#innerBottom>*>button{height:100%;width:100%;padding:0;left:0;bottom:0}#innerBottom>*>div{height:100%;width:100%;padding:0;left:0;bottom:0;border-radius:0}#innerBottom>*>*>button{height:100%;width:100%;padding:0;left:0;bottom:0;border-radius:0}#SwitchButton-div{padding:5px}#SwitchButton-div>*{height:30px}#ToggleSortButton-div{padding:5px}#ToggleSortButton-div>*{height:30px}#ToggleView-div{padding:5px}#ToggleView-div>*{height:30px}#addressDiv1{color:#fff;width:10000px;height:2px;position:absolute;padding:0;font-size:12px;text-align:right;background-color:#00ff00b3}#addressDiv2{color:#fff;width:10000px;height:2px;position:absolute;padding:0;font-size:12px;text-align:right;background-color:#00ffffb3;transform:rotate(90deg)}#from-display-div{color:#0ff}#to-display-div{color:#0f0}#transaction-from-div,#transaction-to-div{color:#f9f}input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:95%;left:2.5%;outline:none;position:absolute;margin:auto;top:40%;bottom:0;background-color:transparent;pointer-events:none}#sliderBar-div{width:95%;left:2.5%;height:5px;position:absolute;margin:auto;top:40%;bottom:0;border-radius:5px;background-color:#fff}input[type=range]::-webkit-slider-runnable-track{-webkit-appearance:none;height:5px}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;height:1.7em;width:1.7em;background-color:#3264fe;cursor:pointer;margin-top:-9px;pointer-events:auto;border-radius:50%}input[type=range]:active::-webkit-slider-thumb{background-color:#fff;border:3px solid #3264fe} diff --git a/assets/index-DRtYWPIR.css b/assets/index-DRtYWPIR.css deleted file mode 100644 index 74a80e15..00000000 --- a/assets/index-DRtYWPIR.css +++ /dev/null @@ -1 +0,0 @@ -html,body{box-sizing:border-box;margin:0;padding:0;overflow:hidden;font-family:Lucida Console}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-track{background:#ffffff80;border-radius:5px}::-webkit-scrollbar-thumb{background:#055e79cc;border-radius:5px}.horizontalContainer{width:100%}.horizontalContainer>div{width:auto;display:inline-block;margin-right:20px;vertical-align:middle}.checkDiv{text-align:right}.checkDiv>div{display:inline-block}input[type=file]{color:#0000;width:90px;margin-right:0}button{background-color:#0a0a0a;opacity:.8;border:none;color:#fff;font-family:Lucida Console}button:hover{cursor:pointer;background-color:#a5a5a5;transition:.3s}#tCont{padding:10px}#titleDiv{color:#fff;width:320px!important;height:90px;position:fixed;top:10px;right:10px;padding:10px;font-size:50px;font-family:Impact;text-align:center;background-color:#0000004d}#helpDiv{color:#fff;width:300px!important;height:30px;position:fixed;top:130px;right:10px;padding:20px;font-size:30px;text-align:center;text-overflow:wrap;background-color:#0000004d;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}#helpDiv:hover{cursor:pointer;background-color:#a5a5a5;transition:.3s}#topDiv{color:#fff;width:700px!important;height:90px;position:fixed;font-size:20px;top:10px;left:10px;padding:10px;background-color:#0000004d;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}#sideDiv{color:#fff;height:calc(100% - 240px);position:fixed;overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis;top:130px;left:10px;padding:10px 0;background-color:#0000004d;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;transition:.3s}.tooltip .tooltiptext{visibility:hidden;background-color:#0000004d;color:#fff;padding:10px;opacity:0;transition:opacity .2s;white-space:normal}.tooltip:hover .tooltiptext{opacity:1;visibility:visible}.topTooltip{position:fixed;top:10px;left:740px;width:calc(100% - 1120px);height:20px;font-size:14px;text-align:center}.bottomTooltip{position:fixed;top:60px;left:740px;width:calc(100% - 1120px);height:40px;font-size:14px;text-align:left}#sideDiv>*{overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}#topDiv>*{padding:5px}#bottomDiv{color:#fff;position:fixed;text-align:center;bottom:10px;left:10px;width:calc(100% - 20px);height:50px;padding:10px;font-size:30px;background-color:#0000004d;user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none}#innerBottom>*{height:30px;width:15%;padding:0;left:0;bottom:0}#innerBottom>*>button{height:100%;width:100%;padding:0;left:0;bottom:0}#innerBottom>*>div{height:100%;width:100%;padding:0;left:0;bottom:0;border-radius:0}#innerBottom>*>*>button{height:100%;width:100%;padding:0;left:0;bottom:0;border-radius:0}#SwitchButton-div{padding:5px}#SwitchButton-div>*{height:30px}#ToggleSortButton-div{padding:5px}#ToggleSortButton-div>*{height:30px}#ToggleView-div{padding:5px}#ToggleView-div>*{height:30px}#addressDiv1{color:#fff;width:10000px;height:2px;position:absolute;padding:0;font-size:12px;text-align:right;background-color:#00ff00b3}#addressDiv2{color:#fff;width:10000px;height:2px;position:absolute;padding:0;font-size:12px;text-align:right;background-color:#00ffffb3;transform:rotate(90deg)}#from-display-div{color:#0ff}#to-display-div{color:#0f0}#transaction-from-div,#transaction-to-div{color:#f9f}input[type=range]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:95%;left:2.5%;outline:none;position:absolute;margin:auto;top:40%;bottom:0;background-color:transparent;pointer-events:none}#sliderBar-div{width:95%;left:2.5%;height:5px;position:absolute;margin:auto;top:40%;bottom:0;border-radius:5px;background-color:#fff}input[type=range]::-webkit-slider-runnable-track{-webkit-appearance:none;height:5px}input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;height:1.7em;width:1.7em;background-color:#3264fe;cursor:pointer;margin-top:-9px;pointer-events:auto;border-radius:50%}input[type=range]:active::-webkit-slider-thumb{background-color:#fff;border:3px solid #3264fe} diff --git a/assets/index-B_B1bxNd.js b/assets/index-Dk78figV.js similarity index 94% rename from assets/index-B_B1bxNd.js rename to assets/index-Dk78figV.js index 0a260363..c102ea36 100644 --- a/assets/index-B_B1bxNd.js +++ b/assets/index-Dk78figV.js @@ -2,7 +2,7 @@ * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const Gs="164",uc=0,ca=1,dc=2,ol=1,fc=2,Ze=3,mn=0,_e=1,Je=2,fn=0,ii=1,ha=2,ua=3,da=4,pc=5,Rn=100,mc=101,gc=102,_c=103,vc=104,xc=200,Sc=201,Mc=202,Ec=203,bs=204,As=205,yc=206,Tc=207,bc=208,Ac=209,wc=210,Rc=211,Cc=212,Pc=213,Lc=214,Dc=0,Uc=1,Ic=2,mr=3,Nc=4,Oc=5,Fc=6,Bc=7,Ws=0,zc=1,kc=2,pn=0,Hc=1,Vc=2,Gc=3,Wc=4,Xc=5,qc=6,Yc=7,ll=300,ai=301,oi=302,ws=303,Rs=304,Tr=306,Cs=1e3,Pn=1001,Ps=1002,Re=1003,jc=1004,Bi=1005,Ue=1006,Fr=1007,Ln=1008,gn=1009,Kc=1010,$c=1011,cl=1012,hl=1013,li=1014,dn=1015,br=1016,ul=1017,dl=1018,Ci=1020,Zc=35902,Jc=1021,Qc=1022,ke=1023,th=1024,eh=1025,ri=1026,wi=1027,nh=1028,fl=1029,ih=1030,pl=1031,ml=1033,Br=33776,zr=33777,kr=33778,Hr=33779,fa=35840,pa=35841,ma=35842,ga=35843,_a=36196,va=37492,xa=37496,Sa=37808,Ma=37809,Ea=37810,ya=37811,Ta=37812,ba=37813,Aa=37814,wa=37815,Ra=37816,Ca=37817,Pa=37818,La=37819,Da=37820,Ua=37821,Vr=36492,Ia=36494,Na=36495,rh=36283,Oa=36284,Fa=36285,Ba=36286,sh=3200,ah=3201,gl=0,oh=1,un="",Fe="srgb",vn="srgb-linear",Xs="display-p3",Ar="display-p3-linear",gr="linear",Kt="srgb",_r="rec709",vr="p3",Fn=7680,za=519,lh=512,ch=513,hh=514,_l=515,uh=516,dh=517,fh=518,ph=519,ka=35044,Ha="300 es",Qe=2e3,xr=2001;class hi{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const r=this._listeners[t];if(r!==void 0){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const n=this._listeners[t.type];if(n!==void 0){t.target=this;const r=n.slice(0);for(let s=0,a=r.length;s>8&255]+ue[i>>16&255]+ue[i>>24&255]+"-"+ue[t&255]+ue[t>>8&255]+"-"+ue[t>>16&15|64]+ue[t>>24&255]+"-"+ue[e&63|128]+ue[e>>8&255]+"-"+ue[e>>16&255]+ue[e>>24&255]+ue[n&255]+ue[n>>8&255]+ue[n>>16&255]+ue[n>>24&255]).toLowerCase()}function ge(i,t,e){return Math.max(t,Math.min(e,i))}function mh(i,t){return(i%t+t)%t}function Wr(i,t,e){return(1-e)*i+e*t}function _i(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function me(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class Ut{constructor(t=0,e=0){Ut.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ge(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),s=this.x-t.x,a=this.y-t.y;return this.x=s*n-a*r+t.x,this.y=s*r+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class wt{constructor(t,e,n,r,s,a,o,l,c){wt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,a,o,l,c)}set(t,e,n,r,s,a,o,l,c){const h=this.elements;return h[0]=t,h[1]=r,h[2]=o,h[3]=e,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],p=n[2],m=n[5],g=n[8],_=r[0],f=r[3],d=r[6],T=r[1],M=r[4],b=r[7],O=r[2],w=r[5],A=r[8];return s[0]=a*_+o*T+l*O,s[3]=a*f+o*M+l*w,s[6]=a*d+o*b+l*A,s[1]=c*_+h*T+u*O,s[4]=c*f+h*M+u*w,s[7]=c*d+h*b+u*A,s[2]=p*_+m*T+g*O,s[5]=p*f+m*M+g*w,s[8]=p*d+m*b+g*A,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=h*a-o*c,p=o*l-h*s,m=c*s-a*l,g=e*u+n*p+r*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return t[0]=u*_,t[1]=(r*c-h*n)*_,t[2]=(o*n-r*a)*_,t[3]=p*_,t[4]=(h*e-r*l)*_,t[5]=(r*s-o*e)*_,t[6]=m*_,t[7]=(n*l-c*e)*_,t[8]=(a*e-n*s)*_,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+t,-r*c,r*l,-r*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(Xr.makeScale(t,e)),this}rotate(t){return this.premultiply(Xr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Xr.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const Xr=new wt;function vl(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function Sr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function gh(){const i=Sr("canvas");return i.style.display="block",i}const Va={};function _h(i){i in Va||(Va[i]=!0,console.warn(i))}const Ga=new wt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Wa=new wt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),zi={[vn]:{transfer:gr,primaries:_r,toReference:i=>i,fromReference:i=>i},[Fe]:{transfer:Kt,primaries:_r,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Ar]:{transfer:gr,primaries:vr,toReference:i=>i.applyMatrix3(Wa),fromReference:i=>i.applyMatrix3(Ga)},[Xs]:{transfer:Kt,primaries:vr,toReference:i=>i.convertSRGBToLinear().applyMatrix3(Wa),fromReference:i=>i.applyMatrix3(Ga).convertLinearToSRGB()}},vh=new Set([vn,Ar]),Wt={enabled:!0,_workingColorSpace:vn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!vh.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,t,e){if(this.enabled===!1||t===e||!t||!e)return i;const n=zi[t].toReference,r=zi[e].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,t){return this.convert(i,this._workingColorSpace,t)},toWorkingColorSpace:function(i,t){return this.convert(i,t,this._workingColorSpace)},getPrimaries:function(i){return zi[i].primaries},getTransfer:function(i){return i===un?gr:zi[i].transfer}};function si(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function qr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Bn;class xh{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Bn===void 0&&(Bn=Sr("canvas")),Bn.width=t.width,Bn.height=t.height;const n=Bn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Bn}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=Sr("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const r=n.getImageData(0,0,t.width,t.height),s=r.data;for(let a=0;a0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ll)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Cs:t.x=t.x-Math.floor(t.x);break;case Pn:t.x=t.x<0?0:1;break;case Ps:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Cs:t.y=t.y-Math.floor(t.y);break;case Pn:t.y=t.y<0?0:1;break;case Ps:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}ve.DEFAULT_IMAGE=null;ve.DEFAULT_MAPPING=ll;ve.DEFAULT_ANISOTROPY=1;class Zt{constructor(t=0,e=0,n=0,r=1){Zt.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,s=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*s,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,s;const l=t.elements,c=l[0],h=l[4],u=l[8],p=l[1],m=l[5],g=l[9],_=l[2],f=l[6],d=l[10];if(Math.abs(h-p)<.01&&Math.abs(u-_)<.01&&Math.abs(g-f)<.01){if(Math.abs(h+p)<.1&&Math.abs(u+_)<.1&&Math.abs(g+f)<.1&&Math.abs(c+m+d-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const M=(c+1)/2,b=(m+1)/2,O=(d+1)/2,w=(h+p)/4,A=(u+_)/4,k=(g+f)/4;return M>b&&M>O?M<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(M),r=w/n,s=A/n):b>O?b<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),n=w/r,s=k/r):O<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(O),n=A/s,r=k/s),this.set(n,r,s,e),this}let T=Math.sqrt((f-g)*(f-g)+(u-_)*(u-_)+(p-h)*(p-h));return Math.abs(T)<.001&&(T=1),this.x=(f-g)/T,this.y=(u-_)/T,this.z=(p-h)/T,this.w=Math.acos((c+m+d-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Eh extends hi{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Zt(0,0,t,e),this.scissorTest=!1,this.viewport=new Zt(0,0,t,e);const r={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ue,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new ve(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o=0?1:-1,M=1-d*d;if(M>Number.EPSILON){const O=Math.sqrt(M),w=Math.atan2(O,d*T);f=Math.sin(f*w)/O,o=Math.sin(o*w)/O}const b=o*T;if(l=l*f+p*b,c=c*f+m*b,h=h*f+g*b,u=u*f+_*b,f===1-o){const O=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=O,c*=O,h*=O,u*=O}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],u=s[a],p=s[a+1],m=s[a+2],g=s[a+3];return t[e]=o*g+h*u+l*m-c*p,t[e+1]=l*g+h*p+c*u-o*m,t[e+2]=c*g+h*m+o*p-l*u,t[e+3]=h*g-o*u-l*p-c*m,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,r=t._y,s=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),u=o(s/2),p=l(n/2),m=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=p*h*u+c*m*g,this._y=c*m*u-p*h*g,this._z=c*h*g+p*m*u,this._w=c*h*u-p*m*g;break;case"YXZ":this._x=p*h*u+c*m*g,this._y=c*m*u-p*h*g,this._z=c*h*g-p*m*u,this._w=c*h*u+p*m*g;break;case"ZXY":this._x=p*h*u-c*m*g,this._y=c*m*u+p*h*g,this._z=c*h*g+p*m*u,this._w=c*h*u-p*m*g;break;case"ZYX":this._x=p*h*u-c*m*g,this._y=c*m*u+p*h*g,this._z=c*h*g-p*m*u,this._w=c*h*u+p*m*g;break;case"YZX":this._x=p*h*u+c*m*g,this._y=c*m*u+p*h*g,this._z=c*h*g-p*m*u,this._w=c*h*u-p*m*g;break;case"XZY":this._x=p*h*u-c*m*g,this._y=c*m*u-p*h*g,this._z=c*h*g+p*m*u,this._w=c*h*u+p*m*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],s=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],u=e[10],p=n+o+u;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(h-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(n>o&&n>u){const m=2*Math.sqrt(1+n-o-u);this._w=(h-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>u){const m=2*Math.sqrt(1+o-n-u);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+u-n-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ge(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,s=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*t._w+n*t._x+r*t._y+s*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-e;return this._w=m*a+e*this._w,this._x=m*n+e*this._x,this._y=m*r+e*this._y,this._z=m*s+e*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-e)*h)/c,p=Math.sin(e*h)/c;return this._w=a*u+this._w*p,this._x=n*u+this._x*p,this._y=r*u+this._y*p,this._z=s*u+this._z*p,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class L{constructor(t=0,e=0,n=0){L.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Xa.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Xa.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*r,this.y=s[1]*e+s[4]*n+s[7]*r,this.z=s[2]*e+s[5]*n+s[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,s=t.elements,a=1/(s[3]*e+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*e+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*e+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,s=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*r-o*n),h=2*(o*e-s*r),u=2*(s*n-a*e);return this.x=e+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=r+l*u+s*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r,this.y=s[1]*e+s[5]*n+s[9]*r,this.z=s[2]*e+s[6]*n+s[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,l=e.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return jr.copy(this).projectOnVector(t),this.sub(jr)}reflect(t){return this.sub(jr.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ge(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const jr=new L,Xa=new Li;class Di{constructor(t=new L(1/0,1/0,1/0),e=new L(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Pe),Pe.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(vi),Hi.subVectors(this.max,vi),zn.subVectors(t.a,vi),kn.subVectors(t.b,vi),Hn.subVectors(t.c,vi),en.subVectors(kn,zn),nn.subVectors(Hn,kn),Sn.subVectors(zn,Hn);let e=[0,-en.z,en.y,0,-nn.z,nn.y,0,-Sn.z,Sn.y,en.z,0,-en.x,nn.z,0,-nn.x,Sn.z,0,-Sn.x,-en.y,en.x,0,-nn.y,nn.x,0,-Sn.y,Sn.x,0];return!Kr(e,zn,kn,Hn,Hi)||(e=[1,0,0,0,1,0,0,0,1],!Kr(e,zn,kn,Hn,Hi))?!1:(Vi.crossVectors(en,nn),e=[Vi.x,Vi.y,Vi.z],Kr(e,zn,kn,Hn,Hi))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Pe).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Pe).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Xe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Xe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Xe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Xe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Xe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Xe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Xe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Xe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Xe),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Xe=[new L,new L,new L,new L,new L,new L,new L,new L],Pe=new L,ki=new Di,zn=new L,kn=new L,Hn=new L,en=new L,nn=new L,Sn=new L,vi=new L,Hi=new L,Vi=new L,Mn=new L;function Kr(i,t,e,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Mn.fromArray(i,s);const o=r.x*Math.abs(Mn.x)+r.y*Math.abs(Mn.y)+r.z*Math.abs(Mn.z),l=t.dot(Mn),c=e.dot(Mn),h=n.dot(Mn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Th=new Di,xi=new L,$r=new L;class qs{constructor(t=new L,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;e!==void 0?n.copy(e):Th.setFromPoints(t).getCenter(n);let r=0;for(let s=0,a=t.length;sthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;xi.subVectors(t,this.center);const e=xi.lengthSq();if(e>this.radius*this.radius){const n=Math.sqrt(e),r=(n-this.radius)*.5;this.center.addScaledVector(xi,r/n),this.radius+=r}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):($r.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(xi.copy(t.center).add($r)),this.expandByPoint(xi.copy(t.center).sub($r))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const qe=new L,Zr=new L,Gi=new L,rn=new L,Jr=new L,Wi=new L,Qr=new L;class Ml{constructor(t=new L,e=new L(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,qe)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=qe.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(qe.copy(this.origin).addScaledVector(this.direction,e),qe.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){Zr.copy(t).add(e).multiplyScalar(.5),Gi.copy(e).sub(t).normalize(),rn.copy(this.origin).sub(Zr);const s=t.distanceTo(e)*.5,a=-this.direction.dot(Gi),o=rn.dot(this.direction),l=-rn.dot(Gi),c=rn.lengthSq(),h=Math.abs(1-a*a);let u,p,m,g;if(h>0)if(u=a*l-o,p=a*o-l,g=s*h,u>=0)if(p>=-g)if(p<=g){const _=1/h;u*=_,p*=_,m=u*(u+a*p+2*o)+p*(a*u+p+2*l)+c}else p=s,u=Math.max(0,-(a*p+o)),m=-u*u+p*(p+2*l)+c;else p=-s,u=Math.max(0,-(a*p+o)),m=-u*u+p*(p+2*l)+c;else p<=-g?(u=Math.max(0,-(-a*s+o)),p=u>0?-s:Math.min(Math.max(-s,-l),s),m=-u*u+p*(p+2*l)+c):p<=g?(u=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(u=Math.max(0,-(a*s+o)),p=u>0?s:Math.min(Math.max(-s,-l),s),m=-u*u+p*(p+2*l)+c);else p=a>0?-s:s,u=Math.max(0,-(a*p+o)),m=-u*u+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Zr).addScaledVector(Gi,p),m}intersectSphere(t,e){qe.subVectors(t.center,this.origin);const n=qe.dot(this.direction),r=qe.dot(qe)-n*n,s=t.radius*t.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,p=this.origin;return c>=0?(n=(t.min.x-p.x)*c,r=(t.max.x-p.x)*c):(n=(t.max.x-p.x)*c,r=(t.min.x-p.x)*c),h>=0?(s=(t.min.y-p.y)*h,a=(t.max.y-p.y)*h):(s=(t.max.y-p.y)*h,a=(t.min.y-p.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a=0?(o=(t.min.z-p.z)*u,l=(t.max.z-p.z)*u):(o=(t.max.z-p.z)*u,l=(t.min.z-p.z)*u),n>l||o>r)||((o>n||n!==n)&&(n=o),(l=0?n:r,e)}intersectsBox(t){return this.intersectBox(t,qe)!==null}intersectTriangle(t,e,n,r,s){Jr.subVectors(e,t),Wi.subVectors(n,t),Qr.crossVectors(Jr,Wi);let a=this.direction.dot(Qr),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;rn.subVectors(this.origin,t);const l=o*this.direction.dot(Wi.crossVectors(rn,Wi));if(l<0)return null;const c=o*this.direction.dot(Jr.cross(rn));if(c<0||l+c>a)return null;const h=-o*rn.dot(Qr);return h<0?null:this.at(h/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Jt{constructor(t,e,n,r,s,a,o,l,c,h,u,p,m,g,_,f){Jt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,a,o,l,c,h,u,p,m,g,_,f)}set(t,e,n,r,s,a,o,l,c,h,u,p,m,g,_,f){const d=this.elements;return d[0]=t,d[4]=e,d[8]=n,d[12]=r,d[1]=s,d[5]=a,d[9]=o,d[13]=l,d[2]=c,d[6]=h,d[10]=u,d[14]=p,d[3]=m,d[7]=g,d[11]=_,d[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Jt().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/Vn.setFromMatrixColumn(t,0).length(),s=1/Vn.setFromMatrixColumn(t,1).length(),a=1/Vn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,r=t.y,s=t.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),u=Math.sin(s);if(t.order==="XYZ"){const p=a*h,m=a*u,g=o*h,_=o*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=m+g*c,e[5]=p-_*c,e[9]=-o*l,e[2]=_-p*c,e[6]=g+m*c,e[10]=a*l}else if(t.order==="YXZ"){const p=l*h,m=l*u,g=c*h,_=c*u;e[0]=p+_*o,e[4]=g*o-m,e[8]=a*c,e[1]=a*u,e[5]=a*h,e[9]=-o,e[2]=m*o-g,e[6]=_+p*o,e[10]=a*l}else if(t.order==="ZXY"){const p=l*h,m=l*u,g=c*h,_=c*u;e[0]=p-_*o,e[4]=-a*u,e[8]=g+m*o,e[1]=m+g*o,e[5]=a*h,e[9]=_-p*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){const p=a*h,m=a*u,g=o*h,_=o*u;e[0]=l*h,e[4]=g*c-m,e[8]=p*c+_,e[1]=l*u,e[5]=_*c+p,e[9]=m*c-g,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){const p=a*l,m=a*c,g=o*l,_=o*c;e[0]=l*h,e[4]=_-p*u,e[8]=g*u+m,e[1]=u,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=m*u+g,e[10]=p-_*u}else if(t.order==="XZY"){const p=a*l,m=a*c,g=o*l,_=o*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=p*u+_,e[5]=a*h,e[9]=m*u-g,e[2]=g*u-m,e[6]=o*h,e[10]=_*u+p}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(bh,t,Ah)}lookAt(t,e,n){const r=this.elements;return Ee.subVectors(t,e),Ee.lengthSq()===0&&(Ee.z=1),Ee.normalize(),sn.crossVectors(n,Ee),sn.lengthSq()===0&&(Math.abs(n.z)===1?Ee.x+=1e-4:Ee.z+=1e-4,Ee.normalize(),sn.crossVectors(n,Ee)),sn.normalize(),Xi.crossVectors(Ee,sn),r[0]=sn.x,r[4]=Xi.x,r[8]=Ee.x,r[1]=sn.y,r[5]=Xi.y,r[9]=Ee.y,r[2]=sn.z,r[6]=Xi.z,r[10]=Ee.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],p=n[9],m=n[13],g=n[2],_=n[6],f=n[10],d=n[14],T=n[3],M=n[7],b=n[11],O=n[15],w=r[0],A=r[4],k=r[8],E=r[12],x=r[1],N=r[5],q=r[9],C=r[13],G=r[2],X=r[6],Z=r[10],J=r[14],H=r[3],tt=r[7],Q=r[11],pt=r[15];return s[0]=a*w+o*x+l*G+c*H,s[4]=a*A+o*N+l*X+c*tt,s[8]=a*k+o*q+l*Z+c*Q,s[12]=a*E+o*C+l*J+c*pt,s[1]=h*w+u*x+p*G+m*H,s[5]=h*A+u*N+p*X+m*tt,s[9]=h*k+u*q+p*Z+m*Q,s[13]=h*E+u*C+p*J+m*pt,s[2]=g*w+_*x+f*G+d*H,s[6]=g*A+_*N+f*X+d*tt,s[10]=g*k+_*q+f*Z+d*Q,s[14]=g*E+_*C+f*J+d*pt,s[3]=T*w+M*x+b*G+O*H,s[7]=T*A+M*N+b*X+O*tt,s[11]=T*k+M*q+b*Z+O*Q,s[15]=T*E+M*C+b*J+O*pt,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],s=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],u=t[6],p=t[10],m=t[14],g=t[3],_=t[7],f=t[11],d=t[15];return g*(+s*l*u-r*c*u-s*o*p+n*c*p+r*o*m-n*l*m)+_*(+e*l*m-e*c*p+s*a*p-r*a*m+r*c*h-s*l*h)+f*(+e*c*u-e*o*m-s*a*u+n*a*m+s*o*h-n*c*h)+d*(-r*o*h-e*l*u+e*o*p+r*a*u-n*a*p+n*l*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],p=t[10],m=t[11],g=t[12],_=t[13],f=t[14],d=t[15],T=u*f*c-_*p*c+_*l*m-o*f*m-u*l*d+o*p*d,M=g*p*c-h*f*c-g*l*m+a*f*m+h*l*d-a*p*d,b=h*_*c-g*u*c+g*o*m-a*_*m-h*o*d+a*u*d,O=g*u*l-h*_*l-g*o*p+a*_*p+h*o*f-a*u*f,w=e*T+n*M+r*b+s*O;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/w;return t[0]=T*A,t[1]=(_*p*s-u*f*s-_*r*m+n*f*m+u*r*d-n*p*d)*A,t[2]=(o*f*s-_*l*s+_*r*c-n*f*c-o*r*d+n*l*d)*A,t[3]=(u*l*s-o*p*s-u*r*c+n*p*c+o*r*m-n*l*m)*A,t[4]=M*A,t[5]=(h*f*s-g*p*s+g*r*m-e*f*m-h*r*d+e*p*d)*A,t[6]=(g*l*s-a*f*s-g*r*c+e*f*c+a*r*d-e*l*d)*A,t[7]=(a*p*s-h*l*s+h*r*c-e*p*c-a*r*m+e*l*m)*A,t[8]=b*A,t[9]=(g*u*s-h*_*s-g*n*m+e*_*m+h*n*d-e*u*d)*A,t[10]=(a*_*s-g*o*s+g*n*c-e*_*c-a*n*d+e*o*d)*A,t[11]=(h*o*s-a*u*s-h*n*c+e*u*c+a*n*m-e*o*m)*A,t[12]=O*A,t[13]=(h*_*r-g*u*r+g*n*p-e*_*p-h*n*f+e*u*f)*A,t[14]=(g*o*r-a*_*r-g*n*l+e*_*l+a*n*f-e*o*f)*A,t[15]=(a*u*r-h*o*r+h*n*l-e*u*l-a*n*p+e*o*p)*A,this}scale(t){const e=this.elements,n=t.x,r=t.y,s=t.z;return e[0]*=n,e[4]*=r,e[8]*=s,e[1]*=n,e[5]*=r,e[9]*=s,e[2]*=n,e[6]*=r,e[10]*=s,e[3]*=n,e[7]*=r,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),s=1-n,a=t.x,o=t.y,l=t.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,r,s,a){return this.set(1,n,s,0,t,1,a,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,s=e._x,a=e._y,o=e._z,l=e._w,c=s+s,h=a+a,u=o+o,p=s*c,m=s*h,g=s*u,_=a*h,f=a*u,d=o*u,T=l*c,M=l*h,b=l*u,O=n.x,w=n.y,A=n.z;return r[0]=(1-(_+d))*O,r[1]=(m+b)*O,r[2]=(g-M)*O,r[3]=0,r[4]=(m-b)*w,r[5]=(1-(p+d))*w,r[6]=(f+T)*w,r[7]=0,r[8]=(g+M)*A,r[9]=(f-T)*A,r[10]=(1-(p+_))*A,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let s=Vn.set(r[0],r[1],r[2]).length();const a=Vn.set(r[4],r[5],r[6]).length(),o=Vn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],Le.copy(this);const c=1/s,h=1/a,u=1/o;return Le.elements[0]*=c,Le.elements[1]*=c,Le.elements[2]*=c,Le.elements[4]*=h,Le.elements[5]*=h,Le.elements[6]*=h,Le.elements[8]*=u,Le.elements[9]*=u,Le.elements[10]*=u,e.setFromRotationMatrix(Le),n.x=s,n.y=a,n.z=o,this}makePerspective(t,e,n,r,s,a,o=Qe){const l=this.elements,c=2*s/(e-t),h=2*s/(n-r),u=(e+t)/(e-t),p=(n+r)/(n-r);let m,g;if(o===Qe)m=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===xr)m=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,r,s,a,o=Qe){const l=this.elements,c=1/(e-t),h=1/(n-r),u=1/(a-s),p=(e+t)*c,m=(n+r)*h;let g,_;if(o===Qe)g=(a+s)*u,_=-2*u;else if(o===xr)g=s*u,_=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Vn=new L,Le=new Jt,bh=new L(0,0,0),Ah=new L(1,1,1),sn=new L,Xi=new L,Ee=new L,qa=new Jt,Ya=new Li;class Ge{constructor(t=0,e=0,n=0,r=Ge.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const r=t.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],p=r[6],m=r[10];switch(e){case"XYZ":this._y=Math.asin(ge(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ge(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(ge(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ge(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ge(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-ge(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return qa.makeRotationFromQuaternion(t),this.setFromRotationMatrix(qa,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ya.setFromEuler(this),this.setFromQuaternion(Ya,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ge.DEFAULT_ORDER="XYZ";class Ys{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let e=0;e1){for(let n=0;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){r.children=[];for(let o=0;o0){r.animations=[];for(let o=0;o0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(t,e,n,r,s){De.subVectors(r,e),je.subVectors(n,e),es.subVectors(t,e);const a=De.dot(De),o=De.dot(je),l=De.dot(es),c=je.dot(je),h=je.dot(es),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const p=1/u,m=(c*l-o*h)*p,g=(a*h-o*l)*p;return s.set(1-m-g,g,m)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,Ke)===null?!1:Ke.x>=0&&Ke.y>=0&&Ke.x+Ke.y<=1}static getInterpolation(t,e,n,r,s,a,o,l){return this.getBarycoord(t,e,n,r,Ke)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Ke.x),l.addScaledVector(a,Ke.y),l.addScaledVector(o,Ke.z),l)}static isFrontFacing(t,e,n,r){return De.subVectors(n,e),je.subVectors(t,e),De.cross(je).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return De.subVectors(this.c,this.b),je.subVectors(this.a,this.b),De.cross(je).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ze.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ze.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,r,s){return ze.getInterpolation(t,this.a,this.b,this.c,e,n,r,s)}containsPoint(t){return ze.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ze.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,r=this.b,s=this.c;let a,o;Xn.subVectors(r,n),qn.subVectors(s,n),ns.subVectors(t,n);const l=Xn.dot(ns),c=qn.dot(ns);if(l<=0&&c<=0)return e.copy(n);is.subVectors(t,r);const h=Xn.dot(is),u=qn.dot(is);if(h>=0&&u<=h)return e.copy(r);const p=l*u-h*c;if(p<=0&&l>=0&&h<=0)return a=l/(l-h),e.copy(n).addScaledVector(Xn,a);rs.subVectors(t,s);const m=Xn.dot(rs),g=qn.dot(rs);if(g>=0&&m<=g)return e.copy(s);const _=m*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),e.copy(n).addScaledVector(qn,o);const f=h*g-m*u;if(f<=0&&u-h>=0&&m-g>=0)return Qa.subVectors(s,r),o=(u-h)/(u-h+(m-g)),e.copy(r).addScaledVector(Qa,o);const d=1/(f+_+p);return a=_*d,o=p*d,e.copy(n).addScaledVector(Xn,a).addScaledVector(qn,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const El={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},an={h:0,s:0,l:0},Yi={h:0,s:0,l:0};function ss(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}class Mt{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){const r=t;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Fe){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Wt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,r=Wt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Wt.toWorkingColorSpace(this,r),this}setHSL(t,e,n,r=Wt.workingColorSpace){if(t=mh(t,1),e=ge(e,0,1),n=ge(n,0,1),e===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+e):n+e-n*e,a=2*n-s;this.r=ss(a,s,t+1/3),this.g=ss(a,s,t),this.b=ss(a,s,t-1/3)}return Wt.toWorkingColorSpace(this,r),this}setStyle(t,e=Fe){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Fe){const n=El[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=si(t.r),this.g=si(t.g),this.b=si(t.b),this}copyLinearToSRGB(t){return this.r=qr(t.r),this.g=qr(t.g),this.b=qr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Fe){return Wt.fromWorkingColorSpace(de.copy(this),t),Math.round(ge(de.r*255,0,255))*65536+Math.round(ge(de.g*255,0,255))*256+Math.round(ge(de.b*255,0,255))}getHexString(t=Fe){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Wt.workingColorSpace){Wt.fromWorkingColorSpace(de.copy(this),e);const n=de.r,r=de.g,s=de.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(r-s)/u+(r0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const r=this[e];if(r===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ii&&(n.blending=this.blending),this.side!==mn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==bs&&(n.blendSrc=this.blendSrc),this.blendDst!==As&&(n.blendDst=this.blendDst),this.blendEquation!==Rn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==mr&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==za&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Fn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Fn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Fn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(e){const s=r(t.textures),a=r(t.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const r=e.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=e[s].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class yl extends Ui{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Mt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ge,this.combine=Ws,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const ie=new L,ji=new Ut;class Ve{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=ka,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=dn,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return _h("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,s=this.itemSize;r0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const l in n){const c=n[l];t.data.attributes[l]=c.toJSON(t.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,p=c.length;u0&&(r[l]=h,s=!0)}s&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone(e));const r=t.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(e))}const s=t.morphAttributes;for(const c in s){const h=[],u=s[c];for(let p=0,m=u.length;p0){const r=e[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s(t.far-t.near)**2))&&(to.copy(s).invert(),En.copy(t.ray).applyMatrix4(to),!(n.boundingBox!==null&&En.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,En)))}_computeIntersections(t,e,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,p=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=p.length;g<_;g++){const f=p[g],d=a[f.materialIndex],T=Math.max(f.start,m.start),M=Math.min(o.count,Math.min(f.start+f.count,m.start+m.count));for(let b=T,O=M;be.far?null:{distance:c,point:er.clone(),object:i}}function nr(i,t,e,n,r,s,a,o,l,c){i.getVertexPosition(o,jn),i.getVertexPosition(l,Kn),i.getVertexPosition(c,$n);const h=Uh(i,t,e,n,jn,Kn,$n,tr);if(h){r&&(Zi.fromBufferAttribute(r,o),Ji.fromBufferAttribute(r,l),Qi.fromBufferAttribute(r,c),h.uv=ze.getInterpolation(tr,jn,Kn,$n,Zi,Ji,Qi,new Ut)),s&&(Zi.fromBufferAttribute(s,o),Ji.fromBufferAttribute(s,l),Qi.fromBufferAttribute(s,c),h.uv1=ze.getInterpolation(tr,jn,Kn,$n,Zi,Ji,Qi,new Ut)),a&&(no.fromBufferAttribute(a,o),io.fromBufferAttribute(a,l),ro.fromBufferAttribute(a,c),h.normal=ze.getInterpolation(tr,jn,Kn,$n,no,io,ro,new L),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const u={a:o,b:l,c,normal:new L,materialIndex:0};ze.getNormal(jn,Kn,$n,u.normal),h.face=u}return h}class ui extends On{constructor(t=1,e=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let p=0,m=0;g("z","y","x",-1,-1,n,e,t,a,s,0),g("z","y","x",1,-1,n,e,-t,a,s,1),g("x","z","y",1,1,t,n,e,r,a,2),g("x","z","y",1,-1,t,n,-e,r,a,3),g("x","y","z",1,-1,t,e,n,r,s,4),g("x","y","z",-1,-1,t,e,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Dn(c,3)),this.setAttribute("normal",new Dn(h,3)),this.setAttribute("uv",new Dn(u,2));function g(_,f,d,T,M,b,O,w,A,k,E){const x=b/A,N=O/k,q=b/2,C=O/2,G=w/2,X=A+1,Z=k+1;let J=0,H=0;const tt=new L;for(let Q=0;Q0?1:-1,h.push(tt.x,tt.y,tt.z),u.push(It/A),u.push(1-Q/k),J+=1}}for(let Q=0;Q>8&255]+ue[i>>16&255]+ue[i>>24&255]+"-"+ue[t&255]+ue[t>>8&255]+"-"+ue[t>>16&15|64]+ue[t>>24&255]+"-"+ue[e&63|128]+ue[e>>8&255]+"-"+ue[e>>16&255]+ue[e>>24&255]+ue[n&255]+ue[n>>8&255]+ue[n>>16&255]+ue[n>>24&255]).toLowerCase()}function ge(i,t,e){return Math.max(t,Math.min(e,i))}function mh(i,t){return(i%t+t)%t}function Wr(i,t,e){return(1-e)*i+e*t}function _i(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function me(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class Ut{constructor(t=0,e=0){Ut.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ge(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),s=this.x-t.x,a=this.y-t.y;return this.x=s*n-a*r+t.x,this.y=s*r+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class wt{constructor(t,e,n,r,s,a,o,l,c){wt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,a,o,l,c)}set(t,e,n,r,s,a,o,l,c){const h=this.elements;return h[0]=t,h[1]=r,h[2]=o,h[3]=e,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],p=n[2],m=n[5],g=n[8],_=r[0],d=r[3],f=r[6],T=r[1],M=r[4],b=r[7],O=r[2],w=r[5],A=r[8];return s[0]=a*_+o*T+l*O,s[3]=a*d+o*M+l*w,s[6]=a*f+o*b+l*A,s[1]=c*_+h*T+u*O,s[4]=c*d+h*M+u*w,s[7]=c*f+h*b+u*A,s[2]=p*_+m*T+g*O,s[5]=p*d+m*M+g*w,s[8]=p*f+m*b+g*A,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*s*h+n*o*l+r*s*c-r*a*l}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=h*a-o*c,p=o*l-h*s,m=c*s-a*l,g=e*u+n*p+r*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return t[0]=u*_,t[1]=(r*c-h*n)*_,t[2]=(o*n-r*a)*_,t[3]=p*_,t[4]=(h*e-r*l)*_,t[5]=(r*s-o*e)*_,t[6]=m*_,t[7]=(n*l-c*e)*_,t[8]=(a*e-n*s)*_,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+t,-r*c,r*l,-r*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(Xr.makeScale(t,e)),this}rotate(t){return this.premultiply(Xr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Xr.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const Xr=new wt;function vl(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function Sr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function gh(){const i=Sr("canvas");return i.style.display="block",i}const Va={};function _h(i){i in Va||(Va[i]=!0,console.warn(i))}const Ga=new wt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Wa=new wt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),zi={[vn]:{transfer:gr,primaries:_r,toReference:i=>i,fromReference:i=>i},[Fe]:{transfer:Kt,primaries:_r,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Ar]:{transfer:gr,primaries:vr,toReference:i=>i.applyMatrix3(Wa),fromReference:i=>i.applyMatrix3(Ga)},[Xs]:{transfer:Kt,primaries:vr,toReference:i=>i.convertSRGBToLinear().applyMatrix3(Wa),fromReference:i=>i.applyMatrix3(Ga).convertLinearToSRGB()}},vh=new Set([vn,Ar]),Wt={enabled:!0,_workingColorSpace:vn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!vh.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,t,e){if(this.enabled===!1||t===e||!t||!e)return i;const n=zi[t].toReference,r=zi[e].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,t){return this.convert(i,this._workingColorSpace,t)},toWorkingColorSpace:function(i,t){return this.convert(i,t,this._workingColorSpace)},getPrimaries:function(i){return zi[i].primaries},getTransfer:function(i){return i===un?gr:zi[i].transfer}};function si(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function qr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Bn;class xh{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Bn===void 0&&(Bn=Sr("canvas")),Bn.width=t.width,Bn.height=t.height;const n=Bn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Bn}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=Sr("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const r=n.getImageData(0,0,t.width,t.height),s=r.data;for(let a=0;a0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ll)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Cs:t.x=t.x-Math.floor(t.x);break;case Pn:t.x=t.x<0?0:1;break;case Ps:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Cs:t.y=t.y-Math.floor(t.y);break;case Pn:t.y=t.y<0?0:1;break;case Ps:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}ve.DEFAULT_IMAGE=null;ve.DEFAULT_MAPPING=ll;ve.DEFAULT_ANISOTROPY=1;class Zt{constructor(t=0,e=0,n=0,r=1){Zt.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,s=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*s,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,s;const l=t.elements,c=l[0],h=l[4],u=l[8],p=l[1],m=l[5],g=l[9],_=l[2],d=l[6],f=l[10];if(Math.abs(h-p)<.01&&Math.abs(u-_)<.01&&Math.abs(g-d)<.01){if(Math.abs(h+p)<.1&&Math.abs(u+_)<.1&&Math.abs(g+d)<.1&&Math.abs(c+m+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const M=(c+1)/2,b=(m+1)/2,O=(f+1)/2,w=(h+p)/4,A=(u+_)/4,k=(g+d)/4;return M>b&&M>O?M<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(M),r=w/n,s=A/n):b>O?b<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),n=w/r,s=k/r):O<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(O),n=A/s,r=k/s),this.set(n,r,s,e),this}let T=Math.sqrt((d-g)*(d-g)+(u-_)*(u-_)+(p-h)*(p-h));return Math.abs(T)<.001&&(T=1),this.x=(d-g)/T,this.y=(u-_)/T,this.z=(p-h)/T,this.w=Math.acos((c+m+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Eh extends hi{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Zt(0,0,t,e),this.scissorTest=!1,this.viewport=new Zt(0,0,t,e);const r={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ue,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new ve(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o=0?1:-1,M=1-f*f;if(M>Number.EPSILON){const O=Math.sqrt(M),w=Math.atan2(O,f*T);d=Math.sin(d*w)/O,o=Math.sin(o*w)/O}const b=o*T;if(l=l*d+p*b,c=c*d+m*b,h=h*d+g*b,u=u*d+_*b,d===1-o){const O=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=O,c*=O,h*=O,u*=O}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],u=s[a],p=s[a+1],m=s[a+2],g=s[a+3];return t[e]=o*g+h*u+l*m-c*p,t[e+1]=l*g+h*p+c*u-o*m,t[e+2]=c*g+h*m+o*p-l*u,t[e+3]=h*g-o*u-l*p-c*m,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,r=t._y,s=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(r/2),u=o(s/2),p=l(n/2),m=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=p*h*u+c*m*g,this._y=c*m*u-p*h*g,this._z=c*h*g+p*m*u,this._w=c*h*u-p*m*g;break;case"YXZ":this._x=p*h*u+c*m*g,this._y=c*m*u-p*h*g,this._z=c*h*g-p*m*u,this._w=c*h*u+p*m*g;break;case"ZXY":this._x=p*h*u-c*m*g,this._y=c*m*u+p*h*g,this._z=c*h*g+p*m*u,this._w=c*h*u-p*m*g;break;case"ZYX":this._x=p*h*u-c*m*g,this._y=c*m*u+p*h*g,this._z=c*h*g-p*m*u,this._w=c*h*u+p*m*g;break;case"YZX":this._x=p*h*u+c*m*g,this._y=c*m*u+p*h*g,this._z=c*h*g-p*m*u,this._w=c*h*u-p*m*g;break;case"XZY":this._x=p*h*u-c*m*g,this._y=c*m*u-p*h*g,this._z=c*h*g+p*m*u,this._w=c*h*u+p*m*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],s=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],u=e[10],p=n+o+u;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(h-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(n>o&&n>u){const m=2*Math.sqrt(1+n-o-u);this._w=(h-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>u){const m=2*Math.sqrt(1+o-n-u);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+u-n-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+h)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ge(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,s=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*t._w+n*t._x+r*t._y+s*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-e;return this._w=m*a+e*this._w,this._x=m*n+e*this._x,this._y=m*r+e*this._y,this._z=m*s+e*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-e)*h)/c,p=Math.sin(e*h)/c;return this._w=a*u+this._w*p,this._x=n*u+this._x*p,this._y=r*u+this._y*p,this._z=s*u+this._z*p,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class L{constructor(t=0,e=0,n=0){L.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Xa.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Xa.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*r,this.y=s[1]*e+s[4]*n+s[7]*r,this.z=s[2]*e+s[5]*n+s[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,s=t.elements,a=1/(s[3]*e+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*e+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*e+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,s=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*r-o*n),h=2*(o*e-s*r),u=2*(s*n-a*e);return this.x=e+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=r+l*u+s*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r,this.y=s[1]*e+s[5]*n+s[9]*r,this.z=s[2]*e+s[6]*n+s[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,l=e.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return jr.copy(this).projectOnVector(t),this.sub(jr)}reflect(t){return this.sub(jr.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ge(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const jr=new L,Xa=new Li;class Di{constructor(t=new L(1/0,1/0,1/0),e=new L(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Pe),Pe.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(vi),Hi.subVectors(this.max,vi),zn.subVectors(t.a,vi),kn.subVectors(t.b,vi),Hn.subVectors(t.c,vi),en.subVectors(kn,zn),nn.subVectors(Hn,kn),Sn.subVectors(zn,Hn);let e=[0,-en.z,en.y,0,-nn.z,nn.y,0,-Sn.z,Sn.y,en.z,0,-en.x,nn.z,0,-nn.x,Sn.z,0,-Sn.x,-en.y,en.x,0,-nn.y,nn.x,0,-Sn.y,Sn.x,0];return!Kr(e,zn,kn,Hn,Hi)||(e=[1,0,0,0,1,0,0,0,1],!Kr(e,zn,kn,Hn,Hi))?!1:(Vi.crossVectors(en,nn),e=[Vi.x,Vi.y,Vi.z],Kr(e,zn,kn,Hn,Hi))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Pe).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Pe).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Xe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Xe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Xe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Xe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Xe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Xe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Xe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Xe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Xe),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Xe=[new L,new L,new L,new L,new L,new L,new L,new L],Pe=new L,ki=new Di,zn=new L,kn=new L,Hn=new L,en=new L,nn=new L,Sn=new L,vi=new L,Hi=new L,Vi=new L,Mn=new L;function Kr(i,t,e,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Mn.fromArray(i,s);const o=r.x*Math.abs(Mn.x)+r.y*Math.abs(Mn.y)+r.z*Math.abs(Mn.z),l=t.dot(Mn),c=e.dot(Mn),h=n.dot(Mn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Th=new Di,xi=new L,$r=new L;class qs{constructor(t=new L,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;e!==void 0?n.copy(e):Th.setFromPoints(t).getCenter(n);let r=0;for(let s=0,a=t.length;sthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;xi.subVectors(t,this.center);const e=xi.lengthSq();if(e>this.radius*this.radius){const n=Math.sqrt(e),r=(n-this.radius)*.5;this.center.addScaledVector(xi,r/n),this.radius+=r}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):($r.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(xi.copy(t.center).add($r)),this.expandByPoint(xi.copy(t.center).sub($r))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const qe=new L,Zr=new L,Gi=new L,rn=new L,Jr=new L,Wi=new L,Qr=new L;class Ml{constructor(t=new L,e=new L(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,qe)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=qe.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(qe.copy(this.origin).addScaledVector(this.direction,e),qe.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){Zr.copy(t).add(e).multiplyScalar(.5),Gi.copy(e).sub(t).normalize(),rn.copy(this.origin).sub(Zr);const s=t.distanceTo(e)*.5,a=-this.direction.dot(Gi),o=rn.dot(this.direction),l=-rn.dot(Gi),c=rn.lengthSq(),h=Math.abs(1-a*a);let u,p,m,g;if(h>0)if(u=a*l-o,p=a*o-l,g=s*h,u>=0)if(p>=-g)if(p<=g){const _=1/h;u*=_,p*=_,m=u*(u+a*p+2*o)+p*(a*u+p+2*l)+c}else p=s,u=Math.max(0,-(a*p+o)),m=-u*u+p*(p+2*l)+c;else p=-s,u=Math.max(0,-(a*p+o)),m=-u*u+p*(p+2*l)+c;else p<=-g?(u=Math.max(0,-(-a*s+o)),p=u>0?-s:Math.min(Math.max(-s,-l),s),m=-u*u+p*(p+2*l)+c):p<=g?(u=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(u=Math.max(0,-(a*s+o)),p=u>0?s:Math.min(Math.max(-s,-l),s),m=-u*u+p*(p+2*l)+c);else p=a>0?-s:s,u=Math.max(0,-(a*p+o)),m=-u*u+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Zr).addScaledVector(Gi,p),m}intersectSphere(t,e){qe.subVectors(t.center,this.origin);const n=qe.dot(this.direction),r=qe.dot(qe)-n*n,s=t.radius*t.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,p=this.origin;return c>=0?(n=(t.min.x-p.x)*c,r=(t.max.x-p.x)*c):(n=(t.max.x-p.x)*c,r=(t.min.x-p.x)*c),h>=0?(s=(t.min.y-p.y)*h,a=(t.max.y-p.y)*h):(s=(t.max.y-p.y)*h,a=(t.min.y-p.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a=0?(o=(t.min.z-p.z)*u,l=(t.max.z-p.z)*u):(o=(t.max.z-p.z)*u,l=(t.min.z-p.z)*u),n>l||o>r)||((o>n||n!==n)&&(n=o),(l=0?n:r,e)}intersectsBox(t){return this.intersectBox(t,qe)!==null}intersectTriangle(t,e,n,r,s){Jr.subVectors(e,t),Wi.subVectors(n,t),Qr.crossVectors(Jr,Wi);let a=this.direction.dot(Qr),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;rn.subVectors(this.origin,t);const l=o*this.direction.dot(Wi.crossVectors(rn,Wi));if(l<0)return null;const c=o*this.direction.dot(Jr.cross(rn));if(c<0||l+c>a)return null;const h=-o*rn.dot(Qr);return h<0?null:this.at(h/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Jt{constructor(t,e,n,r,s,a,o,l,c,h,u,p,m,g,_,d){Jt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,r,s,a,o,l,c,h,u,p,m,g,_,d)}set(t,e,n,r,s,a,o,l,c,h,u,p,m,g,_,d){const f=this.elements;return f[0]=t,f[4]=e,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=h,f[10]=u,f[14]=p,f[3]=m,f[7]=g,f[11]=_,f[15]=d,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Jt().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/Vn.setFromMatrixColumn(t,0).length(),s=1/Vn.setFromMatrixColumn(t,1).length(),a=1/Vn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,r=t.y,s=t.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),u=Math.sin(s);if(t.order==="XYZ"){const p=a*h,m=a*u,g=o*h,_=o*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=m+g*c,e[5]=p-_*c,e[9]=-o*l,e[2]=_-p*c,e[6]=g+m*c,e[10]=a*l}else if(t.order==="YXZ"){const p=l*h,m=l*u,g=c*h,_=c*u;e[0]=p+_*o,e[4]=g*o-m,e[8]=a*c,e[1]=a*u,e[5]=a*h,e[9]=-o,e[2]=m*o-g,e[6]=_+p*o,e[10]=a*l}else if(t.order==="ZXY"){const p=l*h,m=l*u,g=c*h,_=c*u;e[0]=p-_*o,e[4]=-a*u,e[8]=g+m*o,e[1]=m+g*o,e[5]=a*h,e[9]=_-p*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){const p=a*h,m=a*u,g=o*h,_=o*u;e[0]=l*h,e[4]=g*c-m,e[8]=p*c+_,e[1]=l*u,e[5]=_*c+p,e[9]=m*c-g,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){const p=a*l,m=a*c,g=o*l,_=o*c;e[0]=l*h,e[4]=_-p*u,e[8]=g*u+m,e[1]=u,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=m*u+g,e[10]=p-_*u}else if(t.order==="XZY"){const p=a*l,m=a*c,g=o*l,_=o*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=p*u+_,e[5]=a*h,e[9]=m*u-g,e[2]=g*u-m,e[6]=o*h,e[10]=_*u+p}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(bh,t,Ah)}lookAt(t,e,n){const r=this.elements;return Ee.subVectors(t,e),Ee.lengthSq()===0&&(Ee.z=1),Ee.normalize(),sn.crossVectors(n,Ee),sn.lengthSq()===0&&(Math.abs(n.z)===1?Ee.x+=1e-4:Ee.z+=1e-4,Ee.normalize(),sn.crossVectors(n,Ee)),sn.normalize(),Xi.crossVectors(Ee,sn),r[0]=sn.x,r[4]=Xi.x,r[8]=Ee.x,r[1]=sn.y,r[5]=Xi.y,r[9]=Ee.y,r[2]=sn.z,r[6]=Xi.z,r[10]=Ee.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],p=n[9],m=n[13],g=n[2],_=n[6],d=n[10],f=n[14],T=n[3],M=n[7],b=n[11],O=n[15],w=r[0],A=r[4],k=r[8],E=r[12],x=r[1],N=r[5],q=r[9],C=r[13],G=r[2],X=r[6],Z=r[10],J=r[14],H=r[3],tt=r[7],Q=r[11],pt=r[15];return s[0]=a*w+o*x+l*G+c*H,s[4]=a*A+o*N+l*X+c*tt,s[8]=a*k+o*q+l*Z+c*Q,s[12]=a*E+o*C+l*J+c*pt,s[1]=h*w+u*x+p*G+m*H,s[5]=h*A+u*N+p*X+m*tt,s[9]=h*k+u*q+p*Z+m*Q,s[13]=h*E+u*C+p*J+m*pt,s[2]=g*w+_*x+d*G+f*H,s[6]=g*A+_*N+d*X+f*tt,s[10]=g*k+_*q+d*Z+f*Q,s[14]=g*E+_*C+d*J+f*pt,s[3]=T*w+M*x+b*G+O*H,s[7]=T*A+M*N+b*X+O*tt,s[11]=T*k+M*q+b*Z+O*Q,s[15]=T*E+M*C+b*J+O*pt,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],s=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],u=t[6],p=t[10],m=t[14],g=t[3],_=t[7],d=t[11],f=t[15];return g*(+s*l*u-r*c*u-s*o*p+n*c*p+r*o*m-n*l*m)+_*(+e*l*m-e*c*p+s*a*p-r*a*m+r*c*h-s*l*h)+d*(+e*c*u-e*o*m-s*a*u+n*a*m+s*o*h-n*c*h)+f*(-r*o*h-e*l*u+e*o*p+r*a*u-n*a*p+n*l*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],p=t[10],m=t[11],g=t[12],_=t[13],d=t[14],f=t[15],T=u*d*c-_*p*c+_*l*m-o*d*m-u*l*f+o*p*f,M=g*p*c-h*d*c-g*l*m+a*d*m+h*l*f-a*p*f,b=h*_*c-g*u*c+g*o*m-a*_*m-h*o*f+a*u*f,O=g*u*l-h*_*l-g*o*p+a*_*p+h*o*d-a*u*d,w=e*T+n*M+r*b+s*O;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/w;return t[0]=T*A,t[1]=(_*p*s-u*d*s-_*r*m+n*d*m+u*r*f-n*p*f)*A,t[2]=(o*d*s-_*l*s+_*r*c-n*d*c-o*r*f+n*l*f)*A,t[3]=(u*l*s-o*p*s-u*r*c+n*p*c+o*r*m-n*l*m)*A,t[4]=M*A,t[5]=(h*d*s-g*p*s+g*r*m-e*d*m-h*r*f+e*p*f)*A,t[6]=(g*l*s-a*d*s-g*r*c+e*d*c+a*r*f-e*l*f)*A,t[7]=(a*p*s-h*l*s+h*r*c-e*p*c-a*r*m+e*l*m)*A,t[8]=b*A,t[9]=(g*u*s-h*_*s-g*n*m+e*_*m+h*n*f-e*u*f)*A,t[10]=(a*_*s-g*o*s+g*n*c-e*_*c-a*n*f+e*o*f)*A,t[11]=(h*o*s-a*u*s-h*n*c+e*u*c+a*n*m-e*o*m)*A,t[12]=O*A,t[13]=(h*_*r-g*u*r+g*n*p-e*_*p-h*n*d+e*u*d)*A,t[14]=(g*o*r-a*_*r-g*n*l+e*_*l+a*n*d-e*o*d)*A,t[15]=(a*u*r-h*o*r+h*n*l-e*u*l-a*n*p+e*o*p)*A,this}scale(t){const e=this.elements,n=t.x,r=t.y,s=t.z;return e[0]*=n,e[4]*=r,e[8]*=s,e[1]*=n,e[5]*=r,e[9]*=s,e[2]*=n,e[6]*=r,e[10]*=s,e[3]*=n,e[7]*=r,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),s=1-n,a=t.x,o=t.y,l=t.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,r,s,a){return this.set(1,n,s,0,t,1,a,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,s=e._x,a=e._y,o=e._z,l=e._w,c=s+s,h=a+a,u=o+o,p=s*c,m=s*h,g=s*u,_=a*h,d=a*u,f=o*u,T=l*c,M=l*h,b=l*u,O=n.x,w=n.y,A=n.z;return r[0]=(1-(_+f))*O,r[1]=(m+b)*O,r[2]=(g-M)*O,r[3]=0,r[4]=(m-b)*w,r[5]=(1-(p+f))*w,r[6]=(d+T)*w,r[7]=0,r[8]=(g+M)*A,r[9]=(d-T)*A,r[10]=(1-(p+_))*A,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let s=Vn.set(r[0],r[1],r[2]).length();const a=Vn.set(r[4],r[5],r[6]).length(),o=Vn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],Le.copy(this);const c=1/s,h=1/a,u=1/o;return Le.elements[0]*=c,Le.elements[1]*=c,Le.elements[2]*=c,Le.elements[4]*=h,Le.elements[5]*=h,Le.elements[6]*=h,Le.elements[8]*=u,Le.elements[9]*=u,Le.elements[10]*=u,e.setFromRotationMatrix(Le),n.x=s,n.y=a,n.z=o,this}makePerspective(t,e,n,r,s,a,o=Qe){const l=this.elements,c=2*s/(e-t),h=2*s/(n-r),u=(e+t)/(e-t),p=(n+r)/(n-r);let m,g;if(o===Qe)m=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===xr)m=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,r,s,a,o=Qe){const l=this.elements,c=1/(e-t),h=1/(n-r),u=1/(a-s),p=(e+t)*c,m=(n+r)*h;let g,_;if(o===Qe)g=(a+s)*u,_=-2*u;else if(o===xr)g=s*u,_=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Vn=new L,Le=new Jt,bh=new L(0,0,0),Ah=new L(1,1,1),sn=new L,Xi=new L,Ee=new L,qa=new Jt,Ya=new Li;class Ge{constructor(t=0,e=0,n=0,r=Ge.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const r=t.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],p=r[6],m=r[10];switch(e){case"XYZ":this._y=Math.asin(ge(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ge(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(ge(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ge(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ge(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-ge(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return qa.makeRotationFromQuaternion(t),this.setFromRotationMatrix(qa,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ya.setFromEuler(this),this.setFromQuaternion(Ya,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ge.DEFAULT_ORDER="XYZ";class Ys{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let e=0;e1){for(let n=0;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){r.children=[];for(let o=0;o0){r.animations=[];for(let o=0;o0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(t,e,n,r,s){De.subVectors(r,e),je.subVectors(n,e),es.subVectors(t,e);const a=De.dot(De),o=De.dot(je),l=De.dot(es),c=je.dot(je),h=je.dot(es),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const p=1/u,m=(c*l-o*h)*p,g=(a*h-o*l)*p;return s.set(1-m-g,g,m)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,Ke)===null?!1:Ke.x>=0&&Ke.y>=0&&Ke.x+Ke.y<=1}static getInterpolation(t,e,n,r,s,a,o,l){return this.getBarycoord(t,e,n,r,Ke)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Ke.x),l.addScaledVector(a,Ke.y),l.addScaledVector(o,Ke.z),l)}static isFrontFacing(t,e,n,r){return De.subVectors(n,e),je.subVectors(t,e),De.cross(je).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return De.subVectors(this.c,this.b),je.subVectors(this.a,this.b),De.cross(je).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ze.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ze.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,r,s){return ze.getInterpolation(t,this.a,this.b,this.c,e,n,r,s)}containsPoint(t){return ze.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ze.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,r=this.b,s=this.c;let a,o;Xn.subVectors(r,n),qn.subVectors(s,n),ns.subVectors(t,n);const l=Xn.dot(ns),c=qn.dot(ns);if(l<=0&&c<=0)return e.copy(n);is.subVectors(t,r);const h=Xn.dot(is),u=qn.dot(is);if(h>=0&&u<=h)return e.copy(r);const p=l*u-h*c;if(p<=0&&l>=0&&h<=0)return a=l/(l-h),e.copy(n).addScaledVector(Xn,a);rs.subVectors(t,s);const m=Xn.dot(rs),g=qn.dot(rs);if(g>=0&&m<=g)return e.copy(s);const _=m*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),e.copy(n).addScaledVector(qn,o);const d=h*g-m*u;if(d<=0&&u-h>=0&&m-g>=0)return Qa.subVectors(s,r),o=(u-h)/(u-h+(m-g)),e.copy(r).addScaledVector(Qa,o);const f=1/(d+_+p);return a=_*f,o=p*f,e.copy(n).addScaledVector(Xn,a).addScaledVector(qn,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const El={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},an={h:0,s:0,l:0},Yi={h:0,s:0,l:0};function ss(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}class Mt{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){const r=t;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Fe){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Wt.toWorkingColorSpace(this,e),this}setRGB(t,e,n,r=Wt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Wt.toWorkingColorSpace(this,r),this}setHSL(t,e,n,r=Wt.workingColorSpace){if(t=mh(t,1),e=ge(e,0,1),n=ge(n,0,1),e===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+e):n+e-n*e,a=2*n-s;this.r=ss(a,s,t+1/3),this.g=ss(a,s,t),this.b=ss(a,s,t-1/3)}return Wt.toWorkingColorSpace(this,r),this}setStyle(t,e=Fe){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Fe){const n=El[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=si(t.r),this.g=si(t.g),this.b=si(t.b),this}copyLinearToSRGB(t){return this.r=qr(t.r),this.g=qr(t.g),this.b=qr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Fe){return Wt.fromWorkingColorSpace(de.copy(this),t),Math.round(ge(de.r*255,0,255))*65536+Math.round(ge(de.g*255,0,255))*256+Math.round(ge(de.b*255,0,255))}getHexString(t=Fe){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Wt.workingColorSpace){Wt.fromWorkingColorSpace(de.copy(this),e);const n=de.r,r=de.g,s=de.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(r-s)/u+(r0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const r=this[e];if(r===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ii&&(n.blending=this.blending),this.side!==mn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==bs&&(n.blendSrc=this.blendSrc),this.blendDst!==As&&(n.blendDst=this.blendDst),this.blendEquation!==Rn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==mr&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==za&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Fn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Fn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Fn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(e){const s=r(t.textures),a=r(t.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const r=e.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=e[s].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class yl extends Ui{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Mt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ge,this.combine=Ws,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const ie=new L,ji=new Ut;class Ve{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=ka,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=dn,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return _h("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,s=this.itemSize;r0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const l in n){const c=n[l];t.data.attributes[l]=c.toJSON(t.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,p=c.length;u0&&(r[l]=h,s=!0)}s&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone(e));const r=t.attributes;for(const c in r){const h=r[c];this.setAttribute(c,h.clone(e))}const s=t.morphAttributes;for(const c in s){const h=[],u=s[c];for(let p=0,m=u.length;p0){const r=e[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s(t.far-t.near)**2))&&(to.copy(s).invert(),En.copy(t.ray).applyMatrix4(to),!(n.boundingBox!==null&&En.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,En)))}_computeIntersections(t,e,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,p=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=p.length;g<_;g++){const d=p[g],f=a[d.materialIndex],T=Math.max(d.start,m.start),M=Math.min(o.count,Math.min(d.start+d.count,m.start+m.count));for(let b=T,O=M;be.far?null:{distance:c,point:er.clone(),object:i}}function nr(i,t,e,n,r,s,a,o,l,c){i.getVertexPosition(o,jn),i.getVertexPosition(l,Kn),i.getVertexPosition(c,$n);const h=Uh(i,t,e,n,jn,Kn,$n,tr);if(h){r&&(Zi.fromBufferAttribute(r,o),Ji.fromBufferAttribute(r,l),Qi.fromBufferAttribute(r,c),h.uv=ze.getInterpolation(tr,jn,Kn,$n,Zi,Ji,Qi,new Ut)),s&&(Zi.fromBufferAttribute(s,o),Ji.fromBufferAttribute(s,l),Qi.fromBufferAttribute(s,c),h.uv1=ze.getInterpolation(tr,jn,Kn,$n,Zi,Ji,Qi,new Ut)),a&&(no.fromBufferAttribute(a,o),io.fromBufferAttribute(a,l),ro.fromBufferAttribute(a,c),h.normal=ze.getInterpolation(tr,jn,Kn,$n,no,io,ro,new L),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const u={a:o,b:l,c,normal:new L,materialIndex:0};ze.getNormal(jn,Kn,$n,u.normal),h.face=u}return h}class ui extends On{constructor(t=1,e=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let p=0,m=0;g("z","y","x",-1,-1,n,e,t,a,s,0),g("z","y","x",1,-1,n,e,-t,a,s,1),g("x","z","y",1,1,t,n,e,r,a,2),g("x","z","y",1,-1,t,n,-e,r,a,3),g("x","y","z",1,-1,t,e,n,r,s,4),g("x","y","z",-1,-1,t,e,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Dn(c,3)),this.setAttribute("normal",new Dn(h,3)),this.setAttribute("uv",new Dn(u,2));function g(_,d,f,T,M,b,O,w,A,k,E){const x=b/A,N=O/k,q=b/2,C=O/2,G=w/2,X=A+1,Z=k+1;let J=0,H=0;const tt=new L;for(let Q=0;Q0?1:-1,h.push(tt.x,tt.y,tt.z),u.push(It/A),u.push(1-Q/k),J+=1}}for(let Q=0;Q1?null:e.copy(t.start).addScaledVector(n,s)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Hh.getNormalMatrix(t),r=this.coplanarPoint(ls).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const yn=new qs,ir=new L;class js{constructor(t=new An,e=new An,n=new An,r=new An,s=new An,a=new An){this.planes=[t,e,n,r,s,a]}set(t,e,n,r,s,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=Qe){const n=this.planes,r=t.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],u=r[6],p=r[7],m=r[8],g=r[9],_=r[10],f=r[11],d=r[12],T=r[13],M=r[14],b=r[15];if(n[0].setComponents(l-s,p-c,f-m,b-d).normalize(),n[1].setComponents(l+s,p+c,f+m,b+d).normalize(),n[2].setComponents(l+a,p+h,f+g,b+T).normalize(),n[3].setComponents(l-a,p-h,f-g,b-T).normalize(),n[4].setComponents(l-o,p-u,f-_,b-M).normalize(),e===Qe)n[5].setComponents(l+o,p+u,f+_,b+M).normalize();else if(e===xr)n[5].setComponents(o,u,_,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),yn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),yn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(yn)}intersectsSprite(t){return yn.center.set(0,0,0),yn.radius=.7071067811865476,yn.applyMatrix4(t.matrixWorld),this.intersectsSphere(yn)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let s=0;s<6;s++)if(e[s].distanceToPoint(n)0?t.max.x:t.min.x,ir.y=r.normal.y>0?t.max.y:t.min.y,ir.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(ir)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Cl(){let i=null,t=!1,e=null,n=null;function r(s,a){e(s,a),n=i.requestAnimationFrame(r)}return{start:function(){t!==!0&&e!==null&&(n=i.requestAnimationFrame(r),t=!0)},stop:function(){i.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(s){e=s},setContext:function(s){i=s}}}function Vh(i){const t=new WeakMap;function e(o,l){const c=o.array,h=o.usage,u=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,h),o.onUploadCallback();let m;if(c instanceof Float32Array)m=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=i.SHORT;else if(c instanceof Uint32Array)m=i.UNSIGNED_INT;else if(c instanceof Int32Array)m=i.INT;else if(c instanceof Int8Array)m=i.BYTE;else if(c instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l._updateRange,p=l.updateRanges;if(i.bindBuffer(c,o),u.count===-1&&p.length===0&&i.bufferSubData(c,0,h),p.length!==0){for(let m=0,g=p.length;m1?null:e.copy(t.start).addScaledVector(n,s)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Hh.getNormalMatrix(t),r=this.coplanarPoint(ls).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const yn=new qs,ir=new L;class js{constructor(t=new An,e=new An,n=new An,r=new An,s=new An,a=new An){this.planes=[t,e,n,r,s,a]}set(t,e,n,r,s,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=Qe){const n=this.planes,r=t.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],u=r[6],p=r[7],m=r[8],g=r[9],_=r[10],d=r[11],f=r[12],T=r[13],M=r[14],b=r[15];if(n[0].setComponents(l-s,p-c,d-m,b-f).normalize(),n[1].setComponents(l+s,p+c,d+m,b+f).normalize(),n[2].setComponents(l+a,p+h,d+g,b+T).normalize(),n[3].setComponents(l-a,p-h,d-g,b-T).normalize(),n[4].setComponents(l-o,p-u,d-_,b-M).normalize(),e===Qe)n[5].setComponents(l+o,p+u,d+_,b+M).normalize();else if(e===xr)n[5].setComponents(o,u,_,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),yn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),yn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(yn)}intersectsSprite(t){return yn.center.set(0,0,0),yn.radius=.7071067811865476,yn.applyMatrix4(t.matrixWorld),this.intersectsSphere(yn)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let s=0;s<6;s++)if(e[s].distanceToPoint(n)0?t.max.x:t.min.x,ir.y=r.normal.y>0?t.max.y:t.min.y,ir.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(ir)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Cl(){let i=null,t=!1,e=null,n=null;function r(s,a){e(s,a),n=i.requestAnimationFrame(r)}return{start:function(){t!==!0&&e!==null&&(n=i.requestAnimationFrame(r),t=!0)},stop:function(){i.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(s){e=s},setContext:function(s){i=s}}}function Vh(i){const t=new WeakMap;function e(o,l){const c=o.array,h=o.usage,u=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,h),o.onUploadCallback();let m;if(c instanceof Float32Array)m=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=i.HALF_FLOAT:m=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=i.SHORT;else if(c instanceof Uint32Array)m=i.UNSIGNED_INT;else if(c instanceof Int32Array)m=i.INT;else if(c instanceof Int8Array)m=i.BYTE;else if(c instanceof Uint8Array)m=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:m,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l._updateRange,p=l.updateRanges;if(i.bindBuffer(c,o),u.count===-1&&p.length===0&&i.bufferSubData(c,0,h),p.length!==0){for(let m=0,g=p.length;m #include #include -}`,At={alphahash_fragment:Gh,alphahash_pars_fragment:Wh,alphamap_fragment:Xh,alphamap_pars_fragment:qh,alphatest_fragment:Yh,alphatest_pars_fragment:jh,aomap_fragment:Kh,aomap_pars_fragment:$h,batching_pars_vertex:Zh,batching_vertex:Jh,begin_vertex:Qh,beginnormal_vertex:tu,bsdfs:eu,iridescence_fragment:nu,bumpmap_pars_fragment:iu,clipping_planes_fragment:ru,clipping_planes_pars_fragment:su,clipping_planes_pars_vertex:au,clipping_planes_vertex:ou,color_fragment:lu,color_pars_fragment:cu,color_pars_vertex:hu,color_vertex:uu,common:du,cube_uv_reflection_fragment:fu,defaultnormal_vertex:pu,displacementmap_pars_vertex:mu,displacementmap_vertex:gu,emissivemap_fragment:_u,emissivemap_pars_fragment:vu,colorspace_fragment:xu,colorspace_pars_fragment:Su,envmap_fragment:Mu,envmap_common_pars_fragment:Eu,envmap_pars_fragment:yu,envmap_pars_vertex:Tu,envmap_physical_pars_fragment:Nu,envmap_vertex:bu,fog_vertex:Au,fog_pars_vertex:wu,fog_fragment:Ru,fog_pars_fragment:Cu,gradientmap_pars_fragment:Pu,lightmap_pars_fragment:Lu,lights_lambert_fragment:Du,lights_lambert_pars_fragment:Uu,lights_pars_begin:Iu,lights_toon_fragment:Ou,lights_toon_pars_fragment:Fu,lights_phong_fragment:Bu,lights_phong_pars_fragment:zu,lights_physical_fragment:ku,lights_physical_pars_fragment:Hu,lights_fragment_begin:Vu,lights_fragment_maps:Gu,lights_fragment_end:Wu,logdepthbuf_fragment:Xu,logdepthbuf_pars_fragment:qu,logdepthbuf_pars_vertex:Yu,logdepthbuf_vertex:ju,map_fragment:Ku,map_pars_fragment:$u,map_particle_fragment:Zu,map_particle_pars_fragment:Ju,metalnessmap_fragment:Qu,metalnessmap_pars_fragment:td,morphinstance_vertex:ed,morphcolor_vertex:nd,morphnormal_vertex:id,morphtarget_pars_vertex:rd,morphtarget_vertex:sd,normal_fragment_begin:ad,normal_fragment_maps:od,normal_pars_fragment:ld,normal_pars_vertex:cd,normal_vertex:hd,normalmap_pars_fragment:ud,clearcoat_normal_fragment_begin:dd,clearcoat_normal_fragment_maps:fd,clearcoat_pars_fragment:pd,iridescence_pars_fragment:md,opaque_fragment:gd,packing:_d,premultiplied_alpha_fragment:vd,project_vertex:xd,dithering_fragment:Sd,dithering_pars_fragment:Md,roughnessmap_fragment:Ed,roughnessmap_pars_fragment:yd,shadowmap_pars_fragment:Td,shadowmap_pars_vertex:bd,shadowmap_vertex:Ad,shadowmask_pars_fragment:wd,skinbase_vertex:Rd,skinning_pars_vertex:Cd,skinning_vertex:Pd,skinnormal_vertex:Ld,specularmap_fragment:Dd,specularmap_pars_fragment:Ud,tonemapping_fragment:Id,tonemapping_pars_fragment:Nd,transmission_fragment:Od,transmission_pars_fragment:Fd,uv_pars_fragment:Bd,uv_pars_vertex:zd,uv_vertex:kd,worldpos_vertex:Hd,background_vert:Vd,background_frag:Gd,backgroundCube_vert:Wd,backgroundCube_frag:Xd,cube_vert:qd,cube_frag:Yd,depth_vert:jd,depth_frag:Kd,distanceRGBA_vert:$d,distanceRGBA_frag:Zd,equirect_vert:Jd,equirect_frag:Qd,linedashed_vert:tf,linedashed_frag:ef,meshbasic_vert:nf,meshbasic_frag:rf,meshlambert_vert:sf,meshlambert_frag:af,meshmatcap_vert:of,meshmatcap_frag:lf,meshnormal_vert:cf,meshnormal_frag:hf,meshphong_vert:uf,meshphong_frag:df,meshphysical_vert:ff,meshphysical_frag:pf,meshtoon_vert:mf,meshtoon_frag:gf,points_vert:_f,points_frag:vf,shadow_vert:xf,shadow_frag:Sf,sprite_vert:Mf,sprite_frag:Ef},it={common:{diffuse:{value:new Mt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new wt}},envmap:{envMap:{value:null},envMapRotation:{value:new wt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new wt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new wt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new wt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new wt},normalScale:{value:new Ut(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new wt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new wt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new wt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new wt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Mt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Mt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0},uvTransform:{value:new wt}},sprite:{diffuse:{value:new Mt(16777215)},opacity:{value:1},center:{value:new Ut(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}}},Be={basic:{uniforms:pe([it.common,it.specularmap,it.envmap,it.aomap,it.lightmap,it.fog]),vertexShader:At.meshbasic_vert,fragmentShader:At.meshbasic_frag},lambert:{uniforms:pe([it.common,it.specularmap,it.envmap,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.fog,it.lights,{emissive:{value:new Mt(0)}}]),vertexShader:At.meshlambert_vert,fragmentShader:At.meshlambert_frag},phong:{uniforms:pe([it.common,it.specularmap,it.envmap,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.fog,it.lights,{emissive:{value:new Mt(0)},specular:{value:new Mt(1118481)},shininess:{value:30}}]),vertexShader:At.meshphong_vert,fragmentShader:At.meshphong_frag},standard:{uniforms:pe([it.common,it.envmap,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.roughnessmap,it.metalnessmap,it.fog,it.lights,{emissive:{value:new Mt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:At.meshphysical_vert,fragmentShader:At.meshphysical_frag},toon:{uniforms:pe([it.common,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.gradientmap,it.fog,it.lights,{emissive:{value:new Mt(0)}}]),vertexShader:At.meshtoon_vert,fragmentShader:At.meshtoon_frag},matcap:{uniforms:pe([it.common,it.bumpmap,it.normalmap,it.displacementmap,it.fog,{matcap:{value:null}}]),vertexShader:At.meshmatcap_vert,fragmentShader:At.meshmatcap_frag},points:{uniforms:pe([it.points,it.fog]),vertexShader:At.points_vert,fragmentShader:At.points_frag},dashed:{uniforms:pe([it.common,it.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:At.linedashed_vert,fragmentShader:At.linedashed_frag},depth:{uniforms:pe([it.common,it.displacementmap]),vertexShader:At.depth_vert,fragmentShader:At.depth_frag},normal:{uniforms:pe([it.common,it.bumpmap,it.normalmap,it.displacementmap,{opacity:{value:1}}]),vertexShader:At.meshnormal_vert,fragmentShader:At.meshnormal_frag},sprite:{uniforms:pe([it.sprite,it.fog]),vertexShader:At.sprite_vert,fragmentShader:At.sprite_frag},background:{uniforms:{uvTransform:{value:new wt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:At.background_vert,fragmentShader:At.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new wt}},vertexShader:At.backgroundCube_vert,fragmentShader:At.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:At.cube_vert,fragmentShader:At.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:At.equirect_vert,fragmentShader:At.equirect_frag},distanceRGBA:{uniforms:pe([it.common,it.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:At.distanceRGBA_vert,fragmentShader:At.distanceRGBA_frag},shadow:{uniforms:pe([it.lights,it.fog,{color:{value:new Mt(0)},opacity:{value:1}}]),vertexShader:At.shadow_vert,fragmentShader:At.shadow_frag}};Be.physical={uniforms:pe([Be.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new wt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new wt},clearcoatNormalScale:{value:new Ut(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new wt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new wt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new wt},sheen:{value:0},sheenColor:{value:new Mt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new wt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new wt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new wt},transmissionSamplerSize:{value:new Ut},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new wt},attenuationDistance:{value:0},attenuationColor:{value:new Mt(0)},specularColor:{value:new Mt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new wt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new wt},anisotropyVector:{value:new Ut},anisotropyMap:{value:null},anisotropyMapTransform:{value:new wt}}]),vertexShader:At.meshphysical_vert,fragmentShader:At.meshphysical_frag};const rr={r:0,b:0,g:0},Tn=new Ge,yf=new Jt;function Tf(i,t,e,n,r,s,a){const o=new Mt(0);let l=s===!0?0:1,c,h,u=null,p=0,m=null;function g(T){let M=T.isScene===!0?T.background:null;return M&&M.isTexture&&(M=(T.backgroundBlurriness>0?e:t).get(M)),M}function _(T){let M=!1;const b=g(T);b===null?d(o,l):b&&b.isColor&&(d(b,1),M=!0);const O=i.xr.getEnvironmentBlendMode();O==="additive"?n.buffers.color.setClear(0,0,0,1,a):O==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||M)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil)}function f(T,M){const b=g(M);b&&(b.isCubeTexture||b.mapping===Tr)?(h===void 0&&(h=new He(new ui(1,1,1),new _n({name:"BackgroundCubeMaterial",uniforms:ci(Be.backgroundCube.uniforms),vertexShader:Be.backgroundCube.vertexShader,fragmentShader:Be.backgroundCube.fragmentShader,side:_e,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(O,w,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Tn.copy(M.backgroundRotation),Tn.x*=-1,Tn.y*=-1,Tn.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Tn.y*=-1,Tn.z*=-1),h.material.uniforms.envMap.value=b,h.material.uniforms.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(yf.makeRotationFromEuler(Tn)),h.material.toneMapped=Wt.getTransfer(b.colorSpace)!==Kt,(u!==b||p!==b.version||m!==i.toneMapping)&&(h.material.needsUpdate=!0,u=b,p=b.version,m=i.toneMapping),h.layers.enableAll(),T.unshift(h,h.geometry,h.material,0,0,null)):b&&b.isTexture&&(c===void 0&&(c=new He(new wr(2,2),new _n({name:"BackgroundMaterial",uniforms:ci(Be.background.uniforms),vertexShader:Be.background.vertexShader,fragmentShader:Be.background.fragmentShader,side:mn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=b,c.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,c.material.toneMapped=Wt.getTransfer(b.colorSpace)!==Kt,b.matrixAutoUpdate===!0&&b.updateMatrix(),c.material.uniforms.uvTransform.value.copy(b.matrix),(u!==b||p!==b.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,u=b,p=b.version,m=i.toneMapping),c.layers.enableAll(),T.unshift(c,c.geometry,c.material,0,0,null))}function d(T,M){T.getRGB(rr,Al(i)),n.buffers.color.setClear(rr.r,rr.g,rr.b,M,a)}return{getClearColor:function(){return o},setClearColor:function(T,M=1){o.set(T),l=M,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(T){l=T,d(o,l)},render:_,addToRenderList:f}}function bf(i,t){const e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null);let s=r,a=!1;function o(x,N,q,C,G){let X=!1;const Z=u(C,q,N);s!==Z&&(s=Z,c(s.object)),X=m(x,C,q,G),X&&g(x,C,q,G),G!==null&&t.update(G,i.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,b(x,N,q,C),G!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(G).buffer))}function l(){return i.createVertexArray()}function c(x){return i.bindVertexArray(x)}function h(x){return i.deleteVertexArray(x)}function u(x,N,q){const C=q.wireframe===!0;let G=n[x.id];G===void 0&&(G={},n[x.id]=G);let X=G[N.id];X===void 0&&(X={},G[N.id]=X);let Z=X[C];return Z===void 0&&(Z=p(l()),X[C]=Z),Z}function p(x){const N=[],q=[],C=[];for(let G=0;G=0){const Q=G[H];let pt=X[H];if(pt===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&(pt=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&(pt=x.instanceColor)),Q===void 0||Q.attribute!==pt||pt&&Q.data!==pt.data)return!0;Z++}return s.attributesNum!==Z||s.index!==C}function g(x,N,q,C){const G={},X=N.attributes;let Z=0;const J=q.getAttributes();for(const H in J)if(J[H].location>=0){let Q=X[H];Q===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&(Q=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&(Q=x.instanceColor));const pt={};pt.attribute=Q,Q&&Q.data&&(pt.data=Q.data),G[H]=pt,Z++}s.attributes=G,s.attributesNum=Z,s.index=C}function _(){const x=s.newAttributes;for(let N=0,q=x.length;N=0){let tt=G[J];if(tt===void 0&&(J==="instanceMatrix"&&x.instanceMatrix&&(tt=x.instanceMatrix),J==="instanceColor"&&x.instanceColor&&(tt=x.instanceColor)),tt!==void 0){const Q=tt.normalized,pt=tt.itemSize,It=t.get(tt);if(It===void 0)continue;const Xt=It.buffer,V=It.type,et=It.bytesPerElement,ut=V===i.INT||V===i.UNSIGNED_INT||tt.gpuType===hl;if(tt.isInterleavedBufferAttribute){const rt=tt.data,Nt=rt.stride,Ot=tt.offset;if(rt.isInstancedInterleavedBuffer){for(let D=0;D0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=e.logarithmicDepthBuffer===!0,p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),m=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_TEXTURE_SIZE),_=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),d=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),T=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),b=m>0,O=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,maxTextures:p,maxVertexTextures:m,maxTextureSize:g,maxCubemapSize:_,maxAttributes:f,maxVertexUniforms:d,maxVaryings:T,maxFragmentUniforms:M,vertexTextures:b,maxSamples:O}}function Rf(i){const t=this;let e=null,n=0,r=!1,s=!1;const a=new An,o=new wt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,p){const m=u.length!==0||p||n!==0||r;return r=p,n=u.length,m},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,p){e=h(u,p,0)},this.setState=function(u,p,m){const g=u.clippingPlanes,_=u.clipIntersection,f=u.clipShadows,d=i.get(u);if(!r||g===null||g.length===0||s&&!f)s?h(null):c();else{const T=s?0:n,M=T*4;let b=d.clippingState||null;l.value=b,b=h(g,p,M,m);for(let O=0;O!==M;++O)b[O]=e[O];d.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=T}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(u,p,m,g){const _=u!==null?u.length:0;let f=null;if(_!==0){if(f=l.value,g!==!0||f===null){const d=m+_*4,T=p.matrixWorldInverse;o.getNormalMatrix(T),(f===null||f.length0){const c=new zh(l.height);return c.fromEquirectangularTexture(i,a),t.set(a,c),a.addEventListener("dispose",r),e(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=t.get(o);l!==void 0&&(t.delete(o),l.dispose())}function s(){t=new WeakMap}return{get:n,dispose:s}}class Pf extends wl{constructor(t=-1,e=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-t,a=n+t,o=r+e,l=r-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}const ni=4,oo=[.125,.215,.35,.446,.526,.582],Cn=20,cs=new Pf,lo=new Mt;let hs=null,us=0,ds=0,fs=!1;const wn=(1+Math.sqrt(5))/2,Qn=1/wn,co=[new L(-wn,Qn,0),new L(wn,Qn,0),new L(-Qn,0,wn),new L(Qn,0,wn),new L(0,wn,-Qn),new L(0,wn,Qn),new L(-1,1,-1),new L(1,1,-1),new L(-1,1,1),new L(1,1,1)];class ho{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){hs=this._renderer.getRenderTarget(),us=this._renderer.getActiveCubeFace(),ds=this._renderer.getActiveMipmapLevel(),fs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(t,n,r,s),e>0&&this._blur(s,0,0,e),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=po(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?M:0,M,M),h.setRenderTarget(r),_&&h.render(g,o),h.render(t,o)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=p,h.autoClear=u,t.background=f}_textureToCubeUV(t,e){const n=this._renderer,r=t.mapping===ai||t.mapping===oi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=po()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fo());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new He(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=t;const l=this._cubeSize;sr(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(a,cs)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sCn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${Cn}`);const d=[];let T=0;for(let A=0;AM-ni?r-M+ni:0),w=4*(this._cubeSize-b);sr(e,O,w,3*b,2*b),l.setRenderTarget(e),l.render(u,cs)}}function Lf(i){const t=[],e=[],n=[];let r=i;const s=i-ni+1+oo.length;for(let a=0;ai-ni?l=oo[a-i+ni-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,p=[h,h,u,h,u,u,h,h,u,u,h,u],m=6,g=6,_=3,f=2,d=1,T=new Float32Array(_*g*m),M=new Float32Array(f*g*m),b=new Float32Array(d*g*m);for(let w=0;w2?0:-1,E=[A,k,0,A+2/3,k,0,A+2/3,k+1,0,A,k,0,A+2/3,k+1,0,A,k+1,0];T.set(E,_*g*w),M.set(p,f*g*w);const x=[w,w,w,w,w,w];b.set(x,d*g*w)}const O=new On;O.setAttribute("position",new Ve(T,_)),O.setAttribute("uv",new Ve(M,f)),O.setAttribute("faceIndex",new Ve(b,d)),t.push(O),r>ni&&r--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function uo(i,t,e){const n=new In(i,t,e);return n.texture.mapping=Tr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function sr(i,t,e,n,r){i.viewport.set(t,e,n,r),i.scissor.set(t,e,n,r)}function Df(i,t,e){const n=new Float32Array(Cn),r=new L(0,1,0);return new _n({name:"SphericalGaussianBlur",defines:{n:Cn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ks(),fragmentShader:` +}`,At={alphahash_fragment:Gh,alphahash_pars_fragment:Wh,alphamap_fragment:Xh,alphamap_pars_fragment:qh,alphatest_fragment:Yh,alphatest_pars_fragment:jh,aomap_fragment:Kh,aomap_pars_fragment:$h,batching_pars_vertex:Zh,batching_vertex:Jh,begin_vertex:Qh,beginnormal_vertex:tu,bsdfs:eu,iridescence_fragment:nu,bumpmap_pars_fragment:iu,clipping_planes_fragment:ru,clipping_planes_pars_fragment:su,clipping_planes_pars_vertex:au,clipping_planes_vertex:ou,color_fragment:lu,color_pars_fragment:cu,color_pars_vertex:hu,color_vertex:uu,common:du,cube_uv_reflection_fragment:fu,defaultnormal_vertex:pu,displacementmap_pars_vertex:mu,displacementmap_vertex:gu,emissivemap_fragment:_u,emissivemap_pars_fragment:vu,colorspace_fragment:xu,colorspace_pars_fragment:Su,envmap_fragment:Mu,envmap_common_pars_fragment:Eu,envmap_pars_fragment:yu,envmap_pars_vertex:Tu,envmap_physical_pars_fragment:Nu,envmap_vertex:bu,fog_vertex:Au,fog_pars_vertex:wu,fog_fragment:Ru,fog_pars_fragment:Cu,gradientmap_pars_fragment:Pu,lightmap_pars_fragment:Lu,lights_lambert_fragment:Du,lights_lambert_pars_fragment:Uu,lights_pars_begin:Iu,lights_toon_fragment:Ou,lights_toon_pars_fragment:Fu,lights_phong_fragment:Bu,lights_phong_pars_fragment:zu,lights_physical_fragment:ku,lights_physical_pars_fragment:Hu,lights_fragment_begin:Vu,lights_fragment_maps:Gu,lights_fragment_end:Wu,logdepthbuf_fragment:Xu,logdepthbuf_pars_fragment:qu,logdepthbuf_pars_vertex:Yu,logdepthbuf_vertex:ju,map_fragment:Ku,map_pars_fragment:$u,map_particle_fragment:Zu,map_particle_pars_fragment:Ju,metalnessmap_fragment:Qu,metalnessmap_pars_fragment:td,morphinstance_vertex:ed,morphcolor_vertex:nd,morphnormal_vertex:id,morphtarget_pars_vertex:rd,morphtarget_vertex:sd,normal_fragment_begin:ad,normal_fragment_maps:od,normal_pars_fragment:ld,normal_pars_vertex:cd,normal_vertex:hd,normalmap_pars_fragment:ud,clearcoat_normal_fragment_begin:dd,clearcoat_normal_fragment_maps:fd,clearcoat_pars_fragment:pd,iridescence_pars_fragment:md,opaque_fragment:gd,packing:_d,premultiplied_alpha_fragment:vd,project_vertex:xd,dithering_fragment:Sd,dithering_pars_fragment:Md,roughnessmap_fragment:Ed,roughnessmap_pars_fragment:yd,shadowmap_pars_fragment:Td,shadowmap_pars_vertex:bd,shadowmap_vertex:Ad,shadowmask_pars_fragment:wd,skinbase_vertex:Rd,skinning_pars_vertex:Cd,skinning_vertex:Pd,skinnormal_vertex:Ld,specularmap_fragment:Dd,specularmap_pars_fragment:Ud,tonemapping_fragment:Id,tonemapping_pars_fragment:Nd,transmission_fragment:Od,transmission_pars_fragment:Fd,uv_pars_fragment:Bd,uv_pars_vertex:zd,uv_vertex:kd,worldpos_vertex:Hd,background_vert:Vd,background_frag:Gd,backgroundCube_vert:Wd,backgroundCube_frag:Xd,cube_vert:qd,cube_frag:Yd,depth_vert:jd,depth_frag:Kd,distanceRGBA_vert:$d,distanceRGBA_frag:Zd,equirect_vert:Jd,equirect_frag:Qd,linedashed_vert:tf,linedashed_frag:ef,meshbasic_vert:nf,meshbasic_frag:rf,meshlambert_vert:sf,meshlambert_frag:af,meshmatcap_vert:of,meshmatcap_frag:lf,meshnormal_vert:cf,meshnormal_frag:hf,meshphong_vert:uf,meshphong_frag:df,meshphysical_vert:ff,meshphysical_frag:pf,meshtoon_vert:mf,meshtoon_frag:gf,points_vert:_f,points_frag:vf,shadow_vert:xf,shadow_frag:Sf,sprite_vert:Mf,sprite_frag:Ef},it={common:{diffuse:{value:new Mt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new wt}},envmap:{envMap:{value:null},envMapRotation:{value:new wt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new wt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new wt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new wt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new wt},normalScale:{value:new Ut(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new wt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new wt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new wt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new wt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Mt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Mt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0},uvTransform:{value:new wt}},sprite:{diffuse:{value:new Mt(16777215)},opacity:{value:1},center:{value:new Ut(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new wt},alphaMap:{value:null},alphaMapTransform:{value:new wt},alphaTest:{value:0}}},Be={basic:{uniforms:pe([it.common,it.specularmap,it.envmap,it.aomap,it.lightmap,it.fog]),vertexShader:At.meshbasic_vert,fragmentShader:At.meshbasic_frag},lambert:{uniforms:pe([it.common,it.specularmap,it.envmap,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.fog,it.lights,{emissive:{value:new Mt(0)}}]),vertexShader:At.meshlambert_vert,fragmentShader:At.meshlambert_frag},phong:{uniforms:pe([it.common,it.specularmap,it.envmap,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.fog,it.lights,{emissive:{value:new Mt(0)},specular:{value:new Mt(1118481)},shininess:{value:30}}]),vertexShader:At.meshphong_vert,fragmentShader:At.meshphong_frag},standard:{uniforms:pe([it.common,it.envmap,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.roughnessmap,it.metalnessmap,it.fog,it.lights,{emissive:{value:new Mt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:At.meshphysical_vert,fragmentShader:At.meshphysical_frag},toon:{uniforms:pe([it.common,it.aomap,it.lightmap,it.emissivemap,it.bumpmap,it.normalmap,it.displacementmap,it.gradientmap,it.fog,it.lights,{emissive:{value:new Mt(0)}}]),vertexShader:At.meshtoon_vert,fragmentShader:At.meshtoon_frag},matcap:{uniforms:pe([it.common,it.bumpmap,it.normalmap,it.displacementmap,it.fog,{matcap:{value:null}}]),vertexShader:At.meshmatcap_vert,fragmentShader:At.meshmatcap_frag},points:{uniforms:pe([it.points,it.fog]),vertexShader:At.points_vert,fragmentShader:At.points_frag},dashed:{uniforms:pe([it.common,it.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:At.linedashed_vert,fragmentShader:At.linedashed_frag},depth:{uniforms:pe([it.common,it.displacementmap]),vertexShader:At.depth_vert,fragmentShader:At.depth_frag},normal:{uniforms:pe([it.common,it.bumpmap,it.normalmap,it.displacementmap,{opacity:{value:1}}]),vertexShader:At.meshnormal_vert,fragmentShader:At.meshnormal_frag},sprite:{uniforms:pe([it.sprite,it.fog]),vertexShader:At.sprite_vert,fragmentShader:At.sprite_frag},background:{uniforms:{uvTransform:{value:new wt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:At.background_vert,fragmentShader:At.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new wt}},vertexShader:At.backgroundCube_vert,fragmentShader:At.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:At.cube_vert,fragmentShader:At.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:At.equirect_vert,fragmentShader:At.equirect_frag},distanceRGBA:{uniforms:pe([it.common,it.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:At.distanceRGBA_vert,fragmentShader:At.distanceRGBA_frag},shadow:{uniforms:pe([it.lights,it.fog,{color:{value:new Mt(0)},opacity:{value:1}}]),vertexShader:At.shadow_vert,fragmentShader:At.shadow_frag}};Be.physical={uniforms:pe([Be.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new wt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new wt},clearcoatNormalScale:{value:new Ut(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new wt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new wt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new wt},sheen:{value:0},sheenColor:{value:new Mt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new wt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new wt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new wt},transmissionSamplerSize:{value:new Ut},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new wt},attenuationDistance:{value:0},attenuationColor:{value:new Mt(0)},specularColor:{value:new Mt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new wt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new wt},anisotropyVector:{value:new Ut},anisotropyMap:{value:null},anisotropyMapTransform:{value:new wt}}]),vertexShader:At.meshphysical_vert,fragmentShader:At.meshphysical_frag};const rr={r:0,b:0,g:0},Tn=new Ge,yf=new Jt;function Tf(i,t,e,n,r,s,a){const o=new Mt(0);let l=s===!0?0:1,c,h,u=null,p=0,m=null;function g(T){let M=T.isScene===!0?T.background:null;return M&&M.isTexture&&(M=(T.backgroundBlurriness>0?e:t).get(M)),M}function _(T){let M=!1;const b=g(T);b===null?f(o,l):b&&b.isColor&&(f(b,1),M=!0);const O=i.xr.getEnvironmentBlendMode();O==="additive"?n.buffers.color.setClear(0,0,0,1,a):O==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||M)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil)}function d(T,M){const b=g(M);b&&(b.isCubeTexture||b.mapping===Tr)?(h===void 0&&(h=new He(new ui(1,1,1),new _n({name:"BackgroundCubeMaterial",uniforms:ci(Be.backgroundCube.uniforms),vertexShader:Be.backgroundCube.vertexShader,fragmentShader:Be.backgroundCube.fragmentShader,side:_e,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(O,w,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Tn.copy(M.backgroundRotation),Tn.x*=-1,Tn.y*=-1,Tn.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Tn.y*=-1,Tn.z*=-1),h.material.uniforms.envMap.value=b,h.material.uniforms.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(yf.makeRotationFromEuler(Tn)),h.material.toneMapped=Wt.getTransfer(b.colorSpace)!==Kt,(u!==b||p!==b.version||m!==i.toneMapping)&&(h.material.needsUpdate=!0,u=b,p=b.version,m=i.toneMapping),h.layers.enableAll(),T.unshift(h,h.geometry,h.material,0,0,null)):b&&b.isTexture&&(c===void 0&&(c=new He(new wr(2,2),new _n({name:"BackgroundMaterial",uniforms:ci(Be.background.uniforms),vertexShader:Be.background.vertexShader,fragmentShader:Be.background.fragmentShader,side:mn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=b,c.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,c.material.toneMapped=Wt.getTransfer(b.colorSpace)!==Kt,b.matrixAutoUpdate===!0&&b.updateMatrix(),c.material.uniforms.uvTransform.value.copy(b.matrix),(u!==b||p!==b.version||m!==i.toneMapping)&&(c.material.needsUpdate=!0,u=b,p=b.version,m=i.toneMapping),c.layers.enableAll(),T.unshift(c,c.geometry,c.material,0,0,null))}function f(T,M){T.getRGB(rr,Al(i)),n.buffers.color.setClear(rr.r,rr.g,rr.b,M,a)}return{getClearColor:function(){return o},setClearColor:function(T,M=1){o.set(T),l=M,f(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(T){l=T,f(o,l)},render:_,addToRenderList:d}}function bf(i,t){const e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null);let s=r,a=!1;function o(x,N,q,C,G){let X=!1;const Z=u(C,q,N);s!==Z&&(s=Z,c(s.object)),X=m(x,C,q,G),X&&g(x,C,q,G),G!==null&&t.update(G,i.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,b(x,N,q,C),G!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(G).buffer))}function l(){return i.createVertexArray()}function c(x){return i.bindVertexArray(x)}function h(x){return i.deleteVertexArray(x)}function u(x,N,q){const C=q.wireframe===!0;let G=n[x.id];G===void 0&&(G={},n[x.id]=G);let X=G[N.id];X===void 0&&(X={},G[N.id]=X);let Z=X[C];return Z===void 0&&(Z=p(l()),X[C]=Z),Z}function p(x){const N=[],q=[],C=[];for(let G=0;G=0){const Q=G[H];let pt=X[H];if(pt===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&(pt=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&(pt=x.instanceColor)),Q===void 0||Q.attribute!==pt||pt&&Q.data!==pt.data)return!0;Z++}return s.attributesNum!==Z||s.index!==C}function g(x,N,q,C){const G={},X=N.attributes;let Z=0;const J=q.getAttributes();for(const H in J)if(J[H].location>=0){let Q=X[H];Q===void 0&&(H==="instanceMatrix"&&x.instanceMatrix&&(Q=x.instanceMatrix),H==="instanceColor"&&x.instanceColor&&(Q=x.instanceColor));const pt={};pt.attribute=Q,Q&&Q.data&&(pt.data=Q.data),G[H]=pt,Z++}s.attributes=G,s.attributesNum=Z,s.index=C}function _(){const x=s.newAttributes;for(let N=0,q=x.length;N=0){let tt=G[J];if(tt===void 0&&(J==="instanceMatrix"&&x.instanceMatrix&&(tt=x.instanceMatrix),J==="instanceColor"&&x.instanceColor&&(tt=x.instanceColor)),tt!==void 0){const Q=tt.normalized,pt=tt.itemSize,It=t.get(tt);if(It===void 0)continue;const Xt=It.buffer,V=It.type,et=It.bytesPerElement,ut=V===i.INT||V===i.UNSIGNED_INT||tt.gpuType===hl;if(tt.isInterleavedBufferAttribute){const rt=tt.data,Nt=rt.stride,Ot=tt.offset;if(rt.isInstancedInterleavedBuffer){for(let D=0;D0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=e.logarithmicDepthBuffer===!0,p=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),m=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_TEXTURE_SIZE),_=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),d=i.getParameter(i.MAX_VERTEX_ATTRIBS),f=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),T=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),b=m>0,O=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,maxTextures:p,maxVertexTextures:m,maxTextureSize:g,maxCubemapSize:_,maxAttributes:d,maxVertexUniforms:f,maxVaryings:T,maxFragmentUniforms:M,vertexTextures:b,maxSamples:O}}function Rf(i){const t=this;let e=null,n=0,r=!1,s=!1;const a=new An,o=new wt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,p){const m=u.length!==0||p||n!==0||r;return r=p,n=u.length,m},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,p){e=h(u,p,0)},this.setState=function(u,p,m){const g=u.clippingPlanes,_=u.clipIntersection,d=u.clipShadows,f=i.get(u);if(!r||g===null||g.length===0||s&&!d)s?h(null):c();else{const T=s?0:n,M=T*4;let b=f.clippingState||null;l.value=b,b=h(g,p,M,m);for(let O=0;O!==M;++O)b[O]=e[O];f.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=T}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(u,p,m,g){const _=u!==null?u.length:0;let d=null;if(_!==0){if(d=l.value,g!==!0||d===null){const f=m+_*4,T=p.matrixWorldInverse;o.getNormalMatrix(T),(d===null||d.length0){const c=new zh(l.height);return c.fromEquirectangularTexture(i,a),t.set(a,c),a.addEventListener("dispose",r),e(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=t.get(o);l!==void 0&&(t.delete(o),l.dispose())}function s(){t=new WeakMap}return{get:n,dispose:s}}class Pf extends wl{constructor(t=-1,e=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-t,a=n+t,o=r+e,l=r-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}const ni=4,oo=[.125,.215,.35,.446,.526,.582],Cn=20,cs=new Pf,lo=new Mt;let hs=null,us=0,ds=0,fs=!1;const wn=(1+Math.sqrt(5))/2,Qn=1/wn,co=[new L(-wn,Qn,0),new L(wn,Qn,0),new L(-Qn,0,wn),new L(Qn,0,wn),new L(0,wn,-Qn),new L(0,wn,Qn),new L(-1,1,-1),new L(1,1,-1),new L(-1,1,1),new L(1,1,1)];class ho{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){hs=this._renderer.getRenderTarget(),us=this._renderer.getActiveCubeFace(),ds=this._renderer.getActiveMipmapLevel(),fs=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(t,n,r,s),e>0&&this._blur(s,0,0,e),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=po(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?M:0,M,M),h.setRenderTarget(r),_&&h.render(g,o),h.render(t,o)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=p,h.autoClear=u,t.background=d}_textureToCubeUV(t,e){const n=this._renderer,r=t.mapping===ai||t.mapping===oi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=po()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fo());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new He(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=t;const l=this._cubeSize;sr(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(a,cs)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sCn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${d} samples when the maximum is set to ${Cn}`);const f=[];let T=0;for(let A=0;AM-ni?r-M+ni:0),w=4*(this._cubeSize-b);sr(e,O,w,3*b,2*b),l.setRenderTarget(e),l.render(u,cs)}}function Lf(i){const t=[],e=[],n=[];let r=i;const s=i-ni+1+oo.length;for(let a=0;ai-ni?l=oo[a-i+ni-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,p=[h,h,u,h,u,u,h,h,u,u,h,u],m=6,g=6,_=3,d=2,f=1,T=new Float32Array(_*g*m),M=new Float32Array(d*g*m),b=new Float32Array(f*g*m);for(let w=0;w2?0:-1,E=[A,k,0,A+2/3,k,0,A+2/3,k+1,0,A,k,0,A+2/3,k+1,0,A,k+1,0];T.set(E,_*g*w),M.set(p,d*g*w);const x=[w,w,w,w,w,w];b.set(x,f*g*w)}const O=new On;O.setAttribute("position",new Ve(T,_)),O.setAttribute("uv",new Ve(M,d)),O.setAttribute("faceIndex",new Ve(b,f)),t.push(O),r>ni&&r--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function uo(i,t,e){const n=new In(i,t,e);return n.texture.mapping=Tr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function sr(i,t,e,n,r){i.viewport.set(t,e,n,r),i.scissor.set(t,e,n,r)}function Df(i,t,e){const n=new Float32Array(Cn),r=new L(0,1,0);return new _n({name:"SphericalGaussianBlur",defines:{n:Cn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ks(),fragmentShader:` precision mediump float; precision mediump int; @@ -3721,7 +3721,7 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function Uf(i){let t=new WeakMap,e=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===ws||l===Rs,h=l===ai||l===oi;if(c||h){let u=t.get(o);const p=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==p)return e===null&&(e=new ho(i)),u=c?e.fromEquirectangular(o,u):e.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),u.texture;if(u!==void 0)return u.texture;{const m=o.image;return c&&m&&m.height>0||h&&m&&r(m)?(e===null&&(e=new ho(i)),u=c?e.fromEquirectangular(o):e.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;ht.maxTextureSize&&(w=Math.ceil(O/t.maxTextureSize),O=t.maxTextureSize);const A=new Float32Array(O*w*4*u),k=new Sl(A,O,w,u);k.type=dn,k.needsUpdate=!0;const E=b*4;for(let N=0;N0)return i;const r=t*e;let s=mo[r];if(s===void 0&&(s=new Float32Array(r),mo[r]=s),t!==0){n.toArray(s,0);for(let a=1,o=0;a!==t;++a)o+=e,i[a].toArray(s,o)}return s}function se(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e0||h&&m&&r(m)?(e===null&&(e=new ho(i)),u=c?e.fromEquirectangular(o):e.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function r(o){let l=0;const c=6;for(let h=0;ht.maxTextureSize&&(w=Math.ceil(O/t.maxTextureSize),O=t.maxTextureSize);const A=new Float32Array(O*w*4*u),k=new Sl(A,O,w,u);k.type=dn,k.needsUpdate=!0;const E=b*4;for(let N=0;N0)return i;const r=t*e;let s=mo[r];if(s===void 0&&(s=new Float32Array(r),mo[r]=s),t!==0){n.toArray(s,0);for(let a=1,o=0;a!==t;++a)o+=e,i[a].toArray(s,o)}return s}function se(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e":" "} ${o}: ${e[a]}`)}return n.join(` `)}function Up(i){const t=Wt.getPrimaries(Wt.workingColorSpace),e=Wt.getPrimaries(i);let n;switch(t===e?n="":t===vr&&e===_r?n="LinearDisplayP3ToLinearSRGB":t===_r&&e===vr&&(n="LinearSRGBToLinearDisplayP3"),i){case vn:case Ar:return[n,"LinearTransferOETF"];case Fe:case Xs:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function Eo(i,t,e){const n=i.getShaderParameter(t,i.COMPILE_STATUS),r=i.getShaderInfoLog(t).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return e.toUpperCase()+` @@ -3749,28 +3749,28 @@ void main() { `;return i.precision==="highp"?t+=` #define HIGH_PRECISION`:i.precision==="mediump"?t+=` #define MEDIUM_PRECISION`:i.precision==="lowp"&&(t+=` -#define LOW_PRECISION`),t}function Wp(i){let t="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===ol?t="SHADOWMAP_TYPE_PCF":i.shadowMapType===fc?t="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Ze&&(t="SHADOWMAP_TYPE_VSM"),t}function Xp(i){let t="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case ai:case oi:t="ENVMAP_TYPE_CUBE";break;case Tr:t="ENVMAP_TYPE_CUBE_UV";break}return t}function qp(i){let t="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case oi:t="ENVMAP_MODE_REFRACTION";break}return t}function Yp(i){let t="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Ws:t="ENVMAP_BLENDING_MULTIPLY";break;case zc:t="ENVMAP_BLENDING_MIX";break;case kc:t="ENVMAP_BLENDING_ADD";break}return t}function jp(i){const t=i.envMapCubeUVHeight;if(t===null)return null;const e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:n,maxMip:e}}function Kp(i,t,e,n){const r=i.getContext(),s=e.defines;let a=e.vertexShader,o=e.fragmentShader;const l=Wp(e),c=Xp(e),h=qp(e),u=Yp(e),p=jp(e),m=Op(e),g=Fp(s),_=r.createProgram();let f,d,T=e.glslVersion?"#version "+e.glslVersion+` -`:"";e.isRawShaderMaterial?(f=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(Ti).join(` -`),f.length>0&&(f+=` -`),d=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(Ti).join(` +#define LOW_PRECISION`),t}function Wp(i){let t="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===ol?t="SHADOWMAP_TYPE_PCF":i.shadowMapType===fc?t="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Ze&&(t="SHADOWMAP_TYPE_VSM"),t}function Xp(i){let t="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case ai:case oi:t="ENVMAP_TYPE_CUBE";break;case Tr:t="ENVMAP_TYPE_CUBE_UV";break}return t}function qp(i){let t="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case oi:t="ENVMAP_MODE_REFRACTION";break}return t}function Yp(i){let t="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Ws:t="ENVMAP_BLENDING_MULTIPLY";break;case zc:t="ENVMAP_BLENDING_MIX";break;case kc:t="ENVMAP_BLENDING_ADD";break}return t}function jp(i){const t=i.envMapCubeUVHeight;if(t===null)return null;const e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:n,maxMip:e}}function Kp(i,t,e,n){const r=i.getContext(),s=e.defines;let a=e.vertexShader,o=e.fragmentShader;const l=Wp(e),c=Xp(e),h=qp(e),u=Yp(e),p=jp(e),m=Op(e),g=Fp(s),_=r.createProgram();let d,f,T=e.glslVersion?"#version "+e.glslVersion+` +`:"";e.isRawShaderMaterial?(d=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(Ti).join(` `),d.length>0&&(d+=` -`)):(f=[Ao(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`),f=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g].filter(Ti).join(` +`),f.length>0&&(f+=` +`)):(d=[Ao(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(Ti).join(` -`),d=[Ao(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+h:"",e.envMap?"#define "+u:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==pn?"#define TONE_MAPPING":"",e.toneMapping!==pn?At.tonemapping_pars_fragment:"",e.toneMapping!==pn?Np("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",At.colorspace_pars_fragment,Ip("linearToOutputTexel",e.outputColorSpace),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` +`),f=[Ao(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,g,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+h:"",e.envMap?"#define "+u:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==pn?"#define TONE_MAPPING":"",e.toneMapping!==pn?At.tonemapping_pars_fragment:"",e.toneMapping!==pn?Np("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",At.colorspace_pars_fragment,Ip("linearToOutputTexel",e.outputColorSpace),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` `].filter(Ti).join(` `)),a=Ds(a),a=yo(a,e),a=To(a,e),o=Ds(o),o=yo(o,e),o=To(o,e),a=bo(a),o=bo(o),e.isRawShaderMaterial!==!0&&(T=`#version 300 es -`,f=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`,d=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+f,d=["#define varying in",e.glslVersion===Ha?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Ha?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`+d,f=["#define varying in",e.glslVersion===Ha?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Ha?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+d);const M=T+f+a,b=T+d+o,O=Mo(r,r.VERTEX_SHADER,M),w=Mo(r,r.FRAGMENT_SHADER,b);r.attachShader(_,O),r.attachShader(_,w),e.index0AttributeName!==void 0?r.bindAttribLocation(_,0,e.index0AttributeName):e.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function A(N){if(i.debug.checkShaderErrors){const q=r.getProgramInfoLog(_).trim(),C=r.getShaderInfoLog(O).trim(),G=r.getShaderInfoLog(w).trim();let X=!0,Z=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(X=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,_,O,w);else{const J=Eo(r,O,"vertex"),H=Eo(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+` +`+f);const M=T+d+a,b=T+f+o,O=Mo(r,r.VERTEX_SHADER,M),w=Mo(r,r.FRAGMENT_SHADER,b);r.attachShader(_,O),r.attachShader(_,w),e.index0AttributeName!==void 0?r.bindAttribLocation(_,0,e.index0AttributeName):e.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function A(N){if(i.debug.checkShaderErrors){const q=r.getProgramInfoLog(_).trim(),C=r.getShaderInfoLog(O).trim(),G=r.getShaderInfoLog(w).trim();let X=!0,Z=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(X=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,_,O,w);else{const J=Eo(r,O,"vertex"),H=Eo(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+` Material Name: `+N.name+` Material Type: `+N.type+` Program Info Log: `+q+` `+J+` -`+H)}else q!==""?console.warn("THREE.WebGLProgram: Program Info Log:",q):(C===""||G==="")&&(Z=!1);Z&&(N.diagnostics={runnable:X,programLog:q,vertexShader:{log:C,prefix:f},fragmentShader:{log:G,prefix:d}})}r.deleteShader(O),r.deleteShader(w),k=new dr(r,_),E=Bp(r,_)}let k;this.getUniforms=function(){return k===void 0&&A(this),k};let E;this.getAttributes=function(){return E===void 0&&A(this),E};let x=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(_,Pp)),x},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Lp++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=O,this.fragmentShader=w,this}let $p=0;class Zp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,r=this._getShaderStage(e),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return n===void 0&&(n=new Jp(t),e.set(t,n)),n}}class Jp{constructor(t){this.id=$p++,this.code=t,this.usedTimes=0}}function Qp(i,t,e,n,r,s,a){const o=new Ys,l=new Zp,c=new Set,h=[],u=r.logarithmicDepthBuffer,p=r.vertexTextures;let m=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(E){return c.add(E),E===0?"uv":`uv${E}`}function f(E,x,N,q,C){const G=q.fog,X=C.geometry,Z=E.isMeshStandardMaterial?q.environment:null,J=(E.isMeshStandardMaterial?e:t).get(E.envMap||Z),H=J&&J.mapping===Tr?J.image.height:null,tt=g[E.type];E.precision!==null&&(m=r.getMaxPrecision(E.precision),m!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",m,"instead."));const Q=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,pt=Q!==void 0?Q.length:0;let It=0;X.morphAttributes.position!==void 0&&(It=1),X.morphAttributes.normal!==void 0&&(It=2),X.morphAttributes.color!==void 0&&(It=3);let Xt,V,et,ut;if(tt){const Gt=Be[tt];Xt=Gt.vertexShader,V=Gt.fragmentShader}else Xt=E.vertexShader,V=E.fragmentShader,l.update(E),et=l.getVertexShaderID(E),ut=l.getFragmentShaderID(E);const rt=i.getRenderTarget(),Nt=C.isInstancedMesh===!0,Ot=C.isBatchedMesh===!0,D=!!E.map,Yt=!!E.matcap,_t=!!J,qt=!!E.aoMap,St=!!E.lightMap,Bt=!!E.bumpMap,Lt=!!E.normalMap,zt=!!E.displacementMap,Qt=!!E.emissiveMap,y=!!E.metalnessMap,v=!!E.roughnessMap,z=E.anisotropy>0,Y=E.clearcoat>0,K=E.dispersion>0,$=E.iridescence>0,gt=E.sheen>0,lt=E.transmission>0,ot=z&&!!E.anisotropyMap,Rt=Y&&!!E.clearcoatMap,nt=Y&&!!E.clearcoatNormalMap,mt=Y&&!!E.clearcoatRoughnessMap,kt=$&&!!E.iridescenceMap,vt=$&&!!E.iridescenceThicknessMap,ht=gt&&!!E.sheenColorMap,Ct=gt&&!!E.sheenRoughnessMap,Ft=!!E.specularMap,ee=!!E.specularColorMap,Pt=!!E.specularIntensityMap,R=lt&&!!E.transmissionMap,j=lt&&!!E.thicknessMap,W=!!E.gradientMap,st=!!E.alphaMap,ct=E.alphaTest>0,Ht=!!E.alphaHash,jt=!!E.extensions;let te=pn;E.toneMapped&&(rt===null||rt.isXRRenderTarget===!0)&&(te=i.toneMapping);const le={shaderID:tt,shaderType:E.type,shaderName:E.name,vertexShader:Xt,fragmentShader:V,defines:E.defines,customVertexShaderID:et,customFragmentShaderID:ut,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:m,batching:Ot,instancing:Nt,instancingColor:Nt&&C.instanceColor!==null,instancingMorph:Nt&&C.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:rt===null?i.outputColorSpace:rt.isXRRenderTarget===!0?rt.texture.colorSpace:vn,alphaToCoverage:!!E.alphaToCoverage,map:D,matcap:Yt,envMap:_t,envMapMode:_t&&J.mapping,envMapCubeUVHeight:H,aoMap:qt,lightMap:St,bumpMap:Bt,normalMap:Lt,displacementMap:p&&zt,emissiveMap:Qt,normalMapObjectSpace:Lt&&E.normalMapType===oh,normalMapTangentSpace:Lt&&E.normalMapType===gl,metalnessMap:y,roughnessMap:v,anisotropy:z,anisotropyMap:ot,clearcoat:Y,clearcoatMap:Rt,clearcoatNormalMap:nt,clearcoatRoughnessMap:mt,dispersion:K,iridescence:$,iridescenceMap:kt,iridescenceThicknessMap:vt,sheen:gt,sheenColorMap:ht,sheenRoughnessMap:Ct,specularMap:Ft,specularColorMap:ee,specularIntensityMap:Pt,transmission:lt,transmissionMap:R,thicknessMap:j,gradientMap:W,opaque:E.transparent===!1&&E.blending===ii&&E.alphaToCoverage===!1,alphaMap:st,alphaTest:ct,alphaHash:Ht,combine:E.combine,mapUv:D&&_(E.map.channel),aoMapUv:qt&&_(E.aoMap.channel),lightMapUv:St&&_(E.lightMap.channel),bumpMapUv:Bt&&_(E.bumpMap.channel),normalMapUv:Lt&&_(E.normalMap.channel),displacementMapUv:zt&&_(E.displacementMap.channel),emissiveMapUv:Qt&&_(E.emissiveMap.channel),metalnessMapUv:y&&_(E.metalnessMap.channel),roughnessMapUv:v&&_(E.roughnessMap.channel),anisotropyMapUv:ot&&_(E.anisotropyMap.channel),clearcoatMapUv:Rt&&_(E.clearcoatMap.channel),clearcoatNormalMapUv:nt&&_(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:mt&&_(E.clearcoatRoughnessMap.channel),iridescenceMapUv:kt&&_(E.iridescenceMap.channel),iridescenceThicknessMapUv:vt&&_(E.iridescenceThicknessMap.channel),sheenColorMapUv:ht&&_(E.sheenColorMap.channel),sheenRoughnessMapUv:Ct&&_(E.sheenRoughnessMap.channel),specularMapUv:Ft&&_(E.specularMap.channel),specularColorMapUv:ee&&_(E.specularColorMap.channel),specularIntensityMapUv:Pt&&_(E.specularIntensityMap.channel),transmissionMapUv:R&&_(E.transmissionMap.channel),thicknessMapUv:j&&_(E.thicknessMap.channel),alphaMapUv:st&&_(E.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Lt||z),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:C.isPoints===!0&&!!X.attributes.uv&&(D||st),fog:!!G,useFog:E.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:C.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:pt,morphTextureStride:It,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:E.dithering,shadowMapEnabled:i.shadowMap.enabled&&N.length>0,shadowMapType:i.shadowMap.type,toneMapping:te,useLegacyLights:i._useLegacyLights,decodeVideoTexture:D&&E.map.isVideoTexture===!0&&Wt.getTransfer(E.map.colorSpace)===Kt,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Je,flipSided:E.side===_e,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:jt&&E.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:jt&&E.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return le.vertexUv1s=c.has(1),le.vertexUv2s=c.has(2),le.vertexUv3s=c.has(3),c.clear(),le}function d(E){const x=[];if(E.shaderID?x.push(E.shaderID):(x.push(E.customVertexShaderID),x.push(E.customFragmentShaderID)),E.defines!==void 0)for(const N in E.defines)x.push(N),x.push(E.defines[N]);return E.isRawShaderMaterial===!1&&(T(x,E),M(x,E),x.push(i.outputColorSpace)),x.push(E.customProgramCacheKey),x.join()}function T(E,x){E.push(x.precision),E.push(x.outputColorSpace),E.push(x.envMapMode),E.push(x.envMapCubeUVHeight),E.push(x.mapUv),E.push(x.alphaMapUv),E.push(x.lightMapUv),E.push(x.aoMapUv),E.push(x.bumpMapUv),E.push(x.normalMapUv),E.push(x.displacementMapUv),E.push(x.emissiveMapUv),E.push(x.metalnessMapUv),E.push(x.roughnessMapUv),E.push(x.anisotropyMapUv),E.push(x.clearcoatMapUv),E.push(x.clearcoatNormalMapUv),E.push(x.clearcoatRoughnessMapUv),E.push(x.iridescenceMapUv),E.push(x.iridescenceThicknessMapUv),E.push(x.sheenColorMapUv),E.push(x.sheenRoughnessMapUv),E.push(x.specularMapUv),E.push(x.specularColorMapUv),E.push(x.specularIntensityMapUv),E.push(x.transmissionMapUv),E.push(x.thicknessMapUv),E.push(x.combine),E.push(x.fogExp2),E.push(x.sizeAttenuation),E.push(x.morphTargetsCount),E.push(x.morphAttributeCount),E.push(x.numDirLights),E.push(x.numPointLights),E.push(x.numSpotLights),E.push(x.numSpotLightMaps),E.push(x.numHemiLights),E.push(x.numRectAreaLights),E.push(x.numDirLightShadows),E.push(x.numPointLightShadows),E.push(x.numSpotLightShadows),E.push(x.numSpotLightShadowsWithMaps),E.push(x.numLightProbes),E.push(x.shadowMapType),E.push(x.toneMapping),E.push(x.numClippingPlanes),E.push(x.numClipIntersection),E.push(x.depthPacking)}function M(E,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),E.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.skinning&&o.enable(4),x.morphTargets&&o.enable(5),x.morphNormals&&o.enable(6),x.morphColors&&o.enable(7),x.premultipliedAlpha&&o.enable(8),x.shadowMapEnabled&&o.enable(9),x.useLegacyLights&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.alphaToCoverage&&o.enable(20),E.push(o.mask)}function b(E){const x=g[E.type];let N;if(x){const q=Be[x];N=Nh.clone(q.uniforms)}else N=E.uniforms;return N}function O(E,x){let N;for(let q=0,C=h.length;q0?n.push(d):m.transparent===!0?r.push(d):e.push(d)}function l(u,p,m,g,_,f){const d=a(u,p,m,g,_,f);m.transmission>0?n.unshift(d):m.transparent===!0?r.unshift(d):e.unshift(d)}function c(u,p){e.length>1&&e.sort(u||em),n.length>1&&n.sort(p||wo),r.length>1&&r.sort(p||wo)}function h(){for(let u=t,p=i.length;u=s.length?(a=new Ro,s.push(a)):a=s[r],a}function e(){i=new WeakMap}return{get:t,dispose:e}}function im(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new L,color:new Mt};break;case"SpotLight":e={position:new L,direction:new L,color:new Mt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new L,color:new Mt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new L,skyColor:new Mt,groundColor:new Mt};break;case"RectAreaLight":e={color:new Mt,position:new L,halfWidth:new L,halfHeight:new L};break}return i[t.id]=e,e}}}function rm(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ut};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ut};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ut,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}let sm=0;function am(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function om(i){const t=new im,e=rm(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new L);const r=new L,s=new Jt,a=new Jt;function o(c,h){let u=0,p=0,m=0;for(let N=0;N<9;N++)n.probe[N].set(0,0,0);let g=0,_=0,f=0,d=0,T=0,M=0,b=0,O=0,w=0,A=0,k=0;c.sort(am);const E=h===!0?Math.PI:1;for(let N=0,q=c.length;N0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=it.LTC_FLOAT_1,n.rectAreaLTC2=it.LTC_FLOAT_2):(n.rectAreaLTC1=it.LTC_HALF_1,n.rectAreaLTC2=it.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=p,n.ambient[2]=m;const x=n.hash;(x.directionalLength!==g||x.pointLength!==_||x.spotLength!==f||x.rectAreaLength!==d||x.hemiLength!==T||x.numDirectionalShadows!==M||x.numPointShadows!==b||x.numSpotShadows!==O||x.numSpotMaps!==w||x.numLightProbes!==k)&&(n.directional.length=g,n.spot.length=f,n.rectArea.length=d,n.point.length=_,n.hemi.length=T,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=O,n.spotShadowMap.length=O,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=b,n.spotLightMatrix.length=O+w-A,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=A,n.numLightProbes=k,x.directionalLength=g,x.pointLength=_,x.spotLength=f,x.rectAreaLength=d,x.hemiLength=T,x.numDirectionalShadows=M,x.numPointShadows=b,x.numSpotShadows=O,x.numSpotMaps=w,x.numLightProbes=k,n.version=sm++)}function l(c,h){let u=0,p=0,m=0,g=0,_=0;const f=h.matrixWorldInverse;for(let d=0,T=c.length;d=a.length?(o=new Co(i),a.push(o)):o=a[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}class cm extends Ui{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=sh,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class hm extends Ui{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const um=`void main() { +`+H)}else q!==""?console.warn("THREE.WebGLProgram: Program Info Log:",q):(C===""||G==="")&&(Z=!1);Z&&(N.diagnostics={runnable:X,programLog:q,vertexShader:{log:C,prefix:d},fragmentShader:{log:G,prefix:f}})}r.deleteShader(O),r.deleteShader(w),k=new dr(r,_),E=Bp(r,_)}let k;this.getUniforms=function(){return k===void 0&&A(this),k};let E;this.getAttributes=function(){return E===void 0&&A(this),E};let x=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(_,Pp)),x},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Lp++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=O,this.fragmentShader=w,this}let $p=0;class Zp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,r=this._getShaderStage(e),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return n===void 0&&(n=new Jp(t),e.set(t,n)),n}}class Jp{constructor(t){this.id=$p++,this.code=t,this.usedTimes=0}}function Qp(i,t,e,n,r,s,a){const o=new Ys,l=new Zp,c=new Set,h=[],u=r.logarithmicDepthBuffer,p=r.vertexTextures;let m=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(E){return c.add(E),E===0?"uv":`uv${E}`}function d(E,x,N,q,C){const G=q.fog,X=C.geometry,Z=E.isMeshStandardMaterial?q.environment:null,J=(E.isMeshStandardMaterial?e:t).get(E.envMap||Z),H=J&&J.mapping===Tr?J.image.height:null,tt=g[E.type];E.precision!==null&&(m=r.getMaxPrecision(E.precision),m!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",m,"instead."));const Q=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,pt=Q!==void 0?Q.length:0;let It=0;X.morphAttributes.position!==void 0&&(It=1),X.morphAttributes.normal!==void 0&&(It=2),X.morphAttributes.color!==void 0&&(It=3);let Xt,V,et,ut;if(tt){const Gt=Be[tt];Xt=Gt.vertexShader,V=Gt.fragmentShader}else Xt=E.vertexShader,V=E.fragmentShader,l.update(E),et=l.getVertexShaderID(E),ut=l.getFragmentShaderID(E);const rt=i.getRenderTarget(),Nt=C.isInstancedMesh===!0,Ot=C.isBatchedMesh===!0,D=!!E.map,Yt=!!E.matcap,_t=!!J,qt=!!E.aoMap,St=!!E.lightMap,Bt=!!E.bumpMap,Lt=!!E.normalMap,zt=!!E.displacementMap,Qt=!!E.emissiveMap,y=!!E.metalnessMap,v=!!E.roughnessMap,z=E.anisotropy>0,Y=E.clearcoat>0,K=E.dispersion>0,$=E.iridescence>0,gt=E.sheen>0,lt=E.transmission>0,ot=z&&!!E.anisotropyMap,Rt=Y&&!!E.clearcoatMap,nt=Y&&!!E.clearcoatNormalMap,mt=Y&&!!E.clearcoatRoughnessMap,kt=$&&!!E.iridescenceMap,vt=$&&!!E.iridescenceThicknessMap,ht=gt&&!!E.sheenColorMap,Ct=gt&&!!E.sheenRoughnessMap,Ft=!!E.specularMap,ee=!!E.specularColorMap,Pt=!!E.specularIntensityMap,R=lt&&!!E.transmissionMap,j=lt&&!!E.thicknessMap,W=!!E.gradientMap,st=!!E.alphaMap,ct=E.alphaTest>0,Ht=!!E.alphaHash,jt=!!E.extensions;let te=pn;E.toneMapped&&(rt===null||rt.isXRRenderTarget===!0)&&(te=i.toneMapping);const le={shaderID:tt,shaderType:E.type,shaderName:E.name,vertexShader:Xt,fragmentShader:V,defines:E.defines,customVertexShaderID:et,customFragmentShaderID:ut,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:m,batching:Ot,instancing:Nt,instancingColor:Nt&&C.instanceColor!==null,instancingMorph:Nt&&C.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:rt===null?i.outputColorSpace:rt.isXRRenderTarget===!0?rt.texture.colorSpace:vn,alphaToCoverage:!!E.alphaToCoverage,map:D,matcap:Yt,envMap:_t,envMapMode:_t&&J.mapping,envMapCubeUVHeight:H,aoMap:qt,lightMap:St,bumpMap:Bt,normalMap:Lt,displacementMap:p&&zt,emissiveMap:Qt,normalMapObjectSpace:Lt&&E.normalMapType===oh,normalMapTangentSpace:Lt&&E.normalMapType===gl,metalnessMap:y,roughnessMap:v,anisotropy:z,anisotropyMap:ot,clearcoat:Y,clearcoatMap:Rt,clearcoatNormalMap:nt,clearcoatRoughnessMap:mt,dispersion:K,iridescence:$,iridescenceMap:kt,iridescenceThicknessMap:vt,sheen:gt,sheenColorMap:ht,sheenRoughnessMap:Ct,specularMap:Ft,specularColorMap:ee,specularIntensityMap:Pt,transmission:lt,transmissionMap:R,thicknessMap:j,gradientMap:W,opaque:E.transparent===!1&&E.blending===ii&&E.alphaToCoverage===!1,alphaMap:st,alphaTest:ct,alphaHash:Ht,combine:E.combine,mapUv:D&&_(E.map.channel),aoMapUv:qt&&_(E.aoMap.channel),lightMapUv:St&&_(E.lightMap.channel),bumpMapUv:Bt&&_(E.bumpMap.channel),normalMapUv:Lt&&_(E.normalMap.channel),displacementMapUv:zt&&_(E.displacementMap.channel),emissiveMapUv:Qt&&_(E.emissiveMap.channel),metalnessMapUv:y&&_(E.metalnessMap.channel),roughnessMapUv:v&&_(E.roughnessMap.channel),anisotropyMapUv:ot&&_(E.anisotropyMap.channel),clearcoatMapUv:Rt&&_(E.clearcoatMap.channel),clearcoatNormalMapUv:nt&&_(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:mt&&_(E.clearcoatRoughnessMap.channel),iridescenceMapUv:kt&&_(E.iridescenceMap.channel),iridescenceThicknessMapUv:vt&&_(E.iridescenceThicknessMap.channel),sheenColorMapUv:ht&&_(E.sheenColorMap.channel),sheenRoughnessMapUv:Ct&&_(E.sheenRoughnessMap.channel),specularMapUv:Ft&&_(E.specularMap.channel),specularColorMapUv:ee&&_(E.specularColorMap.channel),specularIntensityMapUv:Pt&&_(E.specularIntensityMap.channel),transmissionMapUv:R&&_(E.transmissionMap.channel),thicknessMapUv:j&&_(E.thicknessMap.channel),alphaMapUv:st&&_(E.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Lt||z),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:C.isPoints===!0&&!!X.attributes.uv&&(D||st),fog:!!G,useFog:E.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:C.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:pt,morphTextureStride:It,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:E.dithering,shadowMapEnabled:i.shadowMap.enabled&&N.length>0,shadowMapType:i.shadowMap.type,toneMapping:te,useLegacyLights:i._useLegacyLights,decodeVideoTexture:D&&E.map.isVideoTexture===!0&&Wt.getTransfer(E.map.colorSpace)===Kt,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Je,flipSided:E.side===_e,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:jt&&E.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:jt&&E.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return le.vertexUv1s=c.has(1),le.vertexUv2s=c.has(2),le.vertexUv3s=c.has(3),c.clear(),le}function f(E){const x=[];if(E.shaderID?x.push(E.shaderID):(x.push(E.customVertexShaderID),x.push(E.customFragmentShaderID)),E.defines!==void 0)for(const N in E.defines)x.push(N),x.push(E.defines[N]);return E.isRawShaderMaterial===!1&&(T(x,E),M(x,E),x.push(i.outputColorSpace)),x.push(E.customProgramCacheKey),x.join()}function T(E,x){E.push(x.precision),E.push(x.outputColorSpace),E.push(x.envMapMode),E.push(x.envMapCubeUVHeight),E.push(x.mapUv),E.push(x.alphaMapUv),E.push(x.lightMapUv),E.push(x.aoMapUv),E.push(x.bumpMapUv),E.push(x.normalMapUv),E.push(x.displacementMapUv),E.push(x.emissiveMapUv),E.push(x.metalnessMapUv),E.push(x.roughnessMapUv),E.push(x.anisotropyMapUv),E.push(x.clearcoatMapUv),E.push(x.clearcoatNormalMapUv),E.push(x.clearcoatRoughnessMapUv),E.push(x.iridescenceMapUv),E.push(x.iridescenceThicknessMapUv),E.push(x.sheenColorMapUv),E.push(x.sheenRoughnessMapUv),E.push(x.specularMapUv),E.push(x.specularColorMapUv),E.push(x.specularIntensityMapUv),E.push(x.transmissionMapUv),E.push(x.thicknessMapUv),E.push(x.combine),E.push(x.fogExp2),E.push(x.sizeAttenuation),E.push(x.morphTargetsCount),E.push(x.morphAttributeCount),E.push(x.numDirLights),E.push(x.numPointLights),E.push(x.numSpotLights),E.push(x.numSpotLightMaps),E.push(x.numHemiLights),E.push(x.numRectAreaLights),E.push(x.numDirLightShadows),E.push(x.numPointLightShadows),E.push(x.numSpotLightShadows),E.push(x.numSpotLightShadowsWithMaps),E.push(x.numLightProbes),E.push(x.shadowMapType),E.push(x.toneMapping),E.push(x.numClippingPlanes),E.push(x.numClipIntersection),E.push(x.depthPacking)}function M(E,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),E.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.skinning&&o.enable(4),x.morphTargets&&o.enable(5),x.morphNormals&&o.enable(6),x.morphColors&&o.enable(7),x.premultipliedAlpha&&o.enable(8),x.shadowMapEnabled&&o.enable(9),x.useLegacyLights&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.alphaToCoverage&&o.enable(20),E.push(o.mask)}function b(E){const x=g[E.type];let N;if(x){const q=Be[x];N=Nh.clone(q.uniforms)}else N=E.uniforms;return N}function O(E,x){let N;for(let q=0,C=h.length;q0?n.push(f):m.transparent===!0?r.push(f):e.push(f)}function l(u,p,m,g,_,d){const f=a(u,p,m,g,_,d);m.transmission>0?n.unshift(f):m.transparent===!0?r.unshift(f):e.unshift(f)}function c(u,p){e.length>1&&e.sort(u||em),n.length>1&&n.sort(p||wo),r.length>1&&r.sort(p||wo)}function h(){for(let u=t,p=i.length;u=s.length?(a=new Ro,s.push(a)):a=s[r],a}function e(){i=new WeakMap}return{get:t,dispose:e}}function im(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new L,color:new Mt};break;case"SpotLight":e={position:new L,direction:new L,color:new Mt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new L,color:new Mt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new L,skyColor:new Mt,groundColor:new Mt};break;case"RectAreaLight":e={color:new Mt,position:new L,halfWidth:new L,halfHeight:new L};break}return i[t.id]=e,e}}}function rm(){const i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ut};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ut};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ut,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}let sm=0;function am(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function om(i){const t=new im,e=rm(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new L);const r=new L,s=new Jt,a=new Jt;function o(c,h){let u=0,p=0,m=0;for(let N=0;N<9;N++)n.probe[N].set(0,0,0);let g=0,_=0,d=0,f=0,T=0,M=0,b=0,O=0,w=0,A=0,k=0;c.sort(am);const E=h===!0?Math.PI:1;for(let N=0,q=c.length;N0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=it.LTC_FLOAT_1,n.rectAreaLTC2=it.LTC_FLOAT_2):(n.rectAreaLTC1=it.LTC_HALF_1,n.rectAreaLTC2=it.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=p,n.ambient[2]=m;const x=n.hash;(x.directionalLength!==g||x.pointLength!==_||x.spotLength!==d||x.rectAreaLength!==f||x.hemiLength!==T||x.numDirectionalShadows!==M||x.numPointShadows!==b||x.numSpotShadows!==O||x.numSpotMaps!==w||x.numLightProbes!==k)&&(n.directional.length=g,n.spot.length=d,n.rectArea.length=f,n.point.length=_,n.hemi.length=T,n.directionalShadow.length=M,n.directionalShadowMap.length=M,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=O,n.spotShadowMap.length=O,n.directionalShadowMatrix.length=M,n.pointShadowMatrix.length=b,n.spotLightMatrix.length=O+w-A,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=A,n.numLightProbes=k,x.directionalLength=g,x.pointLength=_,x.spotLength=d,x.rectAreaLength=f,x.hemiLength=T,x.numDirectionalShadows=M,x.numPointShadows=b,x.numSpotShadows=O,x.numSpotMaps=w,x.numLightProbes=k,n.version=sm++)}function l(c,h){let u=0,p=0,m=0,g=0,_=0;const d=h.matrixWorldInverse;for(let f=0,T=c.length;f=a.length?(o=new Co(i),a.push(o)):o=a[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}class cm extends Ui{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=sh,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class hm extends Ui{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}const um=`void main() { gl_Position = vec4( position, 1.0 ); }`,dm=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3798,7 +3798,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function fm(i,t,e){let n=new js;const r=new Ut,s=new Ut,a=new Zt,o=new cm({depthPacking:ah}),l=new hm,c={},h=e.maxTextureSize,u={[mn]:_e,[_e]:mn,[Je]:Je},p=new _n({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ut},radius:{value:4}},vertexShader:um,fragmentShader:dm}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const g=new On;g.setAttribute("position",new Ve(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new He(g,p),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ol;let d=this.type;this.render=function(w,A,k){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||w.length===0)return;const E=i.getRenderTarget(),x=i.getActiveCubeFace(),N=i.getActiveMipmapLevel(),q=i.state;q.setBlending(fn),q.buffers.color.setClear(1,1,1,1),q.buffers.depth.setTest(!0),q.setScissorTest(!1);const C=d!==Ze&&this.type===Ze,G=d===Ze&&this.type!==Ze;for(let X=0,Z=w.length;Xh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/tt.x),r.x=s.x*tt.x,H.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/tt.y),r.y=s.y*tt.y,H.mapSize.y=s.y)),H.map===null||C===!0||G===!0){const pt=this.type!==Ze?{minFilter:Re,magFilter:Re}:{};H.map!==null&&H.map.dispose(),H.map=new In(r.x,r.y,pt),H.map.texture.name=J.name+".shadowMap",H.camera.updateProjectionMatrix()}i.setRenderTarget(H.map),i.clear();const Q=H.getViewportCount();for(let pt=0;pt0||A.map&&A.alphaTest>0){const q=x.uuid,C=A.uuid;let G=c[q];G===void 0&&(G={},c[q]=G);let X=G[C];X===void 0&&(X=x.clone(),G[C]=X,A.addEventListener("dispose",O)),x=X}if(x.visible=A.visible,x.wireframe=A.wireframe,E===Ze?x.side=A.shadowSide!==null?A.shadowSide:A.side:x.side=A.shadowSide!==null?A.shadowSide:u[A.side],x.alphaMap=A.alphaMap,x.alphaTest=A.alphaTest,x.map=A.map,x.clipShadows=A.clipShadows,x.clippingPlanes=A.clippingPlanes,x.clipIntersection=A.clipIntersection,x.displacementMap=A.displacementMap,x.displacementScale=A.displacementScale,x.displacementBias=A.displacementBias,x.wireframeLinewidth=A.wireframeLinewidth,x.linewidth=A.linewidth,k.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const q=i.properties.get(x);q.light=k}return x}function b(w,A,k,E,x){if(w.visible===!1)return;if(w.layers.test(A.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&x===Ze)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,w.matrixWorld);const C=t.update(w),G=w.material;if(Array.isArray(G)){const X=C.groups;for(let Z=0,J=X.length;Z=1):J.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),X=Z>=2);let H=null,tt={};const Q=i.getParameter(i.SCISSOR_BOX),pt=i.getParameter(i.VIEWPORT),It=new Zt().fromArray(Q),Xt=new Zt().fromArray(pt);function V(R,j,W,st){const ct=new Uint8Array(4),Ht=i.createTexture();i.bindTexture(R,Ht),i.texParameteri(R,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(R,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let jt=0;jt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ut,h=new WeakMap;let u;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(y,v){return m?new OffscreenCanvas(y,v):Sr("canvas")}function _(y,v,z){let Y=1;const K=Qt(y);if((K.width>z||K.height>z)&&(Y=z/Math.max(K.width,K.height)),Y<1)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap||typeof VideoFrame<"u"&&y instanceof VideoFrame){const $=Math.floor(Y*K.width),gt=Math.floor(Y*K.height);u===void 0&&(u=g($,gt));const lt=v?g($,gt):u;return lt.width=$,lt.height=gt,lt.getContext("2d").drawImage(y,0,0,$,gt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+$+"x"+gt+")."),lt}else return"data"in y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),y;return y}function f(y){return y.generateMipmaps&&y.minFilter!==Re&&y.minFilter!==Ue}function d(y){i.generateMipmap(y)}function T(y,v,z,Y,K=!1){if(y!==null){if(i[y]!==void 0)return i[y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let $=v;if(v===i.RED&&(z===i.FLOAT&&($=i.R32F),z===i.HALF_FLOAT&&($=i.R16F),z===i.UNSIGNED_BYTE&&($=i.R8)),v===i.RED_INTEGER&&(z===i.UNSIGNED_BYTE&&($=i.R8UI),z===i.UNSIGNED_SHORT&&($=i.R16UI),z===i.UNSIGNED_INT&&($=i.R32UI),z===i.BYTE&&($=i.R8I),z===i.SHORT&&($=i.R16I),z===i.INT&&($=i.R32I)),v===i.RG&&(z===i.FLOAT&&($=i.RG32F),z===i.HALF_FLOAT&&($=i.RG16F),z===i.UNSIGNED_BYTE&&($=i.RG8)),v===i.RG_INTEGER&&(z===i.UNSIGNED_BYTE&&($=i.RG8UI),z===i.UNSIGNED_SHORT&&($=i.RG16UI),z===i.UNSIGNED_INT&&($=i.RG32UI),z===i.BYTE&&($=i.RG8I),z===i.SHORT&&($=i.RG16I),z===i.INT&&($=i.RG32I)),v===i.RGB&&z===i.UNSIGNED_INT_5_9_9_9_REV&&($=i.RGB9_E5),v===i.RGBA){const gt=K?gr:Wt.getTransfer(Y);z===i.FLOAT&&($=i.RGBA32F),z===i.HALF_FLOAT&&($=i.RGBA16F),z===i.UNSIGNED_BYTE&&($=gt===Kt?i.SRGB8_ALPHA8:i.RGBA8),z===i.UNSIGNED_SHORT_4_4_4_4&&($=i.RGBA4),z===i.UNSIGNED_SHORT_5_5_5_1&&($=i.RGB5_A1)}return($===i.R16F||$===i.R32F||$===i.RG16F||$===i.RG32F||$===i.RGBA16F||$===i.RGBA32F)&&t.get("EXT_color_buffer_float"),$}function M(y,v){return f(y)===!0||y.isFramebufferTexture&&y.minFilter!==Re&&y.minFilter!==Ue?Math.log2(Math.max(v.width,v.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?v.mipmaps.length:1}function b(y){const v=y.target;v.removeEventListener("dispose",b),w(v),v.isVideoTexture&&h.delete(v)}function O(y){const v=y.target;v.removeEventListener("dispose",O),k(v)}function w(y){const v=n.get(y);if(v.__webglInit===void 0)return;const z=y.source,Y=p.get(z);if(Y){const K=Y[v.__cacheKey];K.usedTimes--,K.usedTimes===0&&A(y),Object.keys(Y).length===0&&p.delete(z)}n.remove(y)}function A(y){const v=n.get(y);i.deleteTexture(v.__webglTexture);const z=y.source,Y=p.get(z);delete Y[v.__cacheKey],a.memory.textures--}function k(y){const v=n.get(y);if(y.depthTexture&&y.depthTexture.dispose(),y.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(v.__webglFramebuffer[Y]))for(let K=0;K=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+r.maxTextures),E+=1,y}function q(y){const v=[];return v.push(y.wrapS),v.push(y.wrapT),v.push(y.wrapR||0),v.push(y.magFilter),v.push(y.minFilter),v.push(y.anisotropy),v.push(y.internalFormat),v.push(y.format),v.push(y.type),v.push(y.generateMipmaps),v.push(y.premultiplyAlpha),v.push(y.flipY),v.push(y.unpackAlignment),v.push(y.colorSpace),v.join()}function C(y,v){const z=n.get(y);if(y.isVideoTexture&&Lt(y),y.isRenderTargetTexture===!1&&y.version>0&&z.__version!==y.version){const Y=y.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{It(z,y,v);return}}e.bindTexture(i.TEXTURE_2D,z.__webglTexture,i.TEXTURE0+v)}function G(y,v){const z=n.get(y);if(y.version>0&&z.__version!==y.version){It(z,y,v);return}e.bindTexture(i.TEXTURE_2D_ARRAY,z.__webglTexture,i.TEXTURE0+v)}function X(y,v){const z=n.get(y);if(y.version>0&&z.__version!==y.version){It(z,y,v);return}e.bindTexture(i.TEXTURE_3D,z.__webglTexture,i.TEXTURE0+v)}function Z(y,v){const z=n.get(y);if(y.version>0&&z.__version!==y.version){Xt(z,y,v);return}e.bindTexture(i.TEXTURE_CUBE_MAP,z.__webglTexture,i.TEXTURE0+v)}const J={[Cs]:i.REPEAT,[Pn]:i.CLAMP_TO_EDGE,[Ps]:i.MIRRORED_REPEAT},H={[Re]:i.NEAREST,[jc]:i.NEAREST_MIPMAP_NEAREST,[Bi]:i.NEAREST_MIPMAP_LINEAR,[Ue]:i.LINEAR,[Fr]:i.LINEAR_MIPMAP_NEAREST,[Ln]:i.LINEAR_MIPMAP_LINEAR},tt={[lh]:i.NEVER,[ph]:i.ALWAYS,[ch]:i.LESS,[_l]:i.LEQUAL,[hh]:i.EQUAL,[fh]:i.GEQUAL,[uh]:i.GREATER,[dh]:i.NOTEQUAL};function Q(y,v){if(v.type===dn&&t.has("OES_texture_float_linear")===!1&&(v.magFilter===Ue||v.magFilter===Fr||v.magFilter===Bi||v.magFilter===Ln||v.minFilter===Ue||v.minFilter===Fr||v.minFilter===Bi||v.minFilter===Ln)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(y,i.TEXTURE_WRAP_S,J[v.wrapS]),i.texParameteri(y,i.TEXTURE_WRAP_T,J[v.wrapT]),(y===i.TEXTURE_3D||y===i.TEXTURE_2D_ARRAY)&&i.texParameteri(y,i.TEXTURE_WRAP_R,J[v.wrapR]),i.texParameteri(y,i.TEXTURE_MAG_FILTER,H[v.magFilter]),i.texParameteri(y,i.TEXTURE_MIN_FILTER,H[v.minFilter]),v.compareFunction&&(i.texParameteri(y,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(y,i.TEXTURE_COMPARE_FUNC,tt[v.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Re||v.minFilter!==Bi&&v.minFilter!==Ln||v.type===dn&&t.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const z=t.get("EXT_texture_filter_anisotropic");i.texParameterf(y,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function pt(y,v){let z=!1;y.__webglInit===void 0&&(y.__webglInit=!0,v.addEventListener("dispose",b));const Y=v.source;let K=p.get(Y);K===void 0&&(K={},p.set(Y,K));const $=q(v);if($!==y.__cacheKey){K[$]===void 0&&(K[$]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,z=!0),K[$].usedTimes++;const gt=K[y.__cacheKey];gt!==void 0&&(K[y.__cacheKey].usedTimes--,gt.usedTimes===0&&A(v)),y.__cacheKey=$,y.__webglTexture=K[$].texture}return z}function It(y,v,z){let Y=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(Y=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(Y=i.TEXTURE_3D);const K=pt(y,v),$=v.source;e.bindTexture(Y,y.__webglTexture,i.TEXTURE0+z);const gt=n.get($);if($.version!==gt.__version||K===!0){e.activeTexture(i.TEXTURE0+z);const lt=Wt.getPrimaries(Wt.workingColorSpace),ot=v.colorSpace===un?null:Wt.getPrimaries(v.colorSpace),Rt=v.colorSpace===un||lt===ot?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Rt);let nt=_(v.image,!1,r.maxTextureSize);nt=zt(v,nt);const mt=s.convert(v.format,v.colorSpace),kt=s.convert(v.type);let vt=T(v.internalFormat,mt,kt,v.colorSpace,v.isVideoTexture);Q(Y,v);let ht;const Ct=v.mipmaps,Ft=v.isVideoTexture!==!0,ee=gt.__version===void 0||K===!0,Pt=$.dataReady,R=M(v,nt);if(v.isDepthTexture)vt=i.DEPTH_COMPONENT16,v.type===dn?vt=i.DEPTH_COMPONENT32F:v.type===li?vt=i.DEPTH_COMPONENT24:v.type===Ci&&(vt=i.DEPTH24_STENCIL8),ee&&(Ft?e.texStorage2D(i.TEXTURE_2D,1,vt,nt.width,nt.height):e.texImage2D(i.TEXTURE_2D,0,vt,nt.width,nt.height,0,mt,kt,null));else if(v.isDataTexture)if(Ct.length>0){Ft&&ee&&e.texStorage2D(i.TEXTURE_2D,R,vt,Ct[0].width,Ct[0].height);for(let j=0,W=Ct.length;j>=1,W>>=1}}else if(Ct.length>0){if(Ft&&ee){const j=Qt(Ct[0]);e.texStorage2D(i.TEXTURE_2D,R,vt,j.width,j.height)}for(let j=0,W=Ct.length;j0&&R++;const W=Qt(mt[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,R,Ct,W.width,W.height)}for(let W=0;W<6;W++)if(nt){Ft?Pt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,0,0,mt[W].width,mt[W].height,vt,ht,mt[W].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,Ct,mt[W].width,mt[W].height,0,vt,ht,mt[W].data);for(let st=0;st>$),mt=Math.max(1,v.height>>$);K===i.TEXTURE_3D||K===i.TEXTURE_2D_ARRAY?e.texImage3D(K,$,ot,nt,mt,v.depth,0,gt,lt,null):e.texImage2D(K,$,ot,nt,mt,0,gt,lt,null)}e.bindFramebuffer(i.FRAMEBUFFER,y),Bt(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Y,K,n.get(z).__webglTexture,0,St(v)):(K===i.TEXTURE_2D||K>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Y,K,n.get(z).__webglTexture,$),e.bindFramebuffer(i.FRAMEBUFFER,null)}function et(y,v,z){if(i.bindRenderbuffer(i.RENDERBUFFER,y),v.depthBuffer&&!v.stencilBuffer){let Y=i.DEPTH_COMPONENT24;if(z||Bt(v)){const K=v.depthTexture;K&&K.isDepthTexture&&(K.type===dn?Y=i.DEPTH_COMPONENT32F:K.type===li&&(Y=i.DEPTH_COMPONENT24));const $=St(v);Bt(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,$,Y,v.width,v.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,$,Y,v.width,v.height)}else i.renderbufferStorage(i.RENDERBUFFER,Y,v.width,v.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,y)}else if(v.depthBuffer&&v.stencilBuffer){const Y=St(v);z&&Bt(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Y,i.DEPTH24_STENCIL8,v.width,v.height):Bt(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Y,i.DEPTH24_STENCIL8,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,y)}else{const Y=v.textures;for(let K=0;K1;if(gt||(Y.__webglTexture===void 0&&(Y.__webglTexture=i.createTexture()),Y.__version=v.version,a.memory.textures++),$){z.__webglFramebuffer=[];for(let lt=0;lt<6;lt++)if(v.mipmaps&&v.mipmaps.length>0){z.__webglFramebuffer[lt]=[];for(let ot=0;ot0){z.__webglFramebuffer=[];for(let lt=0;lt0&&Bt(y)===!1){z.__webglMultisampledFramebuffer=i.createFramebuffer(),z.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let lt=0;lt0)for(let ot=0;ot0)for(let ot=0;ot0){if(Bt(y)===!1){const v=y.textures,z=y.width,Y=y.height;let K=i.COLOR_BUFFER_BIT;const $=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=n.get(y),lt=v.length>1;if(lt)for(let ot=0;ot0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Lt(y){const v=a.render.frame;h.get(y)!==v&&(h.set(y,v),y.update())}function zt(y,v){const z=y.colorSpace,Y=y.format,K=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||z!==vn&&z!==un&&(Wt.getTransfer(z)===Kt?(Y!==ke||K!==gn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),v}function Qt(y){return typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement?(c.width=y.naturalWidth||y.width,c.height=y.naturalHeight||y.height):typeof VideoFrame<"u"&&y instanceof VideoFrame?(c.width=y.displayWidth,c.height=y.displayHeight):(c.width=y.width,c.height=y.height),c}this.allocateTextureUnit=N,this.resetTextureUnits=x,this.setTexture2D=C,this.setTexture2DArray=G,this.setTexture3D=X,this.setTextureCube=Z,this.rebindTextures=Nt,this.setupRenderTarget=Ot,this.updateRenderTargetMipmap=D,this.updateMultisampleRenderTarget=qt,this.setupDepthRenderbuffer=rt,this.setupFrameBufferTexture=V,this.useMultisampledRTT=Bt}function gm(i,t){function e(n,r=un){let s;const a=Wt.getTransfer(r);if(n===gn)return i.UNSIGNED_BYTE;if(n===ul)return i.UNSIGNED_SHORT_4_4_4_4;if(n===dl)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Zc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Kc)return i.BYTE;if(n===$c)return i.SHORT;if(n===cl)return i.UNSIGNED_SHORT;if(n===hl)return i.INT;if(n===li)return i.UNSIGNED_INT;if(n===dn)return i.FLOAT;if(n===br)return i.HALF_FLOAT;if(n===Jc)return i.ALPHA;if(n===Qc)return i.RGB;if(n===ke)return i.RGBA;if(n===th)return i.LUMINANCE;if(n===eh)return i.LUMINANCE_ALPHA;if(n===ri)return i.DEPTH_COMPONENT;if(n===wi)return i.DEPTH_STENCIL;if(n===nh)return i.RED;if(n===fl)return i.RED_INTEGER;if(n===ih)return i.RG;if(n===pl)return i.RG_INTEGER;if(n===ml)return i.RGBA_INTEGER;if(n===Br||n===zr||n===kr||n===Hr)if(a===Kt)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Br)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===zr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===kr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Hr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Br)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===zr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===kr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Hr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===fa||n===pa||n===ma||n===ga)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===fa)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===pa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ma)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ga)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===_a||n===va||n===xa)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(n===_a||n===va)return a===Kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===xa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Sa||n===Ma||n===Ea||n===ya||n===Ta||n===ba||n===Aa||n===wa||n===Ra||n===Ca||n===Pa||n===La||n===Da||n===Ua)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Sa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ma)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ea)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ya)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ta)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ba)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Aa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===wa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ra)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ca)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Pa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===La)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Da)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ua)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Vr||n===Ia||n===Na)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(n===Vr)return a===Kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ia)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Na)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===rh||n===Oa||n===Fa||n===Ba)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(n===Vr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Oa)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Fa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ba)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ci?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}class _m extends Te{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class bi extends xe{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vm={type:"move"};class ms{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new bi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new bi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new bi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){a=!0;for(const _ of t.hand.values()){const f=e.getJointPose(_,n),d=this._getHandJoint(c,_);f!==null&&(d.matrix.fromArray(f.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,d.jointRadius=f.radius),d.visible=f!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],p=h.position.distanceTo(u.position),m=.02,g=.005;c.inputState.pinching&&p>m+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&p<=m-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=e.getPose(t.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(vm)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const n=new bi;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}const xm=` +}`;function fm(i,t,e){let n=new js;const r=new Ut,s=new Ut,a=new Zt,o=new cm({depthPacking:ah}),l=new hm,c={},h=e.maxTextureSize,u={[mn]:_e,[_e]:mn,[Je]:Je},p=new _n({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ut},radius:{value:4}},vertexShader:um,fragmentShader:dm}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const g=new On;g.setAttribute("position",new Ve(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new He(g,p),d=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ol;let f=this.type;this.render=function(w,A,k){if(d.enabled===!1||d.autoUpdate===!1&&d.needsUpdate===!1||w.length===0)return;const E=i.getRenderTarget(),x=i.getActiveCubeFace(),N=i.getActiveMipmapLevel(),q=i.state;q.setBlending(fn),q.buffers.color.setClear(1,1,1,1),q.buffers.depth.setTest(!0),q.setScissorTest(!1);const C=f!==Ze&&this.type===Ze,G=f===Ze&&this.type!==Ze;for(let X=0,Z=w.length;Xh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/tt.x),r.x=s.x*tt.x,H.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/tt.y),r.y=s.y*tt.y,H.mapSize.y=s.y)),H.map===null||C===!0||G===!0){const pt=this.type!==Ze?{minFilter:Re,magFilter:Re}:{};H.map!==null&&H.map.dispose(),H.map=new In(r.x,r.y,pt),H.map.texture.name=J.name+".shadowMap",H.camera.updateProjectionMatrix()}i.setRenderTarget(H.map),i.clear();const Q=H.getViewportCount();for(let pt=0;pt0||A.map&&A.alphaTest>0){const q=x.uuid,C=A.uuid;let G=c[q];G===void 0&&(G={},c[q]=G);let X=G[C];X===void 0&&(X=x.clone(),G[C]=X,A.addEventListener("dispose",O)),x=X}if(x.visible=A.visible,x.wireframe=A.wireframe,E===Ze?x.side=A.shadowSide!==null?A.shadowSide:A.side:x.side=A.shadowSide!==null?A.shadowSide:u[A.side],x.alphaMap=A.alphaMap,x.alphaTest=A.alphaTest,x.map=A.map,x.clipShadows=A.clipShadows,x.clippingPlanes=A.clippingPlanes,x.clipIntersection=A.clipIntersection,x.displacementMap=A.displacementMap,x.displacementScale=A.displacementScale,x.displacementBias=A.displacementBias,x.wireframeLinewidth=A.wireframeLinewidth,x.linewidth=A.linewidth,k.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const q=i.properties.get(x);q.light=k}return x}function b(w,A,k,E,x){if(w.visible===!1)return;if(w.layers.test(A.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&x===Ze)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,w.matrixWorld);const C=t.update(w),G=w.material;if(Array.isArray(G)){const X=C.groups;for(let Z=0,J=X.length;Z=1):J.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),X=Z>=2);let H=null,tt={};const Q=i.getParameter(i.SCISSOR_BOX),pt=i.getParameter(i.VIEWPORT),It=new Zt().fromArray(Q),Xt=new Zt().fromArray(pt);function V(R,j,W,st){const ct=new Uint8Array(4),Ht=i.createTexture();i.bindTexture(R,Ht),i.texParameteri(R,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(R,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let jt=0;jt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ut,h=new WeakMap;let u;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(y,v){return m?new OffscreenCanvas(y,v):Sr("canvas")}function _(y,v,z){let Y=1;const K=Qt(y);if((K.width>z||K.height>z)&&(Y=z/Math.max(K.width,K.height)),Y<1)if(typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&y instanceof ImageBitmap||typeof VideoFrame<"u"&&y instanceof VideoFrame){const $=Math.floor(Y*K.width),gt=Math.floor(Y*K.height);u===void 0&&(u=g($,gt));const lt=v?g($,gt):u;return lt.width=$,lt.height=gt,lt.getContext("2d").drawImage(y,0,0,$,gt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+$+"x"+gt+")."),lt}else return"data"in y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),y;return y}function d(y){return y.generateMipmaps&&y.minFilter!==Re&&y.minFilter!==Ue}function f(y){i.generateMipmap(y)}function T(y,v,z,Y,K=!1){if(y!==null){if(i[y]!==void 0)return i[y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+y+"'")}let $=v;if(v===i.RED&&(z===i.FLOAT&&($=i.R32F),z===i.HALF_FLOAT&&($=i.R16F),z===i.UNSIGNED_BYTE&&($=i.R8)),v===i.RED_INTEGER&&(z===i.UNSIGNED_BYTE&&($=i.R8UI),z===i.UNSIGNED_SHORT&&($=i.R16UI),z===i.UNSIGNED_INT&&($=i.R32UI),z===i.BYTE&&($=i.R8I),z===i.SHORT&&($=i.R16I),z===i.INT&&($=i.R32I)),v===i.RG&&(z===i.FLOAT&&($=i.RG32F),z===i.HALF_FLOAT&&($=i.RG16F),z===i.UNSIGNED_BYTE&&($=i.RG8)),v===i.RG_INTEGER&&(z===i.UNSIGNED_BYTE&&($=i.RG8UI),z===i.UNSIGNED_SHORT&&($=i.RG16UI),z===i.UNSIGNED_INT&&($=i.RG32UI),z===i.BYTE&&($=i.RG8I),z===i.SHORT&&($=i.RG16I),z===i.INT&&($=i.RG32I)),v===i.RGB&&z===i.UNSIGNED_INT_5_9_9_9_REV&&($=i.RGB9_E5),v===i.RGBA){const gt=K?gr:Wt.getTransfer(Y);z===i.FLOAT&&($=i.RGBA32F),z===i.HALF_FLOAT&&($=i.RGBA16F),z===i.UNSIGNED_BYTE&&($=gt===Kt?i.SRGB8_ALPHA8:i.RGBA8),z===i.UNSIGNED_SHORT_4_4_4_4&&($=i.RGBA4),z===i.UNSIGNED_SHORT_5_5_5_1&&($=i.RGB5_A1)}return($===i.R16F||$===i.R32F||$===i.RG16F||$===i.RG32F||$===i.RGBA16F||$===i.RGBA32F)&&t.get("EXT_color_buffer_float"),$}function M(y,v){return d(y)===!0||y.isFramebufferTexture&&y.minFilter!==Re&&y.minFilter!==Ue?Math.log2(Math.max(v.width,v.height))+1:y.mipmaps!==void 0&&y.mipmaps.length>0?y.mipmaps.length:y.isCompressedTexture&&Array.isArray(y.image)?v.mipmaps.length:1}function b(y){const v=y.target;v.removeEventListener("dispose",b),w(v),v.isVideoTexture&&h.delete(v)}function O(y){const v=y.target;v.removeEventListener("dispose",O),k(v)}function w(y){const v=n.get(y);if(v.__webglInit===void 0)return;const z=y.source,Y=p.get(z);if(Y){const K=Y[v.__cacheKey];K.usedTimes--,K.usedTimes===0&&A(y),Object.keys(Y).length===0&&p.delete(z)}n.remove(y)}function A(y){const v=n.get(y);i.deleteTexture(v.__webglTexture);const z=y.source,Y=p.get(z);delete Y[v.__cacheKey],a.memory.textures--}function k(y){const v=n.get(y);if(y.depthTexture&&y.depthTexture.dispose(),y.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(v.__webglFramebuffer[Y]))for(let K=0;K=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+y+" texture units while this GPU supports only "+r.maxTextures),E+=1,y}function q(y){const v=[];return v.push(y.wrapS),v.push(y.wrapT),v.push(y.wrapR||0),v.push(y.magFilter),v.push(y.minFilter),v.push(y.anisotropy),v.push(y.internalFormat),v.push(y.format),v.push(y.type),v.push(y.generateMipmaps),v.push(y.premultiplyAlpha),v.push(y.flipY),v.push(y.unpackAlignment),v.push(y.colorSpace),v.join()}function C(y,v){const z=n.get(y);if(y.isVideoTexture&&Lt(y),y.isRenderTargetTexture===!1&&y.version>0&&z.__version!==y.version){const Y=y.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{It(z,y,v);return}}e.bindTexture(i.TEXTURE_2D,z.__webglTexture,i.TEXTURE0+v)}function G(y,v){const z=n.get(y);if(y.version>0&&z.__version!==y.version){It(z,y,v);return}e.bindTexture(i.TEXTURE_2D_ARRAY,z.__webglTexture,i.TEXTURE0+v)}function X(y,v){const z=n.get(y);if(y.version>0&&z.__version!==y.version){It(z,y,v);return}e.bindTexture(i.TEXTURE_3D,z.__webglTexture,i.TEXTURE0+v)}function Z(y,v){const z=n.get(y);if(y.version>0&&z.__version!==y.version){Xt(z,y,v);return}e.bindTexture(i.TEXTURE_CUBE_MAP,z.__webglTexture,i.TEXTURE0+v)}const J={[Cs]:i.REPEAT,[Pn]:i.CLAMP_TO_EDGE,[Ps]:i.MIRRORED_REPEAT},H={[Re]:i.NEAREST,[jc]:i.NEAREST_MIPMAP_NEAREST,[Bi]:i.NEAREST_MIPMAP_LINEAR,[Ue]:i.LINEAR,[Fr]:i.LINEAR_MIPMAP_NEAREST,[Ln]:i.LINEAR_MIPMAP_LINEAR},tt={[lh]:i.NEVER,[ph]:i.ALWAYS,[ch]:i.LESS,[_l]:i.LEQUAL,[hh]:i.EQUAL,[fh]:i.GEQUAL,[uh]:i.GREATER,[dh]:i.NOTEQUAL};function Q(y,v){if(v.type===dn&&t.has("OES_texture_float_linear")===!1&&(v.magFilter===Ue||v.magFilter===Fr||v.magFilter===Bi||v.magFilter===Ln||v.minFilter===Ue||v.minFilter===Fr||v.minFilter===Bi||v.minFilter===Ln)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(y,i.TEXTURE_WRAP_S,J[v.wrapS]),i.texParameteri(y,i.TEXTURE_WRAP_T,J[v.wrapT]),(y===i.TEXTURE_3D||y===i.TEXTURE_2D_ARRAY)&&i.texParameteri(y,i.TEXTURE_WRAP_R,J[v.wrapR]),i.texParameteri(y,i.TEXTURE_MAG_FILTER,H[v.magFilter]),i.texParameteri(y,i.TEXTURE_MIN_FILTER,H[v.minFilter]),v.compareFunction&&(i.texParameteri(y,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(y,i.TEXTURE_COMPARE_FUNC,tt[v.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Re||v.minFilter!==Bi&&v.minFilter!==Ln||v.type===dn&&t.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||n.get(v).__currentAnisotropy){const z=t.get("EXT_texture_filter_anisotropic");i.texParameterf(y,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function pt(y,v){let z=!1;y.__webglInit===void 0&&(y.__webglInit=!0,v.addEventListener("dispose",b));const Y=v.source;let K=p.get(Y);K===void 0&&(K={},p.set(Y,K));const $=q(v);if($!==y.__cacheKey){K[$]===void 0&&(K[$]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,z=!0),K[$].usedTimes++;const gt=K[y.__cacheKey];gt!==void 0&&(K[y.__cacheKey].usedTimes--,gt.usedTimes===0&&A(v)),y.__cacheKey=$,y.__webglTexture=K[$].texture}return z}function It(y,v,z){let Y=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(Y=i.TEXTURE_2D_ARRAY),v.isData3DTexture&&(Y=i.TEXTURE_3D);const K=pt(y,v),$=v.source;e.bindTexture(Y,y.__webglTexture,i.TEXTURE0+z);const gt=n.get($);if($.version!==gt.__version||K===!0){e.activeTexture(i.TEXTURE0+z);const lt=Wt.getPrimaries(Wt.workingColorSpace),ot=v.colorSpace===un?null:Wt.getPrimaries(v.colorSpace),Rt=v.colorSpace===un||lt===ot?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Rt);let nt=_(v.image,!1,r.maxTextureSize);nt=zt(v,nt);const mt=s.convert(v.format,v.colorSpace),kt=s.convert(v.type);let vt=T(v.internalFormat,mt,kt,v.colorSpace,v.isVideoTexture);Q(Y,v);let ht;const Ct=v.mipmaps,Ft=v.isVideoTexture!==!0,ee=gt.__version===void 0||K===!0,Pt=$.dataReady,R=M(v,nt);if(v.isDepthTexture)vt=i.DEPTH_COMPONENT16,v.type===dn?vt=i.DEPTH_COMPONENT32F:v.type===li?vt=i.DEPTH_COMPONENT24:v.type===Ci&&(vt=i.DEPTH24_STENCIL8),ee&&(Ft?e.texStorage2D(i.TEXTURE_2D,1,vt,nt.width,nt.height):e.texImage2D(i.TEXTURE_2D,0,vt,nt.width,nt.height,0,mt,kt,null));else if(v.isDataTexture)if(Ct.length>0){Ft&&ee&&e.texStorage2D(i.TEXTURE_2D,R,vt,Ct[0].width,Ct[0].height);for(let j=0,W=Ct.length;j>=1,W>>=1}}else if(Ct.length>0){if(Ft&&ee){const j=Qt(Ct[0]);e.texStorage2D(i.TEXTURE_2D,R,vt,j.width,j.height)}for(let j=0,W=Ct.length;j0&&R++;const W=Qt(mt[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,R,Ct,W.width,W.height)}for(let W=0;W<6;W++)if(nt){Ft?Pt&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,0,0,mt[W].width,mt[W].height,vt,ht,mt[W].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,Ct,mt[W].width,mt[W].height,0,vt,ht,mt[W].data);for(let st=0;st>$),mt=Math.max(1,v.height>>$);K===i.TEXTURE_3D||K===i.TEXTURE_2D_ARRAY?e.texImage3D(K,$,ot,nt,mt,v.depth,0,gt,lt,null):e.texImage2D(K,$,ot,nt,mt,0,gt,lt,null)}e.bindFramebuffer(i.FRAMEBUFFER,y),Bt(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Y,K,n.get(z).__webglTexture,0,St(v)):(K===i.TEXTURE_2D||K>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Y,K,n.get(z).__webglTexture,$),e.bindFramebuffer(i.FRAMEBUFFER,null)}function et(y,v,z){if(i.bindRenderbuffer(i.RENDERBUFFER,y),v.depthBuffer&&!v.stencilBuffer){let Y=i.DEPTH_COMPONENT24;if(z||Bt(v)){const K=v.depthTexture;K&&K.isDepthTexture&&(K.type===dn?Y=i.DEPTH_COMPONENT32F:K.type===li&&(Y=i.DEPTH_COMPONENT24));const $=St(v);Bt(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,$,Y,v.width,v.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,$,Y,v.width,v.height)}else i.renderbufferStorage(i.RENDERBUFFER,Y,v.width,v.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,y)}else if(v.depthBuffer&&v.stencilBuffer){const Y=St(v);z&&Bt(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Y,i.DEPTH24_STENCIL8,v.width,v.height):Bt(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Y,i.DEPTH24_STENCIL8,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,y)}else{const Y=v.textures;for(let K=0;K1;if(gt||(Y.__webglTexture===void 0&&(Y.__webglTexture=i.createTexture()),Y.__version=v.version,a.memory.textures++),$){z.__webglFramebuffer=[];for(let lt=0;lt<6;lt++)if(v.mipmaps&&v.mipmaps.length>0){z.__webglFramebuffer[lt]=[];for(let ot=0;ot0){z.__webglFramebuffer=[];for(let lt=0;lt0&&Bt(y)===!1){z.__webglMultisampledFramebuffer=i.createFramebuffer(),z.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let lt=0;lt0)for(let ot=0;ot0)for(let ot=0;ot0){if(Bt(y)===!1){const v=y.textures,z=y.width,Y=y.height;let K=i.COLOR_BUFFER_BIT;const $=y.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=n.get(y),lt=v.length>1;if(lt)for(let ot=0;ot0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function Lt(y){const v=a.render.frame;h.get(y)!==v&&(h.set(y,v),y.update())}function zt(y,v){const z=y.colorSpace,Y=y.format,K=y.type;return y.isCompressedTexture===!0||y.isVideoTexture===!0||z!==vn&&z!==un&&(Wt.getTransfer(z)===Kt?(Y!==ke||K!==gn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",z)),v}function Qt(y){return typeof HTMLImageElement<"u"&&y instanceof HTMLImageElement?(c.width=y.naturalWidth||y.width,c.height=y.naturalHeight||y.height):typeof VideoFrame<"u"&&y instanceof VideoFrame?(c.width=y.displayWidth,c.height=y.displayHeight):(c.width=y.width,c.height=y.height),c}this.allocateTextureUnit=N,this.resetTextureUnits=x,this.setTexture2D=C,this.setTexture2DArray=G,this.setTexture3D=X,this.setTextureCube=Z,this.rebindTextures=Nt,this.setupRenderTarget=Ot,this.updateRenderTargetMipmap=D,this.updateMultisampleRenderTarget=qt,this.setupDepthRenderbuffer=rt,this.setupFrameBufferTexture=V,this.useMultisampledRTT=Bt}function gm(i,t){function e(n,r=un){let s;const a=Wt.getTransfer(r);if(n===gn)return i.UNSIGNED_BYTE;if(n===ul)return i.UNSIGNED_SHORT_4_4_4_4;if(n===dl)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Zc)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Kc)return i.BYTE;if(n===$c)return i.SHORT;if(n===cl)return i.UNSIGNED_SHORT;if(n===hl)return i.INT;if(n===li)return i.UNSIGNED_INT;if(n===dn)return i.FLOAT;if(n===br)return i.HALF_FLOAT;if(n===Jc)return i.ALPHA;if(n===Qc)return i.RGB;if(n===ke)return i.RGBA;if(n===th)return i.LUMINANCE;if(n===eh)return i.LUMINANCE_ALPHA;if(n===ri)return i.DEPTH_COMPONENT;if(n===wi)return i.DEPTH_STENCIL;if(n===nh)return i.RED;if(n===fl)return i.RED_INTEGER;if(n===ih)return i.RG;if(n===pl)return i.RG_INTEGER;if(n===ml)return i.RGBA_INTEGER;if(n===Br||n===zr||n===kr||n===Hr)if(a===Kt)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Br)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===zr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===kr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Hr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Br)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===zr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===kr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Hr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===fa||n===pa||n===ma||n===ga)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===fa)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===pa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ma)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ga)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===_a||n===va||n===xa)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(n===_a||n===va)return a===Kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===xa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Sa||n===Ma||n===Ea||n===ya||n===Ta||n===ba||n===Aa||n===wa||n===Ra||n===Ca||n===Pa||n===La||n===Da||n===Ua)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Sa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ma)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ea)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ya)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ta)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ba)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Aa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===wa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ra)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ca)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Pa)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===La)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Da)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ua)return a===Kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Vr||n===Ia||n===Na)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(n===Vr)return a===Kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ia)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Na)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===rh||n===Oa||n===Fa||n===Ba)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(n===Vr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Oa)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Fa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ba)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ci?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}class _m extends Te{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class bi extends xe{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vm={type:"move"};class ms{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new bi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new bi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new bi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){a=!0;for(const _ of t.hand.values()){const d=e.getJointPose(_,n),f=this._getHandJoint(c,_);d!==null&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=d.radius),f.visible=d!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],p=h.position.distanceTo(u.position),m=.02,g=.005;c.inputState.pinching&&p>m+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&p<=m-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=e.getPose(t.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(vm)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const n=new bi;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}const xm=` void main() { gl_Position = vec4( position, 1.0 ); @@ -3822,12 +3822,12 @@ void main() { } -}`;class Mm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){const r=new ve,s=t.properties.get(r);s.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}render(t,e){if(this.texture!==null){if(this.mesh===null){const n=e.cameras[0].viewport,r=new _n({vertexShader:xm,fragmentShader:Sm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new He(new wr(20,20),r)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}}class Em extends hi{constructor(t,e){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,p=null,m=null,g=null;const _=new Mm,f=e.getContextAttributes();let d=null,T=null;const M=[],b=[],O=new Ut;let w=null;const A=new Te;A.layers.enable(1),A.viewport=new Zt;const k=new Te;k.layers.enable(2),k.viewport=new Zt;const E=[A,k],x=new _m;x.layers.enable(1),x.layers.enable(2);let N=null,q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let et=M[V];return et===void 0&&(et=new ms,M[V]=et),et.getTargetRaySpace()},this.getControllerGrip=function(V){let et=M[V];return et===void 0&&(et=new ms,M[V]=et),et.getGripSpace()},this.getHand=function(V){let et=M[V];return et===void 0&&(et=new ms,M[V]=et),et.getHandSpace()};function C(V){const et=b.indexOf(V.inputSource);if(et===-1)return;const ut=M[et];ut!==void 0&&(ut.update(V.inputSource,V.frame,c||a),ut.dispatchEvent({type:V.type,data:V.inputSource}))}function G(){r.removeEventListener("select",C),r.removeEventListener("selectstart",C),r.removeEventListener("selectend",C),r.removeEventListener("squeeze",C),r.removeEventListener("squeezestart",C),r.removeEventListener("squeezeend",C),r.removeEventListener("end",G),r.removeEventListener("inputsourceschange",X);for(let V=0;V=0&&(b[rt]=null,M[rt].disconnect(ut))}for(let et=0;et=b.length){b.push(ut),rt=Ot;break}else if(b[Ot]===null){b[Ot]=ut,rt=Ot;break}if(rt===-1)break}const Nt=M[rt];Nt&&Nt.connect(ut)}}const Z=new L,J=new L;function H(V,et,ut){Z.setFromMatrixPosition(et.matrixWorld),J.setFromMatrixPosition(ut.matrixWorld);const rt=Z.distanceTo(J),Nt=et.projectionMatrix.elements,Ot=ut.projectionMatrix.elements,D=Nt[14]/(Nt[10]-1),Yt=Nt[14]/(Nt[10]+1),_t=(Nt[9]+1)/Nt[5],qt=(Nt[9]-1)/Nt[5],St=(Nt[8]-1)/Nt[0],Bt=(Ot[8]+1)/Ot[0],Lt=D*St,zt=D*Bt,Qt=rt/(-St+Bt),y=Qt*-St;et.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(y),V.translateZ(Qt),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const v=D+Qt,z=Yt+Qt,Y=Lt-y,K=zt+(rt-y),$=_t*Yt/z*v,gt=qt*Yt/z*v;V.projectionMatrix.makePerspective(Y,K,$,gt,v,z),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}function tt(V,et){et===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(et.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(r===null)return;_.texture!==null&&(V.near=_.depthNear,V.far=_.depthFar),x.near=k.near=A.near=V.near,x.far=k.far=A.far=V.far,(N!==x.near||q!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),N=x.near,q=x.far,A.near=N,A.far=q,k.near=N,k.far=q,A.updateProjectionMatrix(),k.updateProjectionMatrix(),V.updateProjectionMatrix());const et=V.parent,ut=x.cameras;tt(x,et);for(let rt=0;rt0&&(f.alphaTest.value=d.alphaTest);const T=t.get(d),M=T.envMap,b=T.envMapRotation;if(M&&(f.envMap.value=M,bn.copy(b),bn.x*=-1,bn.y*=-1,bn.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(bn.y*=-1,bn.z*=-1),f.envMapRotation.value.setFromMatrix4(ym.makeRotationFromEuler(bn)),f.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,f.reflectivity.value=d.reflectivity,f.ior.value=d.ior,f.refractionRatio.value=d.refractionRatio),d.lightMap){f.lightMap.value=d.lightMap;const O=i._useLegacyLights===!0?Math.PI:1;f.lightMapIntensity.value=d.lightMapIntensity*O,e(d.lightMap,f.lightMapTransform)}d.aoMap&&(f.aoMap.value=d.aoMap,f.aoMapIntensity.value=d.aoMapIntensity,e(d.aoMap,f.aoMapTransform))}function a(f,d){f.diffuse.value.copy(d.color),f.opacity.value=d.opacity,d.map&&(f.map.value=d.map,e(d.map,f.mapTransform))}function o(f,d){f.dashSize.value=d.dashSize,f.totalSize.value=d.dashSize+d.gapSize,f.scale.value=d.scale}function l(f,d,T,M){f.diffuse.value.copy(d.color),f.opacity.value=d.opacity,f.size.value=d.size*T,f.scale.value=M*.5,d.map&&(f.map.value=d.map,e(d.map,f.uvTransform)),d.alphaMap&&(f.alphaMap.value=d.alphaMap,e(d.alphaMap,f.alphaMapTransform)),d.alphaTest>0&&(f.alphaTest.value=d.alphaTest)}function c(f,d){f.diffuse.value.copy(d.color),f.opacity.value=d.opacity,f.rotation.value=d.rotation,d.map&&(f.map.value=d.map,e(d.map,f.mapTransform)),d.alphaMap&&(f.alphaMap.value=d.alphaMap,e(d.alphaMap,f.alphaMapTransform)),d.alphaTest>0&&(f.alphaTest.value=d.alphaTest)}function h(f,d){f.specular.value.copy(d.specular),f.shininess.value=Math.max(d.shininess,1e-4)}function u(f,d){d.gradientMap&&(f.gradientMap.value=d.gradientMap)}function p(f,d){f.metalness.value=d.metalness,d.metalnessMap&&(f.metalnessMap.value=d.metalnessMap,e(d.metalnessMap,f.metalnessMapTransform)),f.roughness.value=d.roughness,d.roughnessMap&&(f.roughnessMap.value=d.roughnessMap,e(d.roughnessMap,f.roughnessMapTransform)),d.envMap&&(f.envMapIntensity.value=d.envMapIntensity)}function m(f,d,T){f.ior.value=d.ior,d.sheen>0&&(f.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),f.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(f.sheenColorMap.value=d.sheenColorMap,e(d.sheenColorMap,f.sheenColorMapTransform)),d.sheenRoughnessMap&&(f.sheenRoughnessMap.value=d.sheenRoughnessMap,e(d.sheenRoughnessMap,f.sheenRoughnessMapTransform))),d.clearcoat>0&&(f.clearcoat.value=d.clearcoat,f.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(f.clearcoatMap.value=d.clearcoatMap,e(d.clearcoatMap,f.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,e(d.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(f.clearcoatNormalMap.value=d.clearcoatNormalMap,e(d.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===_e&&f.clearcoatNormalScale.value.negate())),d.dispersion>0&&(f.dispersion.value=d.dispersion),d.iridescence>0&&(f.iridescence.value=d.iridescence,f.iridescenceIOR.value=d.iridescenceIOR,f.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(f.iridescenceMap.value=d.iridescenceMap,e(d.iridescenceMap,f.iridescenceMapTransform)),d.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=d.iridescenceThicknessMap,e(d.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),d.transmission>0&&(f.transmission.value=d.transmission,f.transmissionSamplerMap.value=T.texture,f.transmissionSamplerSize.value.set(T.width,T.height),d.transmissionMap&&(f.transmissionMap.value=d.transmissionMap,e(d.transmissionMap,f.transmissionMapTransform)),f.thickness.value=d.thickness,d.thicknessMap&&(f.thicknessMap.value=d.thicknessMap,e(d.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=d.attenuationDistance,f.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(f.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(f.anisotropyMap.value=d.anisotropyMap,e(d.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=d.specularIntensity,f.specularColor.value.copy(d.specularColor),d.specularColorMap&&(f.specularColorMap.value=d.specularColorMap,e(d.specularColorMap,f.specularColorMapTransform)),d.specularIntensityMap&&(f.specularIntensityMap.value=d.specularIntensityMap,e(d.specularIntensityMap,f.specularIntensityMapTransform))}function g(f,d){d.matcap&&(f.matcap.value=d.matcap)}function _(f,d){const T=t.get(d).light;f.referencePosition.value.setFromMatrixPosition(T.matrixWorld),f.nearDistance.value=T.shadow.camera.near,f.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function bm(i,t,e,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(T,M){const b=M.program;n.uniformBlockBinding(T,b)}function c(T,M){let b=r[T.id];b===void 0&&(g(T),b=h(T),r[T.id]=b,T.addEventListener("dispose",f));const O=M.program;n.updateUBOMapping(T,O);const w=t.render.frame;s[T.id]!==w&&(p(T),s[T.id]=w)}function h(T){const M=u();T.__bindingPointIndex=M;const b=i.createBuffer(),O=T.__size,w=T.usage;return i.bindBuffer(i.UNIFORM_BUFFER,b),i.bufferData(i.UNIFORM_BUFFER,O,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,M,b),b}function u(){for(let T=0;T0&&(b+=O-w),T.__size=b,T.__cache={},this}function _(T){const M={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(M.boundary=4,M.storage=4):T.isVector2?(M.boundary=8,M.storage=8):T.isVector3||T.isColor?(M.boundary=16,M.storage=12):T.isVector4?(M.boundary=16,M.storage=16):T.isMatrix3?(M.boundary=48,M.storage=48):T.isMatrix4?(M.boundary=64,M.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),M}function f(T){const M=T.target;M.removeEventListener("dispose",f);const b=a.indexOf(M.__bindingPointIndex);a.splice(b,1),i.deleteBuffer(r[M.id]),delete r[M.id],delete s[M.id]}function d(){for(const T in r)i.deleteBuffer(r[T]);a=[],r={},s={}}return{bind:l,update:c,dispose:d}}class Am{constructor(t={}){const{canvas:e=gh(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=t;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const m=new Uint32Array(4),g=new Int32Array(4);let _=null,f=null;const d=[],T=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Fe,this._useLegacyLights=!1,this.toneMapping=pn,this.toneMappingExposure=1;const M=this;let b=!1,O=0,w=0,A=null,k=-1,E=null;const x=new Zt,N=new Zt;let q=null;const C=new Mt(0);let G=0,X=e.width,Z=e.height,J=1,H=null,tt=null;const Q=new Zt(0,0,X,Z),pt=new Zt(0,0,X,Z);let It=!1;const Xt=new js;let V=!1,et=!1;const ut=new Jt,rt=new L,Nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ot(){return A===null?J:1}let D=n;function Yt(S,P){return e.getContext(S,P)}try{const S={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Gs}`),e.addEventListener("webglcontextlost",R,!1),e.addEventListener("webglcontextrestored",j,!1),e.addEventListener("webglcontextcreationerror",W,!1),D===null){const P="webgl2";if(D=Yt(P,S),D===null)throw Yt(P)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}let _t,qt,St,Bt,Lt,zt,Qt,y,v,z,Y,K,$,gt,lt,ot,Rt,nt,mt,kt,vt,ht,Ct,Ft;function ee(){_t=new If(D),_t.init(),ht=new gm(D,_t),qt=new wf(D,_t,t,ht),St=new pm(D),Bt=new Ff(D),Lt=new tm,zt=new mm(D,_t,St,Lt,qt,ht,Bt),Qt=new Cf(M),y=new Uf(M),v=new Vh(D),Ct=new bf(D,v),z=new Nf(D,v,Bt,Ct),Y=new zf(D,z,v,Bt),mt=new Bf(D,qt,zt),ot=new Rf(Lt),K=new Qp(M,Qt,y,_t,qt,Ct,ot),$=new Tm(M,Lt),gt=new nm,lt=new lm(_t),nt=new Tf(M,Qt,y,St,Y,p,l),Rt=new fm(M,Y,qt),Ft=new bm(D,Bt,qt,St),kt=new Af(D,_t,Bt),vt=new Of(D,_t,Bt),Bt.programs=K.programs,M.capabilities=qt,M.extensions=_t,M.properties=Lt,M.renderLists=gt,M.shadowMap=Rt,M.state=St,M.info=Bt}ee();const Pt=new Em(M,D);this.xr=Pt,this.getContext=function(){return D},this.getContextAttributes=function(){return D.getContextAttributes()},this.forceContextLoss=function(){const S=_t.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=_t.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(S){S!==void 0&&(J=S,this.setSize(X,Z,!1))},this.getSize=function(S){return S.set(X,Z)},this.setSize=function(S,P,F=!0){if(Pt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=S,Z=P,e.width=Math.floor(S*J),e.height=Math.floor(P*J),F===!0&&(e.style.width=S+"px",e.style.height=P+"px"),this.setViewport(0,0,S,P)},this.getDrawingBufferSize=function(S){return S.set(X*J,Z*J).floor()},this.setDrawingBufferSize=function(S,P,F){X=S,Z=P,J=F,e.width=Math.floor(S*F),e.height=Math.floor(P*F),this.setViewport(0,0,S,P)},this.getCurrentViewport=function(S){return S.copy(x)},this.getViewport=function(S){return S.copy(Q)},this.setViewport=function(S,P,F,U){S.isVector4?Q.set(S.x,S.y,S.z,S.w):Q.set(S,P,F,U),St.viewport(x.copy(Q).multiplyScalar(J).round())},this.getScissor=function(S){return S.copy(pt)},this.setScissor=function(S,P,F,U){S.isVector4?pt.set(S.x,S.y,S.z,S.w):pt.set(S,P,F,U),St.scissor(N.copy(pt).multiplyScalar(J).round())},this.getScissorTest=function(){return It},this.setScissorTest=function(S){St.setScissorTest(It=S)},this.setOpaqueSort=function(S){H=S},this.setTransparentSort=function(S){tt=S},this.getClearColor=function(S){return S.copy(nt.getClearColor())},this.setClearColor=function(){nt.setClearColor.apply(nt,arguments)},this.getClearAlpha=function(){return nt.getClearAlpha()},this.setClearAlpha=function(){nt.setClearAlpha.apply(nt,arguments)},this.clear=function(S=!0,P=!0,F=!0){let U=0;if(S){let I=!1;if(A!==null){const at=A.texture.format;I=at===ml||at===pl||at===fl}if(I){const at=A.texture.type,dt=at===gn||at===li||at===cl||at===Ci||at===ul||at===dl,ft=nt.getClearColor(),xt=nt.getClearAlpha(),Et=ft.r,bt=ft.g,Dt=ft.b;dt?(m[0]=Et,m[1]=bt,m[2]=Dt,m[3]=xt,D.clearBufferuiv(D.COLOR,0,m)):(g[0]=Et,g[1]=bt,g[2]=Dt,g[3]=xt,D.clearBufferiv(D.COLOR,0,g))}else U|=D.COLOR_BUFFER_BIT}P&&(U|=D.DEPTH_BUFFER_BIT),F&&(U|=D.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),D.clear(U)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",R,!1),e.removeEventListener("webglcontextrestored",j,!1),e.removeEventListener("webglcontextcreationerror",W,!1),gt.dispose(),lt.dispose(),Lt.dispose(),Qt.dispose(),y.dispose(),Y.dispose(),Ct.dispose(),Ft.dispose(),K.dispose(),Pt.dispose(),Pt.removeEventListener("sessionstart",Gt),Pt.removeEventListener("sessionend",Oe),fe.stop()};function R(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function j(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const S=Bt.autoReset,P=Rt.enabled,F=Rt.autoUpdate,U=Rt.needsUpdate,I=Rt.type;ee(),Bt.autoReset=S,Rt.enabled=P,Rt.autoUpdate=F,Rt.needsUpdate=U,Rt.type=I}function W(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function st(S){const P=S.target;P.removeEventListener("dispose",st),ct(P)}function ct(S){Ht(S),Lt.remove(S)}function Ht(S){const P=Lt.get(S).programs;P!==void 0&&(P.forEach(function(F){K.releaseProgram(F)}),S.isShaderMaterial&&K.releaseShaderCache(S))}this.renderBufferDirect=function(S,P,F,U,I,at){P===null&&(P=Nt);const dt=I.isMesh&&I.matrixWorld.determinant()<0,ft=oc(S,P,F,U,I);St.setMaterial(U,dt);let xt=F.index,Et=1;if(U.wireframe===!0){if(xt=z.getWireframeAttribute(F),xt===void 0)return;Et=2}const bt=F.drawRange,Dt=F.attributes.position;let ne=bt.start*Et,ce=(bt.start+bt.count)*Et;at!==null&&(ne=Math.max(ne,at.start*Et),ce=Math.min(ce,(at.start+at.count)*Et)),xt!==null?(ne=Math.max(ne,0),ce=Math.min(ce,xt.count)):Dt!=null&&(ne=Math.max(ne,0),ce=Math.min(ce,Dt.count));const Me=ce-ne;if(Me<0||Me===1/0)return;Ct.setup(I,U,ft,F,xt);let We,Vt=kt;if(xt!==null&&(We=v.get(xt),Vt=vt,Vt.setIndex(We)),I.isMesh)U.wireframe===!0?(St.setLineWidth(U.wireframeLinewidth*Ot()),Vt.setMode(D.LINES)):Vt.setMode(D.TRIANGLES);else if(I.isLine){let yt=U.linewidth;yt===void 0&&(yt=1),St.setLineWidth(yt*Ot()),I.isLineSegments?Vt.setMode(D.LINES):I.isLineLoop?Vt.setMode(D.LINE_LOOP):Vt.setMode(D.LINE_STRIP)}else I.isPoints?Vt.setMode(D.POINTS):I.isSprite&&Vt.setMode(D.TRIANGLES);if(I.isBatchedMesh)I._multiDrawInstances!==null?Vt.renderMultiDrawInstances(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount,I._multiDrawInstances):Vt.renderMultiDraw(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount);else if(I.isInstancedMesh)Vt.renderInstances(ne,Me,I.count);else if(F.isInstancedBufferGeometry){const yt=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,mi=Math.min(F.instanceCount,yt);Vt.renderInstances(ne,Me,mi)}else Vt.render(ne,Me)};function jt(S,P,F){S.transparent===!0&&S.side===Je&&S.forceSinglePass===!1?(S.side=_e,S.needsUpdate=!0,Fi(S,P,F),S.side=mn,S.needsUpdate=!0,Fi(S,P,F),S.side=Je):Fi(S,P,F)}this.compile=function(S,P,F=null){F===null&&(F=S),f=lt.get(F),f.init(P),T.push(f),F.traverseVisible(function(I){I.isLight&&I.layers.test(P.layers)&&(f.pushLight(I),I.castShadow&&f.pushShadow(I))}),S!==F&&S.traverseVisible(function(I){I.isLight&&I.layers.test(P.layers)&&(f.pushLight(I),I.castShadow&&f.pushShadow(I))}),f.setupLights(M._useLegacyLights);const U=new Set;return S.traverse(function(I){const at=I.material;if(at)if(Array.isArray(at))for(let dt=0;dt{function at(){if(U.forEach(function(dt){Lt.get(dt).currentProgram.isReady()&&U.delete(dt)}),U.size===0){I(S);return}setTimeout(at,10)}_t.get("KHR_parallel_shader_compile")!==null?at():setTimeout(at,10)})};let te=null;function le(S){te&&te(S)}function Gt(){fe.stop()}function Oe(){fe.start()}const fe=new Cl;fe.setAnimationLoop(le),typeof self<"u"&&fe.setContext(self),this.setAnimationLoop=function(S){te=S,Pt.setAnimationLoop(S),S===null?fe.stop():fe.start()},Pt.addEventListener("sessionstart",Gt),Pt.addEventListener("sessionend",Oe),this.render=function(S,P){if(P!==void 0&&P.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),P.parent===null&&P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),Pt.enabled===!0&&Pt.isPresenting===!0&&(Pt.cameraAutoUpdate===!0&&Pt.updateCamera(P),P=Pt.getCamera()),S.isScene===!0&&S.onBeforeRender(M,S,P,A),f=lt.get(S,T.length),f.init(P),T.push(f),ut.multiplyMatrices(P.projectionMatrix,P.matrixWorldInverse),Xt.setFromProjectionMatrix(ut),et=this.localClippingEnabled,V=ot.init(this.clippingPlanes,et),_=gt.get(S,d.length),_.init(),d.push(_),ea(S,P,0,M.sortObjects),_.finish(),M.sortObjects===!0&&_.sort(H,tt);const F=Pt.enabled===!1||Pt.isPresenting===!1||Pt.hasDepthSensing()===!1;F&&nt.addToRenderList(_,S),this.info.render.frame++,V===!0&&ot.beginShadows();const U=f.state.shadowsArray;Rt.render(U,S,P),V===!0&&ot.endShadows(),this.info.autoReset===!0&&this.info.reset();const I=_.opaque,at=_.transmissive;if(f.setupLights(M._useLegacyLights),P.isArrayCamera){const dt=P.cameras;if(at.length>0)for(let ft=0,xt=dt.length;ft0&&ia(I,at,S,P),F&&nt.render(S),na(_,S,P);A!==null&&(zt.updateMultisampleRenderTarget(A),zt.updateRenderTargetMipmap(A)),S.isScene===!0&&S.onAfterRender(M,S,P),Ct.resetDefaultState(),k=-1,E=null,T.pop(),T.length>0?(f=T[T.length-1],V===!0&&ot.setGlobalState(M.clippingPlanes,f.state.camera)):f=null,d.pop(),d.length>0?_=d[d.length-1]:_=null};function ea(S,P,F,U){if(S.visible===!1)return;if(S.layers.test(P.layers)){if(S.isGroup)F=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(P);else if(S.isLight)f.pushLight(S),S.castShadow&&f.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||Xt.intersectsSprite(S)){U&&rt.setFromMatrixPosition(S.matrixWorld).applyMatrix4(ut);const dt=Y.update(S),ft=S.material;ft.visible&&_.push(S,dt,ft,F,rt.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||Xt.intersectsObject(S))){const dt=Y.update(S),ft=S.material;if(U&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),rt.copy(S.boundingSphere.center)):(dt.boundingSphere===null&&dt.computeBoundingSphere(),rt.copy(dt.boundingSphere.center)),rt.applyMatrix4(S.matrixWorld).applyMatrix4(ut)),Array.isArray(ft)){const xt=dt.groups;for(let Et=0,bt=xt.length;Et0&&Oi(I,P,F),at.length>0&&Oi(at,P,F),dt.length>0&&Oi(dt,P,F),St.buffers.depth.setTest(!0),St.buffers.depth.setMask(!0),St.buffers.color.setMask(!0),St.setPolygonOffset(!1)}function ia(S,P,F,U){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;f.state.transmissionRenderTarget[U.id]===void 0&&(f.state.transmissionRenderTarget[U.id]=new In(1,1,{generateMipmaps:!0,type:_t.has("EXT_color_buffer_half_float")||_t.has("EXT_color_buffer_float")?br:gn,minFilter:Ln,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1}));const at=f.state.transmissionRenderTarget[U.id],dt=U.viewport||x;at.setSize(dt.z,dt.w);const ft=M.getRenderTarget();M.setRenderTarget(at),M.getClearColor(C),G=M.getClearAlpha(),G<1&&M.setClearColor(16777215,.5),M.clear();const xt=M.toneMapping;M.toneMapping=pn;const Et=U.viewport;if(U.viewport!==void 0&&(U.viewport=void 0),f.setupLightsView(U),V===!0&&ot.setGlobalState(M.clippingPlanes,U),Oi(S,F,U),zt.updateMultisampleRenderTarget(at),zt.updateRenderTargetMipmap(at),_t.has("WEBGL_multisampled_render_to_texture")===!1){let bt=!1;for(let Dt=0,ne=P.length;Dt0),Dt=!!F.morphAttributes.position,ne=!!F.morphAttributes.normal,ce=!!F.morphAttributes.color;let Me=pn;U.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(Me=M.toneMapping);const We=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,Vt=We!==void 0?We.length:0,yt=Lt.get(U),mi=f.state.lights;if(V===!0&&(et===!0||S!==E)){const be=S===E&&U.id===k;ot.setState(U,S,be)}let $t=!1;U.version===yt.__version?(yt.needsLights&&yt.lightsStateVersion!==mi.state.version||yt.outputColorSpace!==ft||I.isBatchedMesh&&yt.batching===!1||!I.isBatchedMesh&&yt.batching===!0||I.isInstancedMesh&&yt.instancing===!1||!I.isInstancedMesh&&yt.instancing===!0||I.isSkinnedMesh&&yt.skinning===!1||!I.isSkinnedMesh&&yt.skinning===!0||I.isInstancedMesh&&yt.instancingColor===!0&&I.instanceColor===null||I.isInstancedMesh&&yt.instancingColor===!1&&I.instanceColor!==null||I.isInstancedMesh&&yt.instancingMorph===!0&&I.morphTexture===null||I.isInstancedMesh&&yt.instancingMorph===!1&&I.morphTexture!==null||yt.envMap!==xt||U.fog===!0&&yt.fog!==at||yt.numClippingPlanes!==void 0&&(yt.numClippingPlanes!==ot.numPlanes||yt.numIntersection!==ot.numIntersection)||yt.vertexAlphas!==Et||yt.vertexTangents!==bt||yt.morphTargets!==Dt||yt.morphNormals!==ne||yt.morphColors!==ce||yt.toneMapping!==Me||yt.morphTargetsCount!==Vt)&&($t=!0):($t=!0,yt.__version=U.version);let xn=yt.currentProgram;$t===!0&&(xn=Fi(U,P,I));let oa=!1,gi=!1,Ir=!1;const he=xn.getUniforms(),tn=yt.uniforms;if(St.useProgram(xn.program)&&(oa=!0,gi=!0,Ir=!0),U.id!==k&&(k=U.id,gi=!0),oa||E!==S){he.setValue(D,"projectionMatrix",S.projectionMatrix),he.setValue(D,"viewMatrix",S.matrixWorldInverse);const be=he.map.cameraPosition;be!==void 0&&be.setValue(D,rt.setFromMatrixPosition(S.matrixWorld)),qt.logarithmicDepthBuffer&&he.setValue(D,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial)&&he.setValue(D,"isOrthographic",S.isOrthographicCamera===!0),E!==S&&(E=S,gi=!0,Ir=!0)}if(I.isSkinnedMesh){he.setOptional(D,I,"bindMatrix"),he.setOptional(D,I,"bindMatrixInverse");const be=I.skeleton;be&&(be.boneTexture===null&&be.computeBoneTexture(),he.setValue(D,"boneTexture",be.boneTexture,zt))}I.isBatchedMesh&&(he.setOptional(D,I,"batchingTexture"),he.setValue(D,"batchingTexture",I._matricesTexture,zt));const Nr=F.morphAttributes;if((Nr.position!==void 0||Nr.normal!==void 0||Nr.color!==void 0)&&mt.update(I,F,xn),(gi||yt.receiveShadow!==I.receiveShadow)&&(yt.receiveShadow=I.receiveShadow,he.setValue(D,"receiveShadow",I.receiveShadow)),U.isMeshGouraudMaterial&&U.envMap!==null&&(tn.envMap.value=xt,tn.flipEnvMap.value=xt.isCubeTexture&&xt.isRenderTargetTexture===!1?-1:1),U.isMeshStandardMaterial&&U.envMap===null&&P.environment!==null&&(tn.envMapIntensity.value=P.environmentIntensity),gi&&(he.setValue(D,"toneMappingExposure",M.toneMappingExposure),yt.needsLights&&lc(tn,Ir),at&&U.fog===!0&&$.refreshFogUniforms(tn,at),$.refreshMaterialUniforms(tn,U,J,Z,f.state.transmissionRenderTarget[S.id]),dr.upload(D,sa(yt),tn,zt)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(dr.upload(D,sa(yt),tn,zt),U.uniformsNeedUpdate=!1),U.isSpriteMaterial&&he.setValue(D,"center",I.center),he.setValue(D,"modelViewMatrix",I.modelViewMatrix),he.setValue(D,"normalMatrix",I.normalMatrix),he.setValue(D,"modelMatrix",I.matrixWorld),U.isShaderMaterial||U.isRawShaderMaterial){const be=U.uniformsGroups;for(let Or=0,hc=be.length;Or0&&zt.useMultisampledRTT(S)===!1?I=Lt.get(S).__webglMultisampledFramebuffer:Array.isArray(bt)?I=bt[F]:I=bt,x.copy(S.viewport),N.copy(S.scissor),q=S.scissorTest}else x.copy(Q).multiplyScalar(J).floor(),N.copy(pt).multiplyScalar(J).floor(),q=It;if(St.bindFramebuffer(D.FRAMEBUFFER,I)&&U&&St.drawBuffers(S,I),St.viewport(x),St.scissor(N),St.setScissorTest(q),at){const xt=Lt.get(S.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+P,xt.__webglTexture,F)}else if(dt){const xt=Lt.get(S.texture),Et=P||0;D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,xt.__webglTexture,F||0,Et)}k=-1},this.readRenderTargetPixels=function(S,P,F,U,I,at,dt){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ft=Lt.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&dt!==void 0&&(ft=ft[dt]),ft){St.bindFramebuffer(D.FRAMEBUFFER,ft);try{const xt=S.texture,Et=xt.format,bt=xt.type;if(!qt.textureFormatReadable(Et)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!qt.textureTypeReadable(bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}P>=0&&P<=S.width-U&&F>=0&&F<=S.height-I&&D.readPixels(P,F,U,I,ht.convert(Et),ht.convert(bt),at)}finally{const xt=A!==null?Lt.get(A).__webglFramebuffer:null;St.bindFramebuffer(D.FRAMEBUFFER,xt)}}},this.copyFramebufferToTexture=function(S,P,F=0){const U=Math.pow(2,-F),I=Math.floor(P.image.width*U),at=Math.floor(P.image.height*U);zt.setTexture2D(P,0),D.copyTexSubImage2D(D.TEXTURE_2D,F,0,0,S.x,S.y,I,at),St.unbindTexture()},this.copyTextureToTexture=function(S,P,F,U=0){const I=P.image.width,at=P.image.height,dt=ht.convert(F.format),ft=ht.convert(F.type);zt.setTexture2D(F,0),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,F.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,F.unpackAlignment),P.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,U,S.x,S.y,I,at,dt,ft,P.image.data):P.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,U,S.x,S.y,P.mipmaps[0].width,P.mipmaps[0].height,dt,P.mipmaps[0].data):D.texSubImage2D(D.TEXTURE_2D,U,S.x,S.y,dt,ft,P.image),U===0&&F.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D),St.unbindTexture()},this.copyTextureToTexture3D=function(S,P,F,U,I=0){const at=S.max.x-S.min.x,dt=S.max.y-S.min.y,ft=S.max.z-S.min.z,xt=ht.convert(U.format),Et=ht.convert(U.type);let bt;if(U.isData3DTexture)zt.setTexture3D(U,0),bt=D.TEXTURE_3D;else if(U.isDataArrayTexture||U.isCompressedArrayTexture)zt.setTexture2DArray(U,0),bt=D.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,U.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,U.unpackAlignment);const Dt=D.getParameter(D.UNPACK_ROW_LENGTH),ne=D.getParameter(D.UNPACK_IMAGE_HEIGHT),ce=D.getParameter(D.UNPACK_SKIP_PIXELS),Me=D.getParameter(D.UNPACK_SKIP_ROWS),We=D.getParameter(D.UNPACK_SKIP_IMAGES),Vt=F.isCompressedTexture?F.mipmaps[I]:F.image;D.pixelStorei(D.UNPACK_ROW_LENGTH,Vt.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,Vt.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,S.min.x),D.pixelStorei(D.UNPACK_SKIP_ROWS,S.min.y),D.pixelStorei(D.UNPACK_SKIP_IMAGES,S.min.z),F.isDataTexture||F.isData3DTexture?D.texSubImage3D(bt,I,P.x,P.y,P.z,at,dt,ft,xt,Et,Vt.data):U.isCompressedArrayTexture?D.compressedTexSubImage3D(bt,I,P.x,P.y,P.z,at,dt,ft,xt,Vt.data):D.texSubImage3D(bt,I,P.x,P.y,P.z,at,dt,ft,xt,Et,Vt),D.pixelStorei(D.UNPACK_ROW_LENGTH,Dt),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,ne),D.pixelStorei(D.UNPACK_SKIP_PIXELS,ce),D.pixelStorei(D.UNPACK_SKIP_ROWS,Me),D.pixelStorei(D.UNPACK_SKIP_IMAGES,We),I===0&&U.generateMipmaps&&D.generateMipmap(bt),St.unbindTexture()},this.initTexture=function(S){S.isCubeTexture?zt.setTextureCube(S,0):S.isData3DTexture?zt.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?zt.setTexture2DArray(S,0):zt.setTexture2D(S,0),St.unbindTexture()},this.resetState=function(){O=0,w=0,A=null,St.reset(),Ct.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qe}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===Xs?"display-p3":"srgb",e.unpackColorSpace=Wt.workingColorSpace===Ar?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}class wm extends xe{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ge,this.environmentIntensity=1,this.environmentRotation=new Ge,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Rm extends Ui{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Mt(16777215),this.specular=new Mt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Mt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gl,this.normalScale=new Ut(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ge,this.combine=Ws,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Ol extends xe{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Mt(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),e}}const gs=new Jt,Po=new L,Lo=new L;class Cm{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ut(512,512),this.map=null,this.mapPass=null,this.matrix=new Jt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new js,this._frameExtents=new Ut(1,1),this._viewportCount=1,this._viewports=[new Zt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Po.setFromMatrixPosition(t.matrixWorld),e.position.copy(Po),Lo.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Lo),e.updateMatrixWorld(),gs.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(gs),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(gs)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}const Do=new Jt,Ei=new L,_s=new L;class Pm extends Cm{constructor(){super(new Te(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ut(4,2),this._viewportCount=6,this._viewports=[new Zt(2,1,1,1),new Zt(0,1,1,1),new Zt(3,1,1,1),new Zt(1,1,1,1),new Zt(3,0,1,1),new Zt(1,0,1,1)],this._cubeDirections=[new L(1,0,0),new L(-1,0,0),new L(0,0,1),new L(0,0,-1),new L(0,1,0),new L(0,-1,0)],this._cubeUps=[new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,0,1),new L(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,r=this.matrix,s=t.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Ei.setFromMatrixPosition(t.matrixWorld),n.position.copy(Ei),_s.copy(n.position),_s.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(_s),n.updateMatrixWorld(),r.makeTranslation(-Ei.x,-Ei.y,-Ei.z),Do.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Do)}}class Mr extends Ol{constructor(t,e,n=0,r=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Pm}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Lm extends Ol{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}const Uo=new Jt;class Dm{constructor(t,e,n=0,r=1/0){this.ray=new Ml(t,e),this.near=n,this.far=r,this.camera=null,this.layers=new Ys,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return Uo.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Uo),this}intersectObject(t,e=!0,n=[]){return Us(t,this,n,e),n.sort(Io),n}intersectObjects(t,e=!0,n=[]){for(let r=0,s=t.length;r{e.setSize(window.innerWidth,window.innerHeight),t.aspect=window.innerWidth/window.innerHeight,t.updateProjectionMatrix()}),{scene:i,camera:t,renderer:e,lights:n}}const Fo=[new Mt(0,.7,.6),new Mt(1,1,1)],Om=[new Mt(.3,.3,.3),new Mt(.5,.5,0),new Mt(1,0,0)],Fm=new Mt(.8,.2,.8),Bo=new Mt(.2,1,.5),cn=1,ti=.3,hn=.2,Bm=2,zm=.1,km=.04;class Hm{constructor(t,e){this.nodes=new Map,this.transactions=new Map,this.addressCount=0,this.loadedBlocks=new Map,this.loadingBlocks=new Map,this.loadedBars=new Map,this.blocksToClear=[],this.scene=t,this.blocks=[],this.canDrag=!0,this.canHover=!0,this.displayFrom,this.displayTo,this.displayAmount,this.maxRange=0,this.nodeArray,this.toggleSort=0,this.toggleScale=0,this.isLoaded=!1,this.dataToLoad,this.tempBlocks=[],this.viewTransitioning=!1,this.camera=e,this.allTimeMax=.01,this.allTimeMaxNumTrans=1,this.allTimeMaxBar=.01,this.allTimeMaxNumTransBar=1,this.symmetrical=!1,this.dataType=0,this.scaling=0}addNode(t){this.nodes.set(t,new Vm(t))}addTransaction(t,e,n,r){let s=this.nodes.get(t),a=this.nodes.get(e);s.addTransactionIn(a,n,r),a.addTransactionOut(s,n,r);let o=[e,t].toString();if(this.transactions.get(o)||this.transactions.set(o,[]),this.transactions.get(o).push({amount:n,time:r}),this.symmetrical){a.addTransactionIn(s,n,r),s.addTransactionOut(a,n,r);let h=[t,e].toString();this.transactions.get(h)||this.transactions.set(h,[]),this.transactions.get(h).push({amount:n,time:r})}let l=0,c=0;this.transactions.get(o).forEach(h=>{l+=h.amount,c+=1}),l>this.allTimeMax&&(this.allTimeMax=l),c>this.allTimeMaxNumTrans&&(this.allTimeMaxNumTrans=c),s.totalTransactionsValueOut>this.allTimeMaxBar&&(this.allTimeMaxBar=s.totalTransactionsValueOut),a.totalTransactionsValueOut>this.allTimeMaxBar&&(this.allTimeMaxBar=a.totalTransactionsValueOut),s.numTransactionsOut>this.allTimeMaxNumTransBar&&(this.allTimeMaxNumTransBar=s.numTransactionsOut),a.numTransactionsOut>this.allTimeMaxNumTransBar&&(this.allTimeMaxNumTransBar=a.numTransactionsOut)}getTransactions(t,e){let n=this.transactions.get([t,e].toString());return n||[]}getTransactionsValue(t,e){let n=this.transactions.get([t,e].toString());if(n){let r=0;return n.forEach(s=>r+=s.amount),r}else return 0}getTotalNumTransactions(t,e){let n=this.transactions.get([t,e].toString());return n?n.length:0}compareNodeNumTransactions(t,e){return e.node.numTransactionsOut-t.node.numTransactionsOut}compareNodeTotals(t,e){return e.node.totalTransactionsValueOut-t.node.totalTransactionsValueOut}compareLargestTransaction(t,e){return Math.max(e.node.largestTransactionOut,e.node.largestTransactionIn)-Math.max(t.node.largestTransactionOut,t.node.largestTransactionIn)}loadData(t,e=-1,n=-1){this.dataToLoad=t,this.isLoaded=!1}loadDataHelper(t,e=-1,n=-1){this.allTimeMax=.01,this.allTimeMaxNumTrans=1,this.allTimeMaxBar=.01,this.allTimeMaxNumTransBar=1;let r=t.transactions;t.nodes.forEach(s=>this.addNode(s)),r.forEach(s=>{this.nodes.get(s.from)&&this.nodes.get(s.to)?this.addTransaction(s.from,s.to,Number(s.amount),s.timestamp):console.log("failed to add transaction")}),this.nodeArray=Array.from(this.nodes,([s,a])=>({id:s,node:a})),this.toggleSort==0?this.nodeArray.sort(this.compareNodeTotals):this.toggleSort==1?this.nodeArray.sort(this.compareNodeNumTransactions):this.toggleSort==2?this.nodeArray.sort(this.compareLargestTransaction):console.log("Sorting method unrecognized:",this.toggleSort),this.isLoaded=!0}loadBlocks(t,e,n,r=!1){if(!this.isLoaded)return;let s=t+n=this.allTimeMax,this.scene.add(g.getCube()),this.loadedBlocks.set([o,l].toString(),g),this.loadingBlocks.set([o,l].toString(),g),this.blocks.push(g)}}createTempBlocks(){}clearTempBlocks(){}unloadBlocks(t,e,n){if(!this.isLoaded)return;let r=t+n({key:p,value:m})).forEach(p=>{p.value.forEach(m=>{s+=m.amount,a+=1,o.push({to:p.key,amount:m.amount,time:m.time})})});let c=this.toggleSort==1?a:s,h=this.toggleSort==1?this.allTimeMaxNumTransBar:this.allTimeMaxBar,u=new zo(this.nodeArray[r].id,null,o,c,h);u.setPosition(r*(cn+ti),0*(cn+ti)),u.pos=[r,0],this.scene.add(u.getCube()),this.loadedBlocks.set([r,0].toString(),u),this.loadingBlocks.set([r,0].toString(),u),this.blocks.push(u)}}getBlocks(){return this.blocks}clearBlocks(){for(let t=0;t0){this.blocksToClear.forEach(t=>{this.scene.remove(t.getCube())});for(let t=0;t0&&(e.getCube().material.opacity-=.01)}}else this.clearing=!1,this.blocks=[],this.loadedBlocks=new Map}clearData(){for(let t=0;t({key:e,val:n})).forEach(e=>{let n=e.val,r=n.pos[1];n.getCube().material.opacity=3-.2*r})}update(){if(this.isLoaded){let t=Array.from(this.loadingBlocks,([e,n])=>({key:e,val:n}));t.length>0,t.forEach(e=>{let n=e.val,r=n.yScale+(n.finalScale-n.yScale)*.1;n.getCube().material.opacity<=1&&(n.getCube().material.opacity+=.05),n.yScale=1&&(n.getCube().material.opacity=1,this.loadingBlocks.delete(e.key.toString()))}),t.length==0&&this.clearTempBlocks()}else{let t=Array.from(this.loadedBlocks,([e,n])=>({key:e,val:n}));t.forEach(e=>{let n=e.val,r=hn+(n.yScale-hn)*.9;n.getCube().material.opacity>0&&(n.getCube().material.opacity-=km),n.yScale>hn&&(n.getCube().geometry.scale(1,1/n.yScale,1),r-.1{r+=s.amount}),r>this.largestTransactionOut&&(this.largestTransactionOut=r)}addTransactionIn(t,e,n=0){this.transactionsIn.get(t.id)||this.transactionsIn.set(t.id,[]),this.transactionsIn.get(t.id).push({amount:e,time:n}),this.numTransactionsIn+=1,this.totalTransactionsValueIn+=e;let r=0;this.transactionsIn.get(t.id).forEach(s=>{r+=s.amount}),r>this.largestTransactionIn&&(this.largestTransactionIn=r)}}class Fl{constructor(t,e){this.name=t,this.domParent=e,this.div=document.createElement("div"),this.div.id=t.replaceAll(" ","-")+"-div",this.div.classList.add("elementDiv"),this.id=t.replaceAll(" ","-"),e=="body"?this.domElement=document.body:this.domParent=document.getElementById(e),this.elements=[],this.endBreak=document.createElement("BR"),this.domParent.appendChild(this.div),this.labelBreak=document.createElement("BR"),this.label=document.createElement("label"),this.label.id=t.replaceAll(" ","-"),this.label.innerHTML=t,this.tooltip=""}createLineBreak(){return document.createElement("BR")}addElements(){this.elements.forEach(t=>{this.div.appendChild(t)})}removeDiv(){this.div.remove()}addDiv(){this.domParent.appendChild(this.div)}hideLabel(){this.label.remove(),this.labelBreak.remove()}showLabel(){this.div.prepend(this.labelBreak),this.div.prepend(this.label)}removeElement(t){this.elements[t].remove(),this.elements.splice(t,1)}addElement(t){this.elements.push(t),this.domParent.appendChild(t)}addClass(t){this.div.classList.add(t)}setToolTip(t,e){this.div.classList.contains("tooltip")||this.div.classList.add("tooltip");let n=document.createElement("span");n.classList.add("tooltiptext"),n.classList.add(e),n.innerHTML=t,this.tooltip=t,this.elements.push(n),this.div.appendChild(n)}}class Ai{constructor(t,e,n=!1){this.div=document.createElement("div"),this.div.id=t,n?this.div.classList.add("verticalContainer"):this.div.classList.add("horizontalContainer"),e=="body"?this.domElement=document.body:this.domParent=document.getElementById(e),this.domParent.appendChild(this.div)}addBlock(){let t=Array.prototype.slice.call(arguments);for(let e=0;e{this.showing?(this.hideOptions(),this.showing=!1):(this.showOptions(),this.showing=!0)}),this.button.button.innerHTML=n+": "+r[0][0],this.buttons=[],this.selected=this.options[0],this.text=n,this.name=t,this.container.addBlock(this.button)}showOptions(){this.button.div.remove();for(let t=0;t{this.selected!=this.options[t]&&(this.selected=this.options[t],this.options[t][1](),this.button.button.innerHTML=this.text+": "+this.options[t][0]),this.showing=!1,this.hideOptions()});e.div.classList.add("option"),this.options[t].length>=3&&(e.setToolTip(this.button.tooltip,"topTooltip"),e.setToolTip(this.options[t][2],"bottomTooltip")),this.buttons.push(e),this.container.addBlock(e)}this.container.addBlock(this.button),this.container.div.style.marginTop="-"+Number(this.button.div.offsetHeight*this.options.length*2)+"px"}hideOptions(){this.buttons.forEach(t=>{t.div.remove()}),this.container.div.style.marginTop="0px"}}const ko=15,Ho=.99,Gm=40,Wm=5,$e=10,cr=5,Vo=10,Go=1,Wo=.3,Ss=1e4,Xo=0,hr=["yellow",2,10,1],ur=["purple",80,20,2],qo=1;function ei(i,t,e){return i+(t-i)*e}class Xm{constructor(t,e,n){this.scene=t,this.camera=e,this.transactionsGrid=n,this.mouse=new Ut,this.lastMouse=new Ut,this.raycaster=new Dm,this.isMouseHold=!1,this.cameraAccel=new Ut,this.highlightedBlock=null,this.clickedBlock=null,this.selectedBlock=null,this.selectedDiv,this.hlLight,this.hoverLight,this.hoverLightExists=!1,this.canScroll=!0,this.loadedChunks=new Map,this.isDataLoaded=!1,this.cameraMode=0,this.transitioning=!1,this.resettingCamera=!1,this.sideBarTransactionsToLoad=[],this.transitionSpeed=.008,this.cameraGridView={position:new L(0,10,0),lookAtDelta:new L(0,-1,0)},this.cameraBarView={position:new L(0,2,8),lookAtDelta:new L(0,-1,-3)},this.storedCamera,this.cameraTVal=0,this.addressDiv1=document.createElement("div"),this.addressDiv1.id="addressDiv1",document.body.appendChild(this.addressDiv1),this.addressDiv2=document.createElement("div"),this.addressDiv2.id="addressDiv2",document.body.appendChild(this.addressDiv2),this.selects=[]}mouseUpdate(){(this.lastMouse.x!=this.mouse.x||this.lastMouseY!=this.mouse.y)&&this.updateHighlight(),this.lastMouse.x=this.mouse.x,this.lastMouse.y=this.mouse.y,this.mouse.x=event.clientX/window.innerWidth*2-1,this.mouse.y=-(event.clientY/window.innerHeight)*2+1}updateHighlight(){let t=this.transactionsGrid.getBlocks(),e=t.flat().map(r=>r.getCube());this.raycaster.setFromCamera(this.mouse,this.camera);let n=this.raycaster.intersectObjects(e,!1);if(n.length>0&&this.transactionsGrid.canHover){let r=n[0].object;t.flat().forEach(s=>{r==s.getCube()?(s.toggleHighlight(!0),this.highlightedBlock=s):s.toggleHighlight(!1)})}else this.highlightedBlock&&this.highlightedBlock.toggleHighlight(!1),this.highlightedBlock=null;if(this.highlightedBlock&&this.transactionsGrid.displayFrom){this.transactionsGrid.displayFrom.label.innerHTML="From: "+this.highlightedBlock.node1,this.transactionsGrid.displayTo.label.innerHTML="To: "+this.highlightedBlock.node2,this.transactionsGrid.toggleSort==1?this.transactionsGrid.displayAmount.label.innerHTML="Number of Transactions: "+this.highlightedBlock.getTransactionsValue():this.transactionsGrid.displayAmount.label.innerHTML="Transactions Sum: "+this.highlightedBlock.getTransactionsValue();let r=this.highlightedBlock.getCube().position.clone();r.y+=this.highlightedBlock.yScale/2,r.project(this.transactionsGrid.camera);let s=(r.x+1)*window.innerWidth/2,a=(1-r.y)*window.innerHeight/2;if(this.addressDiv1.style.left=s-Ss-Xo+"px",this.addressDiv1.style.top=a+"px",this.addressDiv2.style.left=s-Ss/2+"px",this.addressDiv2.style.top=a-Ss/2-Xo+"px",!this.hoverLightExists){let o=this.cameraMode==1?qo:0;this.hoverLight=new Mr(hr[0],hr[1],hr[2],hr[3]),this.hoverLight.position.x=this.highlightedBlock.getCube().position.x,this.hoverLight.position.y=this.highlightedBlock.getCube().position.y+this.highlightedBlock.yScale/2+1,this.hoverLight.position.z=this.highlightedBlock.getCube().position.z+o,this.scene.add(this.hoverLight),this.hoverLightExists=!0}}else this.addressDiv1.style.left="-100000px",this.addressDiv1.style.top="-100000px",this.addressDiv2.style.left="-100000px",this.addressDiv2.style.top="-10000px",this.hoverLightExists&&(this.scene.remove(this.hoverLight),this.hoverLightExists=!1)}onMouseMove(t){if(this.mouseUpdate(),this.isMouseHold&&this.transactionsGrid.canDrag){let e=this.mouse.x-this.lastMouse.x,n=this.mouse.y-this.lastMouse.y;this.camera.position.x+=-e*ko,this.camera.position.z+=n*ko*(window.innerHeight/window.innerWidth),this.cameraAccel.x=e,this.cameraAccel.y=n,this.bindCamera()}}onMouseDown(t){this.mouseUpdate(),this.isMouseHold=!0}onMouseClick(t){this.mouseUpdate()}onMouseDblClick(t){if(this.mouseUpdate(),this.isMouseHold=!1,this.transactionsGrid.canDrag=!0,this.clickedBlock&&this.transactionsGrid.canHover&&this.highlightedBlock){this.selectedBlock&&this.selectedBlock.toggleSelect(!1),this.selectedBlock=this.clickedBlock;let e=document.getElementById("sideDiv");e.style.width="300px",e.style.padding="10px";let n=this.cameraMode==1?qo:0;this.hlLight=new Mr(ur[0],ur[1],ur[2],ur[3]),this.hlLight.position.x=this.selectedBlock.getCube().position.x,this.hlLight.position.y=this.selectedBlock.getCube().position.y+this.selectedBlock.yScale/2+1,this.hlLight.position.z=this.selectedBlock.getCube().position.z+n,this.scene.add(this.hlLight),this.selectedDiv&&this.selectedDiv.removeDiv(),this.selectedDiv=new Ai("transaction select","sideDiv",!0);let r=new we("transaction from","sideDiv","From: "+String(this.clickedBlock.node1).substring(0,20)+"...");if(this.clickedBlock.node2){let s=new we("transaction to","sideDiv","To: "+String(this.clickedBlock.node2).substring(0,20)+"...");this.selectedDiv.addBlock(r,s)}else this.selectedDiv.addBlock(r);if(this.clickedBlock.transactions.sort(function(s,a){return new Date(a.time)-new Date(s.time)}),this.clickedBlock.transactions.forEach(s=>{this.sideBarTransactionsToLoad.push(s)}),this.sideBarTransactionsToLoad.length==0){let s=new Ai("tCont","sideDiv",!0),a=new we("transaction","sideDiv","Amount: NA");s.addBlock(a),this.selectedDiv.addBlock(s)}this.selectedBlock.toggleSelect(!0)}}addTransactionsToSideBar(t){if(t.amount>0){let e=new Ai("tCont","sideDiv",!0),n;t.to&&(n=new we("transaction to inner","sideDiv","To: "+String(t.to)));let r=new we("transaction amount","sideDiv","Amount: "+String(t.amount)),s;if(this.transactionsGrid.dataType==0){let a=new Date(t.time),o=String(a.getHours());o.length==1&&(o="0"+o);let l=String(a.getMinutes());l.length==1&&(l="0"+l);let c=String(a.getSeconds());c.length==1&&(c="0"+c);let h=String(a.getFullYear())+"-"+String(a.getMonth())+"-"+String(a.getDay())+" "+o+":"+l+":"+c;h=="NaN-NaN-NaN NaN:NaN:NaN"&&(h="N/A"),s=new we("transaction time","sideDiv","Time: "+h)}else{let a=t.time;s=new we("transaction time","sideDiv","Time: "+a)}n?e.addBlock(n,r,s):e.addBlock(r,s),this.selectedDiv.addBlock(e)}}onWheelEvent(t){if(!this.canScroll)return;t.deltaX;let e=t.deltaY;e>0&&this.camera.position.yWm&&this.cameraMode==0&&(this.camera.position.y-=.2,this.updateHighlight())}unselectBlock(){if(this.clickedBlock){this.clickedBlock.toggleSelect(!1);let t=document.getElementById("sideDiv");t.style.width="0px",t.style.padding="10px 0px 10px 0px",this.scene.remove(this.hlLight)}this.sideBarTransactionsToLoad=[]}onMouseUp(t){this.isMouseHold=!1,this.transactionsGrid.canDrag=!0,this.lastMouse.x==this.mouse.x&&this.lastMouse.y==this.mouse.y&&(this.unselectBlock(),this.clickedBlock=this.highlightedBlock)}update(){if(this.sideBarTransactionsToLoad.length>0){let t=this.sideBarTransactionsToLoad.shift();this.addTransactionsToSideBar(t)}if(this.transitioning){this.cameraTVal+=this.transitionSpeed,this.cameraTVal>=1&&(this.transitioning=!1,this.resettingCamera=!1,this.cameraTVal=1);let t;this.cameraMode==0?t=this.cameraGridView:t=this.cameraBarView;let e=ei(this.storedCamera.position.x,t.position.x,this.cameraTVal),n=ei(this.storedCamera.position.y,t.position.y,this.cameraTVal),r=ei(this.storedCamera.position.z,t.position.z,this.cameraTVal),s=ei(this.storedCamera.lookAtDelta.x,t.lookAtDelta.x,this.cameraTVal),a=ei(this.storedCamera.lookAtDelta.y,t.lookAtDelta.y,this.cameraTVal),o=ei(this.storedCamera.lookAtDelta.z,t.lookAtDelta.z,this.cameraTVal);this.resettingCamera?this.camera.position.set(e,n,r):this.camera.position.set(this.camera.position.x,n,r),this.camera.lookAt(this.camera.position.x+s,this.camera.position.y+a,this.camera.position.z+o),this.cameraTVal>=1&&(this.cameraTVal=0)}else this.isMouseHold||(this.cameraAccel.x*=Ho,this.cameraAccel.y*=Ho,Math.abs(this.cameraAccel.x)<.005&&(this.cameraAccel.x=0),Math.abs(this.cameraAccel.y)<.005&&(this.cameraAccel.y=0),this.camera.position.x+=-this.cameraAccel.x,this.camera.position.z+=this.cameraAccel.y,this.bindCamera()),this.cameraMode==1&&(this.camera.position.z=this.cameraBarView.position.z);if(this.isDataLoaded&&this.transactionsGrid.isLoaded){let t=(Go+Wo)*$e;for(let s=-cr;s<=cr;s++)for(let a=-cr;a<=cr;a++){let o=Math.floor(this.camera.position.x/t)+s,l=Math.floor(this.camera.position.z/t)+a;o>=0&&l>=0&&(this.loadedChunks.get([o,l].toString())||(this.loadedChunks.set([o,l].toString(),!0),this.cameraMode==0?this.transactionsGrid.loadBlocks(o*$e,l*$e,$e,!1):this.transactionsGrid.loadBars(o*$e,$e)))}let e=Math.floor(this.camera.position.x/t),n=Math.floor(this.camera.position.z/t);Array.from(this.loadedChunks).forEach(s=>{let a=s[0].split(",").map(o=>Number(o));this.loadedChunks.get([a[0],a[1]].toString())&&(Math.abs(a[0]-e)>Vo||Math.abs(a[1]-n)>Vo)&&(this.loadedChunks.set([a[0],a[1]].toString(),!1),this.transactionsGrid.unloadBlocks(a[0]*$e,a[1]*$e,$e))})}this.bindCamera()}clearChunks(){this.loadedChunks=new Map}setCamera(t){this.unselectBlock(),this.transitionSpeed=.008,this.transitioning=!0,t==0?(this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraBarView.lookAtDelta},this.addressDiv1.style.height="2px",this.addressDiv2.style.height="2px"):t==1&&(this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraGridView.lookAtDelta},this.addressDiv1.style.height="0px",this.addressDiv2.style.height="0px"),this.cameraMode=t}resetCamera(){this.transitioning=!0,this.resettingCamera=!0,this.transitionSpeed=.05,this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraGridView.lookAtDelta},this.cameraAccel=new Ut}bindCamera(){if(this.isDataLoaded){if(!this.transactionsGrid.nodeArray)return;let t=(Go+Wo)*this.transactionsGrid.nodeArray.length;this.camera.position.x>t&&(this.camera.position.x=t),this.camera.position.x<0&&(this.camera.position.x=0),this.camera.position.z>t&&(this.camera.position.z=t),this.camera.position.z<0&&(this.camera.position.z=0)}}}function Bl(i,t){return function(){return i.apply(t,arguments)}}const{toString:qm}=Object.prototype,{getPrototypeOf:$s}=Object,Cr=(i=>t=>{const e=qm.call(t);return i[e]||(i[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),Ne=i=>(i=i.toLowerCase(),t=>Cr(t)===i),Pr=i=>t=>typeof t===i,{isArray:fi}=Array,Ri=Pr("undefined");function Ym(i){return i!==null&&!Ri(i)&&i.constructor!==null&&!Ri(i.constructor)&&Ce(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const zl=Ne("ArrayBuffer");function jm(i){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(i):t=i&&i.buffer&&zl(i.buffer),t}const Km=Pr("string"),Ce=Pr("function"),kl=Pr("number"),Lr=i=>i!==null&&typeof i=="object",$m=i=>i===!0||i===!1,fr=i=>{if(Cr(i)!=="object")return!1;const t=$s(i);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},Zm=Ne("Date"),Jm=Ne("File"),Qm=Ne("Blob"),tg=Ne("FileList"),eg=i=>Lr(i)&&Ce(i.pipe),ng=i=>{let t;return i&&(typeof FormData=="function"&&i instanceof FormData||Ce(i.append)&&((t=Cr(i))==="formdata"||t==="object"&&Ce(i.toString)&&i.toString()==="[object FormData]"))},ig=Ne("URLSearchParams"),[rg,sg,ag,og]=["ReadableStream","Request","Response","Headers"].map(Ne),lg=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ii(i,t,{allOwnKeys:e=!1}={}){if(i===null||typeof i>"u")return;let n,r;if(typeof i!="object"&&(i=[i]),fi(i))for(n=0,r=i.length;n0;)if(r=e[n],t===r.toLowerCase())return r;return null}const Vl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gl=i=>!Ri(i)&&i!==Vl;function Ns(){const{caseless:i}=Gl(this)&&this||{},t={},e=(n,r)=>{const s=i&&Hl(t,r)||r;fr(t[s])&&fr(n)?t[s]=Ns(t[s],n):fr(n)?t[s]=Ns({},n):fi(n)?t[s]=n.slice():t[s]=n};for(let n=0,r=arguments.length;n(Ii(t,(r,s)=>{e&&Ce(r)?i[s]=Bl(r,e):i[s]=r},{allOwnKeys:n}),i),hg=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),ug=(i,t,e,n)=>{i.prototype=Object.create(t.prototype,n),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:t.prototype}),e&&Object.assign(i.prototype,e)},dg=(i,t,e,n)=>{let r,s,a;const o={};if(t=t||{},i==null)return t;do{for(r=Object.getOwnPropertyNames(i),s=r.length;s-- >0;)a=r[s],(!n||n(a,i,t))&&!o[a]&&(t[a]=i[a],o[a]=!0);i=e!==!1&&$s(i)}while(i&&(!e||e(i,t))&&i!==Object.prototype);return t},fg=(i,t,e)=>{i=String(i),(e===void 0||e>i.length)&&(e=i.length),e-=t.length;const n=i.indexOf(t,e);return n!==-1&&n===e},pg=i=>{if(!i)return null;if(fi(i))return i;let t=i.length;if(!kl(t))return null;const e=new Array(t);for(;t-- >0;)e[t]=i[t];return e},mg=(i=>t=>i&&t instanceof i)(typeof Uint8Array<"u"&&$s(Uint8Array)),gg=(i,t)=>{const n=(i&&i[Symbol.iterator]).call(i);let r;for(;(r=n.next())&&!r.done;){const s=r.value;t.call(i,s[0],s[1])}},_g=(i,t)=>{let e;const n=[];for(;(e=i.exec(t))!==null;)n.push(e);return n},vg=Ne("HTMLFormElement"),xg=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,n,r){return n.toUpperCase()+r}),Yo=(({hasOwnProperty:i})=>(t,e)=>i.call(t,e))(Object.prototype),Sg=Ne("RegExp"),Wl=(i,t)=>{const e=Object.getOwnPropertyDescriptors(i),n={};Ii(e,(r,s)=>{let a;(a=t(r,s,i))!==!1&&(n[s]=a||r)}),Object.defineProperties(i,n)},Mg=i=>{Wl(i,(t,e)=>{if(Ce(i)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;const n=i[e];if(Ce(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},Eg=(i,t)=>{const e={},n=r=>{r.forEach(s=>{e[s]=!0})};return fi(i)?n(i):n(String(i).split(t)),e},yg=()=>{},Tg=(i,t)=>i!=null&&Number.isFinite(i=+i)?i:t,Ms="abcdefghijklmnopqrstuvwxyz",jo="0123456789",Xl={DIGIT:jo,ALPHA:Ms,ALPHA_DIGIT:Ms+Ms.toUpperCase()+jo},bg=(i=16,t=Xl.ALPHA_DIGIT)=>{let e="";const{length:n}=t;for(;i--;)e+=t[Math.random()*n|0];return e};function Ag(i){return!!(i&&Ce(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}const wg=i=>{const t=new Array(10),e=(n,r)=>{if(Lr(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[r]=n;const s=fi(n)?[]:{};return Ii(n,(a,o)=>{const l=e(a,r+1);!Ri(l)&&(s[o]=l)}),t[r]=void 0,s}}return n};return e(i,0)},Rg=Ne("AsyncFunction"),Cg=i=>i&&(Lr(i)||Ce(i))&&Ce(i.then)&&Ce(i.catch),B={isArray:fi,isArrayBuffer:zl,isBuffer:Ym,isFormData:ng,isArrayBufferView:jm,isString:Km,isNumber:kl,isBoolean:$m,isObject:Lr,isPlainObject:fr,isReadableStream:rg,isRequest:sg,isResponse:ag,isHeaders:og,isUndefined:Ri,isDate:Zm,isFile:Jm,isBlob:Qm,isRegExp:Sg,isFunction:Ce,isStream:eg,isURLSearchParams:ig,isTypedArray:mg,isFileList:tg,forEach:Ii,merge:Ns,extend:cg,trim:lg,stripBOM:hg,inherits:ug,toFlatObject:dg,kindOf:Cr,kindOfTest:Ne,endsWith:fg,toArray:pg,forEachEntry:gg,matchAll:_g,isHTMLForm:vg,hasOwnProperty:Yo,hasOwnProp:Yo,reduceDescriptors:Wl,freezeMethods:Mg,toObjectSet:Eg,toCamelCase:xg,noop:yg,toFiniteNumber:Tg,findKey:Hl,global:Vl,isContextDefined:Gl,ALPHABET:Xl,generateString:bg,isSpecCompliantForm:Ag,toJSONObject:wg,isAsyncFn:Rg,isThenable:Cg};function Tt(i,t,e,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),r&&(this.response=r)}B.inherits(Tt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const ql=Tt.prototype,Yl={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{Yl[i]={value:i}});Object.defineProperties(Tt,Yl);Object.defineProperty(ql,"isAxiosError",{value:!0});Tt.from=(i,t,e,n,r,s)=>{const a=Object.create(ql);return B.toFlatObject(i,a,function(l){return l!==Error.prototype},o=>o!=="isAxiosError"),Tt.call(a,i.message,t,e,n,r),a.cause=i,a.name=i.name,s&&Object.assign(a,s),a};const Pg=null;function Os(i){return B.isPlainObject(i)||B.isArray(i)}function jl(i){return B.endsWith(i,"[]")?i.slice(0,-2):i}function Ko(i,t,e){return i?i.concat(t).map(function(r,s){return r=jl(r),!e&&s?"["+r+"]":r}).join(e?".":""):t}function Lg(i){return B.isArray(i)&&!i.some(Os)}const Dg=B.toFlatObject(B,{},null,function(t){return/^is[A-Z]/.test(t)});function Dr(i,t,e){if(!B.isObject(i))throw new TypeError("target must be an object");t=t||new FormData,e=B.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,f){return!B.isUndefined(f[_])});const n=e.metaTokens,r=e.visitor||h,s=e.dots,a=e.indexes,l=(e.Blob||typeof Blob<"u"&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(r))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(B.isDate(g))return g.toISOString();if(!l&&B.isBlob(g))throw new Tt("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(g)||B.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function h(g,_,f){let d=g;if(g&&!f&&typeof g=="object"){if(B.endsWith(_,"{}"))_=n?_:_.slice(0,-2),g=JSON.stringify(g);else if(B.isArray(g)&&Lg(g)||(B.isFileList(g)||B.endsWith(_,"[]"))&&(d=B.toArray(g)))return _=jl(_),d.forEach(function(M,b){!(B.isUndefined(M)||M===null)&&t.append(a===!0?Ko([_],b,s):a===null?_:_+"[]",c(M))}),!1}return Os(g)?!0:(t.append(Ko(f,_,s),c(g)),!1)}const u=[],p=Object.assign(Dg,{defaultVisitor:h,convertValue:c,isVisitable:Os});function m(g,_){if(!B.isUndefined(g)){if(u.indexOf(g)!==-1)throw Error("Circular reference detected in "+_.join("."));u.push(g),B.forEach(g,function(d,T){(!(B.isUndefined(d)||d===null)&&r.call(t,d,B.isString(T)?T.trim():T,_,p))===!0&&m(d,_?_.concat(T):[T])}),u.pop()}}if(!B.isObject(i))throw new TypeError("data must be an object");return m(i),t}function $o(i){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Zs(i,t){this._pairs=[],i&&Dr(i,this,t)}const Kl=Zs.prototype;Kl.append=function(t,e){this._pairs.push([t,e])};Kl.toString=function(t){const e=t?function(n){return t.call(this,n,$o)}:$o;return this._pairs.map(function(r){return e(r[0])+"="+e(r[1])},"").join("&")};function Ug(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $l(i,t,e){if(!t)return i;const n=e&&e.encode||Ug,r=e&&e.serialize;let s;if(r?s=r(t,e):s=B.isURLSearchParams(t)?t.toString():new Zs(t,e).toString(n),s){const a=i.indexOf("#");a!==-1&&(i=i.slice(0,a)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Zo{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){B.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Zl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ig=typeof URLSearchParams<"u"?URLSearchParams:Zs,Ng=typeof FormData<"u"?FormData:null,Og=typeof Blob<"u"?Blob:null,Fg={isBrowser:!0,classes:{URLSearchParams:Ig,FormData:Ng,Blob:Og},protocols:["http","https","file","blob","url","data"]},Js=typeof window<"u"&&typeof document<"u",Bg=(i=>Js&&["ReactNative","NativeScript","NS"].indexOf(i)<0)(typeof navigator<"u"&&navigator.product),zg=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",kg=Js&&window.location.href||"http://localhost",Hg=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Js,hasStandardBrowserEnv:Bg,hasStandardBrowserWebWorkerEnv:zg,origin:kg},Symbol.toStringTag,{value:"Module"})),Ie={...Hg,...Fg};function Vg(i,t){return Dr(i,new Ie.classes.URLSearchParams,Object.assign({visitor:function(e,n,r,s){return Ie.isNode&&B.isBuffer(e)?(this.append(n,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Gg(i){return B.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Wg(i){const t={},e=Object.keys(i);let n;const r=e.length;let s;for(n=0;n=e.length;return a=!a&&B.isArray(r)?r.length:a,l?(B.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!B.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],s)&&B.isArray(r[a])&&(r[a]=Wg(r[a])),!o)}if(B.isFormData(i)&&B.isFunction(i.entries)){const e={};return B.forEachEntry(i,(n,r)=>{t(Gg(n),r,e,0)}),e}return null}function Xg(i,t,e){if(B.isString(i))try{return(t||JSON.parse)(i),B.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(i)}const Ni={transitional:Zl,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,s=B.isObject(t);if(s&&B.isHTMLForm(t)&&(t=new FormData(t)),B.isFormData(t))return r?JSON.stringify(Jl(t)):t;if(B.isArrayBuffer(t)||B.isBuffer(t)||B.isStream(t)||B.isFile(t)||B.isBlob(t)||B.isReadableStream(t))return t;if(B.isArrayBufferView(t))return t.buffer;if(B.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Vg(t,this.formSerializer).toString();if((o=B.isFileList(t))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Dr(o?{"files[]":t}:t,l&&new l,this.formSerializer)}}return s||r?(e.setContentType("application/json",!1),Xg(t)):t}],transformResponse:[function(t){const e=this.transitional||Ni.transitional,n=e&&e.forcedJSONParsing,r=this.responseType==="json";if(B.isResponse(t)||B.isReadableStream(t))return t;if(t&&B.isString(t)&&(n&&!this.responseType||r)){const a=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(o){if(a)throw o.name==="SyntaxError"?Tt.from(o,Tt.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ie.classes.FormData,Blob:Ie.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};B.forEach(["delete","get","head","post","put","patch"],i=>{Ni.headers[i]={}});const qg=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Yg=i=>{const t={};let e,n,r;return i&&i.split(` +}`;class Mm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){const r=new ve,s=t.properties.get(r);s.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}render(t,e){if(this.texture!==null){if(this.mesh===null){const n=e.cameras[0].viewport,r=new _n({vertexShader:xm,fragmentShader:Sm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new He(new wr(20,20),r)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}}class Em extends hi{constructor(t,e){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,p=null,m=null,g=null;const _=new Mm,d=e.getContextAttributes();let f=null,T=null;const M=[],b=[],O=new Ut;let w=null;const A=new Te;A.layers.enable(1),A.viewport=new Zt;const k=new Te;k.layers.enable(2),k.viewport=new Zt;const E=[A,k],x=new _m;x.layers.enable(1),x.layers.enable(2);let N=null,q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(V){let et=M[V];return et===void 0&&(et=new ms,M[V]=et),et.getTargetRaySpace()},this.getControllerGrip=function(V){let et=M[V];return et===void 0&&(et=new ms,M[V]=et),et.getGripSpace()},this.getHand=function(V){let et=M[V];return et===void 0&&(et=new ms,M[V]=et),et.getHandSpace()};function C(V){const et=b.indexOf(V.inputSource);if(et===-1)return;const ut=M[et];ut!==void 0&&(ut.update(V.inputSource,V.frame,c||a),ut.dispatchEvent({type:V.type,data:V.inputSource}))}function G(){r.removeEventListener("select",C),r.removeEventListener("selectstart",C),r.removeEventListener("selectend",C),r.removeEventListener("squeeze",C),r.removeEventListener("squeezestart",C),r.removeEventListener("squeezeend",C),r.removeEventListener("end",G),r.removeEventListener("inputsourceschange",X);for(let V=0;V=0&&(b[rt]=null,M[rt].disconnect(ut))}for(let et=0;et=b.length){b.push(ut),rt=Ot;break}else if(b[Ot]===null){b[Ot]=ut,rt=Ot;break}if(rt===-1)break}const Nt=M[rt];Nt&&Nt.connect(ut)}}const Z=new L,J=new L;function H(V,et,ut){Z.setFromMatrixPosition(et.matrixWorld),J.setFromMatrixPosition(ut.matrixWorld);const rt=Z.distanceTo(J),Nt=et.projectionMatrix.elements,Ot=ut.projectionMatrix.elements,D=Nt[14]/(Nt[10]-1),Yt=Nt[14]/(Nt[10]+1),_t=(Nt[9]+1)/Nt[5],qt=(Nt[9]-1)/Nt[5],St=(Nt[8]-1)/Nt[0],Bt=(Ot[8]+1)/Ot[0],Lt=D*St,zt=D*Bt,Qt=rt/(-St+Bt),y=Qt*-St;et.matrixWorld.decompose(V.position,V.quaternion,V.scale),V.translateX(y),V.translateZ(Qt),V.matrixWorld.compose(V.position,V.quaternion,V.scale),V.matrixWorldInverse.copy(V.matrixWorld).invert();const v=D+Qt,z=Yt+Qt,Y=Lt-y,K=zt+(rt-y),$=_t*Yt/z*v,gt=qt*Yt/z*v;V.projectionMatrix.makePerspective(Y,K,$,gt,v,z),V.projectionMatrixInverse.copy(V.projectionMatrix).invert()}function tt(V,et){et===null?V.matrixWorld.copy(V.matrix):V.matrixWorld.multiplyMatrices(et.matrixWorld,V.matrix),V.matrixWorldInverse.copy(V.matrixWorld).invert()}this.updateCamera=function(V){if(r===null)return;_.texture!==null&&(V.near=_.depthNear,V.far=_.depthFar),x.near=k.near=A.near=V.near,x.far=k.far=A.far=V.far,(N!==x.near||q!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),N=x.near,q=x.far,A.near=N,A.far=q,k.near=N,k.far=q,A.updateProjectionMatrix(),k.updateProjectionMatrix(),V.updateProjectionMatrix());const et=V.parent,ut=x.cameras;tt(x,et);for(let rt=0;rt0&&(d.alphaTest.value=f.alphaTest);const T=t.get(f),M=T.envMap,b=T.envMapRotation;if(M&&(d.envMap.value=M,bn.copy(b),bn.x*=-1,bn.y*=-1,bn.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(bn.y*=-1,bn.z*=-1),d.envMapRotation.value.setFromMatrix4(ym.makeRotationFromEuler(bn)),d.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=f.reflectivity,d.ior.value=f.ior,d.refractionRatio.value=f.refractionRatio),f.lightMap){d.lightMap.value=f.lightMap;const O=i._useLegacyLights===!0?Math.PI:1;d.lightMapIntensity.value=f.lightMapIntensity*O,e(f.lightMap,d.lightMapTransform)}f.aoMap&&(d.aoMap.value=f.aoMap,d.aoMapIntensity.value=f.aoMapIntensity,e(f.aoMap,d.aoMapTransform))}function a(d,f){d.diffuse.value.copy(f.color),d.opacity.value=f.opacity,f.map&&(d.map.value=f.map,e(f.map,d.mapTransform))}function o(d,f){d.dashSize.value=f.dashSize,d.totalSize.value=f.dashSize+f.gapSize,d.scale.value=f.scale}function l(d,f,T,M){d.diffuse.value.copy(f.color),d.opacity.value=f.opacity,d.size.value=f.size*T,d.scale.value=M*.5,f.map&&(d.map.value=f.map,e(f.map,d.uvTransform)),f.alphaMap&&(d.alphaMap.value=f.alphaMap,e(f.alphaMap,d.alphaMapTransform)),f.alphaTest>0&&(d.alphaTest.value=f.alphaTest)}function c(d,f){d.diffuse.value.copy(f.color),d.opacity.value=f.opacity,d.rotation.value=f.rotation,f.map&&(d.map.value=f.map,e(f.map,d.mapTransform)),f.alphaMap&&(d.alphaMap.value=f.alphaMap,e(f.alphaMap,d.alphaMapTransform)),f.alphaTest>0&&(d.alphaTest.value=f.alphaTest)}function h(d,f){d.specular.value.copy(f.specular),d.shininess.value=Math.max(f.shininess,1e-4)}function u(d,f){f.gradientMap&&(d.gradientMap.value=f.gradientMap)}function p(d,f){d.metalness.value=f.metalness,f.metalnessMap&&(d.metalnessMap.value=f.metalnessMap,e(f.metalnessMap,d.metalnessMapTransform)),d.roughness.value=f.roughness,f.roughnessMap&&(d.roughnessMap.value=f.roughnessMap,e(f.roughnessMap,d.roughnessMapTransform)),f.envMap&&(d.envMapIntensity.value=f.envMapIntensity)}function m(d,f,T){d.ior.value=f.ior,f.sheen>0&&(d.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),d.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(d.sheenColorMap.value=f.sheenColorMap,e(f.sheenColorMap,d.sheenColorMapTransform)),f.sheenRoughnessMap&&(d.sheenRoughnessMap.value=f.sheenRoughnessMap,e(f.sheenRoughnessMap,d.sheenRoughnessMapTransform))),f.clearcoat>0&&(d.clearcoat.value=f.clearcoat,d.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(d.clearcoatMap.value=f.clearcoatMap,e(f.clearcoatMap,d.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,e(f.clearcoatRoughnessMap,d.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(d.clearcoatNormalMap.value=f.clearcoatNormalMap,e(f.clearcoatNormalMap,d.clearcoatNormalMapTransform),d.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===_e&&d.clearcoatNormalScale.value.negate())),f.dispersion>0&&(d.dispersion.value=f.dispersion),f.iridescence>0&&(d.iridescence.value=f.iridescence,d.iridescenceIOR.value=f.iridescenceIOR,d.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(d.iridescenceMap.value=f.iridescenceMap,e(f.iridescenceMap,d.iridescenceMapTransform)),f.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=f.iridescenceThicknessMap,e(f.iridescenceThicknessMap,d.iridescenceThicknessMapTransform))),f.transmission>0&&(d.transmission.value=f.transmission,d.transmissionSamplerMap.value=T.texture,d.transmissionSamplerSize.value.set(T.width,T.height),f.transmissionMap&&(d.transmissionMap.value=f.transmissionMap,e(f.transmissionMap,d.transmissionMapTransform)),d.thickness.value=f.thickness,f.thicknessMap&&(d.thicknessMap.value=f.thicknessMap,e(f.thicknessMap,d.thicknessMapTransform)),d.attenuationDistance.value=f.attenuationDistance,d.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(d.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(d.anisotropyMap.value=f.anisotropyMap,e(f.anisotropyMap,d.anisotropyMapTransform))),d.specularIntensity.value=f.specularIntensity,d.specularColor.value.copy(f.specularColor),f.specularColorMap&&(d.specularColorMap.value=f.specularColorMap,e(f.specularColorMap,d.specularColorMapTransform)),f.specularIntensityMap&&(d.specularIntensityMap.value=f.specularIntensityMap,e(f.specularIntensityMap,d.specularIntensityMapTransform))}function g(d,f){f.matcap&&(d.matcap.value=f.matcap)}function _(d,f){const T=t.get(f).light;d.referencePosition.value.setFromMatrixPosition(T.matrixWorld),d.nearDistance.value=T.shadow.camera.near,d.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function bm(i,t,e,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(T,M){const b=M.program;n.uniformBlockBinding(T,b)}function c(T,M){let b=r[T.id];b===void 0&&(g(T),b=h(T),r[T.id]=b,T.addEventListener("dispose",d));const O=M.program;n.updateUBOMapping(T,O);const w=t.render.frame;s[T.id]!==w&&(p(T),s[T.id]=w)}function h(T){const M=u();T.__bindingPointIndex=M;const b=i.createBuffer(),O=T.__size,w=T.usage;return i.bindBuffer(i.UNIFORM_BUFFER,b),i.bufferData(i.UNIFORM_BUFFER,O,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,M,b),b}function u(){for(let T=0;T0&&(b+=O-w),T.__size=b,T.__cache={},this}function _(T){const M={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(M.boundary=4,M.storage=4):T.isVector2?(M.boundary=8,M.storage=8):T.isVector3||T.isColor?(M.boundary=16,M.storage=12):T.isVector4?(M.boundary=16,M.storage=16):T.isMatrix3?(M.boundary=48,M.storage=48):T.isMatrix4?(M.boundary=64,M.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),M}function d(T){const M=T.target;M.removeEventListener("dispose",d);const b=a.indexOf(M.__bindingPointIndex);a.splice(b,1),i.deleteBuffer(r[M.id]),delete r[M.id],delete s[M.id]}function f(){for(const T in r)i.deleteBuffer(r[T]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class Am{constructor(t={}){const{canvas:e=gh(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=t;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const m=new Uint32Array(4),g=new Int32Array(4);let _=null,d=null;const f=[],T=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Fe,this._useLegacyLights=!1,this.toneMapping=pn,this.toneMappingExposure=1;const M=this;let b=!1,O=0,w=0,A=null,k=-1,E=null;const x=new Zt,N=new Zt;let q=null;const C=new Mt(0);let G=0,X=e.width,Z=e.height,J=1,H=null,tt=null;const Q=new Zt(0,0,X,Z),pt=new Zt(0,0,X,Z);let It=!1;const Xt=new js;let V=!1,et=!1;const ut=new Jt,rt=new L,Nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ot(){return A===null?J:1}let D=n;function Yt(S,P){return e.getContext(S,P)}try{const S={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Gs}`),e.addEventListener("webglcontextlost",R,!1),e.addEventListener("webglcontextrestored",j,!1),e.addEventListener("webglcontextcreationerror",W,!1),D===null){const P="webgl2";if(D=Yt(P,S),D===null)throw Yt(P)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}let _t,qt,St,Bt,Lt,zt,Qt,y,v,z,Y,K,$,gt,lt,ot,Rt,nt,mt,kt,vt,ht,Ct,Ft;function ee(){_t=new If(D),_t.init(),ht=new gm(D,_t),qt=new wf(D,_t,t,ht),St=new pm(D),Bt=new Ff(D),Lt=new tm,zt=new mm(D,_t,St,Lt,qt,ht,Bt),Qt=new Cf(M),y=new Uf(M),v=new Vh(D),Ct=new bf(D,v),z=new Nf(D,v,Bt,Ct),Y=new zf(D,z,v,Bt),mt=new Bf(D,qt,zt),ot=new Rf(Lt),K=new Qp(M,Qt,y,_t,qt,Ct,ot),$=new Tm(M,Lt),gt=new nm,lt=new lm(_t),nt=new Tf(M,Qt,y,St,Y,p,l),Rt=new fm(M,Y,qt),Ft=new bm(D,Bt,qt,St),kt=new Af(D,_t,Bt),vt=new Of(D,_t,Bt),Bt.programs=K.programs,M.capabilities=qt,M.extensions=_t,M.properties=Lt,M.renderLists=gt,M.shadowMap=Rt,M.state=St,M.info=Bt}ee();const Pt=new Em(M,D);this.xr=Pt,this.getContext=function(){return D},this.getContextAttributes=function(){return D.getContextAttributes()},this.forceContextLoss=function(){const S=_t.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){const S=_t.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(S){S!==void 0&&(J=S,this.setSize(X,Z,!1))},this.getSize=function(S){return S.set(X,Z)},this.setSize=function(S,P,F=!0){if(Pt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=S,Z=P,e.width=Math.floor(S*J),e.height=Math.floor(P*J),F===!0&&(e.style.width=S+"px",e.style.height=P+"px"),this.setViewport(0,0,S,P)},this.getDrawingBufferSize=function(S){return S.set(X*J,Z*J).floor()},this.setDrawingBufferSize=function(S,P,F){X=S,Z=P,J=F,e.width=Math.floor(S*F),e.height=Math.floor(P*F),this.setViewport(0,0,S,P)},this.getCurrentViewport=function(S){return S.copy(x)},this.getViewport=function(S){return S.copy(Q)},this.setViewport=function(S,P,F,U){S.isVector4?Q.set(S.x,S.y,S.z,S.w):Q.set(S,P,F,U),St.viewport(x.copy(Q).multiplyScalar(J).round())},this.getScissor=function(S){return S.copy(pt)},this.setScissor=function(S,P,F,U){S.isVector4?pt.set(S.x,S.y,S.z,S.w):pt.set(S,P,F,U),St.scissor(N.copy(pt).multiplyScalar(J).round())},this.getScissorTest=function(){return It},this.setScissorTest=function(S){St.setScissorTest(It=S)},this.setOpaqueSort=function(S){H=S},this.setTransparentSort=function(S){tt=S},this.getClearColor=function(S){return S.copy(nt.getClearColor())},this.setClearColor=function(){nt.setClearColor.apply(nt,arguments)},this.getClearAlpha=function(){return nt.getClearAlpha()},this.setClearAlpha=function(){nt.setClearAlpha.apply(nt,arguments)},this.clear=function(S=!0,P=!0,F=!0){let U=0;if(S){let I=!1;if(A!==null){const at=A.texture.format;I=at===ml||at===pl||at===fl}if(I){const at=A.texture.type,dt=at===gn||at===li||at===cl||at===Ci||at===ul||at===dl,ft=nt.getClearColor(),xt=nt.getClearAlpha(),Et=ft.r,bt=ft.g,Dt=ft.b;dt?(m[0]=Et,m[1]=bt,m[2]=Dt,m[3]=xt,D.clearBufferuiv(D.COLOR,0,m)):(g[0]=Et,g[1]=bt,g[2]=Dt,g[3]=xt,D.clearBufferiv(D.COLOR,0,g))}else U|=D.COLOR_BUFFER_BIT}P&&(U|=D.DEPTH_BUFFER_BIT),F&&(U|=D.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),D.clear(U)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",R,!1),e.removeEventListener("webglcontextrestored",j,!1),e.removeEventListener("webglcontextcreationerror",W,!1),gt.dispose(),lt.dispose(),Lt.dispose(),Qt.dispose(),y.dispose(),Y.dispose(),Ct.dispose(),Ft.dispose(),K.dispose(),Pt.dispose(),Pt.removeEventListener("sessionstart",Gt),Pt.removeEventListener("sessionend",Oe),fe.stop()};function R(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function j(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const S=Bt.autoReset,P=Rt.enabled,F=Rt.autoUpdate,U=Rt.needsUpdate,I=Rt.type;ee(),Bt.autoReset=S,Rt.enabled=P,Rt.autoUpdate=F,Rt.needsUpdate=U,Rt.type=I}function W(S){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",S.statusMessage)}function st(S){const P=S.target;P.removeEventListener("dispose",st),ct(P)}function ct(S){Ht(S),Lt.remove(S)}function Ht(S){const P=Lt.get(S).programs;P!==void 0&&(P.forEach(function(F){K.releaseProgram(F)}),S.isShaderMaterial&&K.releaseShaderCache(S))}this.renderBufferDirect=function(S,P,F,U,I,at){P===null&&(P=Nt);const dt=I.isMesh&&I.matrixWorld.determinant()<0,ft=oc(S,P,F,U,I);St.setMaterial(U,dt);let xt=F.index,Et=1;if(U.wireframe===!0){if(xt=z.getWireframeAttribute(F),xt===void 0)return;Et=2}const bt=F.drawRange,Dt=F.attributes.position;let ne=bt.start*Et,ce=(bt.start+bt.count)*Et;at!==null&&(ne=Math.max(ne,at.start*Et),ce=Math.min(ce,(at.start+at.count)*Et)),xt!==null?(ne=Math.max(ne,0),ce=Math.min(ce,xt.count)):Dt!=null&&(ne=Math.max(ne,0),ce=Math.min(ce,Dt.count));const Me=ce-ne;if(Me<0||Me===1/0)return;Ct.setup(I,U,ft,F,xt);let We,Vt=kt;if(xt!==null&&(We=v.get(xt),Vt=vt,Vt.setIndex(We)),I.isMesh)U.wireframe===!0?(St.setLineWidth(U.wireframeLinewidth*Ot()),Vt.setMode(D.LINES)):Vt.setMode(D.TRIANGLES);else if(I.isLine){let yt=U.linewidth;yt===void 0&&(yt=1),St.setLineWidth(yt*Ot()),I.isLineSegments?Vt.setMode(D.LINES):I.isLineLoop?Vt.setMode(D.LINE_LOOP):Vt.setMode(D.LINE_STRIP)}else I.isPoints?Vt.setMode(D.POINTS):I.isSprite&&Vt.setMode(D.TRIANGLES);if(I.isBatchedMesh)I._multiDrawInstances!==null?Vt.renderMultiDrawInstances(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount,I._multiDrawInstances):Vt.renderMultiDraw(I._multiDrawStarts,I._multiDrawCounts,I._multiDrawCount);else if(I.isInstancedMesh)Vt.renderInstances(ne,Me,I.count);else if(F.isInstancedBufferGeometry){const yt=F._maxInstanceCount!==void 0?F._maxInstanceCount:1/0,mi=Math.min(F.instanceCount,yt);Vt.renderInstances(ne,Me,mi)}else Vt.render(ne,Me)};function jt(S,P,F){S.transparent===!0&&S.side===Je&&S.forceSinglePass===!1?(S.side=_e,S.needsUpdate=!0,Fi(S,P,F),S.side=mn,S.needsUpdate=!0,Fi(S,P,F),S.side=Je):Fi(S,P,F)}this.compile=function(S,P,F=null){F===null&&(F=S),d=lt.get(F),d.init(P),T.push(d),F.traverseVisible(function(I){I.isLight&&I.layers.test(P.layers)&&(d.pushLight(I),I.castShadow&&d.pushShadow(I))}),S!==F&&S.traverseVisible(function(I){I.isLight&&I.layers.test(P.layers)&&(d.pushLight(I),I.castShadow&&d.pushShadow(I))}),d.setupLights(M._useLegacyLights);const U=new Set;return S.traverse(function(I){const at=I.material;if(at)if(Array.isArray(at))for(let dt=0;dt{function at(){if(U.forEach(function(dt){Lt.get(dt).currentProgram.isReady()&&U.delete(dt)}),U.size===0){I(S);return}setTimeout(at,10)}_t.get("KHR_parallel_shader_compile")!==null?at():setTimeout(at,10)})};let te=null;function le(S){te&&te(S)}function Gt(){fe.stop()}function Oe(){fe.start()}const fe=new Cl;fe.setAnimationLoop(le),typeof self<"u"&&fe.setContext(self),this.setAnimationLoop=function(S){te=S,Pt.setAnimationLoop(S),S===null?fe.stop():fe.start()},Pt.addEventListener("sessionstart",Gt),Pt.addEventListener("sessionend",Oe),this.render=function(S,P){if(P!==void 0&&P.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),P.parent===null&&P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),Pt.enabled===!0&&Pt.isPresenting===!0&&(Pt.cameraAutoUpdate===!0&&Pt.updateCamera(P),P=Pt.getCamera()),S.isScene===!0&&S.onBeforeRender(M,S,P,A),d=lt.get(S,T.length),d.init(P),T.push(d),ut.multiplyMatrices(P.projectionMatrix,P.matrixWorldInverse),Xt.setFromProjectionMatrix(ut),et=this.localClippingEnabled,V=ot.init(this.clippingPlanes,et),_=gt.get(S,f.length),_.init(),f.push(_),ea(S,P,0,M.sortObjects),_.finish(),M.sortObjects===!0&&_.sort(H,tt);const F=Pt.enabled===!1||Pt.isPresenting===!1||Pt.hasDepthSensing()===!1;F&&nt.addToRenderList(_,S),this.info.render.frame++,V===!0&&ot.beginShadows();const U=d.state.shadowsArray;Rt.render(U,S,P),V===!0&&ot.endShadows(),this.info.autoReset===!0&&this.info.reset();const I=_.opaque,at=_.transmissive;if(d.setupLights(M._useLegacyLights),P.isArrayCamera){const dt=P.cameras;if(at.length>0)for(let ft=0,xt=dt.length;ft0&&ia(I,at,S,P),F&&nt.render(S),na(_,S,P);A!==null&&(zt.updateMultisampleRenderTarget(A),zt.updateRenderTargetMipmap(A)),S.isScene===!0&&S.onAfterRender(M,S,P),Ct.resetDefaultState(),k=-1,E=null,T.pop(),T.length>0?(d=T[T.length-1],V===!0&&ot.setGlobalState(M.clippingPlanes,d.state.camera)):d=null,f.pop(),f.length>0?_=f[f.length-1]:_=null};function ea(S,P,F,U){if(S.visible===!1)return;if(S.layers.test(P.layers)){if(S.isGroup)F=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(P);else if(S.isLight)d.pushLight(S),S.castShadow&&d.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||Xt.intersectsSprite(S)){U&&rt.setFromMatrixPosition(S.matrixWorld).applyMatrix4(ut);const dt=Y.update(S),ft=S.material;ft.visible&&_.push(S,dt,ft,F,rt.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||Xt.intersectsObject(S))){const dt=Y.update(S),ft=S.material;if(U&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),rt.copy(S.boundingSphere.center)):(dt.boundingSphere===null&&dt.computeBoundingSphere(),rt.copy(dt.boundingSphere.center)),rt.applyMatrix4(S.matrixWorld).applyMatrix4(ut)),Array.isArray(ft)){const xt=dt.groups;for(let Et=0,bt=xt.length;Et0&&Oi(I,P,F),at.length>0&&Oi(at,P,F),dt.length>0&&Oi(dt,P,F),St.buffers.depth.setTest(!0),St.buffers.depth.setMask(!0),St.buffers.color.setMask(!0),St.setPolygonOffset(!1)}function ia(S,P,F,U){if((F.isScene===!0?F.overrideMaterial:null)!==null)return;d.state.transmissionRenderTarget[U.id]===void 0&&(d.state.transmissionRenderTarget[U.id]=new In(1,1,{generateMipmaps:!0,type:_t.has("EXT_color_buffer_half_float")||_t.has("EXT_color_buffer_float")?br:gn,minFilter:Ln,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1}));const at=d.state.transmissionRenderTarget[U.id],dt=U.viewport||x;at.setSize(dt.z,dt.w);const ft=M.getRenderTarget();M.setRenderTarget(at),M.getClearColor(C),G=M.getClearAlpha(),G<1&&M.setClearColor(16777215,.5),M.clear();const xt=M.toneMapping;M.toneMapping=pn;const Et=U.viewport;if(U.viewport!==void 0&&(U.viewport=void 0),d.setupLightsView(U),V===!0&&ot.setGlobalState(M.clippingPlanes,U),Oi(S,F,U),zt.updateMultisampleRenderTarget(at),zt.updateRenderTargetMipmap(at),_t.has("WEBGL_multisampled_render_to_texture")===!1){let bt=!1;for(let Dt=0,ne=P.length;Dt0),Dt=!!F.morphAttributes.position,ne=!!F.morphAttributes.normal,ce=!!F.morphAttributes.color;let Me=pn;U.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(Me=M.toneMapping);const We=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,Vt=We!==void 0?We.length:0,yt=Lt.get(U),mi=d.state.lights;if(V===!0&&(et===!0||S!==E)){const be=S===E&&U.id===k;ot.setState(U,S,be)}let $t=!1;U.version===yt.__version?(yt.needsLights&&yt.lightsStateVersion!==mi.state.version||yt.outputColorSpace!==ft||I.isBatchedMesh&&yt.batching===!1||!I.isBatchedMesh&&yt.batching===!0||I.isInstancedMesh&&yt.instancing===!1||!I.isInstancedMesh&&yt.instancing===!0||I.isSkinnedMesh&&yt.skinning===!1||!I.isSkinnedMesh&&yt.skinning===!0||I.isInstancedMesh&&yt.instancingColor===!0&&I.instanceColor===null||I.isInstancedMesh&&yt.instancingColor===!1&&I.instanceColor!==null||I.isInstancedMesh&&yt.instancingMorph===!0&&I.morphTexture===null||I.isInstancedMesh&&yt.instancingMorph===!1&&I.morphTexture!==null||yt.envMap!==xt||U.fog===!0&&yt.fog!==at||yt.numClippingPlanes!==void 0&&(yt.numClippingPlanes!==ot.numPlanes||yt.numIntersection!==ot.numIntersection)||yt.vertexAlphas!==Et||yt.vertexTangents!==bt||yt.morphTargets!==Dt||yt.morphNormals!==ne||yt.morphColors!==ce||yt.toneMapping!==Me||yt.morphTargetsCount!==Vt)&&($t=!0):($t=!0,yt.__version=U.version);let xn=yt.currentProgram;$t===!0&&(xn=Fi(U,P,I));let oa=!1,gi=!1,Ir=!1;const he=xn.getUniforms(),tn=yt.uniforms;if(St.useProgram(xn.program)&&(oa=!0,gi=!0,Ir=!0),U.id!==k&&(k=U.id,gi=!0),oa||E!==S){he.setValue(D,"projectionMatrix",S.projectionMatrix),he.setValue(D,"viewMatrix",S.matrixWorldInverse);const be=he.map.cameraPosition;be!==void 0&&be.setValue(D,rt.setFromMatrixPosition(S.matrixWorld)),qt.logarithmicDepthBuffer&&he.setValue(D,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial)&&he.setValue(D,"isOrthographic",S.isOrthographicCamera===!0),E!==S&&(E=S,gi=!0,Ir=!0)}if(I.isSkinnedMesh){he.setOptional(D,I,"bindMatrix"),he.setOptional(D,I,"bindMatrixInverse");const be=I.skeleton;be&&(be.boneTexture===null&&be.computeBoneTexture(),he.setValue(D,"boneTexture",be.boneTexture,zt))}I.isBatchedMesh&&(he.setOptional(D,I,"batchingTexture"),he.setValue(D,"batchingTexture",I._matricesTexture,zt));const Nr=F.morphAttributes;if((Nr.position!==void 0||Nr.normal!==void 0||Nr.color!==void 0)&&mt.update(I,F,xn),(gi||yt.receiveShadow!==I.receiveShadow)&&(yt.receiveShadow=I.receiveShadow,he.setValue(D,"receiveShadow",I.receiveShadow)),U.isMeshGouraudMaterial&&U.envMap!==null&&(tn.envMap.value=xt,tn.flipEnvMap.value=xt.isCubeTexture&&xt.isRenderTargetTexture===!1?-1:1),U.isMeshStandardMaterial&&U.envMap===null&&P.environment!==null&&(tn.envMapIntensity.value=P.environmentIntensity),gi&&(he.setValue(D,"toneMappingExposure",M.toneMappingExposure),yt.needsLights&&lc(tn,Ir),at&&U.fog===!0&&$.refreshFogUniforms(tn,at),$.refreshMaterialUniforms(tn,U,J,Z,d.state.transmissionRenderTarget[S.id]),dr.upload(D,sa(yt),tn,zt)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(dr.upload(D,sa(yt),tn,zt),U.uniformsNeedUpdate=!1),U.isSpriteMaterial&&he.setValue(D,"center",I.center),he.setValue(D,"modelViewMatrix",I.modelViewMatrix),he.setValue(D,"normalMatrix",I.normalMatrix),he.setValue(D,"modelMatrix",I.matrixWorld),U.isShaderMaterial||U.isRawShaderMaterial){const be=U.uniformsGroups;for(let Or=0,hc=be.length;Or0&&zt.useMultisampledRTT(S)===!1?I=Lt.get(S).__webglMultisampledFramebuffer:Array.isArray(bt)?I=bt[F]:I=bt,x.copy(S.viewport),N.copy(S.scissor),q=S.scissorTest}else x.copy(Q).multiplyScalar(J).floor(),N.copy(pt).multiplyScalar(J).floor(),q=It;if(St.bindFramebuffer(D.FRAMEBUFFER,I)&&U&&St.drawBuffers(S,I),St.viewport(x),St.scissor(N),St.setScissorTest(q),at){const xt=Lt.get(S.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+P,xt.__webglTexture,F)}else if(dt){const xt=Lt.get(S.texture),Et=P||0;D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,xt.__webglTexture,F||0,Et)}k=-1},this.readRenderTargetPixels=function(S,P,F,U,I,at,dt){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ft=Lt.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&dt!==void 0&&(ft=ft[dt]),ft){St.bindFramebuffer(D.FRAMEBUFFER,ft);try{const xt=S.texture,Et=xt.format,bt=xt.type;if(!qt.textureFormatReadable(Et)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!qt.textureTypeReadable(bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}P>=0&&P<=S.width-U&&F>=0&&F<=S.height-I&&D.readPixels(P,F,U,I,ht.convert(Et),ht.convert(bt),at)}finally{const xt=A!==null?Lt.get(A).__webglFramebuffer:null;St.bindFramebuffer(D.FRAMEBUFFER,xt)}}},this.copyFramebufferToTexture=function(S,P,F=0){const U=Math.pow(2,-F),I=Math.floor(P.image.width*U),at=Math.floor(P.image.height*U);zt.setTexture2D(P,0),D.copyTexSubImage2D(D.TEXTURE_2D,F,0,0,S.x,S.y,I,at),St.unbindTexture()},this.copyTextureToTexture=function(S,P,F,U=0){const I=P.image.width,at=P.image.height,dt=ht.convert(F.format),ft=ht.convert(F.type);zt.setTexture2D(F,0),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,F.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,F.unpackAlignment),P.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,U,S.x,S.y,I,at,dt,ft,P.image.data):P.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,U,S.x,S.y,P.mipmaps[0].width,P.mipmaps[0].height,dt,P.mipmaps[0].data):D.texSubImage2D(D.TEXTURE_2D,U,S.x,S.y,dt,ft,P.image),U===0&&F.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D),St.unbindTexture()},this.copyTextureToTexture3D=function(S,P,F,U,I=0){const at=S.max.x-S.min.x,dt=S.max.y-S.min.y,ft=S.max.z-S.min.z,xt=ht.convert(U.format),Et=ht.convert(U.type);let bt;if(U.isData3DTexture)zt.setTexture3D(U,0),bt=D.TEXTURE_3D;else if(U.isDataArrayTexture||U.isCompressedArrayTexture)zt.setTexture2DArray(U,0),bt=D.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,U.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,U.unpackAlignment);const Dt=D.getParameter(D.UNPACK_ROW_LENGTH),ne=D.getParameter(D.UNPACK_IMAGE_HEIGHT),ce=D.getParameter(D.UNPACK_SKIP_PIXELS),Me=D.getParameter(D.UNPACK_SKIP_ROWS),We=D.getParameter(D.UNPACK_SKIP_IMAGES),Vt=F.isCompressedTexture?F.mipmaps[I]:F.image;D.pixelStorei(D.UNPACK_ROW_LENGTH,Vt.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,Vt.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,S.min.x),D.pixelStorei(D.UNPACK_SKIP_ROWS,S.min.y),D.pixelStorei(D.UNPACK_SKIP_IMAGES,S.min.z),F.isDataTexture||F.isData3DTexture?D.texSubImage3D(bt,I,P.x,P.y,P.z,at,dt,ft,xt,Et,Vt.data):U.isCompressedArrayTexture?D.compressedTexSubImage3D(bt,I,P.x,P.y,P.z,at,dt,ft,xt,Vt.data):D.texSubImage3D(bt,I,P.x,P.y,P.z,at,dt,ft,xt,Et,Vt),D.pixelStorei(D.UNPACK_ROW_LENGTH,Dt),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,ne),D.pixelStorei(D.UNPACK_SKIP_PIXELS,ce),D.pixelStorei(D.UNPACK_SKIP_ROWS,Me),D.pixelStorei(D.UNPACK_SKIP_IMAGES,We),I===0&&U.generateMipmaps&&D.generateMipmap(bt),St.unbindTexture()},this.initTexture=function(S){S.isCubeTexture?zt.setTextureCube(S,0):S.isData3DTexture?zt.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?zt.setTexture2DArray(S,0):zt.setTexture2D(S,0),St.unbindTexture()},this.resetState=function(){O=0,w=0,A=null,St.reset(),Ct.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qe}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===Xs?"display-p3":"srgb",e.unpackColorSpace=Wt.workingColorSpace===Ar?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}class wm extends xe{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ge,this.environmentIntensity=1,this.environmentRotation=new Ge,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Rm extends Ui{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Mt(16777215),this.specular=new Mt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Mt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gl,this.normalScale=new Ut(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ge,this.combine=Ws,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Ol extends xe{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Mt(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),e}}const gs=new Jt,Po=new L,Lo=new L;class Cm{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ut(512,512),this.map=null,this.mapPass=null,this.matrix=new Jt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new js,this._frameExtents=new Ut(1,1),this._viewportCount=1,this._viewports=[new Zt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Po.setFromMatrixPosition(t.matrixWorld),e.position.copy(Po),Lo.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Lo),e.updateMatrixWorld(),gs.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(gs),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(gs)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}const Do=new Jt,Ei=new L,_s=new L;class Pm extends Cm{constructor(){super(new Te(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ut(4,2),this._viewportCount=6,this._viewports=[new Zt(2,1,1,1),new Zt(0,1,1,1),new Zt(3,1,1,1),new Zt(1,1,1,1),new Zt(3,0,1,1),new Zt(1,0,1,1)],this._cubeDirections=[new L(1,0,0),new L(-1,0,0),new L(0,0,1),new L(0,0,-1),new L(0,1,0),new L(0,-1,0)],this._cubeUps=[new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,0,1),new L(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,r=this.matrix,s=t.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Ei.setFromMatrixPosition(t.matrixWorld),n.position.copy(Ei),_s.copy(n.position),_s.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(_s),n.updateMatrixWorld(),r.makeTranslation(-Ei.x,-Ei.y,-Ei.z),Do.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Do)}}class Mr extends Ol{constructor(t,e,n=0,r=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Pm}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Lm extends Ol{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}const Uo=new Jt;class Dm{constructor(t,e,n=0,r=1/0){this.ray=new Ml(t,e),this.near=n,this.far=r,this.camera=null,this.layers=new Ys,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return Uo.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Uo),this}intersectObject(t,e=!0,n=[]){return Us(t,this,n,e),n.sort(Io),n}intersectObjects(t,e=!0,n=[]){for(let r=0,s=t.length;r{e.setSize(window.innerWidth,window.innerHeight),t.aspect=window.innerWidth/window.innerHeight,t.updateProjectionMatrix()}),{scene:i,camera:t,renderer:e,lights:n}}const Fo=[new Mt(0,.7,.6),new Mt(1,1,1)],Om=[new Mt(.3,.3,.3),new Mt(.5,.5,0),new Mt(1,0,0)],Fm=new Mt(.8,.2,.8),Bo=new Mt(.2,1,.5),cn=1,ti=.3,hn=.2,Bm=2,zm=.1,km=.04;class Hm{constructor(t,e){this.nodes=new Map,this.transactions=new Map,this.addressCount=0,this.loadedBlocks=new Map,this.loadingBlocks=new Map,this.loadedBars=new Map,this.blocksToClear=[],this.scene=t,this.blocks=[],this.canDrag=!0,this.canHover=!0,this.displayFrom,this.displayTo,this.displayAmount,this.maxRange=0,this.nodeArray,this.toggleSort=0,this.toggleScale=0,this.isLoaded=!1,this.dataToLoad,this.tempBlocks=[],this.viewTransitioning=!1,this.camera=e,this.allTimeMax=.01,this.allTimeMaxNumTrans=1,this.allTimeMaxBar=.01,this.allTimeMaxNumTransBar=1,this.symmetrical=!1,this.dataType=0,this.scaling=0}addNode(t){this.nodes.set(t,new Vm(t))}addTransaction(t,e,n,r){let s=this.nodes.get(t),a=this.nodes.get(e);s.addTransactionIn(a,n,r),a.addTransactionOut(s,n,r);let o=[e,t].toString();if(this.transactions.get(o)||this.transactions.set(o,[]),this.transactions.get(o).push({amount:n,time:r}),this.symmetrical){a.addTransactionIn(s,n,r),s.addTransactionOut(a,n,r);let h=[t,e].toString();this.transactions.get(h)||this.transactions.set(h,[]),this.transactions.get(h).push({amount:n,time:r})}let l=0,c=0;this.transactions.get(o).forEach(h=>{l+=h.amount,c+=1}),l>this.allTimeMax&&(this.allTimeMax=l),c>this.allTimeMaxNumTrans&&(this.allTimeMaxNumTrans=c),s.totalTransactionsValueOut>this.allTimeMaxBar&&(this.allTimeMaxBar=s.totalTransactionsValueOut),a.totalTransactionsValueOut>this.allTimeMaxBar&&(this.allTimeMaxBar=a.totalTransactionsValueOut),s.numTransactionsOut>this.allTimeMaxNumTransBar&&(this.allTimeMaxNumTransBar=s.numTransactionsOut),a.numTransactionsOut>this.allTimeMaxNumTransBar&&(this.allTimeMaxNumTransBar=a.numTransactionsOut)}getTransactions(t,e){let n=this.transactions.get([t,e].toString());return n||[]}getTransactionsValue(t,e){let n=this.transactions.get([t,e].toString());if(n){let r=0;return n.forEach(s=>r+=s.amount),r}else return 0}getTotalNumTransactions(t,e){let n=this.transactions.get([t,e].toString());return n?n.length:0}compareNodeNumTransactions(t,e){return e.node.numTransactionsOut-t.node.numTransactionsOut}compareNodeTotals(t,e){return e.node.totalTransactionsValueOut-t.node.totalTransactionsValueOut}compareLargestTransaction(t,e){return Math.max(e.node.largestTransactionOut,e.node.largestTransactionIn)-Math.max(t.node.largestTransactionOut,t.node.largestTransactionIn)}loadData(t,e=-1,n=-1){this.dataToLoad=t,this.isLoaded=!1}loadDataHelper(t,e=-1,n=-1){this.allTimeMax=.01,this.allTimeMaxNumTrans=1,this.allTimeMaxBar=.01,this.allTimeMaxNumTransBar=1;let r=t.transactions;t.nodes.forEach(s=>this.addNode(s)),r.forEach(s=>{this.nodes.get(s.from)&&this.nodes.get(s.to)?this.addTransaction(s.from,s.to,Number(s.amount),s.timestamp):console.log("failed to add transaction")}),this.nodeArray=Array.from(this.nodes,([s,a])=>({id:s,node:a})),this.toggleSort==0?this.nodeArray.sort(this.compareNodeTotals):this.toggleSort==1?this.nodeArray.sort(this.compareNodeNumTransactions):this.toggleSort==2?this.nodeArray.sort(this.compareLargestTransaction):console.log("Sorting method unrecognized:",this.toggleSort),this.isLoaded=!0}loadBlocks(t,e,n,r=!1){if(!this.isLoaded)return;let s=t+n=this.allTimeMax,this.scene.add(g.getCube()),this.loadedBlocks.set([o,l].toString(),g),this.loadingBlocks.set([o,l].toString(),g),this.blocks.push(g)}}createTempBlocks(){}clearTempBlocks(){}unloadBlocks(t,e,n){if(!this.isLoaded)return;let r=t+n({key:p,value:m})).forEach(p=>{p.value.forEach(m=>{s+=m.amount,a+=1,o.push({to:p.key,amount:m.amount,time:m.time})})});let c=this.toggleSort==1?a:s,h=this.toggleSort==1?this.allTimeMaxNumTransBar:this.allTimeMaxBar,u=new zo(this.nodeArray[r].id,null,o,c,h);u.setPosition(r*(cn+ti),0*(cn+ti)),u.pos=[r,0],this.scene.add(u.getCube()),this.loadedBlocks.set([r,0].toString(),u),this.loadingBlocks.set([r,0].toString(),u),this.blocks.push(u)}}getBlocks(){return this.blocks}clearBlocks(){for(let t=0;t0){this.blocksToClear.forEach(t=>{this.scene.remove(t.getCube())});for(let t=0;t0&&(e.getCube().material.opacity-=.01)}}else this.clearing=!1,this.blocks=[],this.loadedBlocks=new Map}clearData(){for(let t=0;t({key:e,val:n})).forEach(e=>{let n=e.val,r=n.pos[1];n.getCube().material.opacity=3-.2*r})}update(){if(this.isLoaded){let t=Array.from(this.loadingBlocks,([e,n])=>({key:e,val:n}));t.length>0,t.forEach(e=>{let n=e.val,r=n.yScale+(n.finalScale-n.yScale)*.1;n.getCube().material.opacity<=1&&(n.getCube().material.opacity+=.05),n.yScale=1&&(n.getCube().material.opacity=1,this.loadingBlocks.delete(e.key.toString()))}),t.length==0&&this.clearTempBlocks()}else{let t=Array.from(this.loadedBlocks,([e,n])=>({key:e,val:n}));t.forEach(e=>{let n=e.val,r=hn+(n.yScale-hn)*.9;n.getCube().material.opacity>0&&(n.getCube().material.opacity-=km),n.yScale>hn&&(n.getCube().geometry.scale(1,1/n.yScale,1),r-.1{r+=s.amount}),r>this.largestTransactionOut&&(this.largestTransactionOut=r)}addTransactionIn(t,e,n=0){this.transactionsIn.get(t.id)||this.transactionsIn.set(t.id,[]),this.transactionsIn.get(t.id).push({amount:e,time:n}),this.numTransactionsIn+=1,this.totalTransactionsValueIn+=e;let r=0;this.transactionsIn.get(t.id).forEach(s=>{r+=s.amount}),r>this.largestTransactionIn&&(this.largestTransactionIn=r)}}class Fl{constructor(t,e){this.name=t,this.domParent=e,this.div=document.createElement("div"),this.div.id=t.replaceAll(" ","-")+"-div",this.div.classList.add("elementDiv"),this.id=t.replaceAll(" ","-"),e=="body"?this.domElement=document.body:this.domParent=document.getElementById(e),this.elements=[],this.endBreak=document.createElement("BR"),this.domParent.appendChild(this.div),this.labelBreak=document.createElement("BR"),this.label=document.createElement("label"),this.label.id=t.replaceAll(" ","-"),this.label.innerHTML=t,this.tooltip=""}createLineBreak(){return document.createElement("BR")}addElements(){this.elements.forEach(t=>{this.div.appendChild(t)})}removeDiv(){this.div.remove()}addDiv(){this.domParent.appendChild(this.div)}hideLabel(){this.label.remove(),this.labelBreak.remove()}showLabel(){this.div.prepend(this.labelBreak),this.div.prepend(this.label)}removeElement(t){this.elements[t].remove(),this.elements.splice(t,1)}addElement(t){this.elements.push(t),this.domParent.appendChild(t)}addClass(t){this.div.classList.add(t)}setToolTip(t,e){this.div.classList.contains("tooltip")||this.div.classList.add("tooltip");let n=document.createElement("span");n.classList.add("tooltiptext"),n.classList.add(e),n.innerHTML=t,this.tooltip=t,this.elements.push(n),this.div.appendChild(n)}}class Ai{constructor(t,e,n=!1){this.div=document.createElement("div"),this.div.id=t,n?this.div.classList.add("verticalContainer"):this.div.classList.add("horizontalContainer"),e=="body"?this.domElement=document.body:this.domParent=document.getElementById(e),this.domParent.appendChild(this.div)}addBlock(){let t=Array.prototype.slice.call(arguments);for(let e=0;e{this.showing?(this.hideOptions(),this.showing=!1):(this.showOptions(),this.showing=!0)}),this.button.button.innerHTML=n+": "+r[0][0],this.buttons=[],this.selected=this.options[0],this.text=n,this.name=t,this.container.addBlock(this.button)}showOptions(){this.button.div.remove();for(let t=0;t{this.selected!=this.options[t]&&(this.selected=this.options[t],this.button.button.innerHTML=this.text+": "+this.options[t][0],this.options[t][1]()),this.showing=!1,this.hideOptions()});e.div.classList.add("option"),this.options[t].length>=3&&(e.setToolTip(this.button.tooltip,"topTooltip"),e.setToolTip(this.options[t][2],"bottomTooltip")),this.buttons.push(e),this.container.addBlock(e)}this.container.addBlock(this.button),this.container.div.style.marginTop="-"+Number(this.button.div.offsetHeight*this.options.length*2)+"px"}hideOptions(){this.buttons.forEach(t=>{t.div.remove()}),this.container.div.style.marginTop="0px"}}const ko=15,Ho=.99,Gm=40,Wm=5,$e=10,cr=5,Vo=10,Go=1,Wo=.3,Ss=1e4,Xo=0,hr=["yellow",2,10,1],ur=["purple",80,20,2],qo=1;function ei(i,t,e){return i+(t-i)*e}class Xm{constructor(t,e,n){this.scene=t,this.camera=e,this.transactionsGrid=n,this.mouse=new Ut,this.lastMouse=new Ut,this.raycaster=new Dm,this.isMouseHold=!1,this.cameraAccel=new Ut,this.highlightedBlock=null,this.clickedBlock=null,this.selectedBlock=null,this.selectedDiv,this.hlLight,this.hoverLight,this.hoverLightExists=!1,this.canScroll=!0,this.loadedChunks=new Map,this.isDataLoaded=!1,this.cameraMode=0,this.transitioning=!1,this.resettingCamera=!1,this.sideBarTransactionsToLoad=[],this.transitionSpeed=.008,this.cameraGridView={position:new L(0,10,0),lookAtDelta:new L(0,-1,0)},this.cameraBarView={position:new L(0,2,8),lookAtDelta:new L(0,-1,-3)},this.storedCamera,this.cameraTVal=0,this.addressDiv1=document.createElement("div"),this.addressDiv1.id="addressDiv1",document.body.appendChild(this.addressDiv1),this.addressDiv2=document.createElement("div"),this.addressDiv2.id="addressDiv2",document.body.appendChild(this.addressDiv2),this.selects=[]}mouseUpdate(){(this.lastMouse.x!=this.mouse.x||this.lastMouseY!=this.mouse.y)&&this.updateHighlight(),this.lastMouse.x=this.mouse.x,this.lastMouse.y=this.mouse.y,this.mouse.x=event.clientX/window.innerWidth*2-1,this.mouse.y=-(event.clientY/window.innerHeight)*2+1}updateHighlight(){let t=this.transactionsGrid.getBlocks(),e=t.flat().map(r=>r.getCube());this.raycaster.setFromCamera(this.mouse,this.camera);let n=this.raycaster.intersectObjects(e,!1);if(n.length>0&&this.transactionsGrid.canHover){let r=n[0].object;t.flat().forEach(s=>{r==s.getCube()?(s.toggleHighlight(!0),this.highlightedBlock=s):s.toggleHighlight(!1)})}else this.highlightedBlock&&this.highlightedBlock.toggleHighlight(!1),this.highlightedBlock=null;if(this.highlightedBlock&&this.transactionsGrid.displayFrom){this.transactionsGrid.displayFrom.label.innerHTML="From: "+this.highlightedBlock.node1,this.transactionsGrid.displayTo.label.innerHTML="To: "+this.highlightedBlock.node2,this.transactionsGrid.toggleSort==1?this.transactionsGrid.displayAmount.label.innerHTML="Number of Transactions: "+this.highlightedBlock.getTransactionsValue():this.transactionsGrid.displayAmount.label.innerHTML="Transactions Sum: "+this.highlightedBlock.getTransactionsValue();let r=this.highlightedBlock.getCube().position.clone();r.y+=this.highlightedBlock.yScale/2,r.project(this.transactionsGrid.camera);let s=(r.x+1)*window.innerWidth/2,a=(1-r.y)*window.innerHeight/2;if(this.addressDiv1.style.left=s-Ss-Xo+"px",this.addressDiv1.style.top=a+"px",this.addressDiv2.style.left=s-Ss/2+"px",this.addressDiv2.style.top=a-Ss/2-Xo+"px",!this.hoverLightExists){let o=this.cameraMode==1?qo:0;this.hoverLight=new Mr(hr[0],hr[1],hr[2],hr[3]),this.hoverLight.position.x=this.highlightedBlock.getCube().position.x,this.hoverLight.position.y=this.highlightedBlock.getCube().position.y+this.highlightedBlock.yScale/2+1,this.hoverLight.position.z=this.highlightedBlock.getCube().position.z+o,this.scene.add(this.hoverLight),this.hoverLightExists=!0}}else this.addressDiv1.style.left="-100000px",this.addressDiv1.style.top="-100000px",this.addressDiv2.style.left="-100000px",this.addressDiv2.style.top="-10000px",this.hoverLightExists&&(this.scene.remove(this.hoverLight),this.hoverLightExists=!1)}onMouseMove(t){if(this.mouseUpdate(),this.isMouseHold&&this.transactionsGrid.canDrag){let e=this.mouse.x-this.lastMouse.x,n=this.mouse.y-this.lastMouse.y;this.camera.position.x+=-e*ko,this.camera.position.z+=n*ko*(window.innerHeight/window.innerWidth),this.cameraAccel.x=e,this.cameraAccel.y=n,this.bindCamera()}}onMouseDown(t){this.mouseUpdate(),this.isMouseHold=!0}onMouseClick(t){this.mouseUpdate()}onMouseDblClick(t){if(this.mouseUpdate(),this.isMouseHold=!1,this.transactionsGrid.canDrag=!0,this.clickedBlock&&this.transactionsGrid.canHover&&this.highlightedBlock){this.selectedBlock&&this.selectedBlock.toggleSelect(!1),this.selectedBlock=this.clickedBlock;let e=document.getElementById("sideDiv");e.style.width="300px",e.style.padding="10px";let n=this.cameraMode==1?qo:0;this.hlLight=new Mr(ur[0],ur[1],ur[2],ur[3]),this.hlLight.position.x=this.selectedBlock.getCube().position.x,this.hlLight.position.y=this.selectedBlock.getCube().position.y+this.selectedBlock.yScale/2+1,this.hlLight.position.z=this.selectedBlock.getCube().position.z+n,this.scene.add(this.hlLight),this.selectedDiv&&this.selectedDiv.removeDiv(),this.selectedDiv=new Ai("transaction select","sideDiv",!0);let r=new we("transaction from","sideDiv","From: "+String(this.clickedBlock.node1).substring(0,20)+"...");if(this.clickedBlock.node2){let s=new we("transaction to","sideDiv","To: "+String(this.clickedBlock.node2).substring(0,20)+"...");this.selectedDiv.addBlock(r,s)}else this.selectedDiv.addBlock(r);if(this.clickedBlock.transactions.sort(function(s,a){return new Date(a.time)-new Date(s.time)}),this.clickedBlock.transactions.forEach(s=>{this.sideBarTransactionsToLoad.push(s)}),this.sideBarTransactionsToLoad.length==0){let s=new Ai("tCont","sideDiv",!0),a=new we("transaction","sideDiv","Amount: NA");s.addBlock(a),this.selectedDiv.addBlock(s)}this.selectedBlock.toggleSelect(!0)}}addTransactionsToSideBar(t){if(t.amount>0){let e=new Ai("tCont","sideDiv",!0),n;t.to&&(n=new we("transaction to inner","sideDiv","To: "+String(t.to)));let r=new we("transaction amount","sideDiv","Amount: "+String(t.amount)),s;if(this.transactionsGrid.dataType==0){let a=new Date(t.time),o=String(a.getHours());o.length==1&&(o="0"+o);let l=String(a.getMinutes());l.length==1&&(l="0"+l);let c=String(a.getSeconds());c.length==1&&(c="0"+c);let h=String(a.getFullYear())+"-"+String(a.getMonth())+"-"+String(a.getDay())+" "+o+":"+l+":"+c;h=="NaN-NaN-NaN NaN:NaN:NaN"&&(h="N/A"),s=new we("transaction time","sideDiv","Time: "+h)}else{let a=t.time;s=new we("transaction time","sideDiv","Time: "+a)}n?e.addBlock(n,r,s):e.addBlock(r,s),this.selectedDiv.addBlock(e)}}onWheelEvent(t){if(!this.canScroll)return;t.deltaX;let e=t.deltaY;e>0&&this.camera.position.yWm&&this.cameraMode==0&&(this.camera.position.y-=.2,this.updateHighlight())}unselectBlock(){if(this.clickedBlock){this.clickedBlock.toggleSelect(!1);let t=document.getElementById("sideDiv");t.style.width="0px",t.style.padding="10px 0px 10px 0px",this.scene.remove(this.hlLight)}this.sideBarTransactionsToLoad=[]}onMouseUp(t){this.isMouseHold=!1,this.transactionsGrid.canDrag=!0,this.lastMouse.x==this.mouse.x&&this.lastMouse.y==this.mouse.y&&(this.unselectBlock(),this.clickedBlock=this.highlightedBlock)}update(){if(this.sideBarTransactionsToLoad.length>0){let t=this.sideBarTransactionsToLoad.shift();this.addTransactionsToSideBar(t)}if(this.transitioning){this.cameraTVal+=this.transitionSpeed,this.cameraTVal>=1&&(this.transitioning=!1,this.resettingCamera=!1,this.cameraTVal=1);let t;this.cameraMode==0?t=this.cameraGridView:t=this.cameraBarView;let e=ei(this.storedCamera.position.x,t.position.x,this.cameraTVal),n=ei(this.storedCamera.position.y,t.position.y,this.cameraTVal),r=ei(this.storedCamera.position.z,t.position.z,this.cameraTVal),s=ei(this.storedCamera.lookAtDelta.x,t.lookAtDelta.x,this.cameraTVal),a=ei(this.storedCamera.lookAtDelta.y,t.lookAtDelta.y,this.cameraTVal),o=ei(this.storedCamera.lookAtDelta.z,t.lookAtDelta.z,this.cameraTVal);this.resettingCamera?this.camera.position.set(e,n,r):this.camera.position.set(this.camera.position.x,n,r),this.camera.lookAt(this.camera.position.x+s,this.camera.position.y+a,this.camera.position.z+o),this.cameraTVal>=1&&(this.cameraTVal=0)}else this.isMouseHold||(this.cameraAccel.x*=Ho,this.cameraAccel.y*=Ho,Math.abs(this.cameraAccel.x)<.005&&(this.cameraAccel.x=0),Math.abs(this.cameraAccel.y)<.005&&(this.cameraAccel.y=0),this.camera.position.x+=-this.cameraAccel.x,this.camera.position.z+=this.cameraAccel.y,this.bindCamera()),this.cameraMode==1&&(this.camera.position.z=this.cameraBarView.position.z);if(this.isDataLoaded&&this.transactionsGrid.isLoaded){let t=(Go+Wo)*$e;for(let s=-cr;s<=cr;s++)for(let a=-cr;a<=cr;a++){let o=Math.floor(this.camera.position.x/t)+s,l=Math.floor(this.camera.position.z/t)+a;o>=0&&l>=0&&(this.loadedChunks.get([o,l].toString())||(this.loadedChunks.set([o,l].toString(),!0),this.cameraMode==0?this.transactionsGrid.loadBlocks(o*$e,l*$e,$e,!1):this.transactionsGrid.loadBars(o*$e,$e)))}let e=Math.floor(this.camera.position.x/t),n=Math.floor(this.camera.position.z/t);Array.from(this.loadedChunks).forEach(s=>{let a=s[0].split(",").map(o=>Number(o));this.loadedChunks.get([a[0],a[1]].toString())&&(Math.abs(a[0]-e)>Vo||Math.abs(a[1]-n)>Vo)&&(this.loadedChunks.set([a[0],a[1]].toString(),!1),this.transactionsGrid.unloadBlocks(a[0]*$e,a[1]*$e,$e))})}this.bindCamera()}clearChunks(){this.loadedChunks=new Map}setCamera(t){this.unselectBlock(),this.transitionSpeed=.008,this.transitioning=!0,t==0?(this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraBarView.lookAtDelta},this.addressDiv1.style.height="2px",this.addressDiv2.style.height="2px"):t==1&&(this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraGridView.lookAtDelta},this.addressDiv1.style.height="0px",this.addressDiv2.style.height="0px"),this.cameraMode=t}resetCamera(){this.transitioning=!0,this.resettingCamera=!0,this.transitionSpeed=.05,this.storedCamera={position:this.camera.position.clone(),lookAtDelta:this.cameraGridView.lookAtDelta},this.cameraAccel=new Ut}bindCamera(){if(this.isDataLoaded){if(!this.transactionsGrid.nodeArray)return;let t=(Go+Wo)*this.transactionsGrid.nodeArray.length;this.camera.position.x>t&&(this.camera.position.x=t),this.camera.position.x<0&&(this.camera.position.x=0),this.camera.position.z>t&&(this.camera.position.z=t),this.camera.position.z<0&&(this.camera.position.z=0)}}}function Bl(i,t){return function(){return i.apply(t,arguments)}}const{toString:qm}=Object.prototype,{getPrototypeOf:$s}=Object,Cr=(i=>t=>{const e=qm.call(t);return i[e]||(i[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),Ne=i=>(i=i.toLowerCase(),t=>Cr(t)===i),Pr=i=>t=>typeof t===i,{isArray:fi}=Array,Ri=Pr("undefined");function Ym(i){return i!==null&&!Ri(i)&&i.constructor!==null&&!Ri(i.constructor)&&Ce(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const zl=Ne("ArrayBuffer");function jm(i){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(i):t=i&&i.buffer&&zl(i.buffer),t}const Km=Pr("string"),Ce=Pr("function"),kl=Pr("number"),Lr=i=>i!==null&&typeof i=="object",$m=i=>i===!0||i===!1,fr=i=>{if(Cr(i)!=="object")return!1;const t=$s(i);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},Zm=Ne("Date"),Jm=Ne("File"),Qm=Ne("Blob"),tg=Ne("FileList"),eg=i=>Lr(i)&&Ce(i.pipe),ng=i=>{let t;return i&&(typeof FormData=="function"&&i instanceof FormData||Ce(i.append)&&((t=Cr(i))==="formdata"||t==="object"&&Ce(i.toString)&&i.toString()==="[object FormData]"))},ig=Ne("URLSearchParams"),[rg,sg,ag,og]=["ReadableStream","Request","Response","Headers"].map(Ne),lg=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ii(i,t,{allOwnKeys:e=!1}={}){if(i===null||typeof i>"u")return;let n,r;if(typeof i!="object"&&(i=[i]),fi(i))for(n=0,r=i.length;n0;)if(r=e[n],t===r.toLowerCase())return r;return null}const Vl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Gl=i=>!Ri(i)&&i!==Vl;function Ns(){const{caseless:i}=Gl(this)&&this||{},t={},e=(n,r)=>{const s=i&&Hl(t,r)||r;fr(t[s])&&fr(n)?t[s]=Ns(t[s],n):fr(n)?t[s]=Ns({},n):fi(n)?t[s]=n.slice():t[s]=n};for(let n=0,r=arguments.length;n(Ii(t,(r,s)=>{e&&Ce(r)?i[s]=Bl(r,e):i[s]=r},{allOwnKeys:n}),i),hg=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),ug=(i,t,e,n)=>{i.prototype=Object.create(t.prototype,n),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:t.prototype}),e&&Object.assign(i.prototype,e)},dg=(i,t,e,n)=>{let r,s,a;const o={};if(t=t||{},i==null)return t;do{for(r=Object.getOwnPropertyNames(i),s=r.length;s-- >0;)a=r[s],(!n||n(a,i,t))&&!o[a]&&(t[a]=i[a],o[a]=!0);i=e!==!1&&$s(i)}while(i&&(!e||e(i,t))&&i!==Object.prototype);return t},fg=(i,t,e)=>{i=String(i),(e===void 0||e>i.length)&&(e=i.length),e-=t.length;const n=i.indexOf(t,e);return n!==-1&&n===e},pg=i=>{if(!i)return null;if(fi(i))return i;let t=i.length;if(!kl(t))return null;const e=new Array(t);for(;t-- >0;)e[t]=i[t];return e},mg=(i=>t=>i&&t instanceof i)(typeof Uint8Array<"u"&&$s(Uint8Array)),gg=(i,t)=>{const n=(i&&i[Symbol.iterator]).call(i);let r;for(;(r=n.next())&&!r.done;){const s=r.value;t.call(i,s[0],s[1])}},_g=(i,t)=>{let e;const n=[];for(;(e=i.exec(t))!==null;)n.push(e);return n},vg=Ne("HTMLFormElement"),xg=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,n,r){return n.toUpperCase()+r}),Yo=(({hasOwnProperty:i})=>(t,e)=>i.call(t,e))(Object.prototype),Sg=Ne("RegExp"),Wl=(i,t)=>{const e=Object.getOwnPropertyDescriptors(i),n={};Ii(e,(r,s)=>{let a;(a=t(r,s,i))!==!1&&(n[s]=a||r)}),Object.defineProperties(i,n)},Mg=i=>{Wl(i,(t,e)=>{if(Ce(i)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;const n=i[e];if(Ce(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},Eg=(i,t)=>{const e={},n=r=>{r.forEach(s=>{e[s]=!0})};return fi(i)?n(i):n(String(i).split(t)),e},yg=()=>{},Tg=(i,t)=>i!=null&&Number.isFinite(i=+i)?i:t,Ms="abcdefghijklmnopqrstuvwxyz",jo="0123456789",Xl={DIGIT:jo,ALPHA:Ms,ALPHA_DIGIT:Ms+Ms.toUpperCase()+jo},bg=(i=16,t=Xl.ALPHA_DIGIT)=>{let e="";const{length:n}=t;for(;i--;)e+=t[Math.random()*n|0];return e};function Ag(i){return!!(i&&Ce(i.append)&&i[Symbol.toStringTag]==="FormData"&&i[Symbol.iterator])}const wg=i=>{const t=new Array(10),e=(n,r)=>{if(Lr(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[r]=n;const s=fi(n)?[]:{};return Ii(n,(a,o)=>{const l=e(a,r+1);!Ri(l)&&(s[o]=l)}),t[r]=void 0,s}}return n};return e(i,0)},Rg=Ne("AsyncFunction"),Cg=i=>i&&(Lr(i)||Ce(i))&&Ce(i.then)&&Ce(i.catch),B={isArray:fi,isArrayBuffer:zl,isBuffer:Ym,isFormData:ng,isArrayBufferView:jm,isString:Km,isNumber:kl,isBoolean:$m,isObject:Lr,isPlainObject:fr,isReadableStream:rg,isRequest:sg,isResponse:ag,isHeaders:og,isUndefined:Ri,isDate:Zm,isFile:Jm,isBlob:Qm,isRegExp:Sg,isFunction:Ce,isStream:eg,isURLSearchParams:ig,isTypedArray:mg,isFileList:tg,forEach:Ii,merge:Ns,extend:cg,trim:lg,stripBOM:hg,inherits:ug,toFlatObject:dg,kindOf:Cr,kindOfTest:Ne,endsWith:fg,toArray:pg,forEachEntry:gg,matchAll:_g,isHTMLForm:vg,hasOwnProperty:Yo,hasOwnProp:Yo,reduceDescriptors:Wl,freezeMethods:Mg,toObjectSet:Eg,toCamelCase:xg,noop:yg,toFiniteNumber:Tg,findKey:Hl,global:Vl,isContextDefined:Gl,ALPHABET:Xl,generateString:bg,isSpecCompliantForm:Ag,toJSONObject:wg,isAsyncFn:Rg,isThenable:Cg};function Tt(i,t,e,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),r&&(this.response=r)}B.inherits(Tt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:B.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const ql=Tt.prototype,Yl={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{Yl[i]={value:i}});Object.defineProperties(Tt,Yl);Object.defineProperty(ql,"isAxiosError",{value:!0});Tt.from=(i,t,e,n,r,s)=>{const a=Object.create(ql);return B.toFlatObject(i,a,function(l){return l!==Error.prototype},o=>o!=="isAxiosError"),Tt.call(a,i.message,t,e,n,r),a.cause=i,a.name=i.name,s&&Object.assign(a,s),a};const Pg=null;function Os(i){return B.isPlainObject(i)||B.isArray(i)}function jl(i){return B.endsWith(i,"[]")?i.slice(0,-2):i}function Ko(i,t,e){return i?i.concat(t).map(function(r,s){return r=jl(r),!e&&s?"["+r+"]":r}).join(e?".":""):t}function Lg(i){return B.isArray(i)&&!i.some(Os)}const Dg=B.toFlatObject(B,{},null,function(t){return/^is[A-Z]/.test(t)});function Dr(i,t,e){if(!B.isObject(i))throw new TypeError("target must be an object");t=t||new FormData,e=B.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,d){return!B.isUndefined(d[_])});const n=e.metaTokens,r=e.visitor||h,s=e.dots,a=e.indexes,l=(e.Blob||typeof Blob<"u"&&Blob)&&B.isSpecCompliantForm(t);if(!B.isFunction(r))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(B.isDate(g))return g.toISOString();if(!l&&B.isBlob(g))throw new Tt("Blob is not supported. Use a Buffer instead.");return B.isArrayBuffer(g)||B.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function h(g,_,d){let f=g;if(g&&!d&&typeof g=="object"){if(B.endsWith(_,"{}"))_=n?_:_.slice(0,-2),g=JSON.stringify(g);else if(B.isArray(g)&&Lg(g)||(B.isFileList(g)||B.endsWith(_,"[]"))&&(f=B.toArray(g)))return _=jl(_),f.forEach(function(M,b){!(B.isUndefined(M)||M===null)&&t.append(a===!0?Ko([_],b,s):a===null?_:_+"[]",c(M))}),!1}return Os(g)?!0:(t.append(Ko(d,_,s),c(g)),!1)}const u=[],p=Object.assign(Dg,{defaultVisitor:h,convertValue:c,isVisitable:Os});function m(g,_){if(!B.isUndefined(g)){if(u.indexOf(g)!==-1)throw Error("Circular reference detected in "+_.join("."));u.push(g),B.forEach(g,function(f,T){(!(B.isUndefined(f)||f===null)&&r.call(t,f,B.isString(T)?T.trim():T,_,p))===!0&&m(f,_?_.concat(T):[T])}),u.pop()}}if(!B.isObject(i))throw new TypeError("data must be an object");return m(i),t}function $o(i){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Zs(i,t){this._pairs=[],i&&Dr(i,this,t)}const Kl=Zs.prototype;Kl.append=function(t,e){this._pairs.push([t,e])};Kl.toString=function(t){const e=t?function(n){return t.call(this,n,$o)}:$o;return this._pairs.map(function(r){return e(r[0])+"="+e(r[1])},"").join("&")};function Ug(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $l(i,t,e){if(!t)return i;const n=e&&e.encode||Ug,r=e&&e.serialize;let s;if(r?s=r(t,e):s=B.isURLSearchParams(t)?t.toString():new Zs(t,e).toString(n),s){const a=i.indexOf("#");a!==-1&&(i=i.slice(0,a)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Zo{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){B.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Zl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ig=typeof URLSearchParams<"u"?URLSearchParams:Zs,Ng=typeof FormData<"u"?FormData:null,Og=typeof Blob<"u"?Blob:null,Fg={isBrowser:!0,classes:{URLSearchParams:Ig,FormData:Ng,Blob:Og},protocols:["http","https","file","blob","url","data"]},Js=typeof window<"u"&&typeof document<"u",Bg=(i=>Js&&["ReactNative","NativeScript","NS"].indexOf(i)<0)(typeof navigator<"u"&&navigator.product),zg=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",kg=Js&&window.location.href||"http://localhost",Hg=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Js,hasStandardBrowserEnv:Bg,hasStandardBrowserWebWorkerEnv:zg,origin:kg},Symbol.toStringTag,{value:"Module"})),Ie={...Hg,...Fg};function Vg(i,t){return Dr(i,new Ie.classes.URLSearchParams,Object.assign({visitor:function(e,n,r,s){return Ie.isNode&&B.isBuffer(e)?(this.append(n,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function Gg(i){return B.matchAll(/\w+|\[(\w*)]/g,i).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Wg(i){const t={},e=Object.keys(i);let n;const r=e.length;let s;for(n=0;n=e.length;return a=!a&&B.isArray(r)?r.length:a,l?(B.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!B.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],s)&&B.isArray(r[a])&&(r[a]=Wg(r[a])),!o)}if(B.isFormData(i)&&B.isFunction(i.entries)){const e={};return B.forEachEntry(i,(n,r)=>{t(Gg(n),r,e,0)}),e}return null}function Xg(i,t,e){if(B.isString(i))try{return(t||JSON.parse)(i),B.trim(i)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(i)}const Ni={transitional:Zl,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,s=B.isObject(t);if(s&&B.isHTMLForm(t)&&(t=new FormData(t)),B.isFormData(t))return r?JSON.stringify(Jl(t)):t;if(B.isArrayBuffer(t)||B.isBuffer(t)||B.isStream(t)||B.isFile(t)||B.isBlob(t)||B.isReadableStream(t))return t;if(B.isArrayBufferView(t))return t.buffer;if(B.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Vg(t,this.formSerializer).toString();if((o=B.isFileList(t))||n.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Dr(o?{"files[]":t}:t,l&&new l,this.formSerializer)}}return s||r?(e.setContentType("application/json",!1),Xg(t)):t}],transformResponse:[function(t){const e=this.transitional||Ni.transitional,n=e&&e.forcedJSONParsing,r=this.responseType==="json";if(B.isResponse(t)||B.isReadableStream(t))return t;if(t&&B.isString(t)&&(n&&!this.responseType||r)){const a=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(o){if(a)throw o.name==="SyntaxError"?Tt.from(o,Tt.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ie.classes.FormData,Blob:Ie.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};B.forEach(["delete","get","head","post","put","patch"],i=>{Ni.headers[i]={}});const qg=B.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Yg=i=>{const t={};let e,n,r;return i&&i.split(` `).forEach(function(a){r=a.indexOf(":"),e=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!e||t[e]&&qg[e])&&(e==="set-cookie"?t[e]?t[e].push(n):t[e]=[n]:t[e]=t[e]?t[e]+", "+n:n)}),t},Jo=Symbol("internals");function yi(i){return i&&String(i).trim().toLowerCase()}function pr(i){return i===!1||i==null?i:B.isArray(i)?i.map(pr):String(i)}function jg(i){const t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=e.exec(i);)t[n[1]]=n[2];return t}const Kg=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function Es(i,t,e,n,r){if(B.isFunction(n))return n.call(this,t,e);if(r&&(t=e),!!B.isString(t)){if(B.isString(n))return t.indexOf(n)!==-1;if(B.isRegExp(n))return n.test(t)}}function $g(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,n)=>e.toUpperCase()+n)}function Zg(i,t){const e=B.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(i,n+e,{value:function(r,s,a){return this[n].call(this,t,r,s,a)},configurable:!0})})}class Se{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function s(o,l,c){const h=yi(l);if(!h)throw new Error("header name must be a non-empty string");const u=B.findKey(r,h);(!u||r[u]===void 0||c===!0||c===void 0&&r[u]!==!1)&&(r[u||l]=pr(o))}const a=(o,l)=>B.forEach(o,(c,h)=>s(c,h,l));if(B.isPlainObject(t)||t instanceof this.constructor)a(t,e);else if(B.isString(t)&&(t=t.trim())&&!Kg(t))a(Yg(t),e);else if(B.isHeaders(t))for(const[o,l]of t.entries())s(l,o,n);else t!=null&&s(e,t,n);return this}get(t,e){if(t=yi(t),t){const n=B.findKey(this,t);if(n){const r=this[n];if(!e)return r;if(e===!0)return jg(r);if(B.isFunction(e))return e.call(this,r,n);if(B.isRegExp(e))return e.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=yi(t),t){const n=B.findKey(this,t);return!!(n&&this[n]!==void 0&&(!e||Es(this,this[n],n,e)))}return!1}delete(t,e){const n=this;let r=!1;function s(a){if(a=yi(a),a){const o=B.findKey(n,a);o&&(!e||Es(n,n[o],o,e))&&(delete n[o],r=!0)}}return B.isArray(t)?t.forEach(s):s(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const s=e[n];(!t||Es(this,this[s],s,t,!0))&&(delete this[s],r=!0)}return r}normalize(t){const e=this,n={};return B.forEach(this,(r,s)=>{const a=B.findKey(n,s);if(a){e[a]=pr(r),delete e[s];return}const o=t?$g(s):String(s).trim();o!==s&&delete e[s],e[o]=pr(r),n[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return B.forEach(this,(n,r)=>{n!=null&&n!==!1&&(e[r]=t&&B.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const n=(this[Jo]=this[Jo]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=yi(a);n[o]||(Zg(r,a),n[o]=!0)}return B.isArray(t)?t.forEach(s):s(t),this}}Se.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);B.reduceDescriptors(Se.prototype,({value:i},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>i,set(n){this[e]=n}}});B.freezeMethods(Se);function ys(i,t){const e=this||Ni,n=t||e,r=Se.from(n.headers);let s=n.data;return B.forEach(i,function(o){s=o.call(e,s,r.normalize(),t?t.status:void 0)}),r.normalize(),s}function Ql(i){return!!(i&&i.__CANCEL__)}function pi(i,t,e){Tt.call(this,i??"canceled",Tt.ERR_CANCELED,t,e),this.name="CanceledError"}B.inherits(pi,Tt,{__CANCEL__:!0});function tc(i,t,e){const n=e.config.validateStatus;!e.status||!n||n(e.status)?i(e):t(new Tt("Request failed with status code "+e.status,[Tt.ERR_BAD_REQUEST,Tt.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}function Jg(i){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return t&&t[1]||""}function Qg(i,t){i=i||10;const e=new Array(i),n=new Array(i);let r=0,s=0,a;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),h=n[s];a||(a=c),e[r]=l,n[r]=c;let u=s,p=0;for(;u!==r;)p+=e[u++],u=u%i;if(r=(r+1)%i,r===s&&(s=(s+1)%i),c-an)return r&&(clearTimeout(r),r=null),e=o,i.apply(null,arguments);r||(r=setTimeout(()=>(r=null,e=Date.now(),i.apply(null,arguments)),n-(o-e)))}}const Er=(i,t,e=3)=>{let n=0;const r=Qg(50,250);return t_(s=>{const a=s.loaded,o=s.lengthComputable?s.total:void 0,l=a-n,c=r(l),h=a<=o;n=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&h?(o-a)/c:void 0,event:s,lengthComputable:o!=null};u[t?"download":"upload"]=!0,i(u)},e)},e_=Ie.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let n;function r(s){let a=s;return t&&(e.setAttribute("href",a),a=e.href),e.setAttribute("href",a),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return n=r(window.location.href),function(a){const o=B.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}(),n_=Ie.hasStandardBrowserEnv?{write(i,t,e,n,r,s){const a=[i+"="+encodeURIComponent(t)];B.isNumber(e)&&a.push("expires="+new Date(e).toGMTString()),B.isString(n)&&a.push("path="+n),B.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(i){const t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(i){this.write(i,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function i_(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function r_(i,t){return t?i.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):i}function ec(i,t){return i&&!i_(t)?r_(i,t):t}const Qo=i=>i instanceof Se?{...i}:i;function Nn(i,t){t=t||{};const e={};function n(c,h,u){return B.isPlainObject(c)&&B.isPlainObject(h)?B.merge.call({caseless:u},c,h):B.isPlainObject(h)?B.merge({},h):B.isArray(h)?h.slice():h}function r(c,h,u){if(B.isUndefined(h)){if(!B.isUndefined(c))return n(void 0,c,u)}else return n(c,h,u)}function s(c,h){if(!B.isUndefined(h))return n(void 0,h)}function a(c,h){if(B.isUndefined(h)){if(!B.isUndefined(c))return n(void 0,c)}else return n(void 0,h)}function o(c,h,u){if(u in t)return n(c,h);if(u in i)return n(void 0,c)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(c,h)=>r(Qo(c),Qo(h),!0)};return B.forEach(Object.keys(Object.assign({},i,t)),function(h){const u=l[h]||r,p=u(i[h],t[h],h);B.isUndefined(p)&&u!==o||(e[h]=p)}),e}const nc=i=>{const t=Nn({},i);let{data:e,withXSRFToken:n,xsrfHeaderName:r,xsrfCookieName:s,headers:a,auth:o}=t;t.headers=a=Se.from(a),t.url=$l(ec(t.baseURL,t.url),i.params,i.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let l;if(B.isFormData(e)){if(Ie.hasStandardBrowserEnv||Ie.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((l=a.getContentType())!==!1){const[c,...h]=l?l.split(";").map(u=>u.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...h].join("; "))}}if(Ie.hasStandardBrowserEnv&&(n&&B.isFunction(n)&&(n=n(t)),n||n!==!1&&e_(t.url))){const c=r&&s&&n_.read(s);c&&a.set(r,c)}return t},s_=typeof XMLHttpRequest<"u",a_=s_&&function(i){return new Promise(function(e,n){const r=nc(i);let s=r.data;const a=Se.from(r.headers).normalize();let{responseType:o}=r,l;function c(){r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function u(){if(!h)return;const m=Se.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),_={data:!o||o==="text"||o==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:m,config:i,request:h};tc(function(d){e(d),c()},function(d){n(d),c()},_),h=null}"onloadend"in h?h.onloadend=u:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(u)},h.onabort=function(){h&&(n(new Tt("Request aborted",Tt.ECONNABORTED,r,h)),h=null)},h.onerror=function(){n(new Tt("Network Error",Tt.ERR_NETWORK,r,h)),h=null},h.ontimeout=function(){let g=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const _=r.transitional||Zl;r.timeoutErrorMessage&&(g=r.timeoutErrorMessage),n(new Tt(g,_.clarifyTimeoutError?Tt.ETIMEDOUT:Tt.ECONNABORTED,r,h)),h=null},s===void 0&&a.setContentType(null),"setRequestHeader"in h&&B.forEach(a.toJSON(),function(g,_){h.setRequestHeader(_,g)}),B.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!=="json"&&(h.responseType=r.responseType),typeof r.onDownloadProgress=="function"&&h.addEventListener("progress",Er(r.onDownloadProgress,!0)),typeof r.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",Er(r.onUploadProgress)),(r.cancelToken||r.signal)&&(l=m=>{h&&(n(!m||m.type?new pi(null,i,h):m),h.abort(),h=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const p=Jg(r.url);if(p&&Ie.protocols.indexOf(p)===-1){n(new Tt("Unsupported protocol "+p+":",Tt.ERR_BAD_REQUEST,i));return}h.send(s||null)})},o_=(i,t)=>{let e=new AbortController,n;const r=function(l){if(!n){n=!0,a();const c=l instanceof Error?l:this.reason;e.abort(c instanceof Tt?c:new pi(c instanceof Error?c.message:c))}};let s=t&&setTimeout(()=>{r(new Tt(`timeout ${t} of ms exceeded`,Tt.ETIMEDOUT))},t);const a=()=>{i&&(s&&clearTimeout(s),s=null,i.forEach(l=>{l&&(l.removeEventListener?l.removeEventListener("abort",r):l.unsubscribe(r))}),i=null)};i.forEach(l=>l&&l.addEventListener&&l.addEventListener("abort",r));const{signal:o}=e;return o.unsubscribe=a,[o,()=>{s&&clearTimeout(s),s=null}]},l_=function*(i,t){let e=i.byteLength;if(!t||e{const s=c_(i,t,r);let a=0;return new ReadableStream({type:"bytes",async pull(o){const{done:l,value:c}=await s.next();if(l){o.close(),n();return}let h=c.byteLength;e&&e(a+=h),o.enqueue(new Uint8Array(c))},cancel(o){return n(o),s.return()}},{highWaterMark:2})},el=(i,t)=>{const e=i!=null;return n=>setTimeout(()=>t({lengthComputable:e,total:i,loaded:n}))},Ur=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ic=Ur&&typeof ReadableStream=="function",Fs=Ur&&(typeof TextEncoder=="function"?(i=>t=>i.encode(t))(new TextEncoder):async i=>new Uint8Array(await new Response(i).arrayBuffer())),h_=ic&&(()=>{let i=!1;const t=new Request(Ie.origin,{body:new ReadableStream,method:"POST",get duplex(){return i=!0,"half"}}).headers.has("Content-Type");return i&&!t})(),nl=64*1024,Bs=ic&&!!(()=>{try{return B.isReadableStream(new Response("").body)}catch{}})(),yr={stream:Bs&&(i=>i.body)};Ur&&(i=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!yr[t]&&(yr[t]=B.isFunction(i[t])?e=>e[t]():(e,n)=>{throw new Tt(`Response type '${t}' is not supported`,Tt.ERR_NOT_SUPPORT,n)})})})(new Response);const u_=async i=>{if(i==null)return 0;if(B.isBlob(i))return i.size;if(B.isSpecCompliantForm(i))return(await new Request(i).arrayBuffer()).byteLength;if(B.isArrayBufferView(i))return i.byteLength;if(B.isURLSearchParams(i)&&(i=i+""),B.isString(i))return(await Fs(i)).byteLength},d_=async(i,t)=>{const e=B.toFiniteNumber(i.getContentLength());return e??u_(t)},f_=Ur&&(async i=>{let{url:t,method:e,data:n,signal:r,cancelToken:s,timeout:a,onDownloadProgress:o,onUploadProgress:l,responseType:c,headers:h,withCredentials:u="same-origin",fetchOptions:p}=nc(i);c=c?(c+"").toLowerCase():"text";let[m,g]=r||s||a?o_([r,s],a):[],_,f;const d=()=>{!_&&setTimeout(()=>{m&&m.unsubscribe()}),_=!0};let T;try{if(l&&h_&&e!=="get"&&e!=="head"&&(T=await d_(h,n))!==0){let w=new Request(t,{method:"POST",body:n,duplex:"half"}),A;B.isFormData(n)&&(A=w.headers.get("content-type"))&&h.setContentType(A),w.body&&(n=tl(w.body,nl,el(T,Er(l)),null,Fs))}B.isString(u)||(u=u?"cors":"omit"),f=new Request(t,{...p,signal:m,method:e.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",withCredentials:u});let M=await fetch(f);const b=Bs&&(c==="stream"||c==="response");if(Bs&&(o||b)){const w={};["status","statusText","headers"].forEach(k=>{w[k]=M[k]});const A=B.toFiniteNumber(M.headers.get("content-length"));M=new Response(tl(M.body,nl,o&&el(A,Er(o,!0)),b&&d,Fs),w)}c=c||"text";let O=await yr[B.findKey(yr,c)||"text"](M,i);return!b&&d(),g&&g(),await new Promise((w,A)=>{tc(w,A,{data:O,headers:Se.from(M.headers),status:M.status,statusText:M.statusText,config:i,request:f})})}catch(M){throw d(),M&&M.name==="TypeError"&&/fetch/i.test(M.message)?Object.assign(new Tt("Network Error",Tt.ERR_NETWORK,i,f),{cause:M.cause||M}):Tt.from(M,M&&M.code,i,f)}}),zs={http:Pg,xhr:a_,fetch:f_};B.forEach(zs,(i,t)=>{if(i){try{Object.defineProperty(i,"name",{value:t})}catch{}Object.defineProperty(i,"adapterName",{value:t})}});const il=i=>`- ${i}`,p_=i=>B.isFunction(i)||i===null||i===!1,rc={getAdapter:i=>{i=B.isArray(i)?i:[i];const{length:t}=i;let e,n;const r={};for(let s=0;s`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?s.length>1?`since : +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const n=(this[Jo]=this[Jo]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=yi(a);n[o]||(Zg(r,a),n[o]=!0)}return B.isArray(t)?t.forEach(s):s(t),this}}Se.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);B.reduceDescriptors(Se.prototype,({value:i},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>i,set(n){this[e]=n}}});B.freezeMethods(Se);function ys(i,t){const e=this||Ni,n=t||e,r=Se.from(n.headers);let s=n.data;return B.forEach(i,function(o){s=o.call(e,s,r.normalize(),t?t.status:void 0)}),r.normalize(),s}function Ql(i){return!!(i&&i.__CANCEL__)}function pi(i,t,e){Tt.call(this,i??"canceled",Tt.ERR_CANCELED,t,e),this.name="CanceledError"}B.inherits(pi,Tt,{__CANCEL__:!0});function tc(i,t,e){const n=e.config.validateStatus;!e.status||!n||n(e.status)?i(e):t(new Tt("Request failed with status code "+e.status,[Tt.ERR_BAD_REQUEST,Tt.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}function Jg(i){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return t&&t[1]||""}function Qg(i,t){i=i||10;const e=new Array(i),n=new Array(i);let r=0,s=0,a;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),h=n[s];a||(a=c),e[r]=l,n[r]=c;let u=s,p=0;for(;u!==r;)p+=e[u++],u=u%i;if(r=(r+1)%i,r===s&&(s=(s+1)%i),c-an)return r&&(clearTimeout(r),r=null),e=o,i.apply(null,arguments);r||(r=setTimeout(()=>(r=null,e=Date.now(),i.apply(null,arguments)),n-(o-e)))}}const Er=(i,t,e=3)=>{let n=0;const r=Qg(50,250);return t_(s=>{const a=s.loaded,o=s.lengthComputable?s.total:void 0,l=a-n,c=r(l),h=a<=o;n=a;const u={loaded:a,total:o,progress:o?a/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&h?(o-a)/c:void 0,event:s,lengthComputable:o!=null};u[t?"download":"upload"]=!0,i(u)},e)},e_=Ie.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let n;function r(s){let a=s;return t&&(e.setAttribute("href",a),a=e.href),e.setAttribute("href",a),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return n=r(window.location.href),function(a){const o=B.isString(a)?r(a):a;return o.protocol===n.protocol&&o.host===n.host}}():function(){return function(){return!0}}(),n_=Ie.hasStandardBrowserEnv?{write(i,t,e,n,r,s){const a=[i+"="+encodeURIComponent(t)];B.isNumber(e)&&a.push("expires="+new Date(e).toGMTString()),B.isString(n)&&a.push("path="+n),B.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(i){const t=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(i){this.write(i,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function i_(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function r_(i,t){return t?i.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):i}function ec(i,t){return i&&!i_(t)?r_(i,t):t}const Qo=i=>i instanceof Se?{...i}:i;function Nn(i,t){t=t||{};const e={};function n(c,h,u){return B.isPlainObject(c)&&B.isPlainObject(h)?B.merge.call({caseless:u},c,h):B.isPlainObject(h)?B.merge({},h):B.isArray(h)?h.slice():h}function r(c,h,u){if(B.isUndefined(h)){if(!B.isUndefined(c))return n(void 0,c,u)}else return n(c,h,u)}function s(c,h){if(!B.isUndefined(h))return n(void 0,h)}function a(c,h){if(B.isUndefined(h)){if(!B.isUndefined(c))return n(void 0,c)}else return n(void 0,h)}function o(c,h,u){if(u in t)return n(c,h);if(u in i)return n(void 0,c)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(c,h)=>r(Qo(c),Qo(h),!0)};return B.forEach(Object.keys(Object.assign({},i,t)),function(h){const u=l[h]||r,p=u(i[h],t[h],h);B.isUndefined(p)&&u!==o||(e[h]=p)}),e}const nc=i=>{const t=Nn({},i);let{data:e,withXSRFToken:n,xsrfHeaderName:r,xsrfCookieName:s,headers:a,auth:o}=t;t.headers=a=Se.from(a),t.url=$l(ec(t.baseURL,t.url),i.params,i.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let l;if(B.isFormData(e)){if(Ie.hasStandardBrowserEnv||Ie.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((l=a.getContentType())!==!1){const[c,...h]=l?l.split(";").map(u=>u.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...h].join("; "))}}if(Ie.hasStandardBrowserEnv&&(n&&B.isFunction(n)&&(n=n(t)),n||n!==!1&&e_(t.url))){const c=r&&s&&n_.read(s);c&&a.set(r,c)}return t},s_=typeof XMLHttpRequest<"u",a_=s_&&function(i){return new Promise(function(e,n){const r=nc(i);let s=r.data;const a=Se.from(r.headers).normalize();let{responseType:o}=r,l;function c(){r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function u(){if(!h)return;const m=Se.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),_={data:!o||o==="text"||o==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:m,config:i,request:h};tc(function(f){e(f),c()},function(f){n(f),c()},_),h=null}"onloadend"in h?h.onloadend=u:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(u)},h.onabort=function(){h&&(n(new Tt("Request aborted",Tt.ECONNABORTED,r,h)),h=null)},h.onerror=function(){n(new Tt("Network Error",Tt.ERR_NETWORK,r,h)),h=null},h.ontimeout=function(){let g=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const _=r.transitional||Zl;r.timeoutErrorMessage&&(g=r.timeoutErrorMessage),n(new Tt(g,_.clarifyTimeoutError?Tt.ETIMEDOUT:Tt.ECONNABORTED,r,h)),h=null},s===void 0&&a.setContentType(null),"setRequestHeader"in h&&B.forEach(a.toJSON(),function(g,_){h.setRequestHeader(_,g)}),B.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!=="json"&&(h.responseType=r.responseType),typeof r.onDownloadProgress=="function"&&h.addEventListener("progress",Er(r.onDownloadProgress,!0)),typeof r.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",Er(r.onUploadProgress)),(r.cancelToken||r.signal)&&(l=m=>{h&&(n(!m||m.type?new pi(null,i,h):m),h.abort(),h=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const p=Jg(r.url);if(p&&Ie.protocols.indexOf(p)===-1){n(new Tt("Unsupported protocol "+p+":",Tt.ERR_BAD_REQUEST,i));return}h.send(s||null)})},o_=(i,t)=>{let e=new AbortController,n;const r=function(l){if(!n){n=!0,a();const c=l instanceof Error?l:this.reason;e.abort(c instanceof Tt?c:new pi(c instanceof Error?c.message:c))}};let s=t&&setTimeout(()=>{r(new Tt(`timeout ${t} of ms exceeded`,Tt.ETIMEDOUT))},t);const a=()=>{i&&(s&&clearTimeout(s),s=null,i.forEach(l=>{l&&(l.removeEventListener?l.removeEventListener("abort",r):l.unsubscribe(r))}),i=null)};i.forEach(l=>l&&l.addEventListener&&l.addEventListener("abort",r));const{signal:o}=e;return o.unsubscribe=a,[o,()=>{s&&clearTimeout(s),s=null}]},l_=function*(i,t){let e=i.byteLength;if(!t||e{const s=c_(i,t,r);let a=0;return new ReadableStream({type:"bytes",async pull(o){const{done:l,value:c}=await s.next();if(l){o.close(),n();return}let h=c.byteLength;e&&e(a+=h),o.enqueue(new Uint8Array(c))},cancel(o){return n(o),s.return()}},{highWaterMark:2})},el=(i,t)=>{const e=i!=null;return n=>setTimeout(()=>t({lengthComputable:e,total:i,loaded:n}))},Ur=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ic=Ur&&typeof ReadableStream=="function",Fs=Ur&&(typeof TextEncoder=="function"?(i=>t=>i.encode(t))(new TextEncoder):async i=>new Uint8Array(await new Response(i).arrayBuffer())),h_=ic&&(()=>{let i=!1;const t=new Request(Ie.origin,{body:new ReadableStream,method:"POST",get duplex(){return i=!0,"half"}}).headers.has("Content-Type");return i&&!t})(),nl=64*1024,Bs=ic&&!!(()=>{try{return B.isReadableStream(new Response("").body)}catch{}})(),yr={stream:Bs&&(i=>i.body)};Ur&&(i=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!yr[t]&&(yr[t]=B.isFunction(i[t])?e=>e[t]():(e,n)=>{throw new Tt(`Response type '${t}' is not supported`,Tt.ERR_NOT_SUPPORT,n)})})})(new Response);const u_=async i=>{if(i==null)return 0;if(B.isBlob(i))return i.size;if(B.isSpecCompliantForm(i))return(await new Request(i).arrayBuffer()).byteLength;if(B.isArrayBufferView(i))return i.byteLength;if(B.isURLSearchParams(i)&&(i=i+""),B.isString(i))return(await Fs(i)).byteLength},d_=async(i,t)=>{const e=B.toFiniteNumber(i.getContentLength());return e??u_(t)},f_=Ur&&(async i=>{let{url:t,method:e,data:n,signal:r,cancelToken:s,timeout:a,onDownloadProgress:o,onUploadProgress:l,responseType:c,headers:h,withCredentials:u="same-origin",fetchOptions:p}=nc(i);c=c?(c+"").toLowerCase():"text";let[m,g]=r||s||a?o_([r,s],a):[],_,d;const f=()=>{!_&&setTimeout(()=>{m&&m.unsubscribe()}),_=!0};let T;try{if(l&&h_&&e!=="get"&&e!=="head"&&(T=await d_(h,n))!==0){let w=new Request(t,{method:"POST",body:n,duplex:"half"}),A;B.isFormData(n)&&(A=w.headers.get("content-type"))&&h.setContentType(A),w.body&&(n=tl(w.body,nl,el(T,Er(l)),null,Fs))}B.isString(u)||(u=u?"cors":"omit"),d=new Request(t,{...p,signal:m,method:e.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",withCredentials:u});let M=await fetch(d);const b=Bs&&(c==="stream"||c==="response");if(Bs&&(o||b)){const w={};["status","statusText","headers"].forEach(k=>{w[k]=M[k]});const A=B.toFiniteNumber(M.headers.get("content-length"));M=new Response(tl(M.body,nl,o&&el(A,Er(o,!0)),b&&f,Fs),w)}c=c||"text";let O=await yr[B.findKey(yr,c)||"text"](M,i);return!b&&f(),g&&g(),await new Promise((w,A)=>{tc(w,A,{data:O,headers:Se.from(M.headers),status:M.status,statusText:M.statusText,config:i,request:d})})}catch(M){throw f(),M&&M.name==="TypeError"&&/fetch/i.test(M.message)?Object.assign(new Tt("Network Error",Tt.ERR_NETWORK,i,d),{cause:M.cause||M}):Tt.from(M,M&&M.code,i,d)}}),zs={http:Pg,xhr:a_,fetch:f_};B.forEach(zs,(i,t)=>{if(i){try{Object.defineProperty(i,"name",{value:t})}catch{}Object.defineProperty(i,"adapterName",{value:t})}});const il=i=>`- ${i}`,p_=i=>B.isFunction(i)||i===null||i===!1,rc={getAdapter:i=>{i=B.isArray(i)?i:[i];const{length:t}=i;let e,n;const r={};for(let s=0;s`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?s.length>1?`since : `+s.map(il).join(` `):" "+il(s[0]):"as no adapter specified";throw new Tt("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n},adapters:zs};function Ts(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new pi(null,i)}function rl(i){return Ts(i),i.headers=Se.from(i.headers),i.data=ys.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),rc.getAdapter(i.adapter||Ni.adapter)(i).then(function(n){return Ts(i),n.data=ys.call(i,i.transformResponse,n),n.headers=Se.from(n.headers),n},function(n){return Ql(n)||(Ts(i),n&&n.response&&(n.response.data=ys.call(i,i.transformResponse,n.response),n.response.headers=Se.from(n.response.headers))),Promise.reject(n)})}const sc="1.7.2",Qs={};["object","boolean","number","function","string","symbol"].forEach((i,t)=>{Qs[i]=function(n){return typeof n===i||"a"+(t<1?"n ":" ")+i}});const sl={};Qs.transitional=function(t,e,n){function r(s,a){return"[Axios v"+sc+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return(s,a,o)=>{if(t===!1)throw new Tt(r(a," has been removed"+(e?" in "+e:"")),Tt.ERR_DEPRECATED);return e&&!sl[a]&&(sl[a]=!0,console.warn(r(a," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,a,o):!0}};function m_(i,t,e){if(typeof i!="object")throw new Tt("options must be an object",Tt.ERR_BAD_OPTION_VALUE);const n=Object.keys(i);let r=n.length;for(;r-- >0;){const s=n[r],a=t[s];if(a){const o=i[s],l=o===void 0||a(o,s,i);if(l!==!0)throw new Tt("option "+s+" must be "+l,Tt.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Tt("Unknown option "+s,Tt.ERR_BAD_OPTION)}}const ks={assertOptions:m_,validators:Qs},ln=ks.validators;class Un{constructor(t){this.defaults=t,this.interceptors={request:new Zo,response:new Zo}}async request(t,e){try{return await this._request(t,e)}catch(n){if(n instanceof Error){let r;Error.captureStackTrace?Error.captureStackTrace(r={}):r=new Error;const s=r.stack?r.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=` -`+s):n.stack=s}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Nn(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:s}=e;n!==void 0&&ks.assertOptions(n,{silentJSONParsing:ln.transitional(ln.boolean),forcedJSONParsing:ln.transitional(ln.boolean),clarifyTimeoutError:ln.transitional(ln.boolean)},!1),r!=null&&(B.isFunction(r)?e.paramsSerializer={serialize:r}:ks.assertOptions(r,{encode:ln.function,serialize:ln.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&B.merge(s.common,s[e.method]);s&&B.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),e.headers=Se.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(e)===!1||(l=l&&_.synchronous,o.unshift(_.fulfilled,_.rejected))});const c=[];this.interceptors.response.forEach(function(_){c.push(_.fulfilled,_.rejected)});let h,u=0,p;if(!l){const g=[rl.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,c),p=g.length,h=Promise.resolve(e);u{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](r);n._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(r);return a.cancel=function(){n.unsubscribe(s)},a},t(function(s,a,o){n.reason||(n.reason=new pi(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new ta(function(r){t=r}),cancel:t}}}function g_(i){return function(e){return i.apply(null,e)}}function __(i){return B.isObject(i)&&i.isAxiosError===!0}const Hs={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Hs).forEach(([i,t])=>{Hs[t]=i});function ac(i){const t=new Un(i),e=Bl(Un.prototype.request,t);return B.extend(e,Un.prototype,t,{allOwnKeys:!0}),B.extend(e,t,null,{allOwnKeys:!0}),e.create=function(r){return ac(Nn(i,r))},e}const re=ac(Ni);re.Axios=Un;re.CanceledError=pi;re.CancelToken=ta;re.isCancel=Ql;re.VERSION=sc;re.toFormData=Dr;re.AxiosError=Tt;re.Cancel=re.CanceledError;re.all=function(t){return Promise.all(t)};re.spread=g_;re.isAxiosError=__;re.mergeConfig=Nn;re.AxiosHeaders=Se;re.formToJSON=i=>Jl(B.isHTMLForm(i)?new FormData(i):i);re.getAdapter=rc.getAdapter;re.HttpStatusCode=Hs;re.default=re;async function v_(i){try{return(await re.get(i)).data.data}catch(t){throw console.error("Axios error:",t),t}}async function Vs(i,t=e=>{}){try{console.log("Getting Data:",i);const e=await v_(i),n=e.users,r=e.transactions;let s={nodes:Array.from(n),transactions:Array.from(r)};t(s)}catch(e){console.error("Error:",e)}}const al="This is a heatmap representing UTXO transactions activity between pairs of addresses. In grid view addresses are layed out as From/To by the X and Y axis. Bar view can be selected to summarize total activty per address.

Camera Controls: The viewer may drag click to move the camera around, scroll up and down to zoom in/out, and double click on any block to see further details on activity between two addresses. Normal clicking will deselect the currently focused block.

Left Tab: This tab will appear when an activity bar is selected. Displays detailed information on the focused block

Configurations: The bottom bar holds a set buttons that allow for reorganization and reconfiguration of the data. Play around with them to see how else this data can be visualized.

Click this tab to hide.";function x_(i,t,e,n,r,s){let a=document.createElement("div");a.id="titleDiv",document.body.appendChild(a);let o=document.createElement("div");o.id="helpDiv",document.body.appendChild(o),o.onmousedown=()=>{i.canDrag=!1},o.onmouseenter=()=>{i.canHover=!1,t.canScroll=!1},o.onmouseleave=()=>{i.canHover=!0,t.canScroll=!0},new we("title","titleDiv","RES LENSES");let l=document.createElement("div");l.id="sideDiv",document.body.appendChild(l),l.style.width="0px",l.onmouseenter=()=>{i.canHover=!1,t.canScroll=!1},l.onmouseleave=()=>{i.canHover=!0,t.canScroll=!0};let c=document.createElement("div");c.id="topDiv",c.onmousedown=()=>{i.canDrag=!1},document.body.appendChild(c);let h=document.createElement("div");h.id="bottomDiv",h.onmousedown=()=>{i.canDrag=!1},h.onmouseenter=()=>{i.canHover=!1},h.onmouseleave=()=>{i.canHover=!0},document.body.appendChild(h);let u=()=>{i.canDrag=!0,i.canHover=!0};new Ai("innerBottom","bottomDiv",!1);let p=new we("from display","topDiv","From: NA");i.displayFrom=p;let m=new we("to display","topDiv","To: NA");i.displayTo=m;let g=new we("amount display","topDiv","Total: NA");i.displayAmount=g,new Is("Return to Origin","innerBottom",()=>{t.resetCamera()}).setToolTip(n.resetPosition,"topTooltip");let f=()=>{let X=r;t.isDataLoaded=!1,u(),Vs(X,Z=>{t.isDataLoaded=!0,t.loadedChunks=new Map,i.dataType=0,i.loadData(Z)})},d=()=>{let X=s;t.isDataLoaded=!1,u(),Vs(X,Z=>{t.isDataLoaded=!0,t.loadedChunks=new Map,i.dataType=1,i.loadData(Z)})};new lr("SelectData","innerBottom","Data",[["ResDB",f,n.resDBData],["Ethereum",d,n.ethData]]).button.setToolTip(n.dataSelect,"topTooltip");let M=()=>{i.toggleSort=0,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()},b=()=>{i.toggleSort=1,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()},O=()=>{i.toggleSort=2,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()};new lr("sortSelect","innerBottom","Sort by",[["Transactions Total",M,n.transactionTotal],["Number of Transactions",b,n.numTransactions],["Largest Transaction",O,n.largestTransaction]]).button.setToolTip(n.sortSelect,"topTooltip");let A=()=>{t.setCamera(0),i.loadData(i.dataToLoad),t.clearChunks(),u()},k=()=>{t.setCamera(1),i.loadData(i.dataToLoad),t.clearChunks(),u()};new lr("ViewSelect","innerBottom","View",[["Grid",A,n.grid],["Bar",k,n.bar]]).button.setToolTip(n.viewSelect,"topTooltip");let x=()=>{console.log("func 1"),i.symmetrical=!0,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()},N=()=>{console.log("func 2"),i.symmetrical=!1,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()};new lr("SymmetrySelect","innerBottom","Symmetry",[["False",N,n.asymmetric],["True",x,n.symmetric]]).button.setToolTip(n.symmetrySelect,"topTooltip");let C=!1,G=new we("Help button","helpDiv","?");o.style.height="calc(100% - 260px)",o.style.textAlign="left",G.label.innerHTML=al,G.div.style.fontSize="16px",o.style.overflowY="scroll",C=!0,G.div.onmousedown=()=>{C?(o.style.height="20px",o.style.textAlign="center",G.label.innerHTML="?",G.div.style.fontSize="30px",o.style.overflowY="hidden",C=!1):(o.style.height="calc(100% - 260px)",o.style.textAlign="left",G.label.innerHTML=al,G.div.style.fontSize="16px",o.style.overflowY="scroll",C=!0)}}async function S_(){const i="BQYd0rsSmffBzkLkUs5bJkqCPlHKZPiz";JSON.stringify({query:` +`+s):n.stack=s}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Nn(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:s}=e;n!==void 0&&ks.assertOptions(n,{silentJSONParsing:ln.transitional(ln.boolean),forcedJSONParsing:ln.transitional(ln.boolean),clarifyTimeoutError:ln.transitional(ln.boolean)},!1),r!=null&&(B.isFunction(r)?e.paramsSerializer={serialize:r}:ks.assertOptions(r,{encode:ln.function,serialize:ln.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=s&&B.merge(s.common,s[e.method]);s&&B.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),e.headers=Se.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(e)===!1||(l=l&&_.synchronous,o.unshift(_.fulfilled,_.rejected))});const c=[];this.interceptors.response.forEach(function(_){c.push(_.fulfilled,_.rejected)});let h,u=0,p;if(!l){const g=[rl.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,c),p=g.length,h=Promise.resolve(e);u{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](r);n._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{n.subscribe(o),s=o}).then(r);return a.cancel=function(){n.unsubscribe(s)},a},t(function(s,a,o){n.reason||(n.reason=new pi(s,a,o),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new ta(function(r){t=r}),cancel:t}}}function g_(i){return function(e){return i.apply(null,e)}}function __(i){return B.isObject(i)&&i.isAxiosError===!0}const Hs={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Hs).forEach(([i,t])=>{Hs[t]=i});function ac(i){const t=new Un(i),e=Bl(Un.prototype.request,t);return B.extend(e,Un.prototype,t,{allOwnKeys:!0}),B.extend(e,t,null,{allOwnKeys:!0}),e.create=function(r){return ac(Nn(i,r))},e}const re=ac(Ni);re.Axios=Un;re.CanceledError=pi;re.CancelToken=ta;re.isCancel=Ql;re.VERSION=sc;re.toFormData=Dr;re.AxiosError=Tt;re.Cancel=re.CanceledError;re.all=function(t){return Promise.all(t)};re.spread=g_;re.isAxiosError=__;re.mergeConfig=Nn;re.AxiosHeaders=Se;re.formToJSON=i=>Jl(B.isHTMLForm(i)?new FormData(i):i);re.getAdapter=rc.getAdapter;re.HttpStatusCode=Hs;re.default=re;async function v_(i){try{return(await re.get(i)).data.data}catch(t){throw console.error("Axios error:",t),t}}async function Vs(i,t=e=>{}){try{console.log("Getting Data:",i);const e=await v_(i),n=e.users,r=e.transactions;let s={nodes:Array.from(n),transactions:Array.from(r)};t(s)}catch(e){console.error("Error:",e)}}const al="This is a heatmap representing UTXO transactions activity between pairs of addresses. In grid view addresses are layed out as From/To by the X and Y axis. Bar view can be selected to summarize total activty per address.

Camera Controls: The viewer may drag click to move the camera around, scroll up and down to zoom in/out, and double click on any block to see further details on activity between two addresses. Normal clicking will deselect the currently focused block.

Left Tab: This tab will appear when an activity bar is selected. Displays detailed information on the focused block

Configurations: The bottom bar holds a set buttons that allow for reorganization and reconfiguration of the data. Play around with them to see how else this data can be visualized.

Click this tab to hide.";function x_(i,t,e,n,r,s){let a=document.createElement("div");a.id="titleDiv",document.body.appendChild(a);let o=document.createElement("div");o.id="helpDiv",document.body.appendChild(o),o.onmousedown=()=>{i.canDrag=!1},o.onmouseenter=()=>{i.canHover=!1,t.canScroll=!1},o.onmouseleave=()=>{i.canHover=!0,t.canScroll=!0},new we("title","titleDiv","RES LENSES");let l=document.createElement("div");l.id="sideDiv",document.body.appendChild(l),l.style.width="0px",l.onmouseenter=()=>{i.canHover=!1,t.canScroll=!1},l.onmouseleave=()=>{i.canHover=!0,t.canScroll=!0};let c=document.createElement("div");c.id="topDiv",c.onmousedown=()=>{i.canDrag=!1},document.body.appendChild(c);let h=document.createElement("div");h.id="bottomDiv",h.onmousedown=()=>{i.canDrag=!1},h.onmouseenter=()=>{i.canHover=!1},h.onmouseleave=()=>{i.canHover=!0},document.body.appendChild(h);let u=()=>{i.canDrag=!0,i.canHover=!0};new Ai("innerBottom","bottomDiv",!1);let p=new we("from display","topDiv","From: NA");i.displayFrom=p;let m=new we("to display","topDiv","To: NA");i.displayTo=m;let g=new we("amount display","topDiv","Total: NA");i.displayAmount=g,new Is("Return to Origin","innerBottom",()=>{t.resetCamera()}).setToolTip(n.resetPosition,"topTooltip");let d,f=()=>{d.button.button.disabled=!0,d.button.button.innerHTML="Loading ResDB ...";let X=r;t.isDataLoaded=!1,u(),Vs(X,Z=>{t.isDataLoaded=!0,t.loadedChunks=new Map,i.dataType=0,i.loadData(Z),d.button.button.disabled=!1,d.button.button.innerHTML="Data: ResDB"})},T=()=>{d.button.button.disabled=!0,d.button.button.innerHTML="Loading Ethereum ...";let X=s;t.isDataLoaded=!1,u(),Vs(X,Z=>{t.isDataLoaded=!0,t.loadedChunks=new Map,i.dataType=1,i.loadData(Z),d.button.button.disabled=!1,d.button.button.innerHTML="Data: Ethereum"})};d=new lr("SelectData","innerBottom","Data",[["ResDB",f,n.resDBData],["Ethereum",T,n.ethData]]),d.button.setToolTip(n.dataSelect,"topTooltip");let M=()=>{i.toggleSort=0,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()},b=()=>{i.toggleSort=1,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()},O=()=>{i.toggleSort=2,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()};new lr("sortSelect","innerBottom","Sort by",[["Transactions Total",M,n.transactionTotal],["Number of Transactions",b,n.numTransactions],["Largest Transaction",O,n.largestTransaction]]).button.setToolTip(n.sortSelect,"topTooltip");let A=()=>{t.setCamera(0),i.loadData(i.dataToLoad),t.clearChunks(),u()},k=()=>{t.setCamera(1),i.loadData(i.dataToLoad),t.clearChunks(),u()};new lr("ViewSelect","innerBottom","View",[["Grid",A,n.grid],["Bar",k,n.bar]]).button.setToolTip(n.viewSelect,"topTooltip");let x=()=>{console.log("func 1"),i.symmetrical=!0,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()},N=()=>{console.log("func 2"),i.symmetrical=!1,t.clearChunks(),i.createTempBlocks(),i.loadData(i.dataToLoad),u()};new lr("SymmetrySelect","innerBottom","Symmetry",[["False",N,n.asymmetric],["True",x,n.symmetric]]).button.setToolTip(n.symmetrySelect,"topTooltip");let C=!1,G=new we("Help button","helpDiv","?");o.style.height="calc(100% - 260px)",o.style.textAlign="left",G.label.innerHTML=al,G.div.style.fontSize="16px",o.style.overflowY="scroll",C=!0,G.div.onmousedown=()=>{C?(o.style.height="20px",o.style.textAlign="center",G.label.innerHTML="?",G.div.style.fontSize="30px",o.style.overflowY="hidden",C=!1):(o.style.height="calc(100% - 260px)",o.style.textAlign="left",G.label.innerHTML=al,G.div.style.fontSize="16px",o.style.overflowY="scroll",C=!0)}}async function S_(){const i="BQYd0rsSmffBzkLkUs5bJkqCPlHKZPiz";JSON.stringify({query:` query ($network: EthereumNetwork!, $limit: Int!, $offset: Int!, $from: ISO8601DateTime, $till: ISO8601DateTime) { ethereum(network: $network) { transfers( @@ -3862,4 +3862,4 @@ void main() { } } } - `,variables:{limit:5,offset:0,network:"ethclassic",from:"2024-04-05T10:04:56.000Z",till:"2024-04-05T10:34:56.999Z",dateFormat:"%Y-%m-%d"}})}const M_={placeholder:"Placeholder text",resetPosition:"Return to Origin: Reset the position of the camera to the top left corner",dataSelect:"Data: Select the source of the data you wish to view.",sortSelect:"Sort: Select how the addresses is sorted from top/left to bottom/right.",viewSelect:"View: Select which format you wish to view the data in.",scaleSelect:"Scale: Select the relative scaling of the data.",symmetrySelect:"Symmetry: Select whether or not the transactions are symmetrical",resDBData:"ResDB: This is live data from the Resilient DB network. This data is updated once every hour.",ethData:"Ethereum: This is data procurred from the Ethereum Mainnet network. This data is the cummulation of random sampling of 1000 transactions every 30 minutes for the last 24 hours. Takes a few seconds to load.",TransactionTotal:"Transactions Total: Sorts addresses based on the total summation of all UTXO they've sent out",numTransactions:"Number of Transactions: Sorts addresses based on the number of transactions they've sent out",largestTransaction:"Largest Transaction: Sorts the activity between all pairs of users first based on UTXO totals, then sorts addresses based high activity pairs. Recommended for highly sparse data such as Ethereum. Bars will likely form in a diagonal",grid:"Grid: Display a 2D grid representing pairwise activity between address A and address B",bar:"Bar: Display a bar graph representing the total activity of each address",linear:"Linear: Bars are linearly scaled.",log:"Log: Bars are logarithmically scaled.",symmetric:"True: Transactions sent to and from an address are both accounted for and summed up regarding activity per From/To pair of addresses.",asymmetric:"False: Only transactions sent to the recieving address is accounted for activity per From/To pair of addresses."};function E_(){let i=Nm();const t=i.scene,e=i.camera,n=i.renderer,r=i.lights,s=new Hm(t,e),a=new Xm(t,e,s);let o="https://res-lenses-backend.resilientdb.com/getData_RESDB",l="https://res-lenses-backend.resilientdb.com/getData_ETH";Vs(o,f=>{s.loadData(f),a.isDataLoaded=!0,x_(s,a,f,M_,o,l)});function c(f){a.onMouseMove(f)}function h(f){a.onMouseDown(f)}function u(f){a.onMouseUp(f)}function p(f){a.onWheelEvent(f)}function m(f){a.onMouseDblClick(f)}function g(f){a.onMouseClick(f)}window.addEventListener("mousemove",c,!1),document.body.addEventListener("mousedown",h,!0),document.body.addEventListener("mouseup",u,!0),document.body.addEventListener("wheel",p,!0),document.body.addEventListener("dblclick",m,!0),document.body.addEventListener("click",g,!0);function _(){requestAnimationFrame(_),a.update(),s.update(),r.position.x=e.position.x,r.position.z=e.position.z,n.render(t,e)}S_(),_()}E_(); + `,variables:{limit:5,offset:0,network:"ethclassic",from:"2024-04-05T10:04:56.000Z",till:"2024-04-05T10:34:56.999Z",dateFormat:"%Y-%m-%d"}})}const M_={placeholder:"Placeholder text",resetPosition:"Return to Origin: Reset the position of the camera to the top left corner",dataSelect:"Data: Select the source of the data you wish to view.",sortSelect:"Sort: Select how the addresses is sorted from top/left to bottom/right.",viewSelect:"View: Select which format you wish to view the data in.",scaleSelect:"Scale: Select the relative scaling of the data.",symmetrySelect:"Symmetry: Select whether or not the transactions are symmetrical",resDBData:"ResDB: This is live data from the Resilient DB network. This data is updated once every hour.",ethData:"Ethereum: This is data procurred from the Ethereum Mainnet network. This data is the cummulation of random sampling of 1000 transactions every 30 minutes for the last 24 hours. Takes a few seconds to load.",TransactionTotal:"Transactions Total: Sorts addresses based on the total summation of all UTXO they've sent out",numTransactions:"Number of Transactions: Sorts addresses based on the number of transactions they've sent out",largestTransaction:"Largest Transaction: Sorts the activity between all pairs of users first based on UTXO totals, then sorts addresses based high activity pairs. Recommended for highly sparse data such as Ethereum. Bars will likely form in a diagonal",grid:"Grid: Display a 2D grid representing pairwise activity between address A and address B",bar:"Bar: Display a bar graph representing the total activity of each address",linear:"Linear: Bars are linearly scaled.",log:"Log: Bars are logarithmically scaled.",symmetric:"True: Transactions sent to and from an address are both accounted for and summed up regarding activity per From/To pair of addresses.",asymmetric:"False: Only transactions sent to the recieving address is accounted for activity per From/To pair of addresses."};function E_(){let i=Nm();const t=i.scene,e=i.camera,n=i.renderer,r=i.lights,s=new Hm(t,e),a=new Xm(t,e,s);let o="https://res-lenses-backend.resilientdb.com/getData_RESDB",l="https://res-lenses-backend.resilientdb.com/getData_ETH";Vs(o,d=>{s.loadData(d),a.isDataLoaded=!0,x_(s,a,d,M_,o,l)});function c(d){a.onMouseMove(d)}function h(d){a.onMouseDown(d)}function u(d){a.onMouseUp(d)}function p(d){a.onWheelEvent(d)}function m(d){a.onMouseDblClick(d)}function g(d){a.onMouseClick(d)}window.addEventListener("mousemove",c,!1),document.body.addEventListener("mousedown",h,!0),document.body.addEventListener("mouseup",u,!0),document.body.addEventListener("wheel",p,!0),document.body.addEventListener("dblclick",m,!0),document.body.addEventListener("click",g,!0);function _(){requestAnimationFrame(_),a.update(),s.update(),r.position.x=e.position.x,r.position.z=e.position.z,n.render(t,e)}S_(),_()}E_(); diff --git a/index.html b/index.html index b3a53626..caba3bd4 100644 --- a/index.html +++ b/index.html @@ -7,8 +7,8 @@ - - + +