"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[934],{4250:function(t,e,i){let s;i.d(e,{$YQ:function(){return rl},BFQ:function(){return tJ},BG$:function(){return t4},BVF:function(){return j},Bf4:function(){return to},Bgp:function(){return ts},BtG:function(){return s4},CaW:function(){return tY},CdI:function(){return K},CtA:function(){return tU},Cy:function(){return V},D1R:function(){return tx},D67:function(){return ev},D9w:function(){return tL},Djp:function(){return t5},DvJ:function(){return sZ},E2K:function(){return tW},EcG:function(){return nI},EoG:function(){return $},F1y:function(){return eM},FM8:function(){return eV},FUD:function(){return ee},GG6:function(){return t8},GUF:function(){return ef},Gih:function(){return et},H7L:function(){return ej},HdW:function(){return eh},HkE:function(){return nS},Hy8:function(){return P},I3e:function(){return eP},ILR:function(){return tH},IOt:function(){return ep},Ilk:function(){return sm},JOQ:function(){return rn},JQ4:function(){return t_},JUT:function(){return e8},Jjb:function(){return ez},KI_:function(){return ey},KhW:function(){return T},Kj0:function(){return sq},Kz5:function(){return tS},L5s:function(){return nw},LSk:function(){return eT},LY2:function(){return te},LgZ:function(){return k},LsT:function(){return tw},Ltg:function(){return e4},Lun:function(){return nn},M$G:function(){return ew},M5h:function(){return x},M6v:function(){return Z},N4l:function(){return g},NDo:function(){return Y},NKc:function(){return L},NYV:function(){return t6},NiX:function(){return s8},Ns1:function(){return G},O4K:function(){return eJ},O5A:function(){return eW},O78:function(){return e_},ORg:function(){return tr},OTo:function(){return tN},OoA:function(){return tp},PA7:function(){return ed},Pa4:function(){return ie},PeU:function(){return n},QO2:function(){return ea},Qey:function(){return eq},Rhp:function(){return sX},RlZ:function(){return I},S2y:function(){return h},S9g:function(){return iD},Se2:function(){return U},Sm8:function(){return _},SvJ:function(){return es},T6w:function(){return eA},T95:function(){return tv},TlE:function(){return sw},TyD:function(){return td},UCm:function(){return tP},USm:function(){return iW},UZH:function(){return r},Vdb:function(){return E},Vkp:function(){return eF},VzW:function(){return tz},WMw:function(){return f},Wbm:function(){return M},Wid:function(){return ns},Wl3:function(){return c},Wpd:function(){return B},Xaj:function(){return b},Y8D:function(){return tB},YGz:function(){return tt},YLQ:function(){return tm},ZAu:function(){return s7},ZTh:function(){return el},Zen:function(){return eS},Zr5:function(){return W},ZzF:function(){return ir},_12:function(){return r4},_AM:function(){return tZ},_Li:function(){return p},_RZ:function(){return eC},_iA:function(){return o},_wr:function(){return R},aCh:function(){return em},aH4:function(){return ty},aLr:function(){return i_},av9:function(){return tj},bGH:function(){return v},bdR:function(){return y},brP:function(){return tV},bsb:function(){return er},c8b:function(){return z},cLu:function(){return tA},cPb:function(){return s3},cRx:function(){return tI},cac:function(){return eU},dSO:function(){return th},dZ3:function(){return ti},dd2:function(){return e7},dpR:function(){return nv},dwf:function(){return sG},dwk:function(){return u},eD:function(){return J},eaV:function(){return tX},ehD:function(){return d},ekQ:function(){return tK},epp:function(){return eY},f2y:function(){return en},fSK:function(){return N},fY$:function(){return tn},fto:function(){return tQ},g8_:function(){return tl},ghN:function(){return A},gi4:function(){return t3},hEm:function(){return tF},iAb:function(){return tM},iKG:function(){return nM},iWC:function(){return C},iWj:function(){return ro},iiP:function(){return ei},irR:function(){return tC},j17:function(){return ex},jFi:function(){return m},jZA:function(){return t1},jes:function(){return F},jyz:function(){return s$},k0A:function(){return tT},k74:function(){return O},ksN:function(){return q},l0P:function(){return t$},l6D:function(){return eg},lCJ:function(){return s_},lGU:function(){return eu},lRF:function(){return nr},lb7:function(){return re},mSO:function(){return ec},ntZ:function(){return l},oAp:function(){return s6},oDz:function(){return sY},p3g:function(){return e9},pBf:function(){return eO},pKu:function(){return t9},ptH:function(){return t0},qhX:function(){return X},qkB:function(){return tR},qlB:function(){return sS},qyh:function(){return tg},rDY:function(){return sQ},rOj:function(){return w},r_:function(){return S},rpg:function(){return tu},tNt:function(){return eH},tQZ:function(){return tk},tm_:function(){return a},u9r:function(){return sE},uL9:function(){return Q},uWy:function(){return tc},v3W:function(){return tq},vBJ:function(){return sx},vCF:function(){return D},vCx:function(){return tG},vuL:function(){return eo},vxC:function(){return ta},w$m:function(){return H},wJv:function(){return tO},wem:function(){return tf},wk1:function(){return tE},wuA:function(){return tD},xEZ:function(){return e5},xJs:function(){return t7},xoQ:function(){return eb},xsS:function(){return rt},y2t:function(){return t2},yGw:function(){return iP},yHo:function(){return eZ},ywz:function(){return tb}});/** * @license * Copyright 2010-2025 Three.js Authors * SPDX-License-Identifier: MIT */ let r="174",n=0,a=1,h=2,o=1,l=2,u=3,c=0,p=1,d=2,m=0,y=1,f=2,g=3,x=4,b=5,v=100,M=101,w=102,S=103,_=104,z=200,A=201,T=202,C=203,O=204,k=205,N=206,P=207,E=208,B=209,I=210,R=211,V=212,F=213,L=214,j=0,U=1,W=2,D=3,J=4,q=5,H=6,Z=7,G=0,X=1,Y=2,Q=0,$=1,K=2,tt=3,te=4,ti=5,ts=6,tr=7,tn=301,ta=302,th=303,to=304,tl=306,tu=1e3,tc=1001,tp=1002,td=1003,tm=1004,ty=1005,tf=1006,tg=1007,tx=1008,tb=1009,tv=1010,tM=1011,tw=1012,tS=1013,t_=1014,tz=1015,tA=1016,tT=1017,tC=1018,tO=1020,tk=35902,tN=1021,tP=1022,tE=1023,tB=1024,tI=1025,tR=1026,tV=1027,tF=1028,tL=1029,tj=1030,tU=1031,tW=1033,tD=33776,tJ=33777,tq=33778,tH=33779,tZ=35840,tG=35841,tX=35842,tY=35843,tQ=36196,t$=37492,tK=37496,t0=37808,t1=37809,t2=37810,t3=37811,t5=37812,t4=37813,t6=37814,t7=37815,t9=37816,t8=37817,et=37818,ee=37819,ei=37820,es=37821,er=36492,en=36494,ea=36495,eh=36283,eo=36284,el=36285,eu=36286,ec=3201,ep=0,ed=1,em="",ey="srgb",ef="srgb-linear",eg="linear",ex="srgb",eb=512,ev=513,eM=514,ew=515,eS=516,e_=517,ez=518,eA=519,eT="300 es",eC=2e3;class eO{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){let i=this._listeners;return void 0!==i&&void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){let i=this._listeners;if(void 0===i)return;let s=i[t];if(void 0!==s){let r=s.indexOf(e);-1!==r&&s.splice(r,1)}}dispatchEvent(t){let e=this._listeners;if(void 0===e)return;let i=e[t.type];if(void 0!==i){t.target=this;let s=i.slice(0);for(let r=0,n=s.length;r<n;r++)s[r].call(this,t);t.target=null}}}let ek=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],eN=Math.PI/180,eP=180/Math.PI;function eE(){let t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,r=ek[255&t]+ek[t>>8&255]+ek[t>>16&255]+ek[t>>24&255]+"-"+ek[255&e]+ek[e>>8&255]+"-"+ek[e>>16&15|64]+ek[e>>24&255]+"-"+ek[63&i|128]+ek[i>>8&255]+"-"+ek[i>>16&255]+ek[i>>24&255]+ek[255&s]+ek[s>>8&255]+ek[s>>16&255]+ek[s>>24&255];return r.toLowerCase()}function eB(t,e,i){return Math.max(e,Math.min(i,t))}function eI(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw Error("Invalid component type.")}}function eR(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw Error("Invalid component type.")}}class eV{constructor(t=0,e=0){eV.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 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 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){let e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[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=eB(this.x,t.x,e.x),this.y=eB(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=eB(this.x,t,e),this.y=eB(this.y,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(eB(i,t,e))}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(){let t=Math.atan2(-this.y,-this.x)+Math.PI;return t}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(eB(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}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,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,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){let i=Math.cos(e),s=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*i-n*s+t.x,this.y=r*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class eF{constructor(t,e,i,s,r,n,a,h,o){eF.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,h,o)}set(t,e,i,s,r,n,a,h,o){let l=this.elements;return l[0]=t,l[1]=s,l[2]=a,l[3]=e,l[4]=r,l[5]=h,l[6]=i,l[7]=n,l[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let 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){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[3],h=i[6],o=i[1],l=i[4],u=i[7],c=i[2],p=i[5],d=i[8],m=s[0],y=s[3],f=s[6],g=s[1],x=s[4],b=s[7],v=s[2],M=s[5],w=s[8];return r[0]=n*m+a*g+h*v,r[3]=n*y+a*x+h*M,r[6]=n*f+a*b+h*w,r[1]=o*m+l*g+u*v,r[4]=o*y+l*x+u*M,r[7]=o*f+l*b+u*w,r[2]=c*m+p*g+d*v,r[5]=c*y+p*x+d*M,r[8]=c*f+p*b+d*w,this}multiplyScalar(t){let 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(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],h=t[6],o=t[7],l=t[8];return e*n*l-e*a*o-i*r*l+i*a*h+s*r*o-s*n*h}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],h=t[6],o=t[7],l=t[8],u=l*n-a*o,c=a*h-l*r,p=o*r-n*h,d=e*u+i*c+s*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);let m=1/d;return t[0]=u*m,t[1]=(s*o-l*i)*m,t[2]=(a*i-s*n)*m,t[3]=c*m,t[4]=(l*e-s*h)*m,t[5]=(s*r-a*e)*m,t[6]=p*m,t[7]=(i*h-o*e)*m,t[8]=(n*e-i*r)*m,this}transpose(){let t;let 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){let 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,i,s,r,n,a){let h=Math.cos(r),o=Math.sin(r);return this.set(i*h,i*o,-i*(h*n+o*a)+n+t,-s*o,s*h,-s*(-o*n+h*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(eL.makeScale(t,e)),this}rotate(t){return this.premultiply(eL.makeRotation(-t)),this}translate(t,e){return this.premultiply(eL.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){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let s=0;s<9;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}}let eL=new eF;function ej(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function eU(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function eW(){let t=eU("canvas");return t.style.display="block",t}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let eD={};function eJ(t){t in eD||(eD[t]=!0,console.warn(t))}function eq(t,e,i){return new Promise(function(s,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,i);break;default:s()}},i)})}function eH(t){let e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function eZ(t){let e=t.elements,i=-1===e[11];i?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}let eG=new eF().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),eX=new eF().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),eY=function(){let t={enabled:!0,workingColorSpace:ef,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i&&(this.spaces[e].transfer===ex&&(t.r=eQ(t.r),t.g=eQ(t.g),t.b=eQ(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===ex&&(t.r=e$(t.r),t.g=e$(t.g),t.b=e$(t.b))),t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===em?eg:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],s=[.3127,.329];return t.define({[ef]:{primaries:e,whitePoint:s,transfer:eg,toXYZ:eG,fromXYZ:eX,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:ey},outputColorSpaceConfig:{drawingBufferColorSpace:ey}},[ey]:{primaries:e,whitePoint:s,transfer:ex,toXYZ:eG,fromXYZ:eX,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:ey}}}),t}();function eQ(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function e$(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class eK{static getDataURL(t){let e;if(/^data:/i.test(t.src)||"undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)e=t;else{void 0===s&&(s=eU("canvas")),s.width=t.width,s.height=t.height;let i=s.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=s}return e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){let e=eU("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let s=i.getImageData(0,0,t.width,t.height),r=s.data;for(let n=0;n<r.length;n++)r[n]=255*eQ(r[n]/255);return i.putImageData(s,0,0),e}if(!t.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t;{let a=t.data.slice(0);for(let h=0;h<a.length;h++)a instanceof Uint8Array||a instanceof Uint8ClampedArray?a[h]=Math.floor(255*eQ(a[h]/255)):a[h]=eQ(a[h]);return{data:a,width:t.width,height:t.height}}}}let e0=0;class e1{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:e0++}),this.uuid=eE(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];let i={uuid:this.uuid,url:""},s=this.data;if(null!==s){let r;if(Array.isArray(s)){r=[];for(let n=0,a=s.length;n<a;n++)s[n].isDataTexture?r.push(e2(s[n].image)):r.push(e2(s[n]))}else r=e2(s);i.url=r}return e||(t.images[this.uuid]=i),i}}function e2(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?eK.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let e3=0;class e5 extends eO{constructor(t=e5.DEFAULT_IMAGE,e=e5.DEFAULT_MAPPING,i=tc,s=tc,r=tf,n=tx,a=tE,h=tb,o=e5.DEFAULT_ANISOTROPY,l=em){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:e3++}),this.uuid=eE(),this.name="",this.source=new e1(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=n,this.anisotropy=o,this.format=a,this.internalFormat=null,this.type=h,this.offset=new eV(0,0),this.repeat=new eV(1,1),this.center=new eV(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new eF,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];let i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case tu:t.x=t.x-Math.floor(t.x);break;case tc:t.x=t.x<0?0:1;break;case tp:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case tu:t.y=t.y-Math.floor(t.y);break;case tc:t.y=t.y<0?0:1;break;case tp:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}e5.DEFAULT_IMAGE=null,e5.DEFAULT_MAPPING=300,e5.DEFAULT_ANISOTROPY=1;class e4{constructor(t=0,e=0,i=0,s=1){e4.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}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,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,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 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 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=void 0!==t.w?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){let e=this.x,i=this.y,s=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s+n[12]*r,this.y=n[1]*e+n[5]*i+n[9]*s+n[13]*r,this.z=n[2]*e+n[6]*i+n[10]*s+n[14]*r,this.w=n[3]*e+n[7]*i+n[11]*s+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let 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,i,s;let r=t.elements,n=r[0],a=r[4],h=r[8],o=r[1],l=r[5],u=r[9],c=r[2],p=r[6],d=r[10];if(.01>Math.abs(a-o)&&.01>Math.abs(h-c)&&.01>Math.abs(u-p)){if(.1>Math.abs(a+o)&&.1>Math.abs(h+c)&&.1>Math.abs(u+p)&&.1>Math.abs(n+l+d-3))return this.set(1,0,0,0),this;let m=(n+1)/2,y=(l+1)/2,f=(d+1)/2,g=(a+o)/4,x=(h+c)/4,b=(u+p)/4;return m>y&&m>f?m<.01?(e=0,i=.707106781,s=.707106781):(i=g/(e=Math.sqrt(m)),s=x/e):y>f?y<.01?(e=.707106781,i=0,s=.707106781):(e=g/(i=Math.sqrt(y)),s=b/i):f<.01?(e=.707106781,i=.707106781,s=0):(e=x/(s=Math.sqrt(f)),i=b/s),this.set(e,i,s,Math.PI),this}let v=Math.sqrt((p-u)*(p-u)+(h-c)*(h-c)+(o-a)*(o-a));return .001>Math.abs(v)&&(v=1),this.x=(p-u)/v,this.y=(h-c)/v,this.z=(o-a)/v,this.w=Math.acos((n+l+d-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],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=eB(this.x,t.x,e.x),this.y=eB(this.y,t.y,e.y),this.z=eB(this.z,t.z,e.z),this.w=eB(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=eB(this.x,t,e),this.y=eB(this.y,t,e),this.z=eB(this.z,t,e),this.w=eB(this.w,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(eB(i,t,e))}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,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,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 e6 extends eO{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new e4(0,0,t,e),this.scissorTest=!1,this.viewport=new e4(0,0,t,e),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:tf,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);let s=new e5({width:t,height:e,depth:1},i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];let r=i.count;for(let n=0;n<r;n++)this.textures[n]=s.clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=i;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let s=Object.assign({},t.textures[e].image);this.textures[e].source=new e1(s)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class e7 extends e6{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class e9 extends e5{constructor(t=null,e=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=td,this.minFilter=td,this.wrapR=tc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class e8 extends e5{constructor(t=null,e=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=td,this.minFilter=td,this.wrapR=tc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class it{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,r,n,a){let h=i[s+0],o=i[s+1],l=i[s+2],u=i[s+3],c=r[n+0],p=r[n+1],d=r[n+2],m=r[n+3];if(0===a){t[e+0]=h,t[e+1]=o,t[e+2]=l,t[e+3]=u;return}if(1===a){t[e+0]=c,t[e+1]=p,t[e+2]=d,t[e+3]=m;return}if(u!==m||h!==c||o!==p||l!==d){let y=1-a,f=h*c+o*p+l*d+u*m,g=f>=0?1:-1,x=1-f*f;if(x>Number.EPSILON){let b=Math.sqrt(x),v=Math.atan2(b,f*g);y=Math.sin(y*v)/b,a=Math.sin(a*v)/b}let M=a*g;if(h=h*y+c*M,o=o*y+p*M,l=l*y+d*M,u=u*y+m*M,y===1-a){let w=1/Math.sqrt(h*h+o*o+l*l+u*u);h*=w,o*=w,l*=w,u*=w}}t[e]=h,t[e+1]=o,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,s,r,n){let a=i[s],h=i[s+1],o=i[s+2],l=i[s+3],u=r[n],c=r[n+1],p=r[n+2],d=r[n+3];return t[e]=a*d+l*u+h*p-o*c,t[e+1]=h*d+l*c+o*u-a*p,t[e+2]=o*d+l*p+a*c-h*u,t[e+3]=l*d-a*u-h*c-o*p,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,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,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){let i=t._x,s=t._y,r=t._z,n=t._order,a=Math.cos,h=Math.sin,o=a(i/2),l=a(s/2),u=a(r/2),c=h(i/2),p=h(s/2),d=h(r/2);switch(n){case"XYZ":this._x=c*l*u+o*p*d,this._y=o*p*u-c*l*d,this._z=o*l*d+c*p*u,this._w=o*l*u-c*p*d;break;case"YXZ":this._x=c*l*u+o*p*d,this._y=o*p*u-c*l*d,this._z=o*l*d-c*p*u,this._w=o*l*u+c*p*d;break;case"ZXY":this._x=c*l*u-o*p*d,this._y=o*p*u+c*l*d,this._z=o*l*d+c*p*u,this._w=o*l*u-c*p*d;break;case"ZYX":this._x=c*l*u-o*p*d,this._y=o*p*u+c*l*d,this._z=o*l*d-c*p*u,this._w=o*l*u+c*p*d;break;case"YZX":this._x=c*l*u+o*p*d,this._y=o*p*u+c*l*d,this._z=o*l*d-c*p*u,this._w=o*l*u-c*p*d;break;case"XZY":this._x=c*l*u-o*p*d,this._y=o*p*u-c*l*d,this._z=o*l*d+c*p*u,this._w=o*l*u+c*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],s=e[4],r=e[8],n=e[1],a=e[5],h=e[9],o=e[2],l=e[6],u=e[10],c=i+a+u;if(c>0){let p=.5/Math.sqrt(c+1);this._w=.25/p,this._x=(l-h)*p,this._y=(r-o)*p,this._z=(n-s)*p}else if(i>a&&i>u){let d=2*Math.sqrt(1+i-a-u);this._w=(l-h)/d,this._x=.25*d,this._y=(s+n)/d,this._z=(r+o)/d}else if(a>u){let m=2*Math.sqrt(1+a-i-u);this._w=(r-o)/m,this._x=(s+n)/m,this._y=.25*m,this._z=(h+l)/m}else{let y=2*Math.sqrt(1+u-i-a);this._w=(n-s)/y,this._x=(r+o)/y,this._y=(h+l)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(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=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(eB(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);return 0===i||this.slerp(t,Math.min(1,e/i)),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 0===t?(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){let i=t._x,s=t._y,r=t._z,n=t._w,a=e._x,h=e._y,o=e._z,l=e._w;return this._x=i*l+n*a+s*o-r*h,this._y=s*l+n*h+r*a-i*o,this._z=r*l+n*o+i*h-s*a,this._w=n*l-i*a-s*h-r*o,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);let i=this._x,s=this._y,r=this._z,n=this._w,a=n*t._w+i*t._x+s*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=n,this._x=i,this._y=s,this._z=r,this;let h=1-a*a;if(h<=Number.EPSILON){let o=1-e;return this._w=o*n+e*this._w,this._x=o*i+e*this._x,this._y=o*s+e*this._y,this._z=o*r+e*this._z,this.normalize(),this}let l=Math.sqrt(h),u=Math.atan2(l,a),c=Math.sin((1-e)*u)/l,p=Math.sin(e*u)/l;return this._w=n*c+this._w*p,this._x=i*c+this._x*p,this._y=s*c+this._y*p,this._z=r*c+this._z*p,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*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 ie{constructor(t=0,e=0,i=0){ie.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,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 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 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(is.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(is.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,s=this.z,r=t.elements,n=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*n,this}applyQuaternion(t){let e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,a=t.z,h=t.w,o=2*(n*s-a*i),l=2*(a*e-r*s),u=2*(r*i-n*e);return this.x=e+h*o+n*u-a*l,this.y=i+h*l+a*o-r*u,this.z=s+h*u+r*l-n*o,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,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=eB(this.x,t.x,e.x),this.y=eB(this.y,t.y,e.y),this.z=eB(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=eB(this.x,t,e),this.y=eB(this.y,t,e),this.z=eB(this.z,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(eB(i,t,e))}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,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,s=t.y,r=t.z,n=e.x,a=e.y,h=e.z;return this.x=s*h-r*a,this.y=r*n-i*h,this.z=i*a-s*n,this}projectOnVector(t){let e=t.lengthSq();if(0===e)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return ii.copy(this).projectOnVector(t),this.sub(ii)}reflect(t){return this.sub(ii.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(eB(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}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,i){let s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}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(){let t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let ii=new ie,is=new it;class ir{constructor(t=new ie(Infinity,Infinity,Infinity),e=new ie(-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,i=t.length;e<i;e+=3)this.expandByPoint(ih.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(ih.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=ih.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let i=t.geometry;if(void 0!==i){let s=i.getAttribute("position");if(!0===e&&void 0!==s&&!0!==t.isInstancedMesh)for(let r=0,n=s.count;r<n;r++)!0===t.isMesh?t.getVertexPosition(r,ih):ih.fromBufferAttribute(s,r),ih.applyMatrix4(t.matrixWorld),this.expandByPoint(ih);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),io.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),io.copy(i.boundingBox)),io.applyMatrix4(t.matrixWorld),this.union(io)}let a=t.children;for(let h=0,o=a.length;h<o;h++)this.expandByObject(a[h],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.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.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,ih),ih.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(iy),ig.subVectors(this.max,iy),il.subVectors(t.a,iy),iu.subVectors(t.b,iy),ic.subVectors(t.c,iy),ip.subVectors(iu,il),id.subVectors(ic,iu),im.subVectors(il,ic);let e=[0,-ip.z,ip.y,0,-id.z,id.y,0,-im.z,im.y,ip.z,0,-ip.x,id.z,0,-id.x,im.z,0,-im.x,-ip.y,ip.x,0,-id.y,id.x,0,-im.y,im.x,0];return!!(iv(e,il,iu,ic,ig)&&iv(e=[1,0,0,0,1,0,0,0,1],il,iu,ic,ig))&&(ix.crossVectors(ip,id),iv(e=[ix.x,ix.y,ix.z],il,iu,ic,ig))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ih).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(ih).length()),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()||(ia[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ia[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ia[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ia[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ia[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ia[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ia[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ia[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ia)),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)}}let ia=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],ih=new ie,io=new ir,il=new ie,iu=new ie,ic=new ie,ip=new ie,id=new ie,im=new ie,iy=new ie,ig=new ie,ix=new ie,ib=new ie;function iv(t,e,i,s,r){for(let n=0,a=t.length-3;n<=a;n+=3){ib.fromArray(t,n);let h=r.x*Math.abs(ib.x)+r.y*Math.abs(ib.y)+r.z*Math.abs(ib.z),o=e.dot(ib),l=i.dot(ib),u=s.dot(ib);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>h)return!1}return!0}let iM=new ir,iw=new ie,iS=new ie;class i_{constructor(t=new ie,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){let i=this.center;void 0!==e?i.copy(e):iM.setFromPoints(t).getCenter(i);let s=0;for(let r=0,n=t.length;r<n;r++)s=Math.max(s,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let i=this.center.distanceToSquared(t);return e.copy(t),i>this.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;iw.subVectors(t,this.center);let e=iw.lengthSq();if(e>this.radius*this.radius){let i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(iw,s/i),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(iS.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(iw.copy(t.center).add(iS)),this.expandByPoint(iw.copy(t.center).sub(iS))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}let iz=new ie,iA=new ie,iT=new ie,iC=new ie,iO=new ie,ik=new ie,iN=new ie;class iP{constructor(t,e,i,s,r,n,a,h,o,l,u,c,p,d,m,y){iP.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,s,r,n,a,h,o,l,u,c,p,d,m,y)}set(t,e,i,s,r,n,a,h,o,l,u,c,p,d,m,y){let f=this.elements;return f[0]=t,f[4]=e,f[8]=i,f[12]=s,f[1]=r,f[5]=n,f[9]=a,f[13]=h,f[2]=o,f[6]=l,f[10]=u,f[14]=c,f[3]=p,f[7]=d,f[11]=m,f[15]=y,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 iP().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let 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,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,i=t.elements,s=1/iE.setFromMatrixColumn(t,0).length(),r=1/iE.setFromMatrixColumn(t,1).length(),n=1/iE.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*n,e[9]=i[9]*n,e[10]=i[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,s=t.y,r=t.z,n=Math.cos(i),a=Math.sin(i),h=Math.cos(s),o=Math.sin(s),l=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){let c=n*l,p=n*u,d=a*l,m=a*u;e[0]=h*l,e[4]=-h*u,e[8]=o,e[1]=p+d*o,e[5]=c-m*o,e[9]=-a*h,e[2]=m-c*o,e[6]=d+p*o,e[10]=n*h}else if("YXZ"===t.order){let y=h*l,f=h*u,g=o*l,x=o*u;e[0]=y+x*a,e[4]=g*a-f,e[8]=n*o,e[1]=n*u,e[5]=n*l,e[9]=-a,e[2]=f*a-g,e[6]=x+y*a,e[10]=n*h}else if("ZXY"===t.order){let b=h*l,v=h*u,M=o*l,w=o*u;e[0]=b-w*a,e[4]=-n*u,e[8]=M+v*a,e[1]=v+M*a,e[5]=n*l,e[9]=w-b*a,e[2]=-n*o,e[6]=a,e[10]=n*h}else if("ZYX"===t.order){let S=n*l,_=n*u,z=a*l,A=a*u;e[0]=h*l,e[4]=z*o-_,e[8]=S*o+A,e[1]=h*u,e[5]=A*o+S,e[9]=_*o-z,e[2]=-o,e[6]=a*h,e[10]=n*h}else if("YZX"===t.order){let T=n*h,C=n*o,O=a*h,k=a*o;e[0]=h*l,e[4]=k-T*u,e[8]=O*u+C,e[1]=u,e[5]=n*l,e[9]=-a*l,e[2]=-o*l,e[6]=C*u+O,e[10]=T-k*u}else if("XZY"===t.order){let N=n*h,P=n*o,E=a*h,B=a*o;e[0]=h*l,e[4]=-u,e[8]=o*l,e[1]=N*u+B,e[5]=n*l,e[9]=P*u-E,e[2]=E*u-P,e[6]=a*l,e[10]=B*u+N}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(iI,t,iR)}lookAt(t,e,i){let s=this.elements;return iL.subVectors(t,e),0===iL.lengthSq()&&(iL.z=1),iL.normalize(),iV.crossVectors(i,iL),0===iV.lengthSq()&&(1===Math.abs(i.z)?iL.x+=1e-4:iL.z+=1e-4,iL.normalize(),iV.crossVectors(i,iL)),iV.normalize(),iF.crossVectors(iL,iV),s[0]=iV.x,s[4]=iF.x,s[8]=iL.x,s[1]=iV.y,s[5]=iF.y,s[9]=iL.y,s[2]=iV.z,s[6]=iF.z,s[10]=iL.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,s=e.elements,r=this.elements,n=i[0],a=i[4],h=i[8],o=i[12],l=i[1],u=i[5],c=i[9],p=i[13],d=i[2],m=i[6],y=i[10],f=i[14],g=i[3],x=i[7],b=i[11],v=i[15],M=s[0],w=s[4],S=s[8],_=s[12],z=s[1],A=s[5],T=s[9],C=s[13],O=s[2],k=s[6],N=s[10],P=s[14],E=s[3],B=s[7],I=s[11],R=s[15];return r[0]=n*M+a*z+h*O+o*E,r[4]=n*w+a*A+h*k+o*B,r[8]=n*S+a*T+h*N+o*I,r[12]=n*_+a*C+h*P+o*R,r[1]=l*M+u*z+c*O+p*E,r[5]=l*w+u*A+c*k+p*B,r[9]=l*S+u*T+c*N+p*I,r[13]=l*_+u*C+c*P+p*R,r[2]=d*M+m*z+y*O+f*E,r[6]=d*w+m*A+y*k+f*B,r[10]=d*S+m*T+y*N+f*I,r[14]=d*_+m*C+y*P+f*R,r[3]=g*M+x*z+b*O+v*E,r[7]=g*w+x*A+b*k+v*B,r[11]=g*S+x*T+b*N+v*I,r[15]=g*_+x*C+b*P+v*R,this}multiplyScalar(t){let 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(){let t=this.elements,e=t[0],i=t[4],s=t[8],r=t[12],n=t[1],a=t[5],h=t[9],o=t[13],l=t[2],u=t[6],c=t[10],p=t[14],d=t[3],m=t[7],y=t[11],f=t[15];return d*(+r*h*u-s*o*u-r*a*c+i*o*c+s*a*p-i*h*p)+m*(+e*h*p-e*o*c+r*n*c-s*n*p+s*o*l-r*h*l)+y*(+e*o*u-e*a*p-r*n*u+i*n*p+r*a*l-i*o*l)+f*(-s*a*l-e*h*u+e*a*c+s*n*u-i*n*c+i*h*l)}transpose(){let t;let e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(t,e,i){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],s=t[2],r=t[3],n=t[4],a=t[5],h=t[6],o=t[7],l=t[8],u=t[9],c=t[10],p=t[11],d=t[12],m=t[13],y=t[14],f=t[15],g=u*y*o-m*c*o+m*h*p-a*y*p-u*h*f+a*c*f,x=d*c*o-l*y*o-d*h*p+n*y*p+l*h*f-n*c*f,b=l*m*o-d*u*o+d*a*p-n*m*p-l*a*f+n*u*f,v=d*u*h-l*m*h-d*a*c+n*m*c+l*a*y-n*u*y,M=e*g+i*x+s*b+r*v;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let w=1/M;return t[0]=g*w,t[1]=(m*c*r-u*y*r-m*s*p+i*y*p+u*s*f-i*c*f)*w,t[2]=(a*y*r-m*h*r+m*s*o-i*y*o-a*s*f+i*h*f)*w,t[3]=(u*h*r-a*c*r-u*s*o+i*c*o+a*s*p-i*h*p)*w,t[4]=x*w,t[5]=(l*y*r-d*c*r+d*s*p-e*y*p-l*s*f+e*c*f)*w,t[6]=(d*h*r-n*y*r-d*s*o+e*y*o+n*s*f-e*h*f)*w,t[7]=(n*c*r-l*h*r+l*s*o-e*c*o-n*s*p+e*h*p)*w,t[8]=b*w,t[9]=(d*u*r-l*m*r-d*i*p+e*m*p+l*i*f-e*u*f)*w,t[10]=(n*m*r-d*a*r+d*i*o-e*m*o-n*i*f+e*a*f)*w,t[11]=(l*a*r-n*u*r-l*i*o+e*u*o+n*i*p-e*a*p)*w,t[12]=v*w,t[13]=(l*m*s-d*u*s+d*i*c-e*m*c-l*i*y+e*u*y)*w,t[14]=(d*a*s-n*m*s-d*i*h+e*m*h+n*i*y-e*a*y)*w,t[15]=(n*u*s-l*a*s+l*i*h-e*u*h-n*i*c+e*a*c)*w,this}scale(t){let e=this.elements,i=t.x,s=t.y,r=t.z;return e[0]*=i,e[4]*=s,e[8]*=r,e[1]*=i,e[5]*=s,e[9]*=r,e[2]*=i,e[6]*=s,e[10]*=r,e[3]*=i,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,s))}makeTranslation(t,e,i){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,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),s=Math.sin(e),r=1-i,n=t.x,a=t.y,h=t.z,o=r*n,l=r*a;return this.set(o*n+i,o*a-s*h,o*h+s*a,0,o*a+s*h,l*a+i,l*h-s*n,0,o*h-s*a,l*h+s*n,r*h*h+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,r,n){return this.set(1,i,r,0,t,1,n,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){let s=this.elements,r=e._x,n=e._y,a=e._z,h=e._w,o=r+r,l=n+n,u=a+a,c=r*o,p=r*l,d=r*u,m=n*l,y=n*u,f=a*u,g=h*o,x=h*l,b=h*u,v=i.x,M=i.y,w=i.z;return s[0]=(1-(m+f))*v,s[1]=(p+b)*v,s[2]=(d-x)*v,s[3]=0,s[4]=(p-b)*M,s[5]=(1-(c+f))*M,s[6]=(y+g)*M,s[7]=0,s[8]=(d+x)*w,s[9]=(y-g)*w,s[10]=(1-(c+m))*w,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){let s=this.elements,r=iE.set(s[0],s[1],s[2]).length(),n=iE.set(s[4],s[5],s[6]).length(),a=iE.set(s[8],s[9],s[10]).length(),h=this.determinant();h<0&&(r=-r),t.x=s[12],t.y=s[13],t.z=s[14],iB.copy(this);let o=1/r,l=1/n,u=1/a;return iB.elements[0]*=o,iB.elements[1]*=o,iB.elements[2]*=o,iB.elements[4]*=l,iB.elements[5]*=l,iB.elements[6]*=l,iB.elements[8]*=u,iB.elements[9]*=u,iB.elements[10]*=u,e.setFromRotationMatrix(iB),i.x=r,i.y=n,i.z=a,this}makePerspective(t,e,i,s,r,n,a=eC){let h,o;let l=this.elements;if(a===eC)h=-(n+r)/(n-r),o=-2*n*r/(n-r);else if(2001===a)h=-n/(n-r),o=-n*r/(n-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=2*r/(e-t),l[4]=0,l[8]=(e+t)/(e-t),l[12]=0,l[1]=0,l[5]=2*r/(i-s),l[9]=(i+s)/(i-s),l[13]=0,l[2]=0,l[6]=0,l[10]=h,l[14]=o,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,i,s,r,n,a=eC){let h,o;let l=this.elements,u=1/(e-t),c=1/(i-s),p=1/(n-r);if(a===eC)h=(n+r)*p,o=-2*p;else if(2001===a)h=r*p,o=-1*p;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-((e+t)*u),l[1]=0,l[5]=2*c,l[9]=0,l[13]=-((i+s)*c),l[2]=0,l[6]=0,l[10]=o,l[14]=-h,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let s=0;s<16;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}let iE=new ie,iB=new iP,iI=new ie(0,0,0),iR=new ie(1,1,1),iV=new ie,iF=new ie,iL=new ie,ij=new iP,iU=new it;class iW{constructor(t=0,e=0,i=0,s=iW.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}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,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,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,i=!0){let s=t.elements,r=s[0],n=s[4],a=s[8],h=s[1],o=s[5],l=s[9],u=s[2],c=s[6],p=s[10];switch(e){case"XYZ":this._y=Math.asin(eB(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(c,o),this._z=0);break;case"YXZ":this._x=Math.asin(-eB(l,-1,1)),.9999999>Math.abs(l)?(this._y=Math.atan2(a,p),this._z=Math.atan2(h,o)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(eB(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-n,o)):(this._y=0,this._z=Math.atan2(h,r));break;case"ZYX":this._y=Math.asin(-eB(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(c,p),this._z=Math.atan2(h,r)):(this._x=0,this._z=Math.atan2(-n,o));break;case"YZX":this._z=Math.asin(eB(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(-l,o),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-eB(n,-1,1)),.9999999>Math.abs(n)?(this._x=Math.atan2(c,o),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return ij.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ij,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return iU.setFromEuler(this),this.setFromQuaternion(iU,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],void 0!==t[3]&&(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}}iW.DEFAULT_ORDER="XYZ";class iD{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!=0}isEnabled(t){return(this.mask&(1<<t|0))!=0}}let iJ=0,iq=new ie,iH=new it,iZ=new iP,iG=new ie,iX=new ie,iY=new ie,iQ=new it,i$=new ie(1,0,0),iK=new ie(0,1,0),i0=new ie(0,0,1),i1={type:"added"},i2={type:"removed"},i3={type:"childadded",child:null},i5={type:"childremoved",child:null};class i4 extends eO{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:iJ++}),this.uuid=eE(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i4.DEFAULT_UP.clone();let t=new ie,e=new iW,i=new it,s=new ie(1,1,1);e._onChange(function(){i.setFromEuler(e,!1)}),i._onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new iP},normalMatrix:{value:new eF}}),this.matrix=new iP,this.matrixWorld=new iP,this.matrixAutoUpdate=i4.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i4.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new iD,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return iH.setFromAxisAngle(t,e),this.quaternion.multiply(iH),this}rotateOnWorldAxis(t,e){return iH.setFromAxisAngle(t,e),this.quaternion.premultiply(iH),this}rotateX(t){return this.rotateOnAxis(i$,t)}rotateY(t){return this.rotateOnAxis(iK,t)}rotateZ(t){return this.rotateOnAxis(i0,t)}translateOnAxis(t,e){return iq.copy(t).applyQuaternion(this.quaternion),this.position.add(iq.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(i$,t)}translateY(t){return this.translateOnAxis(iK,t)}translateZ(t){return this.translateOnAxis(i0,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(iZ.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?iG.copy(t):iG.set(t,e,i);let s=this.parent;this.updateWorldMatrix(!0,!1),iX.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?iZ.lookAt(iX,iG,this.up):iZ.lookAt(iG,iX,this.up),this.quaternion.setFromRotationMatrix(iZ),s&&(iZ.extractRotation(s.matrixWorld),iH.setFromRotationMatrix(iZ),this.quaternion.premultiply(iH.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(i1),i3.child=t,this.dispatchEvent(i3),i3.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let i=this.children.indexOf(t);return -1!==i&&(t.parent=null,this.children.splice(i,1),t.dispatchEvent(i2),i5.child=t,this.dispatchEvent(i5),i5.child=null),this}removeFromParent(){let t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),iZ.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),iZ.multiply(t.parent.matrixWorld)),t.applyMatrix4(iZ),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(i1),i3.child=t,this.dispatchEvent(i3),i3.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,s=this.children.length;i<s;i++){let r=this.children[i],n=r.getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);let s=this.children;for(let r=0,n=s.length;r<n;r++)s[r].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iX,t,iY),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iX,iQ,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);let e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){let e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let i=0,s=e.length;i<s;i++){let r=e[i];r.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){let s=this.children;for(let r=0,n=s.length;r<n;r++){let a=s[r];a.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let s={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),!0===this.castShadow&&(s.castShadow=!0),!0===this.receiveShadow&&(s.receiveShadow=!0),!1===this.visible&&(s.visible=!1),!1===this.frustumCulled&&(s.frustumCulled=!1),0!==this.renderOrder&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()})),s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(s.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),null!==this.boundingBox&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let n=this.geometry.parameters;if(void 0!==n&&void 0!==n.shapes){let a=n.shapes;if(Array.isArray(a))for(let h=0,o=a.length;h<o;h++){let l=a[h];r(t.shapes,l)}else r(t.shapes,a)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),void 0!==this.material){if(Array.isArray(this.material)){let u=[];for(let c=0,p=this.material.length;c<p;c++)u.push(r(t.materials,this.material[c]));s.material=u}else s.material=r(t.materials,this.material)}if(this.children.length>0){s.children=[];for(let d=0;d<this.children.length;d++)s.children.push(this.children[d].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let m=0;m<this.animations.length;m++){let y=this.animations[m];s.animations.push(r(t.animations,y))}}if(e){let f=_(t.geometries),g=_(t.materials),x=_(t.textures),b=_(t.images),v=_(t.shapes),M=_(t.skeletons),w=_(t.animations),S=_(t.nodes);f.length>0&&(i.geometries=f),g.length>0&&(i.materials=g),x.length>0&&(i.textures=x),b.length>0&&(i.images=b),v.length>0&&(i.shapes=v),M.length>0&&(i.skeletons=M),w.length>0&&(i.animations=w),S.length>0&&(i.nodes=S)}return i.object=s,i;function _(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}}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)),!0===e)for(let i=0;i<t.children.length;i++){let s=t.children[i];this.add(s.clone())}return this}}i4.DEFAULT_UP=new ie(0,1,0),i4.DEFAULT_MATRIX_AUTO_UPDATE=!0,i4.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let i6=new ie,i7=new ie,i9=new ie,i8=new ie,st=new ie,se=new ie,si=new ie,ss=new ie,sr=new ie,sn=new ie,sa=new e4,sh=new e4,so=new e4;class sl{constructor(t=new ie,e=new ie,i=new ie){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),i6.subVectors(t,e),s.cross(i6);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,i,s,r){i6.subVectors(s,e),i7.subVectors(i,e),i9.subVectors(t,e);let n=i6.dot(i6),a=i6.dot(i7),h=i6.dot(i9),o=i7.dot(i7),l=i7.dot(i9),u=n*o-a*a;if(0===u)return r.set(0,0,0),null;let c=1/u,p=(o*h-a*l)*c,d=(n*l-a*h)*c;return r.set(1-p-d,d,p)}static containsPoint(t,e,i,s){return null!==this.getBarycoord(t,e,i,s,i8)&&i8.x>=0&&i8.y>=0&&i8.x+i8.y<=1}static getInterpolation(t,e,i,s,r,n,a,h){return null===this.getBarycoord(t,e,i,s,i8)?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(r,i8.x),h.addScaledVector(n,i8.y),h.addScaledVector(a,i8.z),h)}static getInterpolatedAttribute(t,e,i,s,r,n){return sa.setScalar(0),sh.setScalar(0),so.setScalar(0),sa.fromBufferAttribute(t,e),sh.fromBufferAttribute(t,i),so.fromBufferAttribute(t,s),n.setScalar(0),n.addScaledVector(sa,r.x),n.addScaledVector(sh,r.y),n.addScaledVector(so,r.z),n}static isFrontFacing(t,e,i,s){return i6.subVectors(i,e),i7.subVectors(t,e),0>i6.cross(i7).dot(s)}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),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 i6.subVectors(this.c,this.b),i7.subVectors(this.a,this.b),.5*i6.cross(i7).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return sl.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return sl.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,r){return sl.getInterpolation(t,this.a,this.b,this.c,e,i,s,r)}containsPoint(t){return sl.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return sl.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i,s;let r=this.a,n=this.b,a=this.c;st.subVectors(n,r),se.subVectors(a,r),ss.subVectors(t,r);let h=st.dot(ss),o=se.dot(ss);if(h<=0&&o<=0)return e.copy(r);sr.subVectors(t,n);let l=st.dot(sr),u=se.dot(sr);if(l>=0&&u<=l)return e.copy(n);let c=h*u-l*o;if(c<=0&&h>=0&&l<=0)return i=h/(h-l),e.copy(r).addScaledVector(st,i);sn.subVectors(t,a);let p=st.dot(sn),d=se.dot(sn);if(d>=0&&p<=d)return e.copy(a);let m=p*o-h*d;if(m<=0&&o>=0&&d<=0)return s=o/(o-d),e.copy(r).addScaledVector(se,s);let y=l*d-p*u;if(y<=0&&u-l>=0&&p-d>=0)return si.subVectors(a,n),s=(u-l)/(u-l+(p-d)),e.copy(n).addScaledVector(si,s);let f=1/(y+m+c);return i=m*f,s=c*f,e.copy(r).addScaledVector(st,i).addScaledVector(se,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let su={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},sc={h:0,s:0,l:0},sp={h:0,s:0,l:0};function sd(t,e,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?t+(e-t)*6*i:i<.5?e:i<2/3?t+(e-t)*6*(2/3-i):t}class sm{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){return void 0===e&&void 0===i?t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t):this.setRGB(t,e,i),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ey){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,eY.toWorkingColorSpace(this,e),this}setRGB(t,e,i,s=eY.workingColorSpace){return this.r=t,this.g=e,this.b=i,eY.toWorkingColorSpace(this,s),this}setHSL(t,e,i,s=eY.workingColorSpace){if(t=(t%1+1)%1,e=eB(e,0,1),i=eB(i,0,1),0===e)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+e):i+e-i*e,n=2*i-r;this.r=sd(n,r,t+1/3),this.g=sd(n,r,t),this.b=sd(n,r,t-1/3)}return eY.toWorkingColorSpace(this,s),this}setStyle(t,e=ey){let i;function s(e){void 0!==e&&1>parseFloat(e)&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;let n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){let h=i[1],o=h.length;if(3===o)return this.setRGB(parseInt(h.charAt(0),16)/15,parseInt(h.charAt(1),16)/15,parseInt(h.charAt(2),16)/15,e);if(6===o)return this.setHex(parseInt(h,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=ey){let i=su[t.toLowerCase()];return void 0!==i?this.setHex(i,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=eQ(t.r),this.g=eQ(t.g),this.b=eQ(t.b),this}copyLinearToSRGB(t){return this.r=e$(t.r),this.g=e$(t.g),this.b=e$(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ey){return eY.fromWorkingColorSpace(sy.copy(this),t),65536*Math.round(eB(255*sy.r,0,255))+256*Math.round(eB(255*sy.g,0,255))+Math.round(eB(255*sy.b,0,255))}getHexString(t=ey){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=eY.workingColorSpace){let i,s;eY.fromWorkingColorSpace(sy.copy(this),e);let r=sy.r,n=sy.g,a=sy.b,h=Math.max(r,n,a),o=Math.min(r,n,a),l=(o+h)/2;if(o===h)i=0,s=0;else{let u=h-o;switch(s=l<=.5?u/(h+o):u/(2-h-o),h){case r:i=(n-a)/u+(n<a?6:0);break;case n:i=(a-r)/u+2;break;case a:i=(r-n)/u+4}i/=6}return t.h=i,t.s=s,t.l=l,t}getRGB(t,e=eY.workingColorSpace){return eY.fromWorkingColorSpace(sy.copy(this),e),t.r=sy.r,t.g=sy.g,t.b=sy.b,t}getStyle(t=ey){eY.fromWorkingColorSpace(sy.copy(this),t);let e=sy.r,i=sy.g,s=sy.b;return t!==ey?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*s)})`}offsetHSL(t,e,i){return this.getHSL(sc),this.setHSL(sc.h+t,sc.s+e,sc.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(sc),t.getHSL(sp);let i=(1-e)*sc.h+e*sp.h,s=(1-e)*sc.s+e*sp.s,r=(1-e)*sc.l+e*sp.l;return this.setHSL(i,s,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,i=this.g,s=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*s,this.g=r[1]*e+r[4]*i+r[7]*s,this.b=r[2]*e+r[5]*i+r[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let sy=new sm;sm.NAMES=su;let sf=0;class sg extends eO{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:sf++}),this.uuid=eE(),this.name="",this.type="Material",this.blending=y,this.side=c,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=O,this.blendDst=k,this.blendEquation=v,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new sm(0,0,0),this.blendAlpha=0,this.depthFunc=D,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(let e in t){let i=t[e];if(void 0===i){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(void 0===s){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i}}toJSON(t){let e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function s(t){let e=[];for(let i in t){let s=t[i];delete s.metadata,e.push(s)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==y&&(i.blending=this.blending),this.side!==c&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),this.blendSrc!==O&&(i.blendSrc=this.blendSrc),this.blendDst!==k&&(i.blendDst=this.blendDst),this.blendEquation!==v&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==D&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){let r=s(t.textures),n=s(t.images);r.length>0&&(i.textures=r),n.length>0&&(i.images=n)}return i}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;let e=t.clippingPlanes,i=null;if(null!==e){let s=e.length;i=Array(s);for(let r=0;r!==s;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,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){!0===t&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class sx extends sg{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new sm(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 iW,this.combine=G,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}}let sb=new ie,sv=new eV,sM=0;class sw{constructor(t,e,i=!1){if(Array.isArray(t))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:sM++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=tz,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}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,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,r=this.itemSize;s<r;s++)this.array[t+s]=e.array[i+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)sv.fromBufferAttribute(this,e),sv.applyMatrix3(t),this.setXY(e,sv.x,sv.y);else if(3===this.itemSize)for(let s=0,r=this.count;s<r;s++)sb.fromBufferAttribute(this,s),sb.applyMatrix3(t),this.setXYZ(s,sb.x,sb.y,sb.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)sb.fromBufferAttribute(this,e),sb.applyMatrix4(t),this.setXYZ(e,sb.x,sb.y,sb.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)sb.fromBufferAttribute(this,e),sb.applyNormalMatrix(t),this.setXYZ(e,sb.x,sb.y,sb.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)sb.fromBufferAttribute(this,e),sb.transformDirection(t),this.setXYZ(e,sb.x,sb.y,sb.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=eI(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=eR(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=eI(e,this.array)),e}setX(t,e){return this.normalized&&(e=eR(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=eI(e,this.array)),e}setY(t,e){return this.normalized&&(e=eR(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=eI(e,this.array)),e}setZ(t,e){return this.normalized&&(e=eR(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=eI(e,this.array)),e}setW(t,e){return this.normalized&&(e=eR(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=eR(e,this.array),i=eR(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=eR(e,this.array),i=eR(i,this.array),s=eR(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this}setXYZW(t,e,i,s,r){return t*=this.itemSize,this.normalized&&(e=eR(e,this.array),i=eR(i,this.array),s=eR(s,this.array),r=eR(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class sS extends sw{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class s_ extends sw{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class sz extends sw{constructor(t,e,i){super(new Float32Array(t),e,i)}}let sA=0,sT=new iP,sC=new i4,sO=new ie,sk=new ir,sN=new ir,sP=new ie;class sE extends eO{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:sA++}),this.uuid=eE(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(ej(t)?s_:sS)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let s=new eF().getNormalMatrix(t);i.applyNormalMatrix(s),i.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return sT.makeRotationFromQuaternion(t),this.applyMatrix4(sT),this}rotateX(t){return sT.makeRotationX(t),this.applyMatrix4(sT),this}rotateY(t){return sT.makeRotationY(t),this.applyMatrix4(sT),this}rotateZ(t){return sT.makeRotationZ(t),this.applyMatrix4(sT),this}translate(t,e,i){return sT.makeTranslation(t,e,i),this.applyMatrix4(sT),this}scale(t,e,i){return sT.makeScale(t,e,i),this.applyMatrix4(sT),this}lookAt(t){return sC.lookAt(t),sC.updateMatrix(),this.applyMatrix4(sC.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(sO).negate(),this.translate(sO.x,sO.y,sO.z),this}setFromPoints(t){let e=this.getAttribute("position");if(void 0===e){let i=[];for(let s=0,r=t.length;s<r;s++){let n=t[s];i.push(n.x,n.y,n.z||0)}this.setAttribute("position",new sz(i,3))}else{let a=Math.min(t.length,e.count);for(let h=0;h<a;h++){let o=t[h];e.setXYZ(h,o.x,o.y,o.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new ir);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ie(-1/0,-1/0,-1/0),new ie(Infinity,Infinity,Infinity));return}if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,s=e.length;i<s;i++){let r=e[i];sk.setFromBufferAttribute(r),this.morphTargetsRelative?(sP.addVectors(this.boundingBox.min,sk.min),this.boundingBox.expandByPoint(sP),sP.addVectors(this.boundingBox.max,sk.max),this.boundingBox.expandByPoint(sP)):(this.boundingBox.expandByPoint(sk.min),this.boundingBox.expandByPoint(sk.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new i_);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ie,1/0);return}if(t){let i=this.boundingSphere.center;if(sk.setFromBufferAttribute(t),e)for(let s=0,r=e.length;s<r;s++){let n=e[s];sN.setFromBufferAttribute(n),this.morphTargetsRelative?(sP.addVectors(sk.min,sN.min),sk.expandByPoint(sP),sP.addVectors(sk.max,sN.max),sk.expandByPoint(sP)):(sk.expandByPoint(sN.min),sk.expandByPoint(sN.max))}sk.getCenter(i);let a=0;for(let h=0,o=t.count;h<o;h++)sP.fromBufferAttribute(t,h),a=Math.max(a,i.distanceToSquared(sP));if(e)for(let l=0,u=e.length;l<u;l++){let c=e[l],p=this.morphTargetsRelative;for(let d=0,m=c.count;d<m;d++)sP.fromBufferAttribute(c,d),p&&(sO.fromBufferAttribute(t,d),sP.add(sO)),a=Math.max(a,i.distanceToSquared(sP))}this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=e.position,s=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new sw(new Float32Array(4*i.count),4));let n=this.getAttribute("tangent"),a=[],h=[];for(let o=0;o<i.count;o++)a[o]=new ie,h[o]=new ie;let l=new ie,u=new ie,c=new ie,p=new eV,d=new eV,m=new eV,y=new ie,f=new ie,g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let x=0,b=g.length;x<b;++x){let v=g[x],M=v.start,w=v.count;for(let S=M,_=M+w;S<_;S+=3)!function(t,e,s){l.fromBufferAttribute(i,t),u.fromBufferAttribute(i,e),c.fromBufferAttribute(i,s),p.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),m.fromBufferAttribute(r,s),u.sub(l),c.sub(l),d.sub(p),m.sub(p);let n=1/(d.x*m.y-m.x*d.y);isFinite(n)&&(y.copy(u).multiplyScalar(m.y).addScaledVector(c,-d.y).multiplyScalar(n),f.copy(c).multiplyScalar(d.x).addScaledVector(u,-m.x).multiplyScalar(n),a[t].add(y),a[e].add(y),a[s].add(y),h[t].add(f),h[e].add(f),h[s].add(f))}(t.getX(S+0),t.getX(S+1),t.getX(S+2))}let z=new ie,A=new ie,T=new ie,C=new ie;function O(t){T.fromBufferAttribute(s,t),C.copy(T);let e=a[t];z.copy(e),z.sub(T.multiplyScalar(T.dot(e))).normalize(),A.crossVectors(C,e);let i=A.dot(h[t]);n.setXYZW(t,z.x,z.y,z.z,i<0?-1:1)}for(let k=0,N=g.length;k<N;++k){let P=g[k],E=P.start,B=P.count;for(let I=E,R=E+B;I<R;I+=3)O(t.getX(I+0)),O(t.getX(I+1)),O(t.getX(I+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new sw(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let s=0,r=i.count;s<r;s++)i.setXYZ(s,0,0,0);let n=new ie,a=new ie,h=new ie,o=new ie,l=new ie,u=new ie,c=new ie,p=new ie;if(t)for(let d=0,m=t.count;d<m;d+=3){let y=t.getX(d+0),f=t.getX(d+1),g=t.getX(d+2);n.fromBufferAttribute(e,y),a.fromBufferAttribute(e,f),h.fromBufferAttribute(e,g),c.subVectors(h,a),p.subVectors(n,a),c.cross(p),o.fromBufferAttribute(i,y),l.fromBufferAttribute(i,f),u.fromBufferAttribute(i,g),o.add(c),l.add(c),u.add(c),i.setXYZ(y,o.x,o.y,o.z),i.setXYZ(f,l.x,l.y,l.z),i.setXYZ(g,u.x,u.y,u.z)}else for(let x=0,b=e.count;x<b;x+=3)n.fromBufferAttribute(e,x+0),a.fromBufferAttribute(e,x+1),h.fromBufferAttribute(e,x+2),c.subVectors(h,a),p.subVectors(n,a),c.cross(p),i.setXYZ(x+0,c.x,c.y,c.z),i.setXYZ(x+1,c.x,c.y,c.z),i.setXYZ(x+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)sP.fromBufferAttribute(t,e),sP.normalize(),t.setXYZ(e,sP.x,sP.y,sP.z)}toNonIndexed(){function t(t,e){let i=t.array,s=t.itemSize,r=t.normalized,n=new i.constructor(e.length*s),a=0,h=0;for(let o=0,l=e.length;o<l;o++){a=t.isInterleavedBufferAttribute?e[o]*t.data.stride+t.offset:e[o]*s;for(let u=0;u<s;u++)n[h++]=i[a++]}return new sw(n,s,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new sE,i=this.index.array,s=this.attributes;for(let r in s){let n=s[r],a=t(n,i);e.setAttribute(r,a)}let h=this.morphAttributes;for(let o in h){let l=[],u=h[o];for(let c=0,p=u.length;c<p;c++){let d=u[c],m=t(d,i);l.push(m)}e.morphAttributes[o]=l}e.morphTargetsRelative=this.morphTargetsRelative;let y=this.groups;for(let f=0,g=y.length;f<g;f++){let x=y[f];e.addGroup(x.start,x.count,x.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){let e=this.parameters;for(let i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};let s=this.index;null!==s&&(t.data.index={type:s.array.constructor.name,array:Array.prototype.slice.call(s.array)});let r=this.attributes;for(let n in r){let a=r[n];t.data.attributes[n]=a.toJSON(t.data)}let h={},o=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],c=[];for(let p=0,d=u.length;p<d;p++){let m=u[p];c.push(m.toJSON(t.data))}c.length>0&&(h[l]=c,o=!0)}o&&(t.data.morphAttributes=h,t.data.morphTargetsRelative=this.morphTargetsRelative);let y=this.groups;y.length>0&&(t.data.groups=JSON.parse(JSON.stringify(y)));let f=this.boundingSphere;return null!==f&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.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;let e={};this.name=t.name;let i=t.index;null!==i&&this.setIndex(i.clone(e));let s=t.attributes;for(let r in s){let n=s[r];this.setAttribute(r,n.clone(e))}let a=t.morphAttributes;for(let h in a){let o=[],l=a[h];for(let u=0,c=l.length;u<c;u++)o.push(l[u].clone(e));this.morphAttributes[h]=o}this.morphTargetsRelative=t.morphTargetsRelative;let p=t.groups;for(let d=0,m=p.length;d<m;d++){let y=p[d];this.addGroup(y.start,y.count,y.materialIndex)}let f=t.boundingBox;null!==f&&(this.boundingBox=f.clone());let g=t.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let sB=new iP,sI=new class{constructor(t=new ie,e=new ie(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,iz)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=iz.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(iz.copy(this.origin).addScaledVector(this.direction,e),iz.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){let r,n,a,h;iA.copy(t).add(e).multiplyScalar(.5),iT.copy(e).sub(t).normalize(),iC.copy(this.origin).sub(iA);let o=.5*t.distanceTo(e),l=-this.direction.dot(iT),u=iC.dot(this.direction),c=-iC.dot(iT),p=iC.lengthSq(),d=Math.abs(1-l*l);if(d>0){if(r=l*c-u,n=l*u-c,h=o*d,r>=0){if(n>=-h){if(n<=h){let m=1/d;r*=m,n*=m,a=r*(r+l*n+2*u)+n*(l*r+n+2*c)+p}else a=-(r=Math.max(0,-(l*(n=o)+u)))*r+n*(n+2*c)+p}else a=-(r=Math.max(0,-(l*(n=-o)+u)))*r+n*(n+2*c)+p}else n<=-h?(n=(r=Math.max(0,-(-l*o+u)))>0?-o:Math.min(Math.max(-o,-c),o),a=-r*r+n*(n+2*c)+p):n<=h?(r=0,a=(n=Math.min(Math.max(-o,-c),o))*(n+2*c)+p):(n=(r=Math.max(0,-(l*o+u)))>0?o:Math.min(Math.max(-o,-c),o),a=-r*r+n*(n+2*c)+p)}else n=l>0?-o:o,a=-(r=Math.max(0,-(l*n+u)))*r+n*(n+2*c)+p;return i&&i.copy(this.origin).addScaledVector(this.direction,r),s&&s.copy(iA).addScaledVector(iT,n),a}intersectSphere(t,e){iz.subVectors(t.center,this.origin);let i=iz.dot(this.direction),s=iz.dot(iz)-i*i,r=t.radius*t.radius;if(s>r)return null;let n=Math.sqrt(r-s),a=i-n,h=i+n;return h<0?null:a<0?this.at(h,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);if(0===e)return!0;let i=t.normal.dot(this.direction);return i*e<0}intersectBox(t,e){let i,s,r,n,a,h;let o=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,c=this.origin;return(o>=0?(i=(t.min.x-c.x)*o,s=(t.max.x-c.x)*o):(i=(t.max.x-c.x)*o,s=(t.min.x-c.x)*o),l>=0?(r=(t.min.y-c.y)*l,n=(t.max.y-c.y)*l):(r=(t.max.y-c.y)*l,n=(t.min.y-c.y)*l),i>n||r>s)?null:((r>i||isNaN(i))&&(i=r),(n<s||isNaN(s))&&(s=n),u>=0?(a=(t.min.z-c.z)*u,h=(t.max.z-c.z)*u):(a=(t.max.z-c.z)*u,h=(t.min.z-c.z)*u),i>h||a>s)?null:((a>i||i!=i)&&(i=a),(h<s||s!=s)&&(s=h),s<0)?null:this.at(i>=0?i:s,e)}intersectsBox(t){return null!==this.intersectBox(t,iz)}intersectTriangle(t,e,i,s,r){let n;iO.subVectors(e,t),ik.subVectors(i,t),iN.crossVectors(iO,ik);let a=this.direction.dot(iN);if(a>0){if(s)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}iC.subVectors(this.origin,t);let h=n*this.direction.dot(ik.crossVectors(iC,ik));if(h<0)return null;let o=n*this.direction.dot(iO.cross(iC));if(o<0||h+o>a)return null;let l=-n*iC.dot(iN);return l<0?null:this.at(l/a,r)}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)}},sR=new i_,sV=new ie,sF=new ie,sL=new ie,sj=new ie,sU=new ie,sW=new ie,sD=new ie,sJ=new ie;class sq extends i4{constructor(t=new sE,e=new sx){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let t=this.geometry,e=t.morphAttributes,i=Object.keys(e);if(i.length>0){let s=e[i[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,n=s.length;r<n;r++){let a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(t,e){let i=this.geometry,s=i.attributes.position,r=i.morphAttributes.position,n=i.morphTargetsRelative;e.fromBufferAttribute(s,t);let a=this.morphTargetInfluences;if(r&&a){sW.set(0,0,0);for(let h=0,o=r.length;h<o;h++){let l=a[h],u=r[h];0!==l&&(sU.fromBufferAttribute(u,t),n?sW.addScaledVector(sU,l):sW.addScaledVector(sU.sub(e),l))}e.add(sW)}return e}raycast(t,e){let i=this.geometry,s=this.material,r=this.matrixWorld;if(void 0!==s){if(null===i.boundingSphere&&i.computeBoundingSphere(),sR.copy(i.boundingSphere),sR.applyMatrix4(r),sI.copy(t.ray).recast(t.near),!1===sR.containsPoint(sI.origin)&&(null===sI.intersectSphere(sR,sV)||sI.origin.distanceToSquared(sV)>(t.far-t.near)**2)||(sB.copy(r).invert(),sI.copy(t.ray).applyMatrix4(sB),null!==i.boundingBox&&!1===sI.intersectsBox(i.boundingBox)))return;this._computeIntersections(t,e,sI)}}_computeIntersections(t,e,i){let s;let r=this.geometry,n=this.material,a=r.index,h=r.attributes.position,o=r.attributes.uv,l=r.attributes.uv1,u=r.attributes.normal,c=r.groups,p=r.drawRange;if(null!==a){if(Array.isArray(n))for(let d=0,m=c.length;d<m;d++){let y=c[d],f=n[y.materialIndex],g=Math.max(y.start,p.start),x=Math.min(a.count,Math.min(y.start+y.count,p.start+p.count));for(let b=g;b<x;b+=3){let v=a.getX(b),M=a.getX(b+1),w=a.getX(b+2);(s=sH(this,f,t,i,o,l,u,v,M,w))&&(s.faceIndex=Math.floor(b/3),s.face.materialIndex=y.materialIndex,e.push(s))}}else{let S=Math.max(0,p.start),_=Math.min(a.count,p.start+p.count);for(let z=S;z<_;z+=3){let A=a.getX(z),T=a.getX(z+1),C=a.getX(z+2);(s=sH(this,n,t,i,o,l,u,A,T,C))&&(s.faceIndex=Math.floor(z/3),e.push(s))}}}else if(void 0!==h){if(Array.isArray(n))for(let O=0,k=c.length;O<k;O++){let N=c[O],P=n[N.materialIndex],E=Math.max(N.start,p.start),B=Math.min(h.count,Math.min(N.start+N.count,p.start+p.count));for(let I=E;I<B;I+=3){let R=I,V=I+1,F=I+2;(s=sH(this,P,t,i,o,l,u,R,V,F))&&(s.faceIndex=Math.floor(I/3),s.face.materialIndex=N.materialIndex,e.push(s))}}else{let L=Math.max(0,p.start),j=Math.min(h.count,p.start+p.count);for(let U=L;U<j;U+=3){let W=U,D=U+1,J=U+2;(s=sH(this,n,t,i,o,l,u,W,D,J))&&(s.faceIndex=Math.floor(U/3),e.push(s))}}}}}function sH(t,e,i,s,r,n,a,h,o,l){t.getVertexPosition(h,sF),t.getVertexPosition(o,sL),t.getVertexPosition(l,sj);let u=function(t,e,i,s,r,n,a,h){if(null===(e.side===p?s.intersectTriangle(a,n,r,!0,h):s.intersectTriangle(r,n,a,e.side===c,h)))return null;sJ.copy(h),sJ.applyMatrix4(t.matrixWorld);let o=i.ray.origin.distanceTo(sJ);return o<i.near||o>i.far?null:{distance:o,point:sJ.clone(),object:t}}(t,e,i,s,sF,sL,sj,sD);if(u){let d=new ie;sl.getBarycoord(sD,sF,sL,sj,d),r&&(u.uv=sl.getInterpolatedAttribute(r,h,o,l,d,new eV)),n&&(u.uv1=sl.getInterpolatedAttribute(n,h,o,l,d,new eV)),a&&(u.normal=sl.getInterpolatedAttribute(a,h,o,l,d,new ie),u.normal.dot(s.direction)>0&&u.normal.multiplyScalar(-1));let m={a:h,b:o,c:l,normal:new ie,materialIndex:0};sl.getNormal(sF,sL,sj,m.normal),u.face=m,u.barycoord=d}return u}class sZ extends sE{constructor(t=1,e=1,i=1,s=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:r,depthSegments:n};let a=this;s=Math.floor(s),r=Math.floor(r),n=Math.floor(n);let h=[],o=[],l=[],u=[],c=0,p=0;function d(t,e,i,s,r,n,d,m,y,f,g){let x=n/y,b=d/f,v=n/2,M=d/2,w=m/2,S=y+1,_=f+1,z=0,A=0,T=new ie;for(let C=0;C<_;C++){let O=C*b-M;for(let k=0;k<S;k++){let N=k*x-v;T[t]=N*s,T[e]=O*r,T[i]=w,o.push(T.x,T.y,T.z),T[t]=0,T[e]=0,T[i]=m>0?1:-1,l.push(T.x,T.y,T.z),u.push(k/y),u.push(1-C/f),z+=1}}for(let P=0;P<f;P++)for(let E=0;E<y;E++){let B=c+E+S*P,I=c+E+S*(P+1),R=c+(E+1)+S*(P+1),V=c+(E+1)+S*P;h.push(B,I,V),h.push(I,R,V),A+=6}a.addGroup(p,A,g),p+=A,c+=z}d("z","y","x",-1,-1,i,e,t,n,r,0),d("z","y","x",1,-1,i,e,-t,n,r,1),d("x","z","y",1,1,t,i,e,s,n,2),d("x","z","y",1,-1,t,i,-e,s,n,3),d("x","y","z",1,-1,t,e,i,s,r,4),d("x","y","z",-1,-1,t,e,-i,s,r,5),this.setIndex(h),this.setAttribute("position",new sz(o,3)),this.setAttribute("normal",new sz(l,3)),this.setAttribute("uv",new sz(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sZ(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function sG(t){let e={};for(let i in t)for(let s in e[i]={},t[i]){let r=t[i][s];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][s]=null):e[i][s]=r.clone():Array.isArray(r)?e[i][s]=r.slice():e[i][s]=r}return e}function sX(t){let e={};for(let i=0;i<t.length;i++){let s=sG(t[i]);for(let r in s)e[r]=s[r]}return e}function sY(t){let e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:eY.workingColorSpace}let sQ={clone:sG,merge:sX};class s$ extends sg{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=sG(t.uniforms),this.uniformsGroups=function(t){let e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);for(let i in e.glslVersion=this.glslVersion,e.uniforms={},this.uniforms){let s=this.uniforms[i],r=s.value;r&&r.isTexture?e.uniforms[i]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[i]={type:"m4",value:r.toArray()}:e.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let n={};for(let a in this.extensions)!0===this.extensions[a]&&(n[a]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class sK extends i4{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new iP,this.projectionMatrix=new iP,this.projectionMatrixInverse=new iP,this.coordinateSystem=eC}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let s0=new ie,s1=new eV,s2=new eV;class s3 extends sK{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=2*eP*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(.5*eN*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*eP*Math.atan(Math.tan(.5*eN*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){s0.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(s0.x,s0.y).multiplyScalar(-t/s0.z),s0.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(s0.x,s0.y).multiplyScalar(-t/s0.z)}getViewSize(t,e){return this.getViewBounds(t,s1,s2),e.subVectors(s2,s1)}setViewOffset(t,e,i,s,r,n){this.aspect=t/e,null===this.view&&(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=i,this.view.offsetY=s,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(.5*eN*this.fov)/this.zoom,i=2*e,s=this.aspect*i,r=-.5*s,n=this.view;if(null!==this.view&&this.view.enabled){let a=n.fullWidth,h=n.fullHeight;r+=n.offsetX*s/a,e-=n.offsetY*i/h,s*=n.width/a,i*=n.height/h}let o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-i,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}class s5 extends i4{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new s3(-90,1,t,e);s.layers=this.layers,this.add(s);let r=new s3(-90,1,t,e);r.layers=this.layers,this.add(r);let n=new s3(-90,1,t,e);n.layers=this.layers,this.add(n);let a=new s3(-90,1,t,e);a.layers=this.layers,this.add(a);let h=new s3(-90,1,t,e);h.layers=this.layers,this.add(h);let o=new s3(-90,1,t,e);o.layers=this.layers,this.add(o)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[i,s,r,n,a,h]=e;for(let o of e)this.remove(o);if(t===eC)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(2001===t)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let l of e)this.add(l),l.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,n,a,h,o,l]=this.children,u=t.getRenderTarget(),c=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),d=t.xr.enabled;t.xr.enabled=!1;let m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,r),t.setRenderTarget(i,1,s),t.render(e,n),t.setRenderTarget(i,2,s),t.render(e,a),t.setRenderTarget(i,3,s),t.render(e,h),t.setRenderTarget(i,4,s),t.render(e,o),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,s),t.render(e,l),t.setRenderTarget(u,c,p),t.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class s4 extends e5{constructor(t,e,i,s,r,n,a,h,o,l){super(t=void 0!==t?t:[],e=void 0!==e?e:tn,i,s,r,n,a,h,o,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class s6 extends e7{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let i={width:t,height:t,depth:1};this.texture=new s4([i,i,i,i,i,i],e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:tf}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include <begin_vertex> #include <project_vertex> } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include <common> void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},s=new sZ(5,5,5),r=new s$({name:"CubemapFromEquirect",uniforms:sG(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:p,blending:m});r.uniforms.tEquirect.value=e;let n=new sq(s,r),a=e.minFilter;e.minFilter===tx&&(e.minFilter=tf);let h=new s5(1,10,this);return h.update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e,i,s){let r=t.getRenderTarget();for(let n=0;n<6;n++)t.setRenderTarget(this,n),t.clear(e,i,s);t.setRenderTarget(r)}}class s7 extends i4{constructor(){super(),this.isGroup=!0,this.type="Group"}}let s9={type:"move"};class s8{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new s7,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new s7,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ie,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ie),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new s7,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ie,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ie),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let s=null,r=null,n=null,a=this._targetRay,h=this._grip,o=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(o&&t.hand){for(let l of(n=!0,t.hand.values())){let u=e.getJointPose(l,i),c=this._getHandJoint(o,l);null!==u&&(c.matrix.fromArray(u.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,c.jointRadius=u.radius),c.visible=null!==u}let p=o.joints["index-finger-tip"],d=o.joints["thumb-tip"],m=p.position.distanceTo(d.position);o.inputState.pinching&&m>.025?(o.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!o.inputState.pinching&&m<=.015&&(o.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==h&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,i))&&(h.matrix.fromArray(r.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,r.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(r.linearVelocity)):h.hasLinearVelocity=!1,r.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(r.angularVelocity)):h.hasAngularVelocity=!1);null!==a&&(null===(s=e.getPose(t.targetRaySpace,i))&&null!==r&&(s=r),null!==s&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(s9)))}return null!==a&&(a.visible=null!==s),null!==h&&(h.visible=null!==r),null!==o&&(o.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){let i=new s7;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class rt extends i4{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 iW,this.environmentIntensity=1,this.environmentRotation=new iW,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(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),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class re extends sw{constructor(t,e,i,s=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}let ri=new ie,rs=new ie,rr=new eF;class rn{constructor(t=new ie(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){let s=ri.subVectors(i,e).cross(rs.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let i=t.delta(ri),s=this.normal.dot(i);if(0===s)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<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){let i=e||rr.getNormalMatrix(t),s=this.coplanarPoint(ri).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),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)}}let ra=new i_,rh=new ie;class ro{constructor(t=new rn,e=new rn,i=new rn,s=new rn,r=new rn,n=new rn){this.planes=[t,e,i,s,r,n]}set(t,e,i,s,r,n){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(n),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=eC){let i=this.planes,s=t.elements,r=s[0],n=s[1],a=s[2],h=s[3],o=s[4],l=s[5],u=s[6],c=s[7],p=s[8],d=s[9],m=s[10],y=s[11],f=s[12],g=s[13],x=s[14],b=s[15];if(i[0].setComponents(h-r,c-o,y-p,b-f).normalize(),i[1].setComponents(h+r,c+o,y+p,b+f).normalize(),i[2].setComponents(h+n,c+l,y+d,b+g).normalize(),i[3].setComponents(h-n,c-l,y-d,b-g).normalize(),i[4].setComponents(h-a,c-u,y-m,b-x).normalize(),e===eC)i[5].setComponents(h+a,c+u,y+m,b+x).normalize();else if(2001===e)i[5].setComponents(a,u,m,x).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),ra.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),ra.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(ra)}intersectsSprite(t){return ra.center.set(0,0,0),ra.radius=.7071067811865476,ra.applyMatrix4(t.matrixWorld),this.intersectsSphere(ra)}intersectsSphere(t){let e=this.planes,i=t.center,s=-t.radius;for(let r=0;r<6;r++){let n=e[r].distanceToPoint(i);if(n<s)return!1}return!0}intersectsBox(t){let e=this.planes;for(let i=0;i<6;i++){let s=e[i];if(rh.x=s.normal.x>0?t.max.x:t.min.x,rh.y=s.normal.y>0?t.max.y:t.min.y,rh.z=s.normal.z>0?t.max.z:t.min.z,0>s.distanceToPoint(rh))return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(0>e[i].distanceToPoint(t))return!1;return!0}clone(){return new this.constructor().copy(this)}}class rl extends e5{constructor(t,e,i,s,r,n,a,h,o,l=tR){if(l!==tR&&l!==tV)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&l===tR&&(i=t_),void 0===i&&l===tV&&(i=tO),super(null,s,r,n,a,h,l,i,o),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==a?a:td,this.minFilter=void 0!==h?h:td,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new e1(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class ru{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(t,e){let i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e=[],i,s=this.getPoint(0),r=0;e.push(0);for(let n=1;n<=t;n++)e.push(r+=(i=this.getPoint(n/t)).distanceTo(s)),s=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){let i;let s=this.getLengths(),r=0,n=s.length;i=e||t*s[n-1];let a=0,h=n-1,o;for(;a<=h;)if((o=s[r=Math.floor(a+(h-a)/2)]-i)<0)a=r+1;else if(o>0)h=r-1;else{h=r;break}if(s[r=h]===i)return r/(n-1);let l=s[r],u=s[r+1],c=(r+(i-l)/(u-l))/(n-1);return c}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);let r=this.getPoint(i),n=this.getPoint(s),a=e||(r.isVector2?new eV:new ie);return a.copy(n).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new ie,s=[],r=[],n=[],a=new ie,h=new iP;for(let o=0;o<=t;o++){let l=o/t;s[o]=this.getTangentAt(l,new ie)}r[0]=new ie,n[0]=new ie;let u=Number.MAX_VALUE,c=Math.abs(s[0].x),p=Math.abs(s[0].y),d=Math.abs(s[0].z);c<=u&&(u=c,i.set(1,0,0)),p<=u&&(u=p,i.set(0,1,0)),d<=u&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),n[0].crossVectors(s[0],r[0]);for(let m=1;m<=t;m++){if(r[m]=r[m-1].clone(),n[m]=n[m-1].clone(),a.crossVectors(s[m-1],s[m]),a.length()>Number.EPSILON){a.normalize();let y=Math.acos(eB(s[m-1].dot(s[m]),-1,1));r[m].applyMatrix4(h.makeRotationAxis(a,y))}n[m].crossVectors(s[m],r[m])}if(!0===e){let f=Math.acos(eB(r[0].dot(r[t]),-1,1));f/=t,s[0].dot(a.crossVectors(r[0],r[t]))>0&&(f=-f);for(let g=1;g<=t;g++)r[g].applyMatrix4(h.makeRotationAxis(s[g],f*g)),n[g].crossVectors(s[g],r[g])}return{tangents:s,normals:r,binormals:n}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class rc extends ru{constructor(t=0,e=0,i=1,s=1,r=0,n=2*Math.PI,a=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=h}getPoint(t,e=new eV){let i=2*Math.PI,s=this.aEndAngle-this.aStartAngle,r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(s=r?0:i),!0!==this.aClockwise||r||(s===i?s=-i:s-=i);let n=this.aStartAngle+t*s,a=this.aX+this.xRadius*Math.cos(n),h=this.aY+this.yRadius*Math.sin(n);if(0!==this.aRotation){let o=Math.cos(this.aRotation),l=Math.sin(this.aRotation),u=a-this.aX,c=h-this.aY;a=u*o-c*l+this.aX,h=u*l+c*o+this.aY}return e.set(a,h)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function rp(){let t=0,e=0,i=0,s=0;function r(r,n,a,h){t=r,e=a,i=-3*r+3*n-2*a-h,s=2*r-2*n+a+h}return{initCatmullRom:function(t,e,i,s,n){r(e,i,n*(i-t),n*(s-e))},initNonuniformCatmullRom:function(t,e,i,s,n,a,h){let o=(e-t)/n-(i-t)/(n+a)+(i-e)/a,l=(i-e)/a-(s-e)/(a+h)+(s-i)/h;r(e,i,o*=a,l*=a)},calc:function(r){let n=r*r;return t+e*r+i*n+s*(n*r)}}}let rd=new ie,rm=new rp,ry=new rp,rf=new rp;function rg(t,e,i,s,r){let n=(s-e)*.5,a=(r-i)*.5,h=t*t;return(2*i-2*s+n+a)*(t*h)+(-3*i+3*s-2*n-a)*h+n*t+i}function rx(t,e,i,s){return function(t,e){let i=1-t;return i*i*e}(t,e)+2*(1-t)*t*i+t*t*s}function rb(t,e,i,s,r){return function(t,e){let i=1-t;return i*i*i*e}(t,e)+function(t,e){let i=1-t;return 3*i*i*t*e}(t,i)+3*(1-t)*t*t*s+t*t*t*r}class rv extends ru{constructor(t=new eV,e=new eV,i=new eV,s=new eV){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new eV){let i=this.v0,s=this.v1,r=this.v2,n=this.v3;return e.set(rb(t,i.x,s.x,r.x,n.x),rb(t,i.y,s.y,r.y,n.y)),e}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class rM extends ru{constructor(t=new eV,e=new eV){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new eV){return 1===t?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(t).add(this.v1)),e}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new eV){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class rw extends ru{constructor(t=new eV,e=new eV,i=new eV){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new eV){let i=this.v0,s=this.v1,r=this.v2;return e.set(rx(t,i.x,s.x,r.x),rx(t,i.y,s.y,r.y)),e}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class rS extends ru{constructor(t=new ie,e=new ie,i=new ie){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new ie){let i=this.v0,s=this.v1,r=this.v2;return e.set(rx(t,i.x,s.x,r.x),rx(t,i.y,s.y,r.y),rx(t,i.z,s.z,r.z)),e}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class r_ extends ru{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new eV){let i=this.points,s=(i.length-1)*t,r=Math.floor(s),n=s-r,a=i[0===r?r:r-1],h=i[r],o=i[r>i.length-2?i.length-1:r+1],l=i[r>i.length-3?i.length-1:r+2];return e.set(rg(n,a.x,h.x,o.x,l.x),rg(n,a.y,h.y,o.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(new eV().fromArray(s))}return this}}var rz=Object.freeze({__proto__:null,ArcCurve:class extends rc{constructor(t,e,i,s,r,n){super(t,e,i,i,s,r,n),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends ru{constructor(t=[],e=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=s}getPoint(t,e=new ie){let i,s;let r=this.points,n=r.length,a=(n-(this.closed?0:1))*t,h=Math.floor(a),o=a-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/n)+1)*n:0===o&&h===n-1&&(h=n-2,o=1),this.closed||h>0?i=r[(h-1)%n]:(rd.subVectors(r[0],r[1]).add(r[0]),i=rd);let l=r[h%n],u=r[(h+1)%n];if(this.closed||h+2<n?s=r[(h+2)%n]:(rd.subVectors(r[n-1],r[n-2]).add(r[n-1]),s=rd),"centripetal"===this.curveType||"chordal"===this.curveType){let c="chordal"===this.curveType?.5:.25,p=Math.pow(i.distanceToSquared(l),c),d=Math.pow(l.distanceToSquared(u),c),m=Math.pow(u.distanceToSquared(s),c);d<1e-4&&(d=1),p<1e-4&&(p=d),m<1e-4&&(m=d),rm.initNonuniformCatmullRom(i.x,l.x,u.x,s.x,p,d,m),ry.initNonuniformCatmullRom(i.y,l.y,u.y,s.y,p,d,m),rf.initNonuniformCatmullRom(i.z,l.z,u.z,s.z,p,d,m)}else"catmullrom"===this.curveType&&(rm.initCatmullRom(i.x,l.x,u.x,s.x,this.tension),ry.initCatmullRom(i.y,l.y,u.y,s.y,this.tension),rf.initCatmullRom(i.z,l.z,u.z,s.z,this.tension));return e.set(rm.calc(o),ry.calc(o),rf.calc(o)),e}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let s=t.points[e];this.points.push(new ie().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:rv,CubicBezierCurve3:class extends ru{constructor(t=new ie,e=new ie,i=new ie,s=new ie){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new ie){let i=this.v0,s=this.v1,r=this.v2,n=this.v3;return e.set(rb(t,i.x,s.x,r.x,n.x),rb(t,i.y,s.y,r.y,n.y),rb(t,i.z,s.z,r.z,n.z)),e}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},EllipseCurve:rc,LineCurve:rM,LineCurve3:class extends ru{constructor(t=new ie,e=new ie){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new ie){return 1===t?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(t).add(this.v1)),e}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new ie){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:rw,QuadraticBezierCurve3:rS,SplineCurve:r_});class rA extends ru{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new rz[i](e,t))}return this}getPoint(t,e){let i=t*this.getLength(),s=this.getCurveLengths(),r=0;for(;r<s.length;){if(s[r]>=i){let n=s[r]-i,a=this.curves[r],h=a.getLength(),o=0===h?0:1-n/h;return a.getPointAt(o,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,s=this.curves.length;i<s;i++)t.push(e+=this.curves[i].getLength());return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e;let i=[];for(let s=0,r=this.curves;s<r.length;s++){let n=r[s],a=n.isEllipseCurve?2*t:n.isLineCurve||n.isLineCurve3?1:n.isSplineCurve?t*n.points.length:t,h=n.getPoints(a);for(let o=0;o<h.length;o++){let l=h[o];e&&e.equals(l)||(i.push(l),e=l)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){let s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let s=t.curves[e];this.curves.push(new rz[s.type]().fromJSON(s))}return this}}class rT extends rA{constructor(t){super(),this.type="Path",this.currentPoint=new eV,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let i=new rM(this.currentPoint.clone(),new eV(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,s){let r=new rw(this.currentPoint.clone(),new eV(t,e),new eV(i,s));return this.curves.push(r),this.currentPoint.set(i,s),this}bezierCurveTo(t,e,i,s,r,n){let a=new rv(this.currentPoint.clone(),new eV(t,e),new eV(i,s),new eV(r,n));return this.curves.push(a),this.currentPoint.set(r,n),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),i=new r_(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,s,r,n){let a=this.currentPoint.x,h=this.currentPoint.y;return this.absarc(t+a,e+h,i,s,r,n),this}absarc(t,e,i,s,r,n){return this.absellipse(t,e,i,i,s,r,n),this}ellipse(t,e,i,s,r,n,a,h){let o=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+o,e+l,i,s,r,n,a,h),this}absellipse(t,e,i,s,r,n,a,h){let o=new rc(t,e,i,s,r,n,a,h);if(this.curves.length>0){let l=o.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(o);let u=o.getPoint(1);return this.currentPoint.copy(u),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class rC extends sE{constructor(t=[new eV(0,-.5),new eV(.5,0),new eV(0,.5)],e=12,i=0,s=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:s},e=Math.floor(e),s=eB(s,0,2*Math.PI);let r=[],n=[],a=[],h=[],o=[],l=1/e,u=new ie,c=new eV,p=new ie,d=new ie,m=new ie,y=0,f=0;for(let g=0;g<=t.length-1;g++)switch(g){case 0:y=t[g+1].x-t[g].x,f=t[g+1].y-t[g].y,p.x=1*f,p.y=-y,p.z=0*f,m.copy(p),p.normalize(),h.push(p.x,p.y,p.z);break;case t.length-1:h.push(m.x,m.y,m.z);break;default:y=t[g+1].x-t[g].x,f=t[g+1].y-t[g].y,p.x=1*f,p.y=-y,p.z=0*f,d.copy(p),p.x+=m.x,p.y+=m.y,p.z+=m.z,p.normalize(),h.push(p.x,p.y,p.z),m.copy(d)}for(let x=0;x<=e;x++){let b=i+x*l*s,v=Math.sin(b),M=Math.cos(b);for(let w=0;w<=t.length-1;w++){u.x=t[w].x*v,u.y=t[w].y,u.z=t[w].x*M,n.push(u.x,u.y,u.z),c.x=x/e,c.y=w/(t.length-1),a.push(c.x,c.y);let S=h[3*w+0]*v,_=h[3*w+1],z=h[3*w+0]*M;o.push(S,_,z)}}for(let A=0;A<e;A++)for(let T=0;T<t.length-1;T++){let C=T+A*t.length,O=C+t.length,k=C+t.length+1,N=C+1;r.push(C,O,N),r.push(k,N,O)}this.setIndex(r),this.setAttribute("position",new sz(n,3)),this.setAttribute("uv",new sz(a,2)),this.setAttribute("normal",new sz(o,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rC(t.points,t.segments,t.phiStart,t.phiLength)}}class rO extends rC{constructor(t=1,e=1,i=4,s=8){let r=new rT;r.absarc(0,-e/2,t,1.5*Math.PI,0),r.absarc(0,e/2,t,0,.5*Math.PI),super(r.getPoints(i),s),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:i,radialSegments:s}}static fromJSON(t){return new rO(t.radius,t.length,t.capSegments,t.radialSegments)}}class rk extends sE{constructor(t=1,e=32,i=0,s=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:s},e=Math.max(3,e);let r=[],n=[],a=[],h=[],o=new ie,l=new eV;n.push(0,0,0),a.push(0,0,1),h.push(.5,.5);for(let u=0,c=3;u<=e;u++,c+=3){let p=i+u/e*s;o.x=t*Math.cos(p),o.y=t*Math.sin(p),n.push(o.x,o.y,o.z),a.push(0,0,1),l.x=(n[c]/t+1)/2,l.y=(n[c+1]/t+1)/2,h.push(l.x,l.y)}for(let d=1;d<=e;d++)r.push(d,d+1,0);this.setIndex(r),this.setAttribute("position",new sz(n,3)),this.setAttribute("normal",new sz(a,3)),this.setAttribute("uv",new sz(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rk(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class rN extends sE{constructor(t=1,e=1,i=1,s=32,r=1,n=!1,a=0,h=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:s,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:h};let o=this;s=Math.floor(s),r=Math.floor(r);let l=[],u=[],c=[],p=[],d=0,m=[],y=i/2,f=0;function g(i){let r=d,n=new eV,m=new ie,g=0,x=!0===i?t:e,b=!0===i?1:-1;for(let v=1;v<=s;v++)u.push(0,y*b,0),c.push(0,b,0),p.push(.5,.5),d++;let M=d;for(let w=0;w<=s;w++){let S=w/s,_=S*h+a,z=Math.cos(_),A=Math.sin(_);m.x=x*A,m.y=y*b,m.z=x*z,u.push(m.x,m.y,m.z),c.push(0,b,0),n.x=.5*z+.5,n.y=.5*A*b+.5,p.push(n.x,n.y),d++}for(let T=0;T<s;T++){let C=r+T,O=M+T;!0===i?l.push(O,O+1,C):l.push(O+1,O,C),g+=3}o.addGroup(f,g,!0===i?1:2),f+=g}(function(){let n=new ie,g=new ie,x=0,b=(e-t)/i;for(let v=0;v<=r;v++){let M=[],w=v/r,S=w*(e-t)+t;for(let _=0;_<=s;_++){let z=_/s,A=z*h+a,T=Math.sin(A),C=Math.cos(A);g.x=S*T,g.y=-w*i+y,g.z=S*C,u.push(g.x,g.y,g.z),n.set(T,b,C).normalize(),c.push(n.x,n.y,n.z),p.push(z,1-w),M.push(d++)}m.push(M)}for(let O=0;O<s;O++)for(let k=0;k<r;k++){let N=m[k][O],P=m[k+1][O],E=m[k+1][O+1],B=m[k][O+1];(t>0||0!==k)&&(l.push(N,P,B),x+=3),(e>0||k!==r-1)&&(l.push(P,E,B),x+=3)}o.addGroup(f,x,0),f+=x})(),!1===n&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(l),this.setAttribute("position",new sz(u,3)),this.setAttribute("normal",new sz(c,3)),this.setAttribute("uv",new sz(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rN(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rP extends rN{constructor(t=1,e=1,i=32,s=1,r=!1,n=0,a=2*Math.PI){super(0,t,e,i,s,r,n,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:n,thetaLength:a}}static fromJSON(t){return new rP(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rE extends sE{constructor(t=[],e=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:s};let r=[],n=[];function a(t){r.push(t.x,t.y,t.z)}function h(e,i){let s=3*e;i.x=t[s+0],i.y=t[s+1],i.z=t[s+2]}function o(t,e,i,s){s<0&&1===t.x&&(n[e]=t.x-1),0===i.x&&0===i.z&&(n[e]=s/2/Math.PI+.5)}function l(t){return Math.atan2(t.z,-t.x)}(function(t){let i=new ie,s=new ie,r=new ie;for(let n=0;n<e.length;n+=3)h(e[n+0],i),h(e[n+1],s),h(e[n+2],r),function(t,e,i,s){let r=s+1,n=[];for(let h=0;h<=r;h++){n[h]=[];let o=t.clone().lerp(i,h/r),l=e.clone().lerp(i,h/r),u=r-h;for(let c=0;c<=u;c++)0===c&&h===r?n[h][c]=o:n[h][c]=o.clone().lerp(l,c/u)}for(let p=0;p<r;p++)for(let d=0;d<2*(r-p)-1;d++){let m=Math.floor(d/2);d%2==0?(a(n[p][m+1]),a(n[p+1][m]),a(n[p][m])):(a(n[p][m+1]),a(n[p+1][m+1]),a(n[p+1][m]))}}(i,s,r,t)})(s),function(t){let e=new ie;for(let i=0;i<r.length;i+=3)e.x=r[i+0],e.y=r[i+1],e.z=r[i+2],e.normalize().multiplyScalar(t),r[i+0]=e.x,r[i+1]=e.y,r[i+2]=e.z}(i),function(){let t=new ie;for(let e=0;e<r.length;e+=3){t.x=r[e+0],t.y=r[e+1],t.z=r[e+2];let i=l(t)/2/Math.PI+.5,s=Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5;n.push(i,1-s)}(function(){let t=new ie,e=new ie,i=new ie,s=new ie,a=new eV,h=new eV,u=new eV;for(let c=0,p=0;c<r.length;c+=9,p+=6){t.set(r[c+0],r[c+1],r[c+2]),e.set(r[c+3],r[c+4],r[c+5]),i.set(r[c+6],r[c+7],r[c+8]),a.set(n[p+0],n[p+1]),h.set(n[p+2],n[p+3]),u.set(n[p+4],n[p+5]),s.copy(t).add(e).add(i).divideScalar(3);let d=l(s);o(a,p+0,t,d),o(h,p+2,e,d),o(u,p+4,i,d)}})(),function(){for(let t=0;t<n.length;t+=6){let e=n[t+0],i=n[t+2],s=n[t+4],r=Math.max(e,i,s),a=Math.min(e,i,s);r>.9&&a<.1&&(e<.2&&(n[t+0]+=1),i<.2&&(n[t+2]+=1),s<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new sz(r,3)),this.setAttribute("normal",new sz(r.slice(),3)),this.setAttribute("uv",new sz(n,2)),0===s?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rE(t.vertices,t.indices,t.radius,t.details)}}class rB extends rE{constructor(t=1,e=0){let i=(1+Math.sqrt(5))/2,s=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new rB(t.radius,t.detail)}}class rI extends rT{constructor(t){super(t),this.uuid=eE(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,s=this.holes.length;i<s;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){let s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let s=t.holes[e];this.holes.push(new rT().fromJSON(s))}return this}}class rR{static triangulate(t,e,i=2){let s,r,n,a,h,o,l;let u=e&&e.length,c=u?e[0]*i:t.length,p=rV(t,0,c,i,!0),d=[];if(!p||p.next===p.prev)return d;if(u&&(p=function(t,e,i,s){let r,n,a,h,o;let l=[];for(r=0,n=e.length;r<n;r++)a=e[r]*s,h=r<n-1?e[r+1]*s:t.length,(o=rV(t,a,h,s,!1))===o.next&&(o.steiner=!0),l.push(function(t){let e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}(o));for(l.sort(rL),r=0;r<l.length;r++)i=function(t,e){let i=function(t,e){let i=e,s=-1/0,r,n=t.x,a=t.y;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){let h=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(h<=n&&h>s&&(s=h,r=i.x<i.next.x?i:i.next,h===n))return r}i=i.next}while(i!==e);if(!r)return null;let o=r,l=r.x,u=r.y,c=1/0,p;i=r;do{var d,m;n>=i.x&&i.x>=l&&n!==i.x&&rU(a<u?n:s,a,l,u,a<u?s:n,a,i.x,i.y)&&(p=Math.abs(a-i.y)/(n-i.x),rZ(i,t)&&(p<c||p===c&&(i.x>r.x||i.x===r.x&&(d=r,m=i,0>rW(d.prev,d,m.prev)&&0>rW(m.next,d,d.next))))&&(r=i,c=p)),i=i.next}while(i!==o);return r}(t,e);if(!i)return e;let s=rG(i,t);return rF(s,s.next),rF(i,i.next)}(l[r],i);return i}(t,e,p,i)),t.length>80*i){s=n=t[0],r=a=t[1];for(let m=i;m<c;m+=i)h=t[m],o=t[m+1],h<s&&(s=h),o<r&&(r=o),h>n&&(n=h),o>a&&(a=o);l=0!==(l=Math.max(n-s,a-r))?32767/l:0}return function t(e,i,s,r,n,a,h){if(!e)return;!h&&a&&function(t,e,i,s){let r=t;do 0===r.z&&(r.z=rj(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,s,r,n,a,h,o,l=1;do{for(i=t,t=null,n=null,a=0;i;){for(a++,s=i,h=0,e=0;e<l&&(h++,s=s.nextZ);e++);for(o=l;h>0||o>0&&s;)0!==h&&(0===o||!s||i.z<=s.z)?(r=i,i=i.nextZ,h--):(r=s,s=s.nextZ,o--),n?n.nextZ=r:t=r,r.prevZ=n,n=r;i=s}n.nextZ=null,l*=2}while(a>1)}(r)}(e,r,n,a);let o=e,l,u;for(;e.prev!==e.next;){if(l=e.prev,u=e.next,a?function(t,e,i,s){let r=t.prev,n=t.next;if(rW(r,t,n)>=0)return!1;let a=r.x,h=t.x,o=n.x,l=r.y,u=t.y,c=n.y,p=a<h?a<o?a:o:h<o?h:o,d=l<u?l<c?l:c:u<c?u:c,m=a>h?a>o?a:o:h>o?h:o,y=l>u?l>c?l:c:u>c?u:c,f=rj(p,d,e,i,s),g=rj(m,y,e,i,s),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=f&&b&&b.z<=g;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=y&&x!==r&&x!==n&&rU(a,l,h,u,o,c,x.x,x.y)&&rW(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=d&&b.y<=y&&b!==r&&b!==n&&rU(a,l,h,u,o,c,b.x,b.y)&&rW(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=f;){if(x.x>=p&&x.x<=m&&x.y>=d&&x.y<=y&&x!==r&&x!==n&&rU(a,l,h,u,o,c,x.x,x.y)&&rW(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=g;){if(b.x>=p&&b.x<=m&&b.y>=d&&b.y<=y&&b!==r&&b!==n&&rU(a,l,h,u,o,c,b.x,b.y)&&rW(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(e,r,n,a):function(t){let e=t.prev,i=t.next;if(rW(e,t,i)>=0)return!1;let s=e.x,r=t.x,n=i.x,a=e.y,h=t.y,o=i.y,l=s<r?s<n?s:n:r<n?r:n,u=a<h?a<o?a:o:h<o?h:o,c=s>r?s>n?s:n:r>n?r:n,p=a>h?a>o?a:o:h>o?h:o,d=i.next;for(;d!==e;){if(d.x>=l&&d.x<=c&&d.y>=u&&d.y<=p&&rU(s,a,r,h,n,o,d.x,d.y)&&rW(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}(e)){i.push(l.i/s|0),i.push(e.i/s|0),i.push(u.i/s|0),rY(e),e=u.next,o=u.next;continue}if((e=u)===o){h?1===h?t(e=function(t,e,i){let s=t;do{let r=s.prev,n=s.next.next;!rD(r,n)&&rJ(r,s,s.next,n)&&rZ(r,n)&&rZ(n,r)&&(e.push(r.i/i|0),e.push(s.i/i|0),e.push(n.i/i|0),rY(s),rY(s.next),s=t=n),s=s.next}while(s!==t);return rF(s)}(rF(e),i,s),i,s,r,n,a,2):2===h&&function(e,i,s,r,n,a){let h=e;do{let o=h.next.next;for(;o!==h.prev;){var l,u;if(h.i!==o.i&&(l=h,u=o,l.next.i!==u.i&&l.prev.i!==u.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&rJ(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(l,u)&&(rZ(l,u)&&rZ(u,l)&&function(t,e){let i=t,s=!1,r=(t.x+e.x)/2,n=(t.y+e.y)/2;do i.y>n!=i.next.y>n&&i.next.y!==i.y&&r<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next;while(i!==t);return s}(l,u)&&(rW(l.prev,l,u.prev)||rW(l,u.prev,u))||rD(l,u)&&rW(l.prev,l,l.next)>0&&rW(u.prev,u,u.next)>0))){let c=rG(h,o);h=rF(h,h.next),c=rF(c,c.next),t(h,i,s,r,n,a,0),t(c,i,s,r,n,a,0);return}o=o.next}h=h.next}while(h!==e)}(e,i,s,r,n,a):t(rF(e),i,s,r,n,a,1);break}}}(p,d,i,s,r,l,0),d}}function rV(t,e,i,s,r){let n,a;if(r===function(t,e,i,s){let r=0;for(let n=e,a=i-s;n<i;n+=s)r+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return r}(t,e,i,s)>0)for(n=e;n<i;n+=s)a=rX(n,t[n],t[n+1],a);else for(n=i-s;n>=e;n-=s)a=rX(n,t[n],t[n+1],a);return a&&rD(a,a.next)&&(rY(a),a=a.next),a}function rF(t,e){if(!t)return t;e||(e=t);let i=t,s;do if(s=!1,!i.steiner&&(rD(i,i.next)||0===rW(i.prev,i,i.next))){if(rY(i),(i=e=i.prev)===i.next)break;s=!0}else i=i.next;while(s||i!==e);return e}function rL(t,e){return t.x-e.x}function rj(t,e,i,s,r){return(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=(e-s)*r|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function rU(t,e,i,s,r,n,a,h){return(r-a)*(e-h)>=(t-a)*(n-h)&&(t-a)*(s-h)>=(i-a)*(e-h)&&(i-a)*(n-h)>=(r-a)*(s-h)}function rW(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function rD(t,e){return t.x===e.x&&t.y===e.y}function rJ(t,e,i,s){let r=rH(rW(t,e,i)),n=rH(rW(t,e,s)),a=rH(rW(i,s,t)),h=rH(rW(i,s,e));return!!(r!==n&&a!==h||0===r&&rq(t,i,e)||0===n&&rq(t,s,e)||0===a&&rq(i,t,s)||0===h&&rq(i,e,s))}function rq(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function rH(t){return t>0?1:t<0?-1:0}function rZ(t,e){return 0>rW(t.prev,t,t.next)?rW(t,e,t.next)>=0&&rW(t,t.prev,e)>=0:0>rW(t,e,t.prev)||0>rW(t,t.next,e)}function rG(t,e){let i=new rQ(t.i,t.x,t.y),s=new rQ(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,n.next=s,s.prev=n,s}function rX(t,e,i,s){let r=new rQ(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function rY(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function rQ(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class r${static area(t){let e=t.length,i=0;for(let s=e-1,r=0;r<e;s=r++)i+=t[s].x*t[r].y-t[r].x*t[s].y;return .5*i}static isClockWise(t){return 0>r$.area(t)}static triangulateShape(t,e){let i=[],s=[],r=[];rK(t),r0(i,t);let n=t.length;e.forEach(rK);for(let a=0;a<e.length;a++)s.push(n),n+=e[a].length,r0(i,e[a]);let h=rR.triangulate(i,s);for(let o=0;o<h.length;o+=3)r.push(h.slice(o,o+3));return r}}function rK(t){let e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function r0(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class r1 extends sE{constructor(t=new rI([new eV(.5,.5),new eV(-.5,.5),new eV(-.5,-.5),new eV(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];let i=this,s=[],r=[];for(let n=0,a=t.length;n<a;n++){let h=t[n];!function(t){let n,a,h,o;let l=[],u=void 0!==e.curveSegments?e.curveSegments:12,c=void 0!==e.steps?e.steps:1,p=void 0!==e.depth?e.depth:1,d=void 0===e.bevelEnabled||e.bevelEnabled,m=void 0!==e.bevelThickness?e.bevelThickness:.2,y=void 0!==e.bevelSize?e.bevelSize:m-.1,f=void 0!==e.bevelOffset?e.bevelOffset:0,g=void 0!==e.bevelSegments?e.bevelSegments:3,x=e.extrudePath,b=void 0!==e.UVGenerator?e.UVGenerator:r2,v,M=!1;x&&(v=x.getSpacedPoints(c),M=!0,d=!1,n=x.computeFrenetFrames(c,!1),a=new ie,h=new ie,o=new ie),d||(g=0,m=0,y=0,f=0);let w=t.extractPoints(u),S=w.shape,_=w.holes,z=!r$.isClockWise(S);if(z){S=S.reverse();for(let A=0,T=_.length;A<T;A++){let C=_[A];r$.isClockWise(C)&&(_[A]=C.reverse())}}let O=r$.triangulateShape(S,_),k=S;for(let N=0,P=_.length;N<P;N++){let E=_[N];S=S.concat(E)}function B(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,i)}let I=S.length,R=O.length;function V(t,e,i){let s,r,n;let a=t.x-e.x,h=t.y-e.y,o=i.x-t.x,l=i.y-t.y,u=a*a+h*h;if(Math.abs(a*l-h*o)>Number.EPSILON){let c=Math.sqrt(u),p=Math.sqrt(o*o+l*l),d=e.x-h/c,m=e.y+a/c,y=i.x-l/p,f=i.y+o/p,g=((y-d)*l-(f-m)*o)/(a*l-h*o);s=d+a*g-t.x,r=m+h*g-t.y;let x=s*s+r*r;if(x<=2)return new eV(s,r);n=Math.sqrt(x/2)}else{let b=!1;a>Number.EPSILON?o>Number.EPSILON&&(b=!0):a<-Number.EPSILON?o<-Number.EPSILON&&(b=!0):Math.sign(h)===Math.sign(l)&&(b=!0),b?(s=-h,r=a,n=Math.sqrt(u)):(s=a,r=h,n=Math.sqrt(u/2))}return new eV(s/n,r/n)}let F=[];for(let L=0,j=k.length,U=j-1,W=L+1;L<j;L++,U++,W++)U===j&&(U=0),W===j&&(W=0),F[L]=V(k[L],k[U],k[W]);let D=[],J,q=F.concat();for(let H=0,Z=_.length;H<Z;H++){let G=_[H];J=[];for(let X=0,Y=G.length,Q=Y-1,$=X+1;X<Y;X++,Q++,$++)Q===Y&&(Q=0),$===Y&&($=0),J[X]=V(G[X],G[Q],G[$]);D.push(J),q=q.concat(J)}for(let K=0;K<g;K++){let tt=K/g,te=m*Math.cos(tt*Math.PI/2),ti=y*Math.sin(tt*Math.PI/2)+f;for(let ts=0,tr=k.length;ts<tr;ts++){let tn=B(k[ts],F[ts],ti);tP(tn.x,tn.y,-te)}for(let ta=0,th=_.length;ta<th;ta++){let to=_[ta];J=D[ta];for(let tl=0,tu=to.length;tl<tu;tl++){let tc=B(to[tl],J[tl],ti);tP(tc.x,tc.y,-te)}}}let tp=y+f;for(let td=0;td<I;td++){let tm=d?B(S[td],q[td],tp):S[td];M?(h.copy(n.normals[0]).multiplyScalar(tm.x),a.copy(n.binormals[0]).multiplyScalar(tm.y),o.copy(v[0]).add(h).add(a),tP(o.x,o.y,o.z)):tP(tm.x,tm.y,0)}for(let ty=1;ty<=c;ty++)for(let tf=0;tf<I;tf++){let tg=d?B(S[tf],q[tf],tp):S[tf];M?(h.copy(n.normals[ty]).multiplyScalar(tg.x),a.copy(n.binormals[ty]).multiplyScalar(tg.y),o.copy(v[ty]).add(h).add(a),tP(o.x,o.y,o.z)):tP(tg.x,tg.y,p/c*ty)}for(let tx=g-1;tx>=0;tx--){let tb=tx/g,tv=m*Math.cos(tb*Math.PI/2),tM=y*Math.sin(tb*Math.PI/2)+f;for(let tw=0,tS=k.length;tw<tS;tw++){let t_=B(k[tw],F[tw],tM);tP(t_.x,t_.y,p+tv)}for(let tz=0,tA=_.length;tz<tA;tz++){let tT=_[tz];J=D[tz];for(let tC=0,tO=tT.length;tC<tO;tC++){let tk=B(tT[tC],J[tC],tM);M?tP(tk.x,tk.y+v[c-1].y,v[c-1].x+tv):tP(tk.x,tk.y,p+tv)}}}function tN(t,e){let r=t.length;for(;--r>=0;){let n=r,a=r-1;a<0&&(a=t.length-1);for(let h=0,o=c+2*g;h<o;h++){let l=I*h,u=I*(h+1),p=e+n+l,d=e+a+l,m=e+a+u,y=e+n+u;!function(t,e,r,n){tB(t),tB(e),tB(n),tB(e),tB(r),tB(n);let a=s.length/3,h=b.generateSideWallUV(i,s,a-6,a-3,a-2,a-1);tI(h[0]),tI(h[1]),tI(h[3]),tI(h[1]),tI(h[2]),tI(h[3])}(p,d,m,y)}}}function tP(t,e,i){l.push(t),l.push(e),l.push(i)}function tE(t,e,r){tB(t),tB(e),tB(r);let n=s.length/3,a=b.generateTopUV(i,s,n-3,n-2,n-1);tI(a[0]),tI(a[1]),tI(a[2])}function tB(t){s.push(l[3*t+0]),s.push(l[3*t+1]),s.push(l[3*t+2])}function tI(t){r.push(t.x),r.push(t.y)}(function(){let t=s.length/3;if(d){let e=0*I;for(let r=0;r<R;r++){let n=O[r];tE(n[2]+e,n[1]+e,n[0]+e)}e=I*(c+2*g);for(let a=0;a<R;a++){let h=O[a];tE(h[0]+e,h[1]+e,h[2]+e)}}else{for(let o=0;o<R;o++){let l=O[o];tE(l[2],l[1],l[0])}for(let u=0;u<R;u++){let p=O[u];tE(p[0]+I*c,p[1]+I*c,p[2]+I*c)}}i.addGroup(t,s.length/3-t,0)})(),function(){let t=s.length/3,e=0;tN(k,0),e+=k.length;for(let r=0,n=_.length;r<n;r++){let a=_[r];tN(a,e),e+=a.length}i.addGroup(t,s.length/3-t,1)}()}(h)}this.setAttribute("position",new sz(s,3)),this.setAttribute("uv",new sz(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes,i=this.parameters.options;return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let s=0,r=t.length;s<r;s++){let n=t[s];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);return i.options=Object.assign({},e),void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}(e,i,t)}static fromJSON(t,e){let i=[];for(let s=0,r=t.shapes.length;s<r;s++){let n=e[t.shapes[s]];i.push(n)}let a=t.options.extrudePath;return void 0!==a&&(t.options.extrudePath=new rz[a.type]().fromJSON(a)),new r1(i,t.options)}}let r2={generateTopUV:function(t,e,i,s,r){let n=e[3*i],a=e[3*i+1],h=e[3*s],o=e[3*s+1],l=e[3*r],u=e[3*r+1];return[new eV(n,a),new eV(h,o),new eV(l,u)]},generateSideWallUV:function(t,e,i,s,r,n){let a=e[3*i],h=e[3*i+1],o=e[3*i+2],l=e[3*s],u=e[3*s+1],c=e[3*s+2],p=e[3*r],d=e[3*r+1],m=e[3*r+2],y=e[3*n],f=e[3*n+1],g=e[3*n+2];return Math.abs(h-u)<Math.abs(a-l)?[new eV(a,1-o),new eV(l,1-c),new eV(p,1-m),new eV(y,1-g)]:[new eV(h,1-o),new eV(u,1-c),new eV(d,1-m),new eV(f,1-g)]}};class r3 extends rE{constructor(t=1,e=0){let i=(1+Math.sqrt(5))/2;super([-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new r3(t.radius,t.detail)}}class r5 extends rE{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new r5(t.radius,t.detail)}}class r4 extends sE{constructor(t=1,e=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:s};let r=t/2,n=e/2,a=Math.floor(i),h=Math.floor(s),o=a+1,l=h+1,u=t/a,c=e/h,p=[],d=[],m=[],y=[];for(let f=0;f<l;f++){let g=f*c-n;for(let x=0;x<o;x++){let b=x*u-r;d.push(b,-g,0),m.push(0,0,1),y.push(x/a),y.push(1-f/h)}}for(let v=0;v<h;v++)for(let M=0;M<a;M++){let w=M+o*v,S=M+o*(v+1),_=M+1+o*(v+1),z=M+1+o*v;p.push(w,S,z),p.push(S,_,z)}this.setIndex(p),this.setAttribute("position",new sz(d,3)),this.setAttribute("normal",new sz(m,3)),this.setAttribute("uv",new sz(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r4(t.width,t.height,t.widthSegments,t.heightSegments)}}class r6 extends sE{constructor(t=.5,e=1,i=32,s=1,r=0,n=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:s,thetaStart:r,thetaLength:n},i=Math.max(3,i),s=Math.max(1,s);let a=[],h=[],o=[],l=[],u=t,c=(e-t)/s,p=new ie,d=new eV;for(let m=0;m<=s;m++){for(let y=0;y<=i;y++){let f=r+y/i*n;p.x=u*Math.cos(f),p.y=u*Math.sin(f),h.push(p.x,p.y,p.z),o.push(0,0,1),d.x=(p.x/e+1)/2,d.y=(p.y/e+1)/2,l.push(d.x,d.y)}u+=c}for(let g=0;g<s;g++){let x=g*(i+1);for(let b=0;b<i;b++){let v=b+x,M=v+i+1,w=v+i+2,S=v+1;a.push(v,M,S),a.push(M,w,S)}}this.setIndex(a),this.setAttribute("position",new sz(h,3)),this.setAttribute("normal",new sz(o,3)),this.setAttribute("uv",new sz(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r6(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class r7 extends sE{constructor(t=new rI([new eV(0,.5),new eV(-.5,-.5),new eV(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};let i=[],s=[],r=[],n=[],a=0,h=0;if(!1===Array.isArray(t))l(t);else for(let o=0;o<t.length;o++)l(t[o]),this.addGroup(a,h,o),a+=h,h=0;function l(t){let a=s.length/3,o=t.extractPoints(e),l=o.shape,u=o.holes;!1===r$.isClockWise(l)&&(l=l.reverse());for(let c=0,p=u.length;c<p;c++){let d=u[c];!0===r$.isClockWise(d)&&(u[c]=d.reverse())}let m=r$.triangulateShape(l,u);for(let y=0,f=u.length;y<f;y++){let g=u[y];l=l.concat(g)}for(let x=0,b=l.length;x<b;x++){let v=l[x];s.push(v.x,v.y,0),r.push(0,0,1),n.push(v.x,v.y)}for(let M=0,w=m.length;M<w;M++){let S=m[M],_=S[0]+a,z=S[1]+a,A=S[2]+a;i.push(_,z,A),h+=3}}this.setIndex(i),this.setAttribute("position",new sz(s,3)),this.setAttribute("normal",new sz(r,3)),this.setAttribute("uv",new sz(n,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),e=this.parameters.shapes;return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,s=t.length;i<s;i++){let r=t[i];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}(e,t)}static fromJSON(t,e){let i=[];for(let s=0,r=t.shapes.length;s<r;s++){let n=e[t.shapes[s]];i.push(n)}return new r7(i,t.curveSegments)}}class r9 extends sE{constructor(t=1,e=32,i=16,s=0,r=2*Math.PI,n=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:s,phiLength:r,thetaStart:n,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));let h=Math.min(n+a,Math.PI),o=0,l=[],u=new ie,c=new ie,p=[],d=[],m=[],y=[];for(let f=0;f<=i;f++){let g=[],x=f/i,b=0;0===f&&0===n?b=.5/e:f===i&&h===Math.PI&&(b=-.5/e);for(let v=0;v<=e;v++){let M=v/e;u.x=-t*Math.cos(s+M*r)*Math.sin(n+x*a),u.y=t*Math.cos(n+x*a),u.z=t*Math.sin(s+M*r)*Math.sin(n+x*a),d.push(u.x,u.y,u.z),c.copy(u).normalize(),m.push(c.x,c.y,c.z),y.push(M+b,1-x),g.push(o++)}l.push(g)}for(let w=0;w<i;w++)for(let S=0;S<e;S++){let _=l[w][S+1],z=l[w][S],A=l[w+1][S],T=l[w+1][S+1];(0!==w||n>0)&&p.push(_,z,T),(w!==i-1||h<Math.PI)&&p.push(z,A,T)}this.setIndex(p),this.setAttribute("position",new sz(d,3)),this.setAttribute("normal",new sz(m,3)),this.setAttribute("uv",new sz(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r9(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class r8 extends rE{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new r8(t.radius,t.detail)}}class nt extends sE{constructor(t=1,e=.4,i=12,s=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:s,arc:r},i=Math.floor(i),s=Math.floor(s);let n=[],a=[],h=[],o=[],l=new ie,u=new ie,c=new ie;for(let p=0;p<=i;p++)for(let d=0;d<=s;d++){let m=d/s*r,y=p/i*Math.PI*2;u.x=(t+e*Math.cos(y))*Math.cos(m),u.y=(t+e*Math.cos(y))*Math.sin(m),u.z=e*Math.sin(y),a.push(u.x,u.y,u.z),l.x=t*Math.cos(m),l.y=t*Math.sin(m),c.subVectors(u,l).normalize(),h.push(c.x,c.y,c.z),o.push(d/s),o.push(p/i)}for(let f=1;f<=i;f++)for(let g=1;g<=s;g++){let x=(s+1)*f+g-1,b=(s+1)*(f-1)+g-1,v=(s+1)*(f-1)+g,M=(s+1)*f+g;n.push(x,b,M),n.push(b,v,M)}this.setIndex(n),this.setAttribute("position",new sz(a,3)),this.setAttribute("normal",new sz(h,3)),this.setAttribute("uv",new sz(o,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new nt(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class ne extends sE{constructor(t=1,e=.4,i=64,s=8,r=2,n=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:s,p:r,q:n},i=Math.floor(i),s=Math.floor(s);let a=[],h=[],o=[],l=[],u=new ie,c=new ie,p=new ie,d=new ie,m=new ie,y=new ie,f=new ie;for(let g=0;g<=i;++g){let x=g/i*r*Math.PI*2;O(x,r,n,t,p),O(x+.01,r,n,t,d),y.subVectors(d,p),f.addVectors(d,p),m.crossVectors(y,f),f.crossVectors(m,y),m.normalize(),f.normalize();for(let b=0;b<=s;++b){let v=b/s*Math.PI*2,M=-e*Math.cos(v),w=e*Math.sin(v);u.x=p.x+(M*f.x+w*m.x),u.y=p.y+(M*f.y+w*m.y),u.z=p.z+(M*f.z+w*m.z),h.push(u.x,u.y,u.z),c.subVectors(u,p).normalize(),o.push(c.x,c.y,c.z),l.push(g/i),l.push(b/s)}}for(let S=1;S<=i;S++)for(let _=1;_<=s;_++){let z=(s+1)*(S-1)+(_-1),A=(s+1)*S+(_-1),T=(s+1)*S+_,C=(s+1)*(S-1)+_;a.push(z,A,C),a.push(A,T,C)}function O(t,e,i,s,r){let n=i/e*t,a=Math.cos(n);r.x=s*(2+a)*.5*Math.cos(t),r.y=s*(2+a)*Math.sin(t)*.5,r.z=s*Math.sin(n)*.5}this.setIndex(a),this.setAttribute("position",new sz(h,3)),this.setAttribute("normal",new sz(o,3)),this.setAttribute("uv",new sz(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ne(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class ni extends sE{constructor(t=new rS(new ie(-1,-1,0),new ie(-1,1,0),new ie(1,1,0)),e=64,i=1,s=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:s,closed:r};let n=t.computeFrenetFrames(e,r);this.tangents=n.tangents,this.normals=n.normals,this.binormals=n.binormals;let a=new ie,h=new ie,o=new eV,l=new ie,u=[],c=[],p=[],d=[];function m(r){l=t.getPointAt(r/e,l);let o=n.normals[r],p=n.binormals[r];for(let d=0;d<=s;d++){let m=d/s*Math.PI*2,y=Math.sin(m),f=-Math.cos(m);h.x=f*o.x+y*p.x,h.y=f*o.y+y*p.y,h.z=f*o.z+y*p.z,h.normalize(),c.push(h.x,h.y,h.z),a.x=l.x+i*h.x,a.y=l.y+i*h.y,a.z=l.z+i*h.z,u.push(a.x,a.y,a.z)}}(function(){for(let t=0;t<e;t++)m(t);m(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let i=0;i<=s;i++)o.x=t/e,o.y=i/s,p.push(o.x,o.y)}(),function(){for(let t=1;t<=e;t++)for(let i=1;i<=s;i++){let r=(s+1)*(t-1)+(i-1),n=(s+1)*t+(i-1),a=(s+1)*t+i,h=(s+1)*(t-1)+i;d.push(r,n,h),d.push(n,a,h)}}()})(),this.setIndex(d),this.setAttribute("position",new sz(u,3)),this.setAttribute("normal",new sz(c,3)),this.setAttribute("uv",new sz(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new ni(new rz[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class ns extends sg{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new sm(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new sm(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ep,this.normalScale=new eV(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new iW,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,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.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,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 nr extends sg{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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 nn extends sg{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}}function na(t,e,i){return t&&(i||t.constructor!==e)?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}class nh{constructor(t,e,i,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==s?s:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,i=this._cachedIndex,s=e[i],r=e[i-1];t:{e:{let n;i:{s:if(!(t<s)){for(let a=i+2;;){if(void 0===s){if(t<r)break s;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(r=s,t<(s=e[++i]))break e}n=e.length;break i}if(!(t>=r)){let h=e[1];t<h&&(i=2,r=h);for(let o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===o)break;if(s=r,t>=(r=e[--i-1]))break e}n=i,i=0;break i}break t}for(;i<n;){let l=i+n>>>1;t<e[l]?n=l:i=l+1}if(s=e[i],void 0===(r=e[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===s)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,s)}return this.interpolate_(i,r,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,i=this.sampleValues,s=this.valueSize,r=t*s;for(let n=0;n!==s;++n)e[n]=i[r+n];return e}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class no extends nh{constructor(t,e,i,s){super(t,e,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){let s=this.parameterPositions,r=t-2,n=t+1,a=s[r],h=s[n];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:r=t,a=2*e-i;break;case 2402:a=e+s[r=s.length-2]-s[r+1];break;default:r=t,a=i}if(void 0===h)switch(this.getSettings_().endingEnd){case 2401:n=t,h=2*i-e;break;case 2402:n=1,h=i+s[1]-s[0];break;default:n=t-1,h=e}let o=(i-e)*.5,l=this.valueSize;this._weightPrev=o/(e-a),this._weightNext=o/(h-i),this._offsetPrev=r*l,this._offsetNext=n*l}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,h=t*a,o=h-a,l=this._offsetPrev,u=this._offsetNext,c=this._weightPrev,p=this._weightNext,d=(i-e)/(s-e),m=d*d,y=m*d,f=-c*y+2*c*m-c*d,g=(1+c)*y+(-1.5-2*c)*m+(-.5+c)*d+1,x=(-1-p)*y+(1.5+p)*m+.5*d,b=p*y-p*m;for(let v=0;v!==a;++v)r[v]=f*n[l+v]+g*n[o+v]+x*n[h+v]+b*n[u+v];return r}}class nl extends nh{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,h=t*a,o=h-a,l=(i-e)/(s-e),u=1-l;for(let c=0;c!==a;++c)r[c]=n[o+c]*u+n[h+c]*l;return r}}class nu extends nh{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t){return this.copySampleValue_(t-1)}}class nc{constructor(t,e,i,s){if(void 0===t)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=na(e,this.TimeBufferType),this.values=na(i,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e;let i=t.constructor;if(i.toJSON!==this.toJSON)e=i.toJSON(t);else{e={name:t.name,times:na(t.times,Array),values:na(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(e.interpolation=s)}return e.type=t.ValueTypeName,e}InterpolantFactoryMethodDiscrete(t){return new nu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new nl(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new no(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(i)}return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){let e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]+=t}return this}scale(t){if(1!==t){let e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]*=t}return this}trim(t,e){let i=this.times,s=i.length,r=0,n=s-1;for(;r!==s&&i[r]<t;)++r;for(;-1!==n&&i[n]>e;)--n;if(++n,0!==r||n!==s){r>=n&&(r=(n=Math.max(n,1))-1);let a=this.getValueSize();this.times=i.slice(r,n),this.values=this.values.slice(r*a,n*a)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let i=this.times,s=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let a=0;a!==r;a++){let h=i[a];if("number"==typeof h&&isNaN(h)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,h),t=!1;break}if(null!==n&&n>h){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,h,n),t=!1;break}n=h}if(void 0!==s&&ArrayBuffer.isView(s)&&!(s instanceof DataView))for(let o=0,l=s.length;o!==l;++o){let u=s[o];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,u),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=2302===this.getInterpolation(),r=t.length-1,n=1;for(let a=1;a<r;++a){let h=!1,o=t[a],l=t[a+1];if(o!==l&&(1!==a||o!==t[0])){if(s)h=!0;else{let u=a*i,c=u-i,p=u+i;for(let d=0;d!==i;++d){let m=e[u+d];if(m!==e[c+d]||m!==e[p+d]){h=!0;break}}}}if(h){if(a!==n){t[n]=t[a];let y=a*i,f=n*i;for(let g=0;g!==i;++g)e[f+g]=e[y+g]}++n}}if(r>0){t[n]=t[r];for(let x=r*i,b=n*i,v=0;v!==i;++v)e[b+v]=e[x+v];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),i=this.constructor,s=new i(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}}nc.prototype.TimeBufferType=Float32Array,nc.prototype.ValueBufferType=Float32Array,nc.prototype.DefaultInterpolation=2301;class np extends nc{constructor(t,e,i){super(t,e,i)}}np.prototype.ValueTypeName="bool",np.prototype.ValueBufferType=Array,np.prototype.DefaultInterpolation=2300,np.prototype.InterpolantFactoryMethodLinear=void 0,np.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends nc{}).prototype.ValueTypeName="color",(class extends nc{}).prototype.ValueTypeName="number";class nd extends nh{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){let r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,h=(i-e)/(s-e),o=t*a;for(let l=o+a;o!==l;o+=4)it.slerpFlat(r,0,n,o-a,n,o,h);return r}}class nm extends nc{InterpolantFactoryMethodLinear(t){return new nd(this.times,this.values,this.getValueSize(),t)}}nm.prototype.ValueTypeName="quaternion",nm.prototype.InterpolantFactoryMethodSmooth=void 0;class ny extends nc{constructor(t,e,i){super(t,e,i)}}ny.prototype.ValueTypeName="string",ny.prototype.ValueBufferType=Array,ny.prototype.DefaultInterpolation=2300,ny.prototype.InterpolantFactoryMethodLinear=void 0,ny.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends nc{}).prototype.ValueTypeName="vector";let nf={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},ng=new class{constructor(t,e,i){let s;let r=this,n=!1,a=0,h=0,o=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){h++,!1===n&&void 0!==r.onStart&&r.onStart(t,a,h),n=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,h),a===h&&(n=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return o.push(t,e),this},this.removeHandler=function(t){let e=o.indexOf(t);return -1!==e&&o.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=o.length;e<i;e+=2){let s=o[e],r=o[e+1];if(s.global&&(s.lastIndex=0),s.test(t))return r}return null}}};class nx{constructor(t){this.manager=void 0!==t?t:ng,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let i=this;return new Promise(function(s,r){i.load(t,s,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}nx.DEFAULT_MATERIAL_NAME="__DEFAULT";class nb extends nx{constructor(t){super(t)}load(t,e,i,s){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,n=nf.get(t);if(void 0!==n)return r.manager.itemStart(t),setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n;let a=eU("img");function h(){l(),nf.add(t,this),e&&e(this),r.manager.itemEnd(t)}function o(e){l(),s&&s(e),r.manager.itemError(t),r.manager.itemEnd(t)}function l(){a.removeEventListener("load",h,!1),a.removeEventListener("error",o,!1)}return a.addEventListener("load",h,!1),a.addEventListener("error",o,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class nv extends nx{constructor(t){super(t)}load(t,e,i,s){let r=new e5,n=new nb(this.manager);return n.setCrossOrigin(this.crossOrigin),n.setPath(this.path),n.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},i,s),r}}class nM extends sK{constructor(t=-1,e=1,i=1,s=-1,r=.1,n=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=s,this.near=r,this.far=n,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=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,s,r,n){null===this.view&&(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=i,this.view.offsetY=s,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=i-t,n=i+t,a=s+e,h=s-e;if(null!==this.view&&this.view.enabled){let o=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=o*this.view.offsetX,n=r+o*this.view.width,a-=l*this.view.offsetY,h=a-l*this.view.height}this.projectionMatrix.makeOrthographic(r,n,a,h,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let 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,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class nw extends sE{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class nS extends s3{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t,this.index=0}}let n_="\\[\\]\\.:\\/",nz=RegExp("["+n_+"]","g"),nA="[^"+n_+"]",nT="[^"+n_.replace("\\.","")+"]",nC=/((?:WC+[\/:])*)/.source.replace("WC",nA),nO=/(WCOD+)?/.source.replace("WCOD",nT),nk=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nA),nN=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nA),nP=RegExp("^"+nC+nO+nk+nN+"$"),nE=["material","materials","bones","map"];class nB{constructor(t,e,i){this.path=e,this.parsedPath=i||nB.parseTrackName(e),this.node=nB.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new nB.Composite(t,e,i):new nB(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(nz,"")}static parseTrackName(t){let e=nP.exec(t);if(null===e)throw Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==s&&-1!==s){let r=i.nodeName.substring(s+1);-1!==nE.indexOf(r)&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){let s=function(t){for(let i=0;i<t.length;i++){let r=t[i];if(r.name===e||r.uuid===e)return r;let n=s(r.children);if(n)return n}return null},r=s(t.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)t[e++]=i[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,i=e.objectName,s=e.propertyName,r=e.propertyIndex;if(t||(t=nB.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let a=0;a<t.length;a++)if(t[a].name===n){n=a;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(void 0===t[i]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[i]}if(void 0!==n){if(void 0===t[n]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[n]}}let h=t[s];if(void 0===h){let o=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+o+"."+s+" but it wasn't found.",t);return}let l=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?l=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(l=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===s){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}u=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=r}else void 0!==h.fromArray&&void 0!==h.toArray?(u=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(u=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=s;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}function nI(t,e,i,s){let r=function(t){switch(t){case tb:case tv:return{byteLength:1,components:1};case tw:case tM:case tA:return{byteLength:2,components:1};case tT:case tC:return{byteLength:2,components:4};case t_:case tS:case tz:return{byteLength:4,components:1};case tk:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${t}.`)}(s);switch(i){case tN:case tB:return t*e;case tI:return t*e*2;case tF:case tL:return t*e/r.components*r.byteLength;case tj:case tU:return t*e*2/r.components*r.byteLength;case tP:return t*e*3/r.components*r.byteLength;case tE:case tW:return t*e*4/r.components*r.byteLength;case tD:case tJ:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case tq:case tH:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case tG:case tY:return Math.max(t,16)*Math.max(e,8)/4;case tZ:case tX:return Math.max(t,8)*Math.max(e,8)/2;case tQ:case t$:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case tK:case t0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case t1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case t2:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case t3:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case t5:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case t4:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case t6:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case t7:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case t9:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case t8:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case et:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case ee:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case ei:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case es:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case er:case en:case ea:return Math.ceil(t/4)*Math.ceil(e/4)*16;case eh:case eo:return Math.ceil(t/4)*Math.ceil(e/4)*8;case el:case eu:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw Error(`Unable to determine texture byte length for ${i} format.`)}nB.Composite=class{constructor(t,e,i){let s=i||nB.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let i=this._targetGroup.nCachedObjects_,s=this._bindings[i];void 0!==s&&s.getValue(t,e)}setValue(t,e){let i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},nB.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},nB.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},nB.prototype.GetterByBindingType=[nB.prototype._getValue_direct,nB.prototype._getValue_array,nB.prototype._getValue_arrayElement,nB.prototype._getValue_toArray],nB.prototype.SetterByBindingTypeAndVersioning=[[nB.prototype._setValue_direct,nB.prototype._setValue_direct_setNeedsUpdate,nB.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nB.prototype._setValue_array,nB.prototype._setValue_array_setNeedsUpdate,nB.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nB.prototype._setValue_arrayElement,nB.prototype._setValue_arrayElement_setNeedsUpdate,nB.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nB.prototype._setValue_fromArray,nB.prototype._setValue_fromArray_setNeedsUpdate,nB.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],new Float32Array(1),"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:r}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=r)}}]);