driftdetect-dashboard 0.9.32 → 0.9.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/client/assets/{GalaxyTab-BsAmWarF.js → GalaxyTab-CwsGBZRU.js} +27 -27
  2. package/dist/client/assets/GalaxyTab-CwsGBZRU.js.map +1 -0
  3. package/dist/client/assets/main-B8BdmBfC.js +59 -0
  4. package/dist/client/assets/main-B8BdmBfC.js.map +1 -0
  5. package/dist/client/assets/{sfxr-Cr89uVKo.js → sfxr-bUoNgW_R.js} +2 -2
  6. package/dist/client/assets/{sfxr-Cr89uVKo.js.map → sfxr-bUoNgW_R.js.map} +1 -1
  7. package/dist/client/index.html +1 -1
  8. package/dist/server/api-routes.d.ts.map +1 -1
  9. package/dist/server/api-routes.js +1 -1
  10. package/dist/server/api-routes.js.map +1 -1
  11. package/dist/server/dashboard-server.d.ts.map +1 -1
  12. package/dist/server/dashboard-server.js +1 -1
  13. package/dist/server/dashboard-server.js.map +1 -1
  14. package/dist/server/drift-data-reader.d.ts.map +1 -1
  15. package/dist/server/drift-data-reader.js +16 -9
  16. package/dist/server/drift-data-reader.js.map +1 -1
  17. package/dist/server/express-app.d.ts.map +1 -1
  18. package/dist/server/express-app.js +2 -2
  19. package/dist/server/express-app.js.map +1 -1
  20. package/dist/server/galaxy-data-transformer.d.ts.map +1 -1
  21. package/dist/server/galaxy-data-transformer.js +29 -15
  22. package/dist/server/galaxy-data-transformer.js.map +1 -1
  23. package/dist/server/pattern-watcher.d.ts.map +1 -1
  24. package/dist/server/pattern-watcher.js +2 -2
  25. package/dist/server/pattern-watcher.js.map +1 -1
  26. package/dist/server/quality-gates-api.d.ts.map +1 -1
  27. package/dist/server/quality-gates-api.js.map +1 -1
  28. package/dist/server/websocket-server.d.ts +1 -1
  29. package/dist/server/websocket-server.d.ts.map +1 -1
  30. package/dist/server/websocket-server.js.map +1 -1
  31. package/package.json +1 -1
  32. package/dist/client/assets/GalaxyTab-BsAmWarF.js.map +0 -1
  33. package/dist/client/assets/main-QuEZvA3i.js +0 -59
  34. package/dist/client/assets/main-QuEZvA3i.js.map +0 -1
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sfxr-Cr89uVKo.js","assets/main-QuEZvA3i.js","assets/main-CVl-4C5E.css"])))=>i.map(i=>d[i]);
2
- var CS=Object.defineProperty;var RS=(r,e,t)=>e in r?CS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var co=(r,e,t)=>RS(r,typeof e!="symbol"?e+"":e,t);import{r as W,g as PS,j as L,c as LS,S as IS,a as Is,b as K_,A as Q_,O as NS,C as Xg,_ as DS,u as Fn,L as Gn,T as qg,d as Wr,F as xd,E as US,P as us,e as Yg,G as Ii,f as Vr,h as OS,i as FS,k as zS,D as BS,l as kS,m as HS,n as VS}from"./main-QuEZvA3i.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sfxr-bUoNgW_R.js","assets/main-B8BdmBfC.js","assets/main-CVl-4C5E.css"])))=>i.map(i=>d[i]);
2
+ var CS=Object.defineProperty;var RS=(r,e,t)=>e in r?CS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var co=(r,e,t)=>RS(r,typeof e!="symbol"?e+"":e,t);import{r as W,g as PS,j as L,c as LS,u as Fn,C as Vr,S as IS,a as Is,b as K_,A as Q_,O as NS,d as jg,P as us,e as Xg,G as Ii,_ as DS,E as US,L as Gn,f as Wr,F as xd,T as qg,h as OS,i as FS,k as zS,D as BS,l as kS,m as HS,n as VS}from"./main-B8BdmBfC.js";/**
3
3
  * @license
4
4
  * Copyright 2010-2023 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
6
- */const Zo="160",Ms={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Es={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},$_=0,Mf=1,ev=2,GS=3,tv=0,Ou=1,Fa=2,Ri=3,Mr=0,An=1,Si=2,WS=2,Sr=0,Ns=1,Ef=2,bf=3,wf=4,nv=5,Gr=100,iv=101,rv=102,Tf=103,Af=104,sv=200,ov=201,av=202,lv=203,Au=204,Cu=205,cv=206,uv=207,hv=208,dv=209,fv=210,pv=211,mv=212,gv=213,_v=214,vv=0,xv=1,yv=2,Ga=3,Sv=4,Mv=5,Ev=6,bv=7,ul=0,wv=1,Tv=2,Qi=0,Av=1,Cv=2,Rv=3,Fu=4,Pv=5,Lv=6,Cf="attached",Iv="detached",zu=300,Er=301,Yr=302,Wa=303,ja=304,Jo=306,Xa=1e3,Un=1001,qa=1002,en=1003,Ru=1004,jS=1004,za=1005,XS=1005,tn=1006,_p=1007,qS=1007,Zr=1008,YS=1008,$i=1009,Nv=1010,Dv=1011,Bu=1012,vp=1013,xr=1014,Ni=1015,Go=1016,xp=1017,yp=1018,jr=1020,Uv=1021,Wn=1023,Ov=1024,Fv=1025,Xr=1026,ks=1027,zv=1028,Sp=1029,Bv=1030,Mp=1031,Ep=1033,vu=33776,xu=33777,yu=33778,Su=33779,Rf=35840,Pf=35841,Lf=35842,If=35843,bp=36196,Nf=37492,Df=37496,Uf=37808,Of=37809,Ff=37810,zf=37811,Bf=37812,kf=37813,Hf=37814,Vf=37815,Gf=37816,Wf=37817,jf=37818,Xf=37819,qf=37820,Yf=37821,Mu=36492,Zf=36494,Jf=36495,kv=36283,Kf=36284,Qf=36285,$f=36286,Hv=2200,Vv=2201,Gv=2202,Ya=2300,Za=2301,Eu=2302,As=2400,Cs=2401,Ja=2402,ku=2500,wp=2501,ZS=0,JS=1,KS=2,Tp=3e3,qr=3001,Wv=3200,jv=3201,Kr=0,Xv=1,oi="",cn="srgb",nr="srgb-linear",Hu="display-p3",hl="display-p3-linear",Ka="linear",zt="srgb",Qa="rec709",$a="p3",QS=0,bs=7680,$S=7681,eM=7682,tM=7683,nM=34055,iM=34056,rM=5386,sM=512,oM=513,aM=514,lM=515,cM=516,uM=517,hM=518,ep=519,qv=512,Yv=513,Zv=514,Ap=515,Jv=516,Kv=517,Qv=518,$v=519,el=35044,Ds=35048,dM=35040,fM=35045,pM=35049,mM=35041,gM=35046,_M=35050,vM=35042,xM="100",tp="300 es",Pu=1035,Di=2e3,Wo=2001;let wr=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}};const In=["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"];let Zg=1234567;const Us=Math.PI/180,jo=180/Math.PI;function li(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(In[r&255]+In[r>>8&255]+In[r>>16&255]+In[r>>24&255]+"-"+In[e&255]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[t&63|128]+In[t>>8&255]+"-"+In[t>>16&255]+In[t>>24&255]+In[n&255]+In[n>>8&255]+In[n>>16&255]+In[n>>24&255]).toLowerCase()}function Jt(r,e,t){return Math.max(e,Math.min(t,r))}function Cp(r,e){return(r%e+e)%e}function yM(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function SM(r,e,t){return r!==e?(t-r)/(e-r):0}function Ba(r,e,t){return(1-t)*r+t*e}function MM(r,e,t,n){return Ba(r,e,1-Math.exp(-t*n))}function EM(r,e=1){return e-Math.abs(Cp(r,e*2)-e)}function bM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function wM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function TM(r,e){return r+Math.floor(Math.random()*(e-r+1))}function AM(r,e){return r+Math.random()*(e-r)}function CM(r){return r*(.5-Math.random())}function RM(r){r!==void 0&&(Zg=r);let e=Zg+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function PM(r){return r*Us}function LM(r){return r*jo}function np(r){return(r&r-1)===0&&r!==0}function IM(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Lu(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function NM(r,e,t,n,i){const s=Math.cos,a=Math.sin,c=s(t/2),u=a(t/2),h=s((e+n)/2),d=a((e+n)/2),f=s((e-n)/2),m=a((e-n)/2),g=s((n-e)/2),x=a((n-e)/2);switch(i){case"XYX":r.set(c*d,u*f,u*m,c*h);break;case"YZY":r.set(u*m,c*d,u*f,c*h);break;case"ZXZ":r.set(u*f,u*m,c*d,c*h);break;case"XZX":r.set(c*d,u*x,u*g,c*h);break;case"YXY":r.set(u*g,c*d,u*x,c*h);break;case"ZYZ":r.set(u*x,u*g,c*d,c*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Kn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function vt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const ex={DEG2RAD:Us,RAD2DEG:jo,generateUUID:li,clamp:Jt,euclideanModulo:Cp,mapLinear:yM,inverseLerp:SM,lerp:Ba,damp:MM,pingpong:EM,smoothstep:bM,smootherstep:wM,randInt:TM,randFloat:AM,randFloatSpread:CM,seededRandom:RM,degToRad:PM,radToDeg:LM,isPowerOfTwo:np,ceilPowerOfTwo:IM,floorPowerOfTwo:Lu,setQuaternionFromProperEuler:NM,normalize:vt,denormalize:Kn};class he{constructor(e=0,t=0){he.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class yt{constructor(e,t,n,i,s,a,c,u,h){yt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,c,u,h)}set(e,t,n,i,s,a,c,u,h){const d=this.elements;return d[0]=e,d[1]=i,d[2]=c,d[3]=t,d[4]=s,d[5]=u,d[6]=n,d[7]=a,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],c=n[3],u=n[6],h=n[1],d=n[4],f=n[7],m=n[2],g=n[5],x=n[8],S=i[0],y=i[3],_=i[6],b=i[1],M=i[4],T=i[7],R=i[2],C=i[5],N=i[8];return s[0]=a*S+c*b+u*R,s[3]=a*y+c*M+u*C,s[6]=a*_+c*T+u*N,s[1]=h*S+d*b+f*R,s[4]=h*y+d*M+f*C,s[7]=h*_+d*T+f*N,s[2]=m*S+g*b+x*R,s[5]=m*y+g*M+x*C,s[8]=m*_+g*T+x*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],d=e[8];return t*a*d-t*c*h-n*s*d+n*c*u+i*s*h-i*a*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],d=e[8],f=d*a-c*h,m=c*u-d*s,g=h*s-a*u,x=t*f+n*m+i*g;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=f*S,e[1]=(i*h-d*n)*S,e[2]=(c*n-i*a)*S,e[3]=m*S,e[4]=(d*t-i*u)*S,e[5]=(i*s-c*t)*S,e[6]=g*S,e[7]=(n*u-h*t)*S,e[8]=(a*t-n*s)*S,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,c){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*a+h*c)+a+e,-i*h,i*u,-i*(-h*a+u*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(yd.makeScale(e,t)),this}rotate(e){return this.premultiply(yd.makeRotation(-e)),this}translate(e,t){return this.premultiply(yd.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const yd=new yt;function tx(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const DM={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Oo(r,e){return new DM[r](e)}function tl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function nx(){const r=tl("canvas");return r.style.display="block",r}const Jg={};function ka(r){r in Jg||(Jg[r]=!0,console.warn(r))}const Kg=new yt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Qg=new yt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),xc={[nr]:{transfer:Ka,primaries:Qa,toReference:r=>r,fromReference:r=>r},[cn]:{transfer:zt,primaries:Qa,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[hl]:{transfer:Ka,primaries:$a,toReference:r=>r.applyMatrix3(Qg),fromReference:r=>r.applyMatrix3(Kg)},[Hu]:{transfer:zt,primaries:$a,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Qg),fromReference:r=>r.applyMatrix3(Kg).convertLinearToSRGB()}},UM=new Set([nr,hl]),Dt={enabled:!0,_workingColorSpace:nr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!UM.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=xc[e].toReference,i=xc[t].fromReference;return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this._workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this._workingColorSpace)},getPrimaries:function(r){return xc[r].primaries},getTransfer:function(r){return r===oi?Ka:xc[r].transfer}};function Vo(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Sd(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let uo;class Rp{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{uo===void 0&&(uo=tl("canvas")),uo.width=e.width,uo.height=e.height;const n=uo.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=uo}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tl("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=Vo(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Vo(t[n]/255)*255):t[n]=Vo(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let OM=0;class Rs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:OM++}),this.uuid=li(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,c=i.length;a<c;a++)i[a].isDataTexture?s.push(Md(i[a].image)):s.push(Md(i[a]))}else s=Md(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Md(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?Rp.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let FM=0;class nn extends wr{constructor(e=nn.DEFAULT_IMAGE,t=nn.DEFAULT_MAPPING,n=Un,i=Un,s=tn,a=Zr,c=Wn,u=$i,h=nn.DEFAULT_ANISOTROPY,d=oi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:FM++}),this.uuid=li(),this.name="",this.source=new Rs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=h,this.format=c,this.internalFormat=null,this.type=u,this.offset=new he(0,0),this.repeat=new he(1,1),this.center=new he(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new yt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof d=="string"?this.colorSpace=d:(ka("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=d===qr?cn:oi),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}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(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==zu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Xa:e.x=e.x-Math.floor(e.x);break;case Un:e.x=e.x<0?0:1;break;case qa:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Xa:e.y=e.y-Math.floor(e.y);break;case Un:e.y=e.y<0?0:1;break;case qa:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return ka("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===cn?qr:Tp}set encoding(e){ka("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===qr?cn:oi}}nn.DEFAULT_IMAGE=null;nn.DEFAULT_MAPPING=zu;nn.DEFAULT_ANISOTROPY=1;class At{constructor(e=0,t=0,n=0,i=1){At.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const u=e.elements,h=u[0],d=u[4],f=u[8],m=u[1],g=u[5],x=u[9],S=u[2],y=u[6],_=u[10];if(Math.abs(d-m)<.01&&Math.abs(f-S)<.01&&Math.abs(x-y)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+S)<.1&&Math.abs(x+y)<.1&&Math.abs(h+g+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(h+1)/2,T=(g+1)/2,R=(_+1)/2,C=(d+m)/4,N=(f+S)/4,B=(x+y)/4;return M>T&&M>R?M<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(M),i=C/n,s=N/n):T>R?T<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(T),n=C/i,s=B/i):R<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(R),n=N/s,i=B/s),this.set(n,i,s,t),this}let b=Math.sqrt((y-x)*(y-x)+(f-S)*(f-S)+(m-d)*(m-d));return Math.abs(b)<.001&&(b=1),this.x=(y-x)/b,this.y=(f-S)/b,this.z=(m-d)/b,this.w=Math.acos((h+g+_-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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 ix extends wr{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new At(0,0,e,t),this.scissorTest=!1,this.viewport=new At(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(ka("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===qr?cn:oi),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:tn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new nn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps,this.texture.internalFormat=n.internalFormat,this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Rs(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ui extends ix{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Vu extends nn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=en,this.minFilter=en,this.wrapR=Un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class zM extends Ui{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Vu(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Pp extends nn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=en,this.minFilter=en,this.wrapR=Un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class BM extends Ui{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Pp(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class kM extends Ui{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let a=0;a<n;a++)this.texture[a]=s.clone(),this.texture[a].isRenderTargetTexture=!0}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.texture.length;i<s;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class On{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,c){let u=n[i+0],h=n[i+1],d=n[i+2],f=n[i+3];const m=s[a+0],g=s[a+1],x=s[a+2],S=s[a+3];if(c===0){e[t+0]=u,e[t+1]=h,e[t+2]=d,e[t+3]=f;return}if(c===1){e[t+0]=m,e[t+1]=g,e[t+2]=x,e[t+3]=S;return}if(f!==S||u!==m||h!==g||d!==x){let y=1-c;const _=u*m+h*g+d*x+f*S,b=_>=0?1:-1,M=1-_*_;if(M>Number.EPSILON){const R=Math.sqrt(M),C=Math.atan2(R,_*b);y=Math.sin(y*C)/R,c=Math.sin(c*C)/R}const T=c*b;if(u=u*y+m*T,h=h*y+g*T,d=d*y+x*T,f=f*y+S*T,y===1-c){const R=1/Math.sqrt(u*u+h*h+d*d+f*f);u*=R,h*=R,d*=R,f*=R}}e[t]=u,e[t+1]=h,e[t+2]=d,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,i,s,a){const c=n[i],u=n[i+1],h=n[i+2],d=n[i+3],f=s[a],m=s[a+1],g=s[a+2],x=s[a+3];return e[t]=c*x+d*f+u*g-h*m,e[t+1]=u*x+d*m+h*f-c*g,e[t+2]=h*x+d*g+c*m-u*f,e[t+3]=d*x-c*f-u*m-h*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,c=Math.cos,u=Math.sin,h=c(n/2),d=c(i/2),f=c(s/2),m=u(n/2),g=u(i/2),x=u(s/2);switch(a){case"XYZ":this._x=m*d*f+h*g*x,this._y=h*g*f-m*d*x,this._z=h*d*x+m*g*f,this._w=h*d*f-m*g*x;break;case"YXZ":this._x=m*d*f+h*g*x,this._y=h*g*f-m*d*x,this._z=h*d*x-m*g*f,this._w=h*d*f+m*g*x;break;case"ZXY":this._x=m*d*f-h*g*x,this._y=h*g*f+m*d*x,this._z=h*d*x+m*g*f,this._w=h*d*f-m*g*x;break;case"ZYX":this._x=m*d*f-h*g*x,this._y=h*g*f+m*d*x,this._z=h*d*x-m*g*f,this._w=h*d*f+m*g*x;break;case"YZX":this._x=m*d*f+h*g*x,this._y=h*g*f+m*d*x,this._z=h*d*x-m*g*f,this._w=h*d*f-m*g*x;break;case"XZY":this._x=m*d*f-h*g*x,this._y=h*g*f-m*d*x,this._z=h*d*x+m*g*f,this._w=h*d*f+m*g*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],c=t[5],u=t[9],h=t[2],d=t[6],f=t[10],m=n+c+f;if(m>0){const g=.5/Math.sqrt(m+1);this._w=.25/g,this._x=(d-u)*g,this._y=(s-h)*g,this._z=(a-i)*g}else if(n>c&&n>f){const g=2*Math.sqrt(1+n-c-f);this._w=(d-u)/g,this._x=.25*g,this._y=(i+a)/g,this._z=(s+h)/g}else if(c>f){const g=2*Math.sqrt(1+c-n-f);this._w=(s-h)/g,this._x=(i+a)/g,this._y=.25*g,this._z=(u+d)/g}else{const g=2*Math.sqrt(1+f-n-c);this._w=(a-i)/g,this._x=(s+h)/g,this._y=(u+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Jt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,c=t._x,u=t._y,h=t._z,d=t._w;return this._x=n*d+a*c+i*h-s*u,this._y=i*d+a*u+s*c-n*h,this._z=s*d+a*h+n*u-i*c,this._w=a*d-n*c-i*u-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,a=this._w;let c=a*e._w+n*e._x+i*e._y+s*e._z;if(c<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,c=-c):this.copy(e),c>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const u=1-c*c;if(u<=Number.EPSILON){const g=1-t;return this._w=g*a+t*this._w,this._x=g*n+t*this._x,this._y=g*i+t*this._y,this._z=g*s+t*this._z,this.normalize(),this}const h=Math.sqrt(u),d=Math.atan2(h,c),f=Math.sin((1-t)*d)/h,m=Math.sin(t*d)/h;return this._w=a*f+this._w*m,this._x=n*f+this._x*m,this._y=i*f+this._y*m,this._z=s*f+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class U{constructor(e=0,t=0,n=0){U.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion($g.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion($g.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,c=e.z,u=e.w,h=2*(a*i-c*n),d=2*(c*t-s*i),f=2*(s*n-a*t);return this.x=t+u*h+a*f-c*d,this.y=n+u*d+c*h-s*f,this.z=i+u*f+s*d-a*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,c=t.y,u=t.z;return this.x=i*u-s*c,this.y=s*a-n*u,this.z=n*c-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ed.copy(this).projectOnVector(e),this.sub(Ed)}reflect(e){return this.sub(Ed.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ed=new U,$g=new On;class vn{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Ti.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ti.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ti.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,c=s.count;a<c;a++)e.isMesh===!0?e.getVertexPosition(a,Ti):Ti.fromBufferAttribute(s,a),Ti.applyMatrix4(e.matrixWorld),this.expandByPoint(Ti);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),yc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),yc.copy(n.boundingBox)),yc.applyMatrix4(e.matrixWorld),this.union(yc)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ti),Ti.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sa),Sc.subVectors(this.max,Sa),ho.subVectors(e.a,Sa),fo.subVectors(e.b,Sa),po.subVectors(e.c,Sa),Ur.subVectors(fo,ho),Or.subVectors(po,fo),hs.subVectors(ho,po);let t=[0,-Ur.z,Ur.y,0,-Or.z,Or.y,0,-hs.z,hs.y,Ur.z,0,-Ur.x,Or.z,0,-Or.x,hs.z,0,-hs.x,-Ur.y,Ur.x,0,-Or.y,Or.x,0,-hs.y,hs.x,0];return!bd(t,ho,fo,po,Sc)||(t=[1,0,0,0,1,0,0,0,1],!bd(t,ho,fo,po,Sc))?!1:(Mc.crossVectors(Ur,Or),t=[Mc.x,Mc.y,Mc.z],bd(t,ho,fo,po,Sc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ti).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ti).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ur[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ur[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ur[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ur[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ur[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ur[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ur[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ur[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ur),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ur=[new U,new U,new U,new U,new U,new U,new U,new U],Ti=new U,yc=new vn,ho=new U,fo=new U,po=new U,Ur=new U,Or=new U,hs=new U,Sa=new U,Sc=new U,Mc=new U,ds=new U;function bd(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){ds.fromArray(r,s);const c=i.x*Math.abs(ds.x)+i.y*Math.abs(ds.y)+i.z*Math.abs(ds.z),u=e.dot(ds),h=t.dot(ds),d=n.dot(ds);if(Math.max(-Math.max(u,h,d),Math.min(u,h,d))>c)return!1}return!0}const HM=new vn,Ma=new U,wd=new U;let xn=class{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):HM.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ma.subVectors(e,this.center);const t=Ma.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ma,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(wd.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ma.copy(e.center).add(wd)),this.expandByPoint(Ma.copy(e.center).sub(wd))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const hr=new U,Td=new U,Ec=new U,Fr=new U,Ad=new U,bc=new U,Cd=new U;class Vs{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,hr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=hr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(hr.copy(this.origin).addScaledVector(this.direction,t),hr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Td.copy(e).add(t).multiplyScalar(.5),Ec.copy(t).sub(e).normalize(),Fr.copy(this.origin).sub(Td);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ec),c=Fr.dot(this.direction),u=-Fr.dot(Ec),h=Fr.lengthSq(),d=Math.abs(1-a*a);let f,m,g,x;if(d>0)if(f=a*u-c,m=a*c-u,x=s*d,f>=0)if(m>=-x)if(m<=x){const S=1/d;f*=S,m*=S,g=f*(f+a*m+2*c)+m*(a*f+m+2*u)+h}else m=s,f=Math.max(0,-(a*m+c)),g=-f*f+m*(m+2*u)+h;else m=-s,f=Math.max(0,-(a*m+c)),g=-f*f+m*(m+2*u)+h;else m<=-x?(f=Math.max(0,-(-a*s+c)),m=f>0?-s:Math.min(Math.max(-s,-u),s),g=-f*f+m*(m+2*u)+h):m<=x?(f=0,m=Math.min(Math.max(-s,-u),s),g=m*(m+2*u)+h):(f=Math.max(0,-(a*s+c)),m=f>0?s:Math.min(Math.max(-s,-u),s),g=-f*f+m*(m+2*u)+h);else m=a>0?-s:s,f=Math.max(0,-(a*m+c)),g=-f*f+m*(m+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(Td).addScaledVector(Ec,m),g}intersectSphere(e,t){hr.subVectors(e.center,this.origin);const n=hr.dot(this.direction),i=hr.dot(hr)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),c=n-a,u=n+a;return u<0?null:c<0?this.at(u,t):this.at(c,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,c,u;const h=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return h>=0?(n=(e.min.x-m.x)*h,i=(e.max.x-m.x)*h):(n=(e.max.x-m.x)*h,i=(e.min.x-m.x)*h),d>=0?(s=(e.min.y-m.y)*d,a=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,a=(e.min.y-m.y)*d),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),f>=0?(c=(e.min.z-m.z)*f,u=(e.max.z-m.z)*f):(c=(e.max.z-m.z)*f,u=(e.min.z-m.z)*f),n>u||c>i)||((c>n||n!==n)&&(n=c),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,hr)!==null}intersectTriangle(e,t,n,i,s){Ad.subVectors(t,e),bc.subVectors(n,e),Cd.crossVectors(Ad,bc);let a=this.direction.dot(Cd),c;if(a>0){if(i)return null;c=1}else if(a<0)c=-1,a=-a;else return null;Fr.subVectors(this.origin,e);const u=c*this.direction.dot(bc.crossVectors(Fr,bc));if(u<0)return null;const h=c*this.direction.dot(Ad.cross(Fr));if(h<0||u+h>a)return null;const d=-c*Fr.dot(Cd);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class lt{constructor(e,t,n,i,s,a,c,u,h,d,f,m,g,x,S,y){lt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,c,u,h,d,f,m,g,x,S,y)}set(e,t,n,i,s,a,c,u,h,d,f,m,g,x,S,y){const _=this.elements;return _[0]=e,_[4]=t,_[8]=n,_[12]=i,_[1]=s,_[5]=a,_[9]=c,_[13]=u,_[2]=h,_[6]=d,_[10]=f,_[14]=m,_[3]=g,_[7]=x,_[11]=S,_[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 lt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/mo.setFromMatrixColumn(e,0).length(),s=1/mo.setFromMatrixColumn(e,1).length(),a=1/mo.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const m=a*d,g=a*f,x=c*d,S=c*f;t[0]=u*d,t[4]=-u*f,t[8]=h,t[1]=g+x*h,t[5]=m-S*h,t[9]=-c*u,t[2]=S-m*h,t[6]=x+g*h,t[10]=a*u}else if(e.order==="YXZ"){const m=u*d,g=u*f,x=h*d,S=h*f;t[0]=m+S*c,t[4]=x*c-g,t[8]=a*h,t[1]=a*f,t[5]=a*d,t[9]=-c,t[2]=g*c-x,t[6]=S+m*c,t[10]=a*u}else if(e.order==="ZXY"){const m=u*d,g=u*f,x=h*d,S=h*f;t[0]=m-S*c,t[4]=-a*f,t[8]=x+g*c,t[1]=g+x*c,t[5]=a*d,t[9]=S-m*c,t[2]=-a*h,t[6]=c,t[10]=a*u}else if(e.order==="ZYX"){const m=a*d,g=a*f,x=c*d,S=c*f;t[0]=u*d,t[4]=x*h-g,t[8]=m*h+S,t[1]=u*f,t[5]=S*h+m,t[9]=g*h-x,t[2]=-h,t[6]=c*u,t[10]=a*u}else if(e.order==="YZX"){const m=a*u,g=a*h,x=c*u,S=c*h;t[0]=u*d,t[4]=S-m*f,t[8]=x*f+g,t[1]=f,t[5]=a*d,t[9]=-c*d,t[2]=-h*d,t[6]=g*f+x,t[10]=m-S*f}else if(e.order==="XZY"){const m=a*u,g=a*h,x=c*u,S=c*h;t[0]=u*d,t[4]=-f,t[8]=h*d,t[1]=m*f+S,t[5]=a*d,t[9]=g*f-x,t[2]=x*f-g,t[6]=c*d,t[10]=S*f+m}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(VM,e,GM)}lookAt(e,t,n){const i=this.elements;return ri.subVectors(e,t),ri.lengthSq()===0&&(ri.z=1),ri.normalize(),zr.crossVectors(n,ri),zr.lengthSq()===0&&(Math.abs(n.z)===1?ri.x+=1e-4:ri.z+=1e-4,ri.normalize(),zr.crossVectors(n,ri)),zr.normalize(),wc.crossVectors(ri,zr),i[0]=zr.x,i[4]=wc.x,i[8]=ri.x,i[1]=zr.y,i[5]=wc.y,i[9]=ri.y,i[2]=zr.z,i[6]=wc.z,i[10]=ri.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],c=n[4],u=n[8],h=n[12],d=n[1],f=n[5],m=n[9],g=n[13],x=n[2],S=n[6],y=n[10],_=n[14],b=n[3],M=n[7],T=n[11],R=n[15],C=i[0],N=i[4],B=i[8],A=i[12],P=i[1],z=i[5],ee=i[9],de=i[13],H=i[2],q=i[6],ie=i[10],le=i[14],j=i[3],Z=i[7],J=i[11],te=i[15];return s[0]=a*C+c*P+u*H+h*j,s[4]=a*N+c*z+u*q+h*Z,s[8]=a*B+c*ee+u*ie+h*J,s[12]=a*A+c*de+u*le+h*te,s[1]=d*C+f*P+m*H+g*j,s[5]=d*N+f*z+m*q+g*Z,s[9]=d*B+f*ee+m*ie+g*J,s[13]=d*A+f*de+m*le+g*te,s[2]=x*C+S*P+y*H+_*j,s[6]=x*N+S*z+y*q+_*Z,s[10]=x*B+S*ee+y*ie+_*J,s[14]=x*A+S*de+y*le+_*te,s[3]=b*C+M*P+T*H+R*j,s[7]=b*N+M*z+T*q+R*Z,s[11]=b*B+M*ee+T*ie+R*J,s[15]=b*A+M*de+T*le+R*te,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],c=e[5],u=e[9],h=e[13],d=e[2],f=e[6],m=e[10],g=e[14],x=e[3],S=e[7],y=e[11],_=e[15];return x*(+s*u*f-i*h*f-s*c*m+n*h*m+i*c*g-n*u*g)+S*(+t*u*g-t*h*m+s*a*m-i*a*g+i*h*d-s*u*d)+y*(+t*h*f-t*c*g-s*a*f+n*a*g+s*c*d-n*h*d)+_*(-i*c*d-t*u*f+t*c*m+i*a*f-n*a*m+n*u*d)}transpose(){const e=this.elements;let t;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(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],d=e[8],f=e[9],m=e[10],g=e[11],x=e[12],S=e[13],y=e[14],_=e[15],b=f*y*h-S*m*h+S*u*g-c*y*g-f*u*_+c*m*_,M=x*m*h-d*y*h-x*u*g+a*y*g+d*u*_-a*m*_,T=d*S*h-x*f*h+x*c*g-a*S*g-d*c*_+a*f*_,R=x*f*u-d*S*u-x*c*m+a*S*m+d*c*y-a*f*y,C=t*b+n*M+i*T+s*R;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/C;return e[0]=b*N,e[1]=(S*m*s-f*y*s-S*i*g+n*y*g+f*i*_-n*m*_)*N,e[2]=(c*y*s-S*u*s+S*i*h-n*y*h-c*i*_+n*u*_)*N,e[3]=(f*u*s-c*m*s-f*i*h+n*m*h+c*i*g-n*u*g)*N,e[4]=M*N,e[5]=(d*y*s-x*m*s+x*i*g-t*y*g-d*i*_+t*m*_)*N,e[6]=(x*u*s-a*y*s-x*i*h+t*y*h+a*i*_-t*u*_)*N,e[7]=(a*m*s-d*u*s+d*i*h-t*m*h-a*i*g+t*u*g)*N,e[8]=T*N,e[9]=(x*f*s-d*S*s-x*n*g+t*S*g+d*n*_-t*f*_)*N,e[10]=(a*S*s-x*c*s+x*n*h-t*S*h-a*n*_+t*c*_)*N,e[11]=(d*c*s-a*f*s-d*n*h+t*f*h+a*n*g-t*c*g)*N,e[12]=R*N,e[13]=(d*S*i-x*f*i+x*n*m-t*S*m-d*n*y+t*f*y)*N,e[14]=(x*c*i-a*S*i-x*n*u+t*S*u+a*n*y-t*c*y)*N,e[15]=(a*f*i-d*c*i+d*n*u-t*f*u-a*n*m+t*c*m)*N,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,c=e.y,u=e.z,h=s*a,d=s*c;return this.set(h*a+n,h*c-i*u,h*u+i*c,0,h*c+i*u,d*c+n,d*u-i*a,0,h*u-i*c,d*u+i*a,s*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,c=t._z,u=t._w,h=s+s,d=a+a,f=c+c,m=s*h,g=s*d,x=s*f,S=a*d,y=a*f,_=c*f,b=u*h,M=u*d,T=u*f,R=n.x,C=n.y,N=n.z;return i[0]=(1-(S+_))*R,i[1]=(g+T)*R,i[2]=(x-M)*R,i[3]=0,i[4]=(g-T)*C,i[5]=(1-(m+_))*C,i[6]=(y+b)*C,i[7]=0,i[8]=(x+M)*N,i[9]=(y-b)*N,i[10]=(1-(m+S))*N,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=mo.set(i[0],i[1],i[2]).length();const a=mo.set(i[4],i[5],i[6]).length(),c=mo.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Ai.copy(this);const h=1/s,d=1/a,f=1/c;return Ai.elements[0]*=h,Ai.elements[1]*=h,Ai.elements[2]*=h,Ai.elements[4]*=d,Ai.elements[5]*=d,Ai.elements[6]*=d,Ai.elements[8]*=f,Ai.elements[9]*=f,Ai.elements[10]*=f,t.setFromRotationMatrix(Ai),n.x=s,n.y=a,n.z=c,this}makePerspective(e,t,n,i,s,a,c=Di){const u=this.elements,h=2*s/(t-e),d=2*s/(n-i),f=(t+e)/(t-e),m=(n+i)/(n-i);let g,x;if(c===Di)g=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(c===Wo)g=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return u[0]=h,u[4]=0,u[8]=f,u[12]=0,u[1]=0,u[5]=d,u[9]=m,u[13]=0,u[2]=0,u[6]=0,u[10]=g,u[14]=x,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,i,s,a,c=Di){const u=this.elements,h=1/(t-e),d=1/(n-i),f=1/(a-s),m=(t+e)*h,g=(n+i)*d;let x,S;if(c===Di)x=(a+s)*f,S=-2*f;else if(c===Wo)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return u[0]=2*h,u[4]=0,u[8]=0,u[12]=-m,u[1]=0,u[5]=2*d,u[9]=0,u[13]=-g,u[2]=0,u[6]=0,u[10]=S,u[14]=-x,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const mo=new U,Ai=new lt,VM=new U(0,0,0),GM=new U(1,1,1),zr=new U,wc=new U,ri=new U,e0=new lt,t0=new On;class dl{constructor(e=0,t=0,n=0,i=dl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],c=i[8],u=i[1],h=i[5],d=i[9],f=i[2],m=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(Jt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Jt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(c,g),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Jt(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,g),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-Jt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,g),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(Jt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(c,g));break;case"XZY":this._z=Math.asin(-Jt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(c,s)):(this._x=Math.atan2(-d,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return e0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(e0,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return t0.setFromEuler(this),this.setFromQuaternion(t0,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}dl.DEFAULT_ORDER="XYZ";class Os{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let WM=0;const n0=new U,go=new On,dr=new lt,Tc=new U,Ea=new U,jM=new U,XM=new On,i0=new U(1,0,0),r0=new U(0,1,0),s0=new U(0,0,1),qM={type:"added"},YM={type:"removed"};class Nt extends wr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:WM++}),this.uuid=li(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Nt.DEFAULT_UP.clone();const e=new U,t=new dl,n=new On,i=new U(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new lt},normalMatrix:{value:new yt}}),this.matrix=new lt,this.matrixWorld=new lt,this.matrixAutoUpdate=Nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Os,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return go.setFromAxisAngle(e,t),this.quaternion.multiply(go),this}rotateOnWorldAxis(e,t){return go.setFromAxisAngle(e,t),this.quaternion.premultiply(go),this}rotateX(e){return this.rotateOnAxis(i0,e)}rotateY(e){return this.rotateOnAxis(r0,e)}rotateZ(e){return this.rotateOnAxis(s0,e)}translateOnAxis(e,t){return n0.copy(e).applyQuaternion(this.quaternion),this.position.add(n0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(i0,e)}translateY(e){return this.translateOnAxis(r0,e)}translateZ(e){return this.translateOnAxis(s0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(dr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Tc.copy(e):Tc.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ea.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?dr.lookAt(Ea,Tc,this.up):dr.lookAt(Tc,Ea,this.up),this.quaternion.setFromRotationMatrix(dr),i&&(dr.extractRotation(i.matrixWorld),go.setFromRotationMatrix(dr),this.quaternion.premultiply(go.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(qM)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(YM)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),dr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),dr.multiply(e.parent.matrixWorld)),e.applyMatrix4(dr),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ea,e,jM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ea,XM,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++){const c=i[s];c.matrixWorldAutoUpdate===!0&&c.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(c=>({boxInitialized:c.boxInitialized,boxMin:c.box.min.toArray(),boxMax:c.box.max.toArray(),sphereInitialized:c.sphereInitialized,sphereRadius:c.sphere.radius,sphereCenter:c.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const u=c.shapes;if(Array.isArray(u))for(let h=0,d=u.length;h<d;h++){const f=u[h];s(e.shapes,f)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let u=0,h=this.material.length;u<h;u++)c.push(s(e.materials,this.material[u]));i.material=c}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let c=0;c<this.children.length;c++)i.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let c=0;c<this.animations.length;c++){const u=this.animations[c];i.animations.push(s(e.animations,u))}}if(t){const c=a(e.geometries),u=a(e.materials),h=a(e.textures),d=a(e.images),f=a(e.shapes),m=a(e.skeletons),g=a(e.animations),x=a(e.nodes);c.length>0&&(n.geometries=c),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),d.length>0&&(n.images=d),f.length>0&&(n.shapes=f),m.length>0&&(n.skeletons=m),g.length>0&&(n.animations=g),x.length>0&&(n.nodes=x)}return n.object=i,n;function a(c){const u=[];for(const h in c){const d=c[h];delete d.metadata,u.push(d)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Nt.DEFAULT_UP=new U(0,1,0);Nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ci=new U,fr=new U,Rd=new U,pr=new U,_o=new U,vo=new U,o0=new U,Pd=new U,Ld=new U,Id=new U;let Ac=!1;class Jn{constructor(e=new U,t=new U,n=new U){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Ci.subVectors(e,t),i.cross(Ci);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Ci.subVectors(i,t),fr.subVectors(n,t),Rd.subVectors(e,t);const a=Ci.dot(Ci),c=Ci.dot(fr),u=Ci.dot(Rd),h=fr.dot(fr),d=fr.dot(Rd),f=a*h-c*c;if(f===0)return s.set(0,0,0),null;const m=1/f,g=(h*u-c*d)*m,x=(a*d-c*u)*m;return s.set(1-g-x,x,g)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,pr)===null?!1:pr.x>=0&&pr.y>=0&&pr.x+pr.y<=1}static getUV(e,t,n,i,s,a,c,u){return Ac===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ac=!0),this.getInterpolation(e,t,n,i,s,a,c,u)}static getInterpolation(e,t,n,i,s,a,c,u){return this.getBarycoord(e,t,n,i,pr)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,pr.x),u.addScaledVector(a,pr.y),u.addScaledVector(c,pr.z),u)}static isFrontFacing(e,t,n,i){return Ci.subVectors(n,t),fr.subVectors(e,t),Ci.cross(fr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ci.subVectors(this.c,this.b),fr.subVectors(this.a,this.b),Ci.cross(fr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Jn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Jn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return Ac===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ac=!0),Jn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return Jn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Jn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Jn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,c;_o.subVectors(i,n),vo.subVectors(s,n),Pd.subVectors(e,n);const u=_o.dot(Pd),h=vo.dot(Pd);if(u<=0&&h<=0)return t.copy(n);Ld.subVectors(e,i);const d=_o.dot(Ld),f=vo.dot(Ld);if(d>=0&&f<=d)return t.copy(i);const m=u*f-d*h;if(m<=0&&u>=0&&d<=0)return a=u/(u-d),t.copy(n).addScaledVector(_o,a);Id.subVectors(e,s);const g=_o.dot(Id),x=vo.dot(Id);if(x>=0&&g<=x)return t.copy(s);const S=g*h-u*x;if(S<=0&&h>=0&&x<=0)return c=h/(h-x),t.copy(n).addScaledVector(vo,c);const y=d*x-g*f;if(y<=0&&f-d>=0&&g-x>=0)return o0.subVectors(s,i),c=(f-d)/(f-d+(g-x)),t.copy(i).addScaledVector(o0,c);const _=1/(y+S+m);return a=S*_,c=m*_,t.copy(n).addScaledVector(_o,a).addScaledVector(vo,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const rx={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},Br={h:0,s:0,l:0},Cc={h:0,s:0,l:0};function Nd(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class ke{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=cn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=Cp(e,1),t=Jt(t,0,1),n=Jt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Nd(a,s,e+1/3),this.g=Nd(a,s,e),this.b=Nd(a,s,e-1/3)}return Dt.toWorkingColorSpace(this,i),this}setStyle(e,t=cn){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],c=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=cn){const n=rx[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Vo(e.r),this.g=Vo(e.g),this.b=Vo(e.b),this}copyLinearToSRGB(e){return this.r=Sd(e.r),this.g=Sd(e.g),this.b=Sd(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=cn){return Dt.fromWorkingColorSpace(Nn.copy(this),e),Math.round(Jt(Nn.r*255,0,255))*65536+Math.round(Jt(Nn.g*255,0,255))*256+Math.round(Jt(Nn.b*255,0,255))}getHexString(e=cn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.fromWorkingColorSpace(Nn.copy(this),t);const n=Nn.r,i=Nn.g,s=Nn.b,a=Math.max(n,i,s),c=Math.min(n,i,s);let u,h;const d=(c+a)/2;if(c===a)u=0,h=0;else{const f=a-c;switch(h=d<=.5?f/(a+c):f/(2-a-c),a){case n:u=(i-s)/f+(i<s?6:0);break;case i:u=(s-n)/f+2;break;case s:u=(n-i)/f+4;break}u/=6}return e.h=u,e.s=h,e.l=d,e}getRGB(e,t=Dt.workingColorSpace){return Dt.fromWorkingColorSpace(Nn.copy(this),t),e.r=Nn.r,e.g=Nn.g,e.b=Nn.b,e}getStyle(e=cn){Dt.fromWorkingColorSpace(Nn.copy(this),e);const t=Nn.r,n=Nn.g,i=Nn.b;return e!==cn?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Br),this.setHSL(Br.h+e,Br.s+t,Br.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Br),e.getHSL(Cc);const n=Ba(Br.h,Cc.h,t),i=Ba(Br.s,Cc.s,t),s=Ba(Br.l,Cc.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Nn=new ke;ke.NAMES=rx;let ZM=0;class zn extends wr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ZM++}),this.uuid=li(),this.name="",this.type="Material",this.blending=Ns,this.side=Mr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Au,this.blendDst=Cu,this.blendEquation=Gr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ke(0,0,0),this.blendAlpha=0,this.depthFunc=Ga,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ep,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=bs,this.stencilZFail=bs,this.stencilZPass=bs,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(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ns&&(n.blending=this.blending),this.side!==Mr&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Au&&(n.blendSrc=this.blendSrc),this.blendDst!==Cu&&(n.blendDst=this.blendDst),this.blendEquation!==Gr&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ga&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ep&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==bs&&(n.stencilFail=this.stencilFail),this.stencilZFail!==bs&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==bs&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const c in s){const u=s[c];delete u.metadata,a.push(u)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qr extends zn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ke(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.combine=ul,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const vr=JM();function JM(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,i[u]=24,i[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,i[u]=-h-1,i[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,i[u]=13,i[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,i[u]=24,i[u|256]=24):(n[u]=31744,n[u|256]=64512,i[u]=13,i[u|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),c=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,d=0;for(;!(h&8388608);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[u]=h|d}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)a[u]=u<<23;a[31]=1199570944,a[32]=2147483648;for(let u=33;u<63;++u)a[u]=2147483648+(u-32<<23);a[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(c[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:c}}function Zn(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Jt(r,-65504,65504),vr.floatView[0]=r;const e=vr.uint32View[0],t=e>>23&511;return vr.baseTable[t]+((e&8388607)>>vr.shiftTable[t])}function Oa(r){const e=r>>10;return vr.uint32View[0]=vr.mantissaTable[vr.offsetTable[e]+(r&1023)]+vr.exponentTable[e],vr.floatView[0]}const KM={toHalfFloat:Zn,fromHalfFloat:Oa},on=new U,Rc=new he;class Ut{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=el,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ni,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Rc.fromBufferAttribute(this,t),Rc.applyMatrix3(e),this.setXY(t,Rc.x,Rc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)on.fromBufferAttribute(this,t),on.applyMatrix3(e),this.setXYZ(t,on.x,on.y,on.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)on.fromBufferAttribute(this,t),on.applyMatrix4(e),this.setXYZ(t,on.x,on.y,on.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)on.fromBufferAttribute(this,t),on.applyNormalMatrix(e),this.setXYZ(t,on.x,on.y,on.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)on.fromBufferAttribute(this,t),on.transformDirection(e),this.setXYZ(t,on.x,on.y,on.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Kn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=vt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Kn(t,this.array)),t}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Kn(t,this.array)),t}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Kn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Kn(t,this.array)),t}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array),s=vt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==el&&(e.usage=this.usage),e}}class QM extends Ut{constructor(e,t,n){super(new Int8Array(e),t,n)}}class $M extends Ut{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class eE extends Ut{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class tE extends Ut{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Lp extends Ut{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class nE extends Ut{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Ip extends Ut{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class iE extends Ut{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Oa(this.array[e*this.itemSize]);return this.normalized&&(t=Kn(t,this.array)),t}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize]=Zn(t),this}getY(e){let t=Oa(this.array[e*this.itemSize+1]);return this.normalized&&(t=Kn(t,this.array)),t}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+1]=Zn(t),this}getZ(e){let t=Oa(this.array[e*this.itemSize+2]);return this.normalized&&(t=Kn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+2]=Zn(t),this}getW(e){let t=Oa(this.array[e*this.itemSize+3]);return this.normalized&&(t=Kn(t,this.array)),t}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+3]=Zn(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.array[e+0]=Zn(t),this.array[e+1]=Zn(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array)),this.array[e+0]=Zn(t),this.array[e+1]=Zn(n),this.array[e+2]=Zn(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array),s=vt(s,this.array)),this.array[e+0]=Zn(t),this.array[e+1]=Zn(n),this.array[e+2]=Zn(i),this.array[e+3]=Zn(s),this}}class qe extends Ut{constructor(e,t,n){super(new Float32Array(e),t,n)}}class rE extends Ut{constructor(e,t,n){super(new Float64Array(e),t,n)}}let sE=0;const yi=new lt,Dd=new Nt,xo=new U,si=new vn,ba=new vn,_n=new U;class St extends wr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:sE++}),this.uuid=li(),this.name="",this.type="BufferGeometry",this.index=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(e){return Array.isArray(e)?this.index=new(tx(e)?Ip:Lp)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new yt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return yi.makeRotationFromQuaternion(e),this.applyMatrix4(yi),this}rotateX(e){return yi.makeRotationX(e),this.applyMatrix4(yi),this}rotateY(e){return yi.makeRotationY(e),this.applyMatrix4(yi),this}rotateZ(e){return yi.makeRotationZ(e),this.applyMatrix4(yi),this}translate(e,t,n){return yi.makeTranslation(e,t,n),this.applyMatrix4(yi),this}scale(e,t,n){return yi.makeScale(e,t,n),this.applyMatrix4(yi),this}lookAt(e){return Dd.lookAt(e),Dd.updateMatrix(),this.applyMatrix4(Dd.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(xo).negate(),this.translate(xo.x,xo.y,xo.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new qe(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new vn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];si.setFromBufferAttribute(s),this.morphTargetsRelative?(_n.addVectors(this.boundingBox.min,si.min),this.boundingBox.expandByPoint(_n),_n.addVectors(this.boundingBox.max,si.max),this.boundingBox.expandByPoint(_n)):(this.boundingBox.expandByPoint(si.min),this.boundingBox.expandByPoint(si.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(){this.boundingSphere===null&&(this.boundingSphere=new xn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new U,1/0);return}if(e){const n=this.boundingSphere.center;if(si.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const c=t[s];ba.setFromBufferAttribute(c),this.morphTargetsRelative?(_n.addVectors(si.min,ba.min),si.expandByPoint(_n),_n.addVectors(si.max,ba.max),si.expandByPoint(_n)):(si.expandByPoint(ba.min),si.expandByPoint(ba.max))}si.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)_n.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(_n));if(t)for(let s=0,a=t.length;s<a;s++){const c=t[s],u=this.morphTargetsRelative;for(let h=0,d=c.count;h<d;h++)_n.fromBufferAttribute(c,h),u&&(xo.fromBufferAttribute(e,h),_n.add(xo)),i=Math.max(i,n.distanceToSquared(_n))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,s=t.normal.array,a=t.uv.array,c=i.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ut(new Float32Array(4*c),4));const u=this.getAttribute("tangent").array,h=[],d=[];for(let P=0;P<c;P++)h[P]=new U,d[P]=new U;const f=new U,m=new U,g=new U,x=new he,S=new he,y=new he,_=new U,b=new U;function M(P,z,ee){f.fromArray(i,P*3),m.fromArray(i,z*3),g.fromArray(i,ee*3),x.fromArray(a,P*2),S.fromArray(a,z*2),y.fromArray(a,ee*2),m.sub(f),g.sub(f),S.sub(x),y.sub(x);const de=1/(S.x*y.y-y.x*S.y);isFinite(de)&&(_.copy(m).multiplyScalar(y.y).addScaledVector(g,-S.y).multiplyScalar(de),b.copy(g).multiplyScalar(S.x).addScaledVector(m,-y.x).multiplyScalar(de),h[P].add(_),h[z].add(_),h[ee].add(_),d[P].add(b),d[z].add(b),d[ee].add(b))}let T=this.groups;T.length===0&&(T=[{start:0,count:n.length}]);for(let P=0,z=T.length;P<z;++P){const ee=T[P],de=ee.start,H=ee.count;for(let q=de,ie=de+H;q<ie;q+=3)M(n[q+0],n[q+1],n[q+2])}const R=new U,C=new U,N=new U,B=new U;function A(P){N.fromArray(s,P*3),B.copy(N);const z=h[P];R.copy(z),R.sub(N.multiplyScalar(N.dot(z))).normalize(),C.crossVectors(B,z);const de=C.dot(d[P])<0?-1:1;u[P*4]=R.x,u[P*4+1]=R.y,u[P*4+2]=R.z,u[P*4+3]=de}for(let P=0,z=T.length;P<z;++P){const ee=T[P],de=ee.start,H=ee.count;for(let q=de,ie=de+H;q<ie;q+=3)A(n[q+0]),A(n[q+1]),A(n[q+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Ut(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let m=0,g=n.count;m<g;m++)n.setXYZ(m,0,0,0);const i=new U,s=new U,a=new U,c=new U,u=new U,h=new U,d=new U,f=new U;if(e)for(let m=0,g=e.count;m<g;m+=3){const x=e.getX(m+0),S=e.getX(m+1),y=e.getX(m+2);i.fromBufferAttribute(t,x),s.fromBufferAttribute(t,S),a.fromBufferAttribute(t,y),d.subVectors(a,s),f.subVectors(i,s),d.cross(f),c.fromBufferAttribute(n,x),u.fromBufferAttribute(n,S),h.fromBufferAttribute(n,y),c.add(d),u.add(d),h.add(d),n.setXYZ(x,c.x,c.y,c.z),n.setXYZ(S,u.x,u.y,u.z),n.setXYZ(y,h.x,h.y,h.z)}else for(let m=0,g=t.count;m<g;m+=3)i.fromBufferAttribute(t,m+0),s.fromBufferAttribute(t,m+1),a.fromBufferAttribute(t,m+2),d.subVectors(a,s),f.subVectors(i,s),d.cross(f),n.setXYZ(m+0,d.x,d.y,d.z),n.setXYZ(m+1,d.x,d.y,d.z),n.setXYZ(m+2,d.x,d.y,d.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)_n.fromBufferAttribute(e,t),_n.normalize(),e.setXYZ(t,_n.x,_n.y,_n.z)}toNonIndexed(){function e(c,u){const h=c.array,d=c.itemSize,f=c.normalized,m=new h.constructor(u.length*d);let g=0,x=0;for(let S=0,y=u.length;S<y;S++){c.isInterleavedBufferAttribute?g=u[S]*c.data.stride+c.offset:g=u[S]*d;for(let _=0;_<d;_++)m[x++]=h[g++]}return new Ut(m,d,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new St,n=this.index.array,i=this.attributes;for(const c in i){const u=i[c],h=e(u,n);t.setAttribute(c,h)}const s=this.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,f=h.length;d<f;d++){const m=h[d],g=e(m,n);u.push(g)}t.morphAttributes[c]=u}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const i={};let s=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],d=[];for(let f=0,m=h.length;f<m;f++){const g=h[f];d.push(g.toJSON(e.data))}d.length>0&&(i[u]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const h in i){const d=i[h];this.setAttribute(h,d.clone(t))}const s=e.morphAttributes;for(const h in s){const d=[],f=s[h];for(let m=0,g=f.length;m<g;m++)d.push(f[m].clone(t));this.morphAttributes[h]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let h=0,d=a.length;h<d;h++){const f=a[h];this.addGroup(f.start,f.count,f.materialIndex)}const c=e.boundingBox;c!==null&&(this.boundingBox=c.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const a0=new lt,fs=new Vs,Pc=new xn,l0=new U,yo=new U,So=new U,Mo=new U,Ud=new U,Lc=new U,Ic=new he,Nc=new he,Dc=new he,c0=new U,u0=new U,h0=new U,Uc=new U,Oc=new U;class an extends Nt{constructor(e=new St,t=new Qr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const c=this.morphTargetInfluences;if(s&&c){Lc.set(0,0,0);for(let u=0,h=s.length;u<h;u++){const d=c[u],f=s[u];d!==0&&(Ud.fromBufferAttribute(f,e),a?Lc.addScaledVector(Ud,d):Lc.addScaledVector(Ud.sub(t),d))}t.add(Lc)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Pc.copy(n.boundingSphere),Pc.applyMatrix4(s),fs.copy(e.ray).recast(e.near),!(Pc.containsPoint(fs.origin)===!1&&(fs.intersectSphere(Pc,l0)===null||fs.origin.distanceToSquared(l0)>(e.far-e.near)**2))&&(a0.copy(s).invert(),fs.copy(e.ray).applyMatrix4(a0),!(n.boundingBox!==null&&fs.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,fs)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,c=s.index,u=s.attributes.position,h=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,m=s.groups,g=s.drawRange;if(c!==null)if(Array.isArray(a))for(let x=0,S=m.length;x<S;x++){const y=m[x],_=a[y.materialIndex],b=Math.max(y.start,g.start),M=Math.min(c.count,Math.min(y.start+y.count,g.start+g.count));for(let T=b,R=M;T<R;T+=3){const C=c.getX(T),N=c.getX(T+1),B=c.getX(T+2);i=Fc(this,_,e,n,h,d,f,C,N,B),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{const x=Math.max(0,g.start),S=Math.min(c.count,g.start+g.count);for(let y=x,_=S;y<_;y+=3){const b=c.getX(y),M=c.getX(y+1),T=c.getX(y+2);i=Fc(this,a,e,n,h,d,f,b,M,T),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(a))for(let x=0,S=m.length;x<S;x++){const y=m[x],_=a[y.materialIndex],b=Math.max(y.start,g.start),M=Math.min(u.count,Math.min(y.start+y.count,g.start+g.count));for(let T=b,R=M;T<R;T+=3){const C=T,N=T+1,B=T+2;i=Fc(this,_,e,n,h,d,f,C,N,B),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{const x=Math.max(0,g.start),S=Math.min(u.count,g.start+g.count);for(let y=x,_=S;y<_;y+=3){const b=y,M=y+1,T=y+2;i=Fc(this,a,e,n,h,d,f,b,M,T),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}}}function oE(r,e,t,n,i,s,a,c){let u;if(e.side===An?u=n.intersectTriangle(a,s,i,!0,c):u=n.intersectTriangle(i,s,a,e.side===Mr,c),u===null)return null;Oc.copy(c),Oc.applyMatrix4(r.matrixWorld);const h=t.ray.origin.distanceTo(Oc);return h<t.near||h>t.far?null:{distance:h,point:Oc.clone(),object:r}}function Fc(r,e,t,n,i,s,a,c,u,h){r.getVertexPosition(c,yo),r.getVertexPosition(u,So),r.getVertexPosition(h,Mo);const d=oE(r,e,t,n,yo,So,Mo,Uc);if(d){i&&(Ic.fromBufferAttribute(i,c),Nc.fromBufferAttribute(i,u),Dc.fromBufferAttribute(i,h),d.uv=Jn.getInterpolation(Uc,yo,So,Mo,Ic,Nc,Dc,new he)),s&&(Ic.fromBufferAttribute(s,c),Nc.fromBufferAttribute(s,u),Dc.fromBufferAttribute(s,h),d.uv1=Jn.getInterpolation(Uc,yo,So,Mo,Ic,Nc,Dc,new he),d.uv2=d.uv1),a&&(c0.fromBufferAttribute(a,c),u0.fromBufferAttribute(a,u),h0.fromBufferAttribute(a,h),d.normal=Jn.getInterpolation(Uc,yo,So,Mo,c0,u0,h0,new U),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const f={a:c,b:u,c:h,normal:new U,materialIndex:0};Jn.getNormal(yo,So,Mo,f.normal),d.face=f}return d}class Gs extends St{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const c=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const u=[],h=[],d=[],f=[];let m=0,g=0;x("z","y","x",-1,-1,n,t,e,a,s,0),x("z","y","x",1,-1,n,t,-e,a,s,1),x("x","z","y",1,1,e,n,t,i,a,2),x("x","z","y",1,-1,e,n,-t,i,a,3),x("x","y","z",1,-1,e,t,n,i,s,4),x("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(u),this.setAttribute("position",new qe(h,3)),this.setAttribute("normal",new qe(d,3)),this.setAttribute("uv",new qe(f,2));function x(S,y,_,b,M,T,R,C,N,B,A){const P=T/N,z=R/B,ee=T/2,de=R/2,H=C/2,q=N+1,ie=B+1;let le=0,j=0;const Z=new U;for(let J=0;J<ie;J++){const te=J*z-de;for(let ge=0;ge<q;ge++){const K=ge*P-ee;Z[S]=K*b,Z[y]=te*M,Z[_]=H,h.push(Z.x,Z.y,Z.z),Z[S]=0,Z[y]=0,Z[_]=C>0?1:-1,d.push(Z.x,Z.y,Z.z),f.push(ge/N),f.push(1-J/B),le+=1}}for(let J=0;J<B;J++)for(let te=0;te<N;te++){const ge=m+te+q*J,K=m+te+q*(J+1),fe=m+(te+1)+q*(J+1),be=m+(te+1)+q*J;u.push(ge,K,be),u.push(K,fe,be),j+=6}c.addGroup(g,j,A),g+=j,m+=le}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Xo(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Vn(r){const e={};for(let t=0;t<r.length;t++){const n=Xo(r[t]);for(const i in n)e[i]=n[i]}return e}function aE(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function sx(r){return r.getRenderTarget()===null?r.outputColorSpace:Dt.workingColorSpace}const Iu={clone:Xo,merge:Vn};var lE=`void main() {
6
+ */const Zo="160",Ms={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Es={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},$_=0,Sf=1,ev=2,GS=3,tv=0,Ou=1,Fa=2,Ri=3,Mr=0,An=1,Si=2,WS=2,Sr=0,Ns=1,Mf=2,Ef=3,bf=4,nv=5,Gr=100,iv=101,rv=102,wf=103,Tf=104,sv=200,ov=201,av=202,lv=203,Au=204,Cu=205,cv=206,uv=207,hv=208,dv=209,fv=210,pv=211,mv=212,gv=213,_v=214,vv=0,xv=1,yv=2,Ga=3,Sv=4,Mv=5,Ev=6,bv=7,ul=0,wv=1,Tv=2,Qi=0,Av=1,Cv=2,Rv=3,Fu=4,Pv=5,Lv=6,Af="attached",Iv="detached",zu=300,Er=301,Yr=302,Wa=303,ja=304,Jo=306,Xa=1e3,Un=1001,qa=1002,en=1003,Ru=1004,jS=1004,za=1005,XS=1005,tn=1006,gp=1007,qS=1007,Zr=1008,YS=1008,$i=1009,Nv=1010,Dv=1011,Bu=1012,_p=1013,xr=1014,Ni=1015,Go=1016,vp=1017,xp=1018,jr=1020,Uv=1021,Wn=1023,Ov=1024,Fv=1025,Xr=1026,ks=1027,zv=1028,yp=1029,Bv=1030,Sp=1031,Mp=1033,vu=33776,xu=33777,yu=33778,Su=33779,Cf=35840,Rf=35841,Pf=35842,Lf=35843,Ep=36196,If=37492,Nf=37496,Df=37808,Uf=37809,Of=37810,Ff=37811,zf=37812,Bf=37813,kf=37814,Hf=37815,Vf=37816,Gf=37817,Wf=37818,jf=37819,Xf=37820,qf=37821,Mu=36492,Yf=36494,Zf=36495,kv=36283,Jf=36284,Kf=36285,Qf=36286,Hv=2200,Vv=2201,Gv=2202,Ya=2300,Za=2301,Eu=2302,As=2400,Cs=2401,Ja=2402,ku=2500,bp=2501,ZS=0,JS=1,KS=2,wp=3e3,qr=3001,Wv=3200,jv=3201,Kr=0,Xv=1,oi="",cn="srgb",nr="srgb-linear",Hu="display-p3",hl="display-p3-linear",Ka="linear",zt="srgb",Qa="rec709",$a="p3",QS=0,bs=7680,$S=7681,eM=7682,tM=7683,nM=34055,iM=34056,rM=5386,sM=512,oM=513,aM=514,lM=515,cM=516,uM=517,hM=518,$f=519,qv=512,Yv=513,Zv=514,Tp=515,Jv=516,Kv=517,Qv=518,$v=519,el=35044,Ds=35048,dM=35040,fM=35045,pM=35049,mM=35041,gM=35046,_M=35050,vM=35042,xM="100",ep="300 es",Pu=1035,Di=2e3,Wo=2001;let wr=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}};const In=["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"];let Yg=1234567;const Us=Math.PI/180,jo=180/Math.PI;function li(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(In[r&255]+In[r>>8&255]+In[r>>16&255]+In[r>>24&255]+"-"+In[e&255]+In[e>>8&255]+"-"+In[e>>16&15|64]+In[e>>24&255]+"-"+In[t&63|128]+In[t>>8&255]+"-"+In[t>>16&255]+In[t>>24&255]+In[n&255]+In[n>>8&255]+In[n>>16&255]+In[n>>24&255]).toLowerCase()}function Jt(r,e,t){return Math.max(e,Math.min(t,r))}function Ap(r,e){return(r%e+e)%e}function yM(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function SM(r,e,t){return r!==e?(t-r)/(e-r):0}function Ba(r,e,t){return(1-t)*r+t*e}function MM(r,e,t,n){return Ba(r,e,1-Math.exp(-t*n))}function EM(r,e=1){return e-Math.abs(Ap(r,e*2)-e)}function bM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function wM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function TM(r,e){return r+Math.floor(Math.random()*(e-r+1))}function AM(r,e){return r+Math.random()*(e-r)}function CM(r){return r*(.5-Math.random())}function RM(r){r!==void 0&&(Yg=r);let e=Yg+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function PM(r){return r*Us}function LM(r){return r*jo}function tp(r){return(r&r-1)===0&&r!==0}function IM(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Lu(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function NM(r,e,t,n,i){const s=Math.cos,a=Math.sin,c=s(t/2),u=a(t/2),h=s((e+n)/2),d=a((e+n)/2),f=s((e-n)/2),m=a((e-n)/2),g=s((n-e)/2),x=a((n-e)/2);switch(i){case"XYX":r.set(c*d,u*f,u*m,c*h);break;case"YZY":r.set(u*m,c*d,u*f,c*h);break;case"ZXZ":r.set(u*f,u*m,c*d,c*h);break;case"XZX":r.set(c*d,u*x,u*g,c*h);break;case"YXY":r.set(u*g,c*d,u*x,c*h);break;case"ZYZ":r.set(u*x,u*g,c*d,c*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Kn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function vt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const ex={DEG2RAD:Us,RAD2DEG:jo,generateUUID:li,clamp:Jt,euclideanModulo:Ap,mapLinear:yM,inverseLerp:SM,lerp:Ba,damp:MM,pingpong:EM,smoothstep:bM,smootherstep:wM,randInt:TM,randFloat:AM,randFloatSpread:CM,seededRandom:RM,degToRad:PM,radToDeg:LM,isPowerOfTwo:tp,ceilPowerOfTwo:IM,floorPowerOfTwo:Lu,setQuaternionFromProperEuler:NM,normalize:vt,denormalize:Kn};class he{constructor(e=0,t=0){he.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class yt{constructor(e,t,n,i,s,a,c,u,h){yt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,c,u,h)}set(e,t,n,i,s,a,c,u,h){const d=this.elements;return d[0]=e,d[1]=i,d[2]=c,d[3]=t,d[4]=s,d[5]=u,d[6]=n,d[7]=a,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],c=n[3],u=n[6],h=n[1],d=n[4],f=n[7],m=n[2],g=n[5],x=n[8],S=i[0],y=i[3],_=i[6],b=i[1],M=i[4],T=i[7],R=i[2],C=i[5],N=i[8];return s[0]=a*S+c*b+u*R,s[3]=a*y+c*M+u*C,s[6]=a*_+c*T+u*N,s[1]=h*S+d*b+f*R,s[4]=h*y+d*M+f*C,s[7]=h*_+d*T+f*N,s[2]=m*S+g*b+x*R,s[5]=m*y+g*M+x*C,s[8]=m*_+g*T+x*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],d=e[8];return t*a*d-t*c*h-n*s*d+n*c*u+i*s*h-i*a*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],d=e[8],f=d*a-c*h,m=c*u-d*s,g=h*s-a*u,x=t*f+n*m+i*g;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=f*S,e[1]=(i*h-d*n)*S,e[2]=(c*n-i*a)*S,e[3]=m*S,e[4]=(d*t-i*u)*S,e[5]=(i*s-c*t)*S,e[6]=g*S,e[7]=(n*u-h*t)*S,e[8]=(a*t-n*s)*S,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,c){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*a+h*c)+a+e,-i*h,i*u,-i*(-h*a+u*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(yd.makeScale(e,t)),this}rotate(e){return this.premultiply(yd.makeRotation(-e)),this}translate(e,t){return this.premultiply(yd.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const yd=new yt;function tx(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const DM={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Oo(r,e){return new DM[r](e)}function tl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function nx(){const r=tl("canvas");return r.style.display="block",r}const Zg={};function ka(r){r in Zg||(Zg[r]=!0,console.warn(r))}const Jg=new yt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Kg=new yt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),xc={[nr]:{transfer:Ka,primaries:Qa,toReference:r=>r,fromReference:r=>r},[cn]:{transfer:zt,primaries:Qa,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[hl]:{transfer:Ka,primaries:$a,toReference:r=>r.applyMatrix3(Kg),fromReference:r=>r.applyMatrix3(Jg)},[Hu]:{transfer:zt,primaries:$a,toReference:r=>r.convertSRGBToLinear().applyMatrix3(Kg),fromReference:r=>r.applyMatrix3(Jg).convertLinearToSRGB()}},UM=new Set([nr,hl]),Dt={enabled:!0,_workingColorSpace:nr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!UM.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=xc[e].toReference,i=xc[t].fromReference;return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this._workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this._workingColorSpace)},getPrimaries:function(r){return xc[r].primaries},getTransfer:function(r){return r===oi?Ka:xc[r].transfer}};function Vo(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Sd(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let uo;class Cp{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{uo===void 0&&(uo=tl("canvas")),uo.width=e.width,uo.height=e.height;const n=uo.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=uo}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=tl("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=Vo(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Vo(t[n]/255)*255):t[n]=Vo(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let OM=0;class Rs{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:OM++}),this.uuid=li(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,c=i.length;a<c;a++)i[a].isDataTexture?s.push(Md(i[a].image)):s.push(Md(i[a]))}else s=Md(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Md(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?Cp.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let FM=0;class nn extends wr{constructor(e=nn.DEFAULT_IMAGE,t=nn.DEFAULT_MAPPING,n=Un,i=Un,s=tn,a=Zr,c=Wn,u=$i,h=nn.DEFAULT_ANISOTROPY,d=oi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:FM++}),this.uuid=li(),this.name="",this.source=new Rs(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=h,this.format=c,this.internalFormat=null,this.type=u,this.offset=new he(0,0),this.repeat=new he(1,1),this.center=new he(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new yt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof d=="string"?this.colorSpace=d:(ka("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=d===qr?cn:oi),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}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(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==zu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Xa:e.x=e.x-Math.floor(e.x);break;case Un:e.x=e.x<0?0:1;break;case qa:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Xa:e.y=e.y-Math.floor(e.y);break;case Un:e.y=e.y<0?0:1;break;case qa:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return ka("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===cn?qr:wp}set encoding(e){ka("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===qr?cn:oi}}nn.DEFAULT_IMAGE=null;nn.DEFAULT_MAPPING=zu;nn.DEFAULT_ANISOTROPY=1;class At{constructor(e=0,t=0,n=0,i=1){At.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const u=e.elements,h=u[0],d=u[4],f=u[8],m=u[1],g=u[5],x=u[9],S=u[2],y=u[6],_=u[10];if(Math.abs(d-m)<.01&&Math.abs(f-S)<.01&&Math.abs(x-y)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+S)<.1&&Math.abs(x+y)<.1&&Math.abs(h+g+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const M=(h+1)/2,T=(g+1)/2,R=(_+1)/2,C=(d+m)/4,N=(f+S)/4,B=(x+y)/4;return M>T&&M>R?M<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(M),i=C/n,s=N/n):T>R?T<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(T),n=C/i,s=B/i):R<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(R),n=N/s,i=B/s),this.set(n,i,s,t),this}let b=Math.sqrt((y-x)*(y-x)+(f-S)*(f-S)+(m-d)*(m-d));return Math.abs(b)<.001&&(b=1),this.x=(y-x)/b,this.y=(f-S)/b,this.z=(m-d)/b,this.w=Math.acos((h+g+_-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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 ix extends wr{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new At(0,0,e,t),this.scissorTest=!1,this.viewport=new At(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(ka("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===qr?cn:oi),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:tn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new nn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps,this.texture.internalFormat=n.internalFormat,this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Rs(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ui extends ix{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Vu extends nn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=en,this.minFilter=en,this.wrapR=Un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class zM extends Ui{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Vu(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Rp extends nn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=en,this.minFilter=en,this.wrapR=Un,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class BM extends Ui{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Rp(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class kM extends Ui{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let a=0;a<n;a++)this.texture[a]=s.clone(),this.texture[a].isRenderTargetTexture=!0}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.texture.length;i<s;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class On{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,c){let u=n[i+0],h=n[i+1],d=n[i+2],f=n[i+3];const m=s[a+0],g=s[a+1],x=s[a+2],S=s[a+3];if(c===0){e[t+0]=u,e[t+1]=h,e[t+2]=d,e[t+3]=f;return}if(c===1){e[t+0]=m,e[t+1]=g,e[t+2]=x,e[t+3]=S;return}if(f!==S||u!==m||h!==g||d!==x){let y=1-c;const _=u*m+h*g+d*x+f*S,b=_>=0?1:-1,M=1-_*_;if(M>Number.EPSILON){const R=Math.sqrt(M),C=Math.atan2(R,_*b);y=Math.sin(y*C)/R,c=Math.sin(c*C)/R}const T=c*b;if(u=u*y+m*T,h=h*y+g*T,d=d*y+x*T,f=f*y+S*T,y===1-c){const R=1/Math.sqrt(u*u+h*h+d*d+f*f);u*=R,h*=R,d*=R,f*=R}}e[t]=u,e[t+1]=h,e[t+2]=d,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,i,s,a){const c=n[i],u=n[i+1],h=n[i+2],d=n[i+3],f=s[a],m=s[a+1],g=s[a+2],x=s[a+3];return e[t]=c*x+d*f+u*g-h*m,e[t+1]=u*x+d*m+h*f-c*g,e[t+2]=h*x+d*g+c*m-u*f,e[t+3]=d*x-c*f-u*m-h*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,c=Math.cos,u=Math.sin,h=c(n/2),d=c(i/2),f=c(s/2),m=u(n/2),g=u(i/2),x=u(s/2);switch(a){case"XYZ":this._x=m*d*f+h*g*x,this._y=h*g*f-m*d*x,this._z=h*d*x+m*g*f,this._w=h*d*f-m*g*x;break;case"YXZ":this._x=m*d*f+h*g*x,this._y=h*g*f-m*d*x,this._z=h*d*x-m*g*f,this._w=h*d*f+m*g*x;break;case"ZXY":this._x=m*d*f-h*g*x,this._y=h*g*f+m*d*x,this._z=h*d*x+m*g*f,this._w=h*d*f-m*g*x;break;case"ZYX":this._x=m*d*f-h*g*x,this._y=h*g*f+m*d*x,this._z=h*d*x-m*g*f,this._w=h*d*f+m*g*x;break;case"YZX":this._x=m*d*f+h*g*x,this._y=h*g*f+m*d*x,this._z=h*d*x-m*g*f,this._w=h*d*f-m*g*x;break;case"XZY":this._x=m*d*f-h*g*x,this._y=h*g*f-m*d*x,this._z=h*d*x+m*g*f,this._w=h*d*f+m*g*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],c=t[5],u=t[9],h=t[2],d=t[6],f=t[10],m=n+c+f;if(m>0){const g=.5/Math.sqrt(m+1);this._w=.25/g,this._x=(d-u)*g,this._y=(s-h)*g,this._z=(a-i)*g}else if(n>c&&n>f){const g=2*Math.sqrt(1+n-c-f);this._w=(d-u)/g,this._x=.25*g,this._y=(i+a)/g,this._z=(s+h)/g}else if(c>f){const g=2*Math.sqrt(1+c-n-f);this._w=(s-h)/g,this._x=(i+a)/g,this._y=.25*g,this._z=(u+d)/g}else{const g=2*Math.sqrt(1+f-n-c);this._w=(a-i)/g,this._x=(s+h)/g,this._y=(u+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Jt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,c=t._x,u=t._y,h=t._z,d=t._w;return this._x=n*d+a*c+i*h-s*u,this._y=i*d+a*u+s*c-n*h,this._z=s*d+a*h+n*u-i*c,this._w=a*d-n*c-i*u-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,a=this._w;let c=a*e._w+n*e._x+i*e._y+s*e._z;if(c<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,c=-c):this.copy(e),c>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const u=1-c*c;if(u<=Number.EPSILON){const g=1-t;return this._w=g*a+t*this._w,this._x=g*n+t*this._x,this._y=g*i+t*this._y,this._z=g*s+t*this._z,this.normalize(),this}const h=Math.sqrt(u),d=Math.atan2(h,c),f=Math.sin((1-t)*d)/h,m=Math.sin(t*d)/h;return this._w=a*f+this._w*m,this._x=n*f+this._x*m,this._y=i*f+this._y*m,this._z=s*f+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class U{constructor(e=0,t=0,n=0){U.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Qg.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qg.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,c=e.z,u=e.w,h=2*(a*i-c*n),d=2*(c*t-s*i),f=2*(s*n-a*t);return this.x=t+u*h+a*f-c*d,this.y=n+u*d+c*h-s*f,this.z=i+u*f+s*d-a*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,c=t.y,u=t.z;return this.x=i*u-s*c,this.y=s*a-n*u,this.z=n*c-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ed.copy(this).projectOnVector(e),this.sub(Ed)}reflect(e){return this.sub(Ed.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Jt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ed=new U,Qg=new On;class vn{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Ti.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ti.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ti.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,c=s.count;a<c;a++)e.isMesh===!0?e.getVertexPosition(a,Ti):Ti.fromBufferAttribute(s,a),Ti.applyMatrix4(e.matrixWorld),this.expandByPoint(Ti);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),yc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),yc.copy(n.boundingBox)),yc.applyMatrix4(e.matrixWorld),this.union(yc)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ti),Ti.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Sa),Sc.subVectors(this.max,Sa),ho.subVectors(e.a,Sa),fo.subVectors(e.b,Sa),po.subVectors(e.c,Sa),Ur.subVectors(fo,ho),Or.subVectors(po,fo),hs.subVectors(ho,po);let t=[0,-Ur.z,Ur.y,0,-Or.z,Or.y,0,-hs.z,hs.y,Ur.z,0,-Ur.x,Or.z,0,-Or.x,hs.z,0,-hs.x,-Ur.y,Ur.x,0,-Or.y,Or.x,0,-hs.y,hs.x,0];return!bd(t,ho,fo,po,Sc)||(t=[1,0,0,0,1,0,0,0,1],!bd(t,ho,fo,po,Sc))?!1:(Mc.crossVectors(Ur,Or),t=[Mc.x,Mc.y,Mc.z],bd(t,ho,fo,po,Sc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ti).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ti).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ur[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ur[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ur[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ur[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ur[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ur[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ur[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ur[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ur),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ur=[new U,new U,new U,new U,new U,new U,new U,new U],Ti=new U,yc=new vn,ho=new U,fo=new U,po=new U,Ur=new U,Or=new U,hs=new U,Sa=new U,Sc=new U,Mc=new U,ds=new U;function bd(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){ds.fromArray(r,s);const c=i.x*Math.abs(ds.x)+i.y*Math.abs(ds.y)+i.z*Math.abs(ds.z),u=e.dot(ds),h=t.dot(ds),d=n.dot(ds);if(Math.max(-Math.max(u,h,d),Math.min(u,h,d))>c)return!1}return!0}const HM=new vn,Ma=new U,wd=new U;let xn=class{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):HM.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ma.subVectors(e,this.center);const t=Ma.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ma,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(wd.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ma.copy(e.center).add(wd)),this.expandByPoint(Ma.copy(e.center).sub(wd))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const hr=new U,Td=new U,Ec=new U,Fr=new U,Ad=new U,bc=new U,Cd=new U;class Vs{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,hr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=hr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(hr.copy(this.origin).addScaledVector(this.direction,t),hr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Td.copy(e).add(t).multiplyScalar(.5),Ec.copy(t).sub(e).normalize(),Fr.copy(this.origin).sub(Td);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ec),c=Fr.dot(this.direction),u=-Fr.dot(Ec),h=Fr.lengthSq(),d=Math.abs(1-a*a);let f,m,g,x;if(d>0)if(f=a*u-c,m=a*c-u,x=s*d,f>=0)if(m>=-x)if(m<=x){const S=1/d;f*=S,m*=S,g=f*(f+a*m+2*c)+m*(a*f+m+2*u)+h}else m=s,f=Math.max(0,-(a*m+c)),g=-f*f+m*(m+2*u)+h;else m=-s,f=Math.max(0,-(a*m+c)),g=-f*f+m*(m+2*u)+h;else m<=-x?(f=Math.max(0,-(-a*s+c)),m=f>0?-s:Math.min(Math.max(-s,-u),s),g=-f*f+m*(m+2*u)+h):m<=x?(f=0,m=Math.min(Math.max(-s,-u),s),g=m*(m+2*u)+h):(f=Math.max(0,-(a*s+c)),m=f>0?s:Math.min(Math.max(-s,-u),s),g=-f*f+m*(m+2*u)+h);else m=a>0?-s:s,f=Math.max(0,-(a*m+c)),g=-f*f+m*(m+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(Td).addScaledVector(Ec,m),g}intersectSphere(e,t){hr.subVectors(e.center,this.origin);const n=hr.dot(this.direction),i=hr.dot(hr)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),c=n-a,u=n+a;return u<0?null:c<0?this.at(u,t):this.at(c,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,c,u;const h=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return h>=0?(n=(e.min.x-m.x)*h,i=(e.max.x-m.x)*h):(n=(e.max.x-m.x)*h,i=(e.min.x-m.x)*h),d>=0?(s=(e.min.y-m.y)*d,a=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,a=(e.min.y-m.y)*d),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),f>=0?(c=(e.min.z-m.z)*f,u=(e.max.z-m.z)*f):(c=(e.max.z-m.z)*f,u=(e.min.z-m.z)*f),n>u||c>i)||((c>n||n!==n)&&(n=c),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,hr)!==null}intersectTriangle(e,t,n,i,s){Ad.subVectors(t,e),bc.subVectors(n,e),Cd.crossVectors(Ad,bc);let a=this.direction.dot(Cd),c;if(a>0){if(i)return null;c=1}else if(a<0)c=-1,a=-a;else return null;Fr.subVectors(this.origin,e);const u=c*this.direction.dot(bc.crossVectors(Fr,bc));if(u<0)return null;const h=c*this.direction.dot(Ad.cross(Fr));if(h<0||u+h>a)return null;const d=-c*Fr.dot(Cd);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class lt{constructor(e,t,n,i,s,a,c,u,h,d,f,m,g,x,S,y){lt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,c,u,h,d,f,m,g,x,S,y)}set(e,t,n,i,s,a,c,u,h,d,f,m,g,x,S,y){const _=this.elements;return _[0]=e,_[4]=t,_[8]=n,_[12]=i,_[1]=s,_[5]=a,_[9]=c,_[13]=u,_[2]=h,_[6]=d,_[10]=f,_[14]=m,_[3]=g,_[7]=x,_[11]=S,_[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 lt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/mo.setFromMatrixColumn(e,0).length(),s=1/mo.setFromMatrixColumn(e,1).length(),a=1/mo.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const m=a*d,g=a*f,x=c*d,S=c*f;t[0]=u*d,t[4]=-u*f,t[8]=h,t[1]=g+x*h,t[5]=m-S*h,t[9]=-c*u,t[2]=S-m*h,t[6]=x+g*h,t[10]=a*u}else if(e.order==="YXZ"){const m=u*d,g=u*f,x=h*d,S=h*f;t[0]=m+S*c,t[4]=x*c-g,t[8]=a*h,t[1]=a*f,t[5]=a*d,t[9]=-c,t[2]=g*c-x,t[6]=S+m*c,t[10]=a*u}else if(e.order==="ZXY"){const m=u*d,g=u*f,x=h*d,S=h*f;t[0]=m-S*c,t[4]=-a*f,t[8]=x+g*c,t[1]=g+x*c,t[5]=a*d,t[9]=S-m*c,t[2]=-a*h,t[6]=c,t[10]=a*u}else if(e.order==="ZYX"){const m=a*d,g=a*f,x=c*d,S=c*f;t[0]=u*d,t[4]=x*h-g,t[8]=m*h+S,t[1]=u*f,t[5]=S*h+m,t[9]=g*h-x,t[2]=-h,t[6]=c*u,t[10]=a*u}else if(e.order==="YZX"){const m=a*u,g=a*h,x=c*u,S=c*h;t[0]=u*d,t[4]=S-m*f,t[8]=x*f+g,t[1]=f,t[5]=a*d,t[9]=-c*d,t[2]=-h*d,t[6]=g*f+x,t[10]=m-S*f}else if(e.order==="XZY"){const m=a*u,g=a*h,x=c*u,S=c*h;t[0]=u*d,t[4]=-f,t[8]=h*d,t[1]=m*f+S,t[5]=a*d,t[9]=g*f-x,t[2]=x*f-g,t[6]=c*d,t[10]=S*f+m}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(VM,e,GM)}lookAt(e,t,n){const i=this.elements;return ri.subVectors(e,t),ri.lengthSq()===0&&(ri.z=1),ri.normalize(),zr.crossVectors(n,ri),zr.lengthSq()===0&&(Math.abs(n.z)===1?ri.x+=1e-4:ri.z+=1e-4,ri.normalize(),zr.crossVectors(n,ri)),zr.normalize(),wc.crossVectors(ri,zr),i[0]=zr.x,i[4]=wc.x,i[8]=ri.x,i[1]=zr.y,i[5]=wc.y,i[9]=ri.y,i[2]=zr.z,i[6]=wc.z,i[10]=ri.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],c=n[4],u=n[8],h=n[12],d=n[1],f=n[5],m=n[9],g=n[13],x=n[2],S=n[6],y=n[10],_=n[14],b=n[3],M=n[7],T=n[11],R=n[15],C=i[0],N=i[4],B=i[8],A=i[12],P=i[1],z=i[5],ee=i[9],de=i[13],H=i[2],q=i[6],ie=i[10],le=i[14],j=i[3],Z=i[7],J=i[11],te=i[15];return s[0]=a*C+c*P+u*H+h*j,s[4]=a*N+c*z+u*q+h*Z,s[8]=a*B+c*ee+u*ie+h*J,s[12]=a*A+c*de+u*le+h*te,s[1]=d*C+f*P+m*H+g*j,s[5]=d*N+f*z+m*q+g*Z,s[9]=d*B+f*ee+m*ie+g*J,s[13]=d*A+f*de+m*le+g*te,s[2]=x*C+S*P+y*H+_*j,s[6]=x*N+S*z+y*q+_*Z,s[10]=x*B+S*ee+y*ie+_*J,s[14]=x*A+S*de+y*le+_*te,s[3]=b*C+M*P+T*H+R*j,s[7]=b*N+M*z+T*q+R*Z,s[11]=b*B+M*ee+T*ie+R*J,s[15]=b*A+M*de+T*le+R*te,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],c=e[5],u=e[9],h=e[13],d=e[2],f=e[6],m=e[10],g=e[14],x=e[3],S=e[7],y=e[11],_=e[15];return x*(+s*u*f-i*h*f-s*c*m+n*h*m+i*c*g-n*u*g)+S*(+t*u*g-t*h*m+s*a*m-i*a*g+i*h*d-s*u*d)+y*(+t*h*f-t*c*g-s*a*f+n*a*g+s*c*d-n*h*d)+_*(-i*c*d-t*u*f+t*c*m+i*a*f-n*a*m+n*u*d)}transpose(){const e=this.elements;let t;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(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],d=e[8],f=e[9],m=e[10],g=e[11],x=e[12],S=e[13],y=e[14],_=e[15],b=f*y*h-S*m*h+S*u*g-c*y*g-f*u*_+c*m*_,M=x*m*h-d*y*h-x*u*g+a*y*g+d*u*_-a*m*_,T=d*S*h-x*f*h+x*c*g-a*S*g-d*c*_+a*f*_,R=x*f*u-d*S*u-x*c*m+a*S*m+d*c*y-a*f*y,C=t*b+n*M+i*T+s*R;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/C;return e[0]=b*N,e[1]=(S*m*s-f*y*s-S*i*g+n*y*g+f*i*_-n*m*_)*N,e[2]=(c*y*s-S*u*s+S*i*h-n*y*h-c*i*_+n*u*_)*N,e[3]=(f*u*s-c*m*s-f*i*h+n*m*h+c*i*g-n*u*g)*N,e[4]=M*N,e[5]=(d*y*s-x*m*s+x*i*g-t*y*g-d*i*_+t*m*_)*N,e[6]=(x*u*s-a*y*s-x*i*h+t*y*h+a*i*_-t*u*_)*N,e[7]=(a*m*s-d*u*s+d*i*h-t*m*h-a*i*g+t*u*g)*N,e[8]=T*N,e[9]=(x*f*s-d*S*s-x*n*g+t*S*g+d*n*_-t*f*_)*N,e[10]=(a*S*s-x*c*s+x*n*h-t*S*h-a*n*_+t*c*_)*N,e[11]=(d*c*s-a*f*s-d*n*h+t*f*h+a*n*g-t*c*g)*N,e[12]=R*N,e[13]=(d*S*i-x*f*i+x*n*m-t*S*m-d*n*y+t*f*y)*N,e[14]=(x*c*i-a*S*i-x*n*u+t*S*u+a*n*y-t*c*y)*N,e[15]=(a*f*i-d*c*i+d*n*u-t*f*u-a*n*m+t*c*m)*N,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,c=e.y,u=e.z,h=s*a,d=s*c;return this.set(h*a+n,h*c-i*u,h*u+i*c,0,h*c+i*u,d*c+n,d*u-i*a,0,h*u-i*c,d*u+i*a,s*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,c=t._z,u=t._w,h=s+s,d=a+a,f=c+c,m=s*h,g=s*d,x=s*f,S=a*d,y=a*f,_=c*f,b=u*h,M=u*d,T=u*f,R=n.x,C=n.y,N=n.z;return i[0]=(1-(S+_))*R,i[1]=(g+T)*R,i[2]=(x-M)*R,i[3]=0,i[4]=(g-T)*C,i[5]=(1-(m+_))*C,i[6]=(y+b)*C,i[7]=0,i[8]=(x+M)*N,i[9]=(y-b)*N,i[10]=(1-(m+S))*N,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=mo.set(i[0],i[1],i[2]).length();const a=mo.set(i[4],i[5],i[6]).length(),c=mo.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Ai.copy(this);const h=1/s,d=1/a,f=1/c;return Ai.elements[0]*=h,Ai.elements[1]*=h,Ai.elements[2]*=h,Ai.elements[4]*=d,Ai.elements[5]*=d,Ai.elements[6]*=d,Ai.elements[8]*=f,Ai.elements[9]*=f,Ai.elements[10]*=f,t.setFromRotationMatrix(Ai),n.x=s,n.y=a,n.z=c,this}makePerspective(e,t,n,i,s,a,c=Di){const u=this.elements,h=2*s/(t-e),d=2*s/(n-i),f=(t+e)/(t-e),m=(n+i)/(n-i);let g,x;if(c===Di)g=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(c===Wo)g=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return u[0]=h,u[4]=0,u[8]=f,u[12]=0,u[1]=0,u[5]=d,u[9]=m,u[13]=0,u[2]=0,u[6]=0,u[10]=g,u[14]=x,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,i,s,a,c=Di){const u=this.elements,h=1/(t-e),d=1/(n-i),f=1/(a-s),m=(t+e)*h,g=(n+i)*d;let x,S;if(c===Di)x=(a+s)*f,S=-2*f;else if(c===Wo)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return u[0]=2*h,u[4]=0,u[8]=0,u[12]=-m,u[1]=0,u[5]=2*d,u[9]=0,u[13]=-g,u[2]=0,u[6]=0,u[10]=S,u[14]=-x,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const mo=new U,Ai=new lt,VM=new U(0,0,0),GM=new U(1,1,1),zr=new U,wc=new U,ri=new U,$g=new lt,e0=new On;class dl{constructor(e=0,t=0,n=0,i=dl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],c=i[8],u=i[1],h=i[5],d=i[9],f=i[2],m=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(Jt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Jt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(c,g),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Jt(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,g),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-Jt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,g),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(Jt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(c,g));break;case"XZY":this._z=Math.asin(-Jt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(c,s)):(this._x=Math.atan2(-d,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return $g.makeRotationFromQuaternion(e),this.setFromRotationMatrix($g,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return e0.setFromEuler(this),this.setFromQuaternion(e0,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}dl.DEFAULT_ORDER="XYZ";class Os{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let WM=0;const t0=new U,go=new On,dr=new lt,Tc=new U,Ea=new U,jM=new U,XM=new On,n0=new U(1,0,0),i0=new U(0,1,0),r0=new U(0,0,1),qM={type:"added"},YM={type:"removed"};class Nt extends wr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:WM++}),this.uuid=li(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Nt.DEFAULT_UP.clone();const e=new U,t=new dl,n=new On,i=new U(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new lt},normalMatrix:{value:new yt}}),this.matrix=new lt,this.matrixWorld=new lt,this.matrixAutoUpdate=Nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Os,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return go.setFromAxisAngle(e,t),this.quaternion.multiply(go),this}rotateOnWorldAxis(e,t){return go.setFromAxisAngle(e,t),this.quaternion.premultiply(go),this}rotateX(e){return this.rotateOnAxis(n0,e)}rotateY(e){return this.rotateOnAxis(i0,e)}rotateZ(e){return this.rotateOnAxis(r0,e)}translateOnAxis(e,t){return t0.copy(e).applyQuaternion(this.quaternion),this.position.add(t0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(n0,e)}translateY(e){return this.translateOnAxis(i0,e)}translateZ(e){return this.translateOnAxis(r0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(dr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Tc.copy(e):Tc.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ea.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?dr.lookAt(Ea,Tc,this.up):dr.lookAt(Tc,Ea,this.up),this.quaternion.setFromRotationMatrix(dr),i&&(dr.extractRotation(i.matrixWorld),go.setFromRotationMatrix(dr),this.quaternion.premultiply(go.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(qM)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(YM)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),dr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),dr.multiply(e.parent.matrixWorld)),e.applyMatrix4(dr),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ea,e,jM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ea,XM,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++){const c=i[s];c.matrixWorldAutoUpdate===!0&&c.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(c=>({boxInitialized:c.boxInitialized,boxMin:c.box.min.toArray(),boxMax:c.box.max.toArray(),sphereInitialized:c.sphereInitialized,sphereRadius:c.sphere.radius,sphereCenter:c.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const u=c.shapes;if(Array.isArray(u))for(let h=0,d=u.length;h<d;h++){const f=u[h];s(e.shapes,f)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let u=0,h=this.material.length;u<h;u++)c.push(s(e.materials,this.material[u]));i.material=c}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let c=0;c<this.children.length;c++)i.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let c=0;c<this.animations.length;c++){const u=this.animations[c];i.animations.push(s(e.animations,u))}}if(t){const c=a(e.geometries),u=a(e.materials),h=a(e.textures),d=a(e.images),f=a(e.shapes),m=a(e.skeletons),g=a(e.animations),x=a(e.nodes);c.length>0&&(n.geometries=c),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),d.length>0&&(n.images=d),f.length>0&&(n.shapes=f),m.length>0&&(n.skeletons=m),g.length>0&&(n.animations=g),x.length>0&&(n.nodes=x)}return n.object=i,n;function a(c){const u=[];for(const h in c){const d=c[h];delete d.metadata,u.push(d)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Nt.DEFAULT_UP=new U(0,1,0);Nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ci=new U,fr=new U,Rd=new U,pr=new U,_o=new U,vo=new U,s0=new U,Pd=new U,Ld=new U,Id=new U;let Ac=!1;class Jn{constructor(e=new U,t=new U,n=new U){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Ci.subVectors(e,t),i.cross(Ci);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Ci.subVectors(i,t),fr.subVectors(n,t),Rd.subVectors(e,t);const a=Ci.dot(Ci),c=Ci.dot(fr),u=Ci.dot(Rd),h=fr.dot(fr),d=fr.dot(Rd),f=a*h-c*c;if(f===0)return s.set(0,0,0),null;const m=1/f,g=(h*u-c*d)*m,x=(a*d-c*u)*m;return s.set(1-g-x,x,g)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,pr)===null?!1:pr.x>=0&&pr.y>=0&&pr.x+pr.y<=1}static getUV(e,t,n,i,s,a,c,u){return Ac===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ac=!0),this.getInterpolation(e,t,n,i,s,a,c,u)}static getInterpolation(e,t,n,i,s,a,c,u){return this.getBarycoord(e,t,n,i,pr)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,pr.x),u.addScaledVector(a,pr.y),u.addScaledVector(c,pr.z),u)}static isFrontFacing(e,t,n,i){return Ci.subVectors(n,t),fr.subVectors(e,t),Ci.cross(fr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ci.subVectors(this.c,this.b),fr.subVectors(this.a,this.b),Ci.cross(fr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Jn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Jn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return Ac===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ac=!0),Jn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return Jn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Jn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Jn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,c;_o.subVectors(i,n),vo.subVectors(s,n),Pd.subVectors(e,n);const u=_o.dot(Pd),h=vo.dot(Pd);if(u<=0&&h<=0)return t.copy(n);Ld.subVectors(e,i);const d=_o.dot(Ld),f=vo.dot(Ld);if(d>=0&&f<=d)return t.copy(i);const m=u*f-d*h;if(m<=0&&u>=0&&d<=0)return a=u/(u-d),t.copy(n).addScaledVector(_o,a);Id.subVectors(e,s);const g=_o.dot(Id),x=vo.dot(Id);if(x>=0&&g<=x)return t.copy(s);const S=g*h-u*x;if(S<=0&&h>=0&&x<=0)return c=h/(h-x),t.copy(n).addScaledVector(vo,c);const y=d*x-g*f;if(y<=0&&f-d>=0&&g-x>=0)return s0.subVectors(s,i),c=(f-d)/(f-d+(g-x)),t.copy(i).addScaledVector(s0,c);const _=1/(y+S+m);return a=S*_,c=m*_,t.copy(n).addScaledVector(_o,a).addScaledVector(vo,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const rx={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},Br={h:0,s:0,l:0},Cc={h:0,s:0,l:0};function Nd(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class ke{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=cn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=Ap(e,1),t=Jt(t,0,1),n=Jt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Nd(a,s,e+1/3),this.g=Nd(a,s,e),this.b=Nd(a,s,e-1/3)}return Dt.toWorkingColorSpace(this,i),this}setStyle(e,t=cn){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],c=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=cn){const n=rx[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Vo(e.r),this.g=Vo(e.g),this.b=Vo(e.b),this}copyLinearToSRGB(e){return this.r=Sd(e.r),this.g=Sd(e.g),this.b=Sd(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=cn){return Dt.fromWorkingColorSpace(Nn.copy(this),e),Math.round(Jt(Nn.r*255,0,255))*65536+Math.round(Jt(Nn.g*255,0,255))*256+Math.round(Jt(Nn.b*255,0,255))}getHexString(e=cn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.fromWorkingColorSpace(Nn.copy(this),t);const n=Nn.r,i=Nn.g,s=Nn.b,a=Math.max(n,i,s),c=Math.min(n,i,s);let u,h;const d=(c+a)/2;if(c===a)u=0,h=0;else{const f=a-c;switch(h=d<=.5?f/(a+c):f/(2-a-c),a){case n:u=(i-s)/f+(i<s?6:0);break;case i:u=(s-n)/f+2;break;case s:u=(n-i)/f+4;break}u/=6}return e.h=u,e.s=h,e.l=d,e}getRGB(e,t=Dt.workingColorSpace){return Dt.fromWorkingColorSpace(Nn.copy(this),t),e.r=Nn.r,e.g=Nn.g,e.b=Nn.b,e}getStyle(e=cn){Dt.fromWorkingColorSpace(Nn.copy(this),e);const t=Nn.r,n=Nn.g,i=Nn.b;return e!==cn?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Br),this.setHSL(Br.h+e,Br.s+t,Br.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Br),e.getHSL(Cc);const n=Ba(Br.h,Cc.h,t),i=Ba(Br.s,Cc.s,t),s=Ba(Br.l,Cc.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Nn=new ke;ke.NAMES=rx;let ZM=0;class zn extends wr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ZM++}),this.uuid=li(),this.name="",this.type="Material",this.blending=Ns,this.side=Mr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Au,this.blendDst=Cu,this.blendEquation=Gr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ke(0,0,0),this.blendAlpha=0,this.depthFunc=Ga,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=$f,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=bs,this.stencilZFail=bs,this.stencilZPass=bs,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(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ns&&(n.blending=this.blending),this.side!==Mr&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Au&&(n.blendSrc=this.blendSrc),this.blendDst!==Cu&&(n.blendDst=this.blendDst),this.blendEquation!==Gr&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ga&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==$f&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==bs&&(n.stencilFail=this.stencilFail),this.stencilZFail!==bs&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==bs&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const c in s){const u=s[c];delete u.metadata,a.push(u)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Qr extends zn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ke(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.combine=ul,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const vr=JM();function JM(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,i[u]=24,i[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,i[u]=-h-1,i[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,i[u]=13,i[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,i[u]=24,i[u|256]=24):(n[u]=31744,n[u|256]=64512,i[u]=13,i[u|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),c=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,d=0;for(;!(h&8388608);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[u]=h|d}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)a[u]=u<<23;a[31]=1199570944,a[32]=2147483648;for(let u=33;u<63;++u)a[u]=2147483648+(u-32<<23);a[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(c[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:c}}function Zn(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Jt(r,-65504,65504),vr.floatView[0]=r;const e=vr.uint32View[0],t=e>>23&511;return vr.baseTable[t]+((e&8388607)>>vr.shiftTable[t])}function Oa(r){const e=r>>10;return vr.uint32View[0]=vr.mantissaTable[vr.offsetTable[e]+(r&1023)]+vr.exponentTable[e],vr.floatView[0]}const KM={toHalfFloat:Zn,fromHalfFloat:Oa},on=new U,Rc=new he;class Ut{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=el,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ni,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Rc.fromBufferAttribute(this,t),Rc.applyMatrix3(e),this.setXY(t,Rc.x,Rc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)on.fromBufferAttribute(this,t),on.applyMatrix3(e),this.setXYZ(t,on.x,on.y,on.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)on.fromBufferAttribute(this,t),on.applyMatrix4(e),this.setXYZ(t,on.x,on.y,on.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)on.fromBufferAttribute(this,t),on.applyNormalMatrix(e),this.setXYZ(t,on.x,on.y,on.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)on.fromBufferAttribute(this,t),on.transformDirection(e),this.setXYZ(t,on.x,on.y,on.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Kn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=vt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Kn(t,this.array)),t}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Kn(t,this.array)),t}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Kn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Kn(t,this.array)),t}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array),s=vt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==el&&(e.usage=this.usage),e}}class QM extends Ut{constructor(e,t,n){super(new Int8Array(e),t,n)}}class $M extends Ut{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class eE extends Ut{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class tE extends Ut{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Pp extends Ut{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class nE extends Ut{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Lp extends Ut{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class iE extends Ut{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Oa(this.array[e*this.itemSize]);return this.normalized&&(t=Kn(t,this.array)),t}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize]=Zn(t),this}getY(e){let t=Oa(this.array[e*this.itemSize+1]);return this.normalized&&(t=Kn(t,this.array)),t}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+1]=Zn(t),this}getZ(e){let t=Oa(this.array[e*this.itemSize+2]);return this.normalized&&(t=Kn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+2]=Zn(t),this}getW(e){let t=Oa(this.array[e*this.itemSize+3]);return this.normalized&&(t=Kn(t,this.array)),t}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.array[e*this.itemSize+3]=Zn(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.array[e+0]=Zn(t),this.array[e+1]=Zn(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array)),this.array[e+0]=Zn(t),this.array[e+1]=Zn(n),this.array[e+2]=Zn(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array),s=vt(s,this.array)),this.array[e+0]=Zn(t),this.array[e+1]=Zn(n),this.array[e+2]=Zn(i),this.array[e+3]=Zn(s),this}}class qe extends Ut{constructor(e,t,n){super(new Float32Array(e),t,n)}}class rE extends Ut{constructor(e,t,n){super(new Float64Array(e),t,n)}}let sE=0;const yi=new lt,Dd=new Nt,xo=new U,si=new vn,ba=new vn,_n=new U;class St extends wr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:sE++}),this.uuid=li(),this.name="",this.type="BufferGeometry",this.index=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(e){return Array.isArray(e)?this.index=new(tx(e)?Lp:Pp)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new yt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return yi.makeRotationFromQuaternion(e),this.applyMatrix4(yi),this}rotateX(e){return yi.makeRotationX(e),this.applyMatrix4(yi),this}rotateY(e){return yi.makeRotationY(e),this.applyMatrix4(yi),this}rotateZ(e){return yi.makeRotationZ(e),this.applyMatrix4(yi),this}translate(e,t,n){return yi.makeTranslation(e,t,n),this.applyMatrix4(yi),this}scale(e,t,n){return yi.makeScale(e,t,n),this.applyMatrix4(yi),this}lookAt(e){return Dd.lookAt(e),Dd.updateMatrix(),this.applyMatrix4(Dd.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(xo).negate(),this.translate(xo.x,xo.y,xo.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new qe(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new vn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];si.setFromBufferAttribute(s),this.morphTargetsRelative?(_n.addVectors(this.boundingBox.min,si.min),this.boundingBox.expandByPoint(_n),_n.addVectors(this.boundingBox.max,si.max),this.boundingBox.expandByPoint(_n)):(this.boundingBox.expandByPoint(si.min),this.boundingBox.expandByPoint(si.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(){this.boundingSphere===null&&(this.boundingSphere=new xn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new U,1/0);return}if(e){const n=this.boundingSphere.center;if(si.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const c=t[s];ba.setFromBufferAttribute(c),this.morphTargetsRelative?(_n.addVectors(si.min,ba.min),si.expandByPoint(_n),_n.addVectors(si.max,ba.max),si.expandByPoint(_n)):(si.expandByPoint(ba.min),si.expandByPoint(ba.max))}si.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)_n.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(_n));if(t)for(let s=0,a=t.length;s<a;s++){const c=t[s],u=this.morphTargetsRelative;for(let h=0,d=c.count;h<d;h++)_n.fromBufferAttribute(c,h),u&&(xo.fromBufferAttribute(e,h),_n.add(xo)),i=Math.max(i,n.distanceToSquared(_n))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.array,i=t.position.array,s=t.normal.array,a=t.uv.array,c=i.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ut(new Float32Array(4*c),4));const u=this.getAttribute("tangent").array,h=[],d=[];for(let P=0;P<c;P++)h[P]=new U,d[P]=new U;const f=new U,m=new U,g=new U,x=new he,S=new he,y=new he,_=new U,b=new U;function M(P,z,ee){f.fromArray(i,P*3),m.fromArray(i,z*3),g.fromArray(i,ee*3),x.fromArray(a,P*2),S.fromArray(a,z*2),y.fromArray(a,ee*2),m.sub(f),g.sub(f),S.sub(x),y.sub(x);const de=1/(S.x*y.y-y.x*S.y);isFinite(de)&&(_.copy(m).multiplyScalar(y.y).addScaledVector(g,-S.y).multiplyScalar(de),b.copy(g).multiplyScalar(S.x).addScaledVector(m,-y.x).multiplyScalar(de),h[P].add(_),h[z].add(_),h[ee].add(_),d[P].add(b),d[z].add(b),d[ee].add(b))}let T=this.groups;T.length===0&&(T=[{start:0,count:n.length}]);for(let P=0,z=T.length;P<z;++P){const ee=T[P],de=ee.start,H=ee.count;for(let q=de,ie=de+H;q<ie;q+=3)M(n[q+0],n[q+1],n[q+2])}const R=new U,C=new U,N=new U,B=new U;function A(P){N.fromArray(s,P*3),B.copy(N);const z=h[P];R.copy(z),R.sub(N.multiplyScalar(N.dot(z))).normalize(),C.crossVectors(B,z);const de=C.dot(d[P])<0?-1:1;u[P*4]=R.x,u[P*4+1]=R.y,u[P*4+2]=R.z,u[P*4+3]=de}for(let P=0,z=T.length;P<z;++P){const ee=T[P],de=ee.start,H=ee.count;for(let q=de,ie=de+H;q<ie;q+=3)A(n[q+0]),A(n[q+1]),A(n[q+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Ut(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let m=0,g=n.count;m<g;m++)n.setXYZ(m,0,0,0);const i=new U,s=new U,a=new U,c=new U,u=new U,h=new U,d=new U,f=new U;if(e)for(let m=0,g=e.count;m<g;m+=3){const x=e.getX(m+0),S=e.getX(m+1),y=e.getX(m+2);i.fromBufferAttribute(t,x),s.fromBufferAttribute(t,S),a.fromBufferAttribute(t,y),d.subVectors(a,s),f.subVectors(i,s),d.cross(f),c.fromBufferAttribute(n,x),u.fromBufferAttribute(n,S),h.fromBufferAttribute(n,y),c.add(d),u.add(d),h.add(d),n.setXYZ(x,c.x,c.y,c.z),n.setXYZ(S,u.x,u.y,u.z),n.setXYZ(y,h.x,h.y,h.z)}else for(let m=0,g=t.count;m<g;m+=3)i.fromBufferAttribute(t,m+0),s.fromBufferAttribute(t,m+1),a.fromBufferAttribute(t,m+2),d.subVectors(a,s),f.subVectors(i,s),d.cross(f),n.setXYZ(m+0,d.x,d.y,d.z),n.setXYZ(m+1,d.x,d.y,d.z),n.setXYZ(m+2,d.x,d.y,d.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)_n.fromBufferAttribute(e,t),_n.normalize(),e.setXYZ(t,_n.x,_n.y,_n.z)}toNonIndexed(){function e(c,u){const h=c.array,d=c.itemSize,f=c.normalized,m=new h.constructor(u.length*d);let g=0,x=0;for(let S=0,y=u.length;S<y;S++){c.isInterleavedBufferAttribute?g=u[S]*c.data.stride+c.offset:g=u[S]*d;for(let _=0;_<d;_++)m[x++]=h[g++]}return new Ut(m,d,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new St,n=this.index.array,i=this.attributes;for(const c in i){const u=i[c],h=e(u,n);t.setAttribute(c,h)}const s=this.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,f=h.length;d<f;d++){const m=h[d],g=e(m,n);u.push(g)}t.morphAttributes[c]=u}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let c=0,u=a.length;c<u;c++){const h=a[c];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const i={};let s=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],d=[];for(let f=0,m=h.length;f<m;f++){const g=h[f];d.push(g.toJSON(e.data))}d.length>0&&(i[u]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const h in i){const d=i[h];this.setAttribute(h,d.clone(t))}const s=e.morphAttributes;for(const h in s){const d=[],f=s[h];for(let m=0,g=f.length;m<g;m++)d.push(f[m].clone(t));this.morphAttributes[h]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let h=0,d=a.length;h<d;h++){const f=a[h];this.addGroup(f.start,f.count,f.materialIndex)}const c=e.boundingBox;c!==null&&(this.boundingBox=c.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const o0=new lt,fs=new Vs,Pc=new xn,a0=new U,yo=new U,So=new U,Mo=new U,Ud=new U,Lc=new U,Ic=new he,Nc=new he,Dc=new he,l0=new U,c0=new U,u0=new U,Uc=new U,Oc=new U;class an extends Nt{constructor(e=new St,t=new Qr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const c=this.morphTargetInfluences;if(s&&c){Lc.set(0,0,0);for(let u=0,h=s.length;u<h;u++){const d=c[u],f=s[u];d!==0&&(Ud.fromBufferAttribute(f,e),a?Lc.addScaledVector(Ud,d):Lc.addScaledVector(Ud.sub(t),d))}t.add(Lc)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Pc.copy(n.boundingSphere),Pc.applyMatrix4(s),fs.copy(e.ray).recast(e.near),!(Pc.containsPoint(fs.origin)===!1&&(fs.intersectSphere(Pc,a0)===null||fs.origin.distanceToSquared(a0)>(e.far-e.near)**2))&&(o0.copy(s).invert(),fs.copy(e.ray).applyMatrix4(o0),!(n.boundingBox!==null&&fs.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,fs)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,c=s.index,u=s.attributes.position,h=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,m=s.groups,g=s.drawRange;if(c!==null)if(Array.isArray(a))for(let x=0,S=m.length;x<S;x++){const y=m[x],_=a[y.materialIndex],b=Math.max(y.start,g.start),M=Math.min(c.count,Math.min(y.start+y.count,g.start+g.count));for(let T=b,R=M;T<R;T+=3){const C=c.getX(T),N=c.getX(T+1),B=c.getX(T+2);i=Fc(this,_,e,n,h,d,f,C,N,B),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{const x=Math.max(0,g.start),S=Math.min(c.count,g.start+g.count);for(let y=x,_=S;y<_;y+=3){const b=c.getX(y),M=c.getX(y+1),T=c.getX(y+2);i=Fc(this,a,e,n,h,d,f,b,M,T),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(a))for(let x=0,S=m.length;x<S;x++){const y=m[x],_=a[y.materialIndex],b=Math.max(y.start,g.start),M=Math.min(u.count,Math.min(y.start+y.count,g.start+g.count));for(let T=b,R=M;T<R;T+=3){const C=T,N=T+1,B=T+2;i=Fc(this,_,e,n,h,d,f,C,N,B),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{const x=Math.max(0,g.start),S=Math.min(u.count,g.start+g.count);for(let y=x,_=S;y<_;y+=3){const b=y,M=y+1,T=y+2;i=Fc(this,a,e,n,h,d,f,b,M,T),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}}}function oE(r,e,t,n,i,s,a,c){let u;if(e.side===An?u=n.intersectTriangle(a,s,i,!0,c):u=n.intersectTriangle(i,s,a,e.side===Mr,c),u===null)return null;Oc.copy(c),Oc.applyMatrix4(r.matrixWorld);const h=t.ray.origin.distanceTo(Oc);return h<t.near||h>t.far?null:{distance:h,point:Oc.clone(),object:r}}function Fc(r,e,t,n,i,s,a,c,u,h){r.getVertexPosition(c,yo),r.getVertexPosition(u,So),r.getVertexPosition(h,Mo);const d=oE(r,e,t,n,yo,So,Mo,Uc);if(d){i&&(Ic.fromBufferAttribute(i,c),Nc.fromBufferAttribute(i,u),Dc.fromBufferAttribute(i,h),d.uv=Jn.getInterpolation(Uc,yo,So,Mo,Ic,Nc,Dc,new he)),s&&(Ic.fromBufferAttribute(s,c),Nc.fromBufferAttribute(s,u),Dc.fromBufferAttribute(s,h),d.uv1=Jn.getInterpolation(Uc,yo,So,Mo,Ic,Nc,Dc,new he),d.uv2=d.uv1),a&&(l0.fromBufferAttribute(a,c),c0.fromBufferAttribute(a,u),u0.fromBufferAttribute(a,h),d.normal=Jn.getInterpolation(Uc,yo,So,Mo,l0,c0,u0,new U),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const f={a:c,b:u,c:h,normal:new U,materialIndex:0};Jn.getNormal(yo,So,Mo,f.normal),d.face=f}return d}class Gs extends St{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const c=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const u=[],h=[],d=[],f=[];let m=0,g=0;x("z","y","x",-1,-1,n,t,e,a,s,0),x("z","y","x",1,-1,n,t,-e,a,s,1),x("x","z","y",1,1,e,n,t,i,a,2),x("x","z","y",1,-1,e,n,-t,i,a,3),x("x","y","z",1,-1,e,t,n,i,s,4),x("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(u),this.setAttribute("position",new qe(h,3)),this.setAttribute("normal",new qe(d,3)),this.setAttribute("uv",new qe(f,2));function x(S,y,_,b,M,T,R,C,N,B,A){const P=T/N,z=R/B,ee=T/2,de=R/2,H=C/2,q=N+1,ie=B+1;let le=0,j=0;const Z=new U;for(let J=0;J<ie;J++){const te=J*z-de;for(let ge=0;ge<q;ge++){const K=ge*P-ee;Z[S]=K*b,Z[y]=te*M,Z[_]=H,h.push(Z.x,Z.y,Z.z),Z[S]=0,Z[y]=0,Z[_]=C>0?1:-1,d.push(Z.x,Z.y,Z.z),f.push(ge/N),f.push(1-J/B),le+=1}}for(let J=0;J<B;J++)for(let te=0;te<N;te++){const ge=m+te+q*J,K=m+te+q*(J+1),fe=m+(te+1)+q*(J+1),be=m+(te+1)+q*J;u.push(ge,K,be),u.push(K,fe,be),j+=6}c.addGroup(g,j,A),g+=j,m+=le}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Xo(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Vn(r){const e={};for(let t=0;t<r.length;t++){const n=Xo(r[t]);for(const i in n)e[i]=n[i]}return e}function aE(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function sx(r){return r.getRenderTarget()===null?r.outputColorSpace:Dt.workingColorSpace}const Iu={clone:Xo,merge:Vn};var lE=`void main() {
7
7
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
8
8
  }`,cE=`void main() {
9
9
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
@@ -3475,7 +3475,7 @@ void main() {
3475
3475
  #include <tonemapping_fragment>
3476
3476
  #include <colorspace_fragment>
3477
3477
  #include <fog_fragment>
3478
- }`,_t={alphahash_fragment:fE,alphahash_pars_fragment:pE,alphamap_fragment:mE,alphamap_pars_fragment:gE,alphatest_fragment:_E,alphatest_pars_fragment:vE,aomap_fragment:xE,aomap_pars_fragment:yE,batching_pars_vertex:SE,batching_vertex:ME,begin_vertex:EE,beginnormal_vertex:bE,bsdfs:wE,iridescence_fragment:TE,bumpmap_pars_fragment:AE,clipping_planes_fragment:CE,clipping_planes_pars_fragment:RE,clipping_planes_pars_vertex:PE,clipping_planes_vertex:LE,color_fragment:IE,color_pars_fragment:NE,color_pars_vertex:DE,color_vertex:UE,common:OE,cube_uv_reflection_fragment:FE,defaultnormal_vertex:zE,displacementmap_pars_vertex:BE,displacementmap_vertex:kE,emissivemap_fragment:HE,emissivemap_pars_fragment:VE,colorspace_fragment:GE,colorspace_pars_fragment:WE,envmap_fragment:jE,envmap_common_pars_fragment:XE,envmap_pars_fragment:qE,envmap_pars_vertex:YE,envmap_physical_pars_fragment:ob,envmap_vertex:ZE,fog_vertex:JE,fog_pars_vertex:KE,fog_fragment:QE,fog_pars_fragment:$E,gradientmap_pars_fragment:eb,lightmap_fragment:tb,lightmap_pars_fragment:nb,lights_lambert_fragment:ib,lights_lambert_pars_fragment:rb,lights_pars_begin:sb,lights_toon_fragment:ab,lights_toon_pars_fragment:lb,lights_phong_fragment:cb,lights_phong_pars_fragment:ub,lights_physical_fragment:hb,lights_physical_pars_fragment:db,lights_fragment_begin:fb,lights_fragment_maps:pb,lights_fragment_end:mb,logdepthbuf_fragment:gb,logdepthbuf_pars_fragment:_b,logdepthbuf_pars_vertex:vb,logdepthbuf_vertex:xb,map_fragment:yb,map_pars_fragment:Sb,map_particle_fragment:Mb,map_particle_pars_fragment:Eb,metalnessmap_fragment:bb,metalnessmap_pars_fragment:wb,morphcolor_vertex:Tb,morphnormal_vertex:Ab,morphtarget_pars_vertex:Cb,morphtarget_vertex:Rb,normal_fragment_begin:Pb,normal_fragment_maps:Lb,normal_pars_fragment:Ib,normal_pars_vertex:Nb,normal_vertex:Db,normalmap_pars_fragment:Ub,clearcoat_normal_fragment_begin:Ob,clearcoat_normal_fragment_maps:Fb,clearcoat_pars_fragment:zb,iridescence_pars_fragment:Bb,opaque_fragment:kb,packing:Hb,premultiplied_alpha_fragment:Vb,project_vertex:Gb,dithering_fragment:Wb,dithering_pars_fragment:jb,roughnessmap_fragment:Xb,roughnessmap_pars_fragment:qb,shadowmap_pars_fragment:Yb,shadowmap_pars_vertex:Zb,shadowmap_vertex:Jb,shadowmask_pars_fragment:Kb,skinbase_vertex:Qb,skinning_pars_vertex:$b,skinning_vertex:ew,skinnormal_vertex:tw,specularmap_fragment:nw,specularmap_pars_fragment:iw,tonemapping_fragment:rw,tonemapping_pars_fragment:sw,transmission_fragment:ow,transmission_pars_fragment:aw,uv_pars_fragment:lw,uv_pars_vertex:cw,uv_vertex:uw,worldpos_vertex:hw,background_vert:dw,background_frag:fw,backgroundCube_vert:pw,backgroundCube_frag:mw,cube_vert:gw,cube_frag:_w,depth_vert:vw,depth_frag:xw,distanceRGBA_vert:yw,distanceRGBA_frag:Sw,equirect_vert:Mw,equirect_frag:Ew,linedashed_vert:bw,linedashed_frag:ww,meshbasic_vert:Tw,meshbasic_frag:Aw,meshlambert_vert:Cw,meshlambert_frag:Rw,meshmatcap_vert:Pw,meshmatcap_frag:Lw,meshnormal_vert:Iw,meshnormal_frag:Nw,meshphong_vert:Dw,meshphong_frag:Uw,meshphysical_vert:Ow,meshphysical_frag:Fw,meshtoon_vert:zw,meshtoon_frag:Bw,points_vert:kw,points_frag:Hw,shadow_vert:Vw,shadow_frag:Gw,sprite_vert:Ww,sprite_frag:jw},Ce={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new yt},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new yt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new yt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new yt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new yt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new yt},normalScale:{value:new he(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new yt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new yt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new yt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new yt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0},uvTransform:{value:new yt}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new he(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new yt},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0}}},Li={basic:{uniforms:Vn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.fog]),vertexShader:_t.meshbasic_vert,fragmentShader:_t.meshbasic_frag},lambert:{uniforms:Vn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new ke(0)}}]),vertexShader:_t.meshlambert_vert,fragmentShader:_t.meshlambert_frag},phong:{uniforms:Vn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:_t.meshphong_vert,fragmentShader:_t.meshphong_frag},standard:{uniforms:Vn([Ce.common,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.roughnessmap,Ce.metalnessmap,Ce.fog,Ce.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag},toon:{uniforms:Vn([Ce.common,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.gradientmap,Ce.fog,Ce.lights,{emissive:{value:new ke(0)}}]),vertexShader:_t.meshtoon_vert,fragmentShader:_t.meshtoon_frag},matcap:{uniforms:Vn([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,{matcap:{value:null}}]),vertexShader:_t.meshmatcap_vert,fragmentShader:_t.meshmatcap_frag},points:{uniforms:Vn([Ce.points,Ce.fog]),vertexShader:_t.points_vert,fragmentShader:_t.points_frag},dashed:{uniforms:Vn([Ce.common,Ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_t.linedashed_vert,fragmentShader:_t.linedashed_frag},depth:{uniforms:Vn([Ce.common,Ce.displacementmap]),vertexShader:_t.depth_vert,fragmentShader:_t.depth_frag},normal:{uniforms:Vn([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,{opacity:{value:1}}]),vertexShader:_t.meshnormal_vert,fragmentShader:_t.meshnormal_frag},sprite:{uniforms:Vn([Ce.sprite,Ce.fog]),vertexShader:_t.sprite_vert,fragmentShader:_t.sprite_frag},background:{uniforms:{uvTransform:{value:new yt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:_t.background_vert,fragmentShader:_t.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:_t.backgroundCube_vert,fragmentShader:_t.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_t.cube_vert,fragmentShader:_t.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_t.equirect_vert,fragmentShader:_t.equirect_frag},distanceRGBA:{uniforms:Vn([Ce.common,Ce.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_t.distanceRGBA_vert,fragmentShader:_t.distanceRGBA_frag},shadow:{uniforms:Vn([Ce.lights,Ce.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:_t.shadow_vert,fragmentShader:_t.shadow_frag}};Li.physical={uniforms:Vn([Li.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new yt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new yt},clearcoatNormalScale:{value:new he(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new yt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new yt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new yt},sheen:{value:0},sheenColor:{value:new ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new yt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new yt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new yt},transmissionSamplerSize:{value:new he},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new yt},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new yt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new yt},anisotropyVector:{value:new he},anisotropyMap:{value:null},anisotropyMapTransform:{value:new yt}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag};const Bc={r:0,b:0,g:0};function Xw(r,e,t,n,i,s,a){const c=new ke(0);let u=s===!0?0:1,h,d,f=null,m=0,g=null;function x(y,_){let b=!1,M=_.isScene===!0?_.background:null;M&&M.isTexture&&(M=(_.backgroundBlurriness>0?t:e).get(M)),M===null?S(c,u):M&&M.isColor&&(S(M,1),b=!0);const T=r.xr.getEnvironmentBlendMode();T==="additive"?n.buffers.color.setClear(0,0,0,1,a):T==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||b)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),M&&(M.isCubeTexture||M.mapping===Jo)?(d===void 0&&(d=new an(new Gs(1,1,1),new Oi({name:"BackgroundCubeMaterial",uniforms:Xo(Li.backgroundCube.uniforms),vertexShader:Li.backgroundCube.vertexShader,fragmentShader:Li.backgroundCube.fragmentShader,side:An,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(R,C,N){this.matrixWorld.copyPosition(N.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),d.material.uniforms.envMap.value=M,d.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,d.material.toneMapped=Dt.getTransfer(M.colorSpace)!==zt,(f!==M||m!==M.version||g!==r.toneMapping)&&(d.material.needsUpdate=!0,f=M,m=M.version,g=r.toneMapping),d.layers.enableAll(),y.unshift(d,d.geometry,d.material,0,0,null)):M&&M.isTexture&&(h===void 0&&(h=new an(new gl(2,2),new Oi({name:"BackgroundMaterial",uniforms:Xo(Li.background.uniforms),vertexShader:Li.background.vertexShader,fragmentShader:Li.background.fragmentShader,side:Mr,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(h)),h.material.uniforms.t2D.value=M,h.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(M.colorSpace)!==zt,M.matrixAutoUpdate===!0&&M.updateMatrix(),h.material.uniforms.uvTransform.value.copy(M.matrix),(f!==M||m!==M.version||g!==r.toneMapping)&&(h.material.needsUpdate=!0,f=M,m=M.version,g=r.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null))}function S(y,_){y.getRGB(Bc,sx(r)),n.buffers.color.setClear(Bc.r,Bc.g,Bc.b,_,a)}return{getClearColor:function(){return c},setClearColor:function(y,_=1){c.set(y),u=_,S(c,u)},getClearAlpha:function(){return u},setClearAlpha:function(y){u=y,S(c,u)},render:x}}function qw(r,e,t,n){const i=r.getParameter(r.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||s!==null,c={},u=y(null);let h=u,d=!1;function f(H,q,ie,le,j){let Z=!1;if(a){const J=S(le,ie,q);h!==J&&(h=J,g(h.object)),Z=_(H,le,ie,j),Z&&b(H,le,ie,j)}else{const J=q.wireframe===!0;(h.geometry!==le.id||h.program!==ie.id||h.wireframe!==J)&&(h.geometry=le.id,h.program=ie.id,h.wireframe=J,Z=!0)}j!==null&&t.update(j,r.ELEMENT_ARRAY_BUFFER),(Z||d)&&(d=!1,B(H,q,ie,le),j!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(j).buffer))}function m(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function g(H){return n.isWebGL2?r.bindVertexArray(H):s.bindVertexArrayOES(H)}function x(H){return n.isWebGL2?r.deleteVertexArray(H):s.deleteVertexArrayOES(H)}function S(H,q,ie){const le=ie.wireframe===!0;let j=c[H.id];j===void 0&&(j={},c[H.id]=j);let Z=j[q.id];Z===void 0&&(Z={},j[q.id]=Z);let J=Z[le];return J===void 0&&(J=y(m()),Z[le]=J),J}function y(H){const q=[],ie=[],le=[];for(let j=0;j<i;j++)q[j]=0,ie[j]=0,le[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:q,enabledAttributes:ie,attributeDivisors:le,object:H,attributes:{},index:null}}function _(H,q,ie,le){const j=h.attributes,Z=q.attributes;let J=0;const te=ie.getAttributes();for(const ge in te)if(te[ge].location>=0){const fe=j[ge];let be=Z[ge];if(be===void 0&&(ge==="instanceMatrix"&&H.instanceMatrix&&(be=H.instanceMatrix),ge==="instanceColor"&&H.instanceColor&&(be=H.instanceColor)),fe===void 0||fe.attribute!==be||be&&fe.data!==be.data)return!0;J++}return h.attributesNum!==J||h.index!==le}function b(H,q,ie,le){const j={},Z=q.attributes;let J=0;const te=ie.getAttributes();for(const ge in te)if(te[ge].location>=0){let fe=Z[ge];fe===void 0&&(ge==="instanceMatrix"&&H.instanceMatrix&&(fe=H.instanceMatrix),ge==="instanceColor"&&H.instanceColor&&(fe=H.instanceColor));const be={};be.attribute=fe,fe&&fe.data&&(be.data=fe.data),j[ge]=be,J++}h.attributes=j,h.attributesNum=J,h.index=le}function M(){const H=h.newAttributes;for(let q=0,ie=H.length;q<ie;q++)H[q]=0}function T(H){R(H,0)}function R(H,q){const ie=h.newAttributes,le=h.enabledAttributes,j=h.attributeDivisors;ie[H]=1,le[H]===0&&(r.enableVertexAttribArray(H),le[H]=1),j[H]!==q&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](H,q),j[H]=q)}function C(){const H=h.newAttributes,q=h.enabledAttributes;for(let ie=0,le=q.length;ie<le;ie++)q[ie]!==H[ie]&&(r.disableVertexAttribArray(ie),q[ie]=0)}function N(H,q,ie,le,j,Z,J){J===!0?r.vertexAttribIPointer(H,q,ie,j,Z):r.vertexAttribPointer(H,q,ie,le,j,Z)}function B(H,q,ie,le){if(n.isWebGL2===!1&&(H.isInstancedMesh||le.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;M();const j=le.attributes,Z=ie.getAttributes(),J=q.defaultAttributeValues;for(const te in Z){const ge=Z[te];if(ge.location>=0){let K=j[te];if(K===void 0&&(te==="instanceMatrix"&&H.instanceMatrix&&(K=H.instanceMatrix),te==="instanceColor"&&H.instanceColor&&(K=H.instanceColor)),K!==void 0){const fe=K.normalized,be=K.itemSize,Oe=t.get(K);if(Oe===void 0)continue;const Ne=Oe.buffer,Je=Oe.type,rt=Oe.bytesPerElement,Pe=n.isWebGL2===!0&&(Je===r.INT||Je===r.UNSIGNED_INT||K.gpuType===vp);if(K.isInterleavedBufferAttribute){const Ae=K.data,k=Ae.stride,ve=K.offset;if(Ae.isInstancedInterleavedBuffer){for(let ue=0;ue<ge.locationSize;ue++)R(ge.location+ue,Ae.meshPerAttribute);H.isInstancedMesh!==!0&&le._maxInstanceCount===void 0&&(le._maxInstanceCount=Ae.meshPerAttribute*Ae.count)}else for(let ue=0;ue<ge.locationSize;ue++)T(ge.location+ue);r.bindBuffer(r.ARRAY_BUFFER,Ne);for(let ue=0;ue<ge.locationSize;ue++)N(ge.location+ue,be/ge.locationSize,Je,fe,k*rt,(ve+be/ge.locationSize*ue)*rt,Pe)}else{if(K.isInstancedBufferAttribute){for(let Ae=0;Ae<ge.locationSize;Ae++)R(ge.location+Ae,K.meshPerAttribute);H.isInstancedMesh!==!0&&le._maxInstanceCount===void 0&&(le._maxInstanceCount=K.meshPerAttribute*K.count)}else for(let Ae=0;Ae<ge.locationSize;Ae++)T(ge.location+Ae);r.bindBuffer(r.ARRAY_BUFFER,Ne);for(let Ae=0;Ae<ge.locationSize;Ae++)N(ge.location+Ae,be/ge.locationSize,Je,fe,be*rt,be/ge.locationSize*Ae*rt,Pe)}}else if(J!==void 0){const fe=J[te];if(fe!==void 0)switch(fe.length){case 2:r.vertexAttrib2fv(ge.location,fe);break;case 3:r.vertexAttrib3fv(ge.location,fe);break;case 4:r.vertexAttrib4fv(ge.location,fe);break;default:r.vertexAttrib1fv(ge.location,fe)}}}}C()}function A(){ee();for(const H in c){const q=c[H];for(const ie in q){const le=q[ie];for(const j in le)x(le[j].object),delete le[j];delete q[ie]}delete c[H]}}function P(H){if(c[H.id]===void 0)return;const q=c[H.id];for(const ie in q){const le=q[ie];for(const j in le)x(le[j].object),delete le[j];delete q[ie]}delete c[H.id]}function z(H){for(const q in c){const ie=c[q];if(ie[H.id]===void 0)continue;const le=ie[H.id];for(const j in le)x(le[j].object),delete le[j];delete ie[H.id]}}function ee(){de(),d=!0,h!==u&&(h=u,g(h.object))}function de(){u.geometry=null,u.program=null,u.wireframe=!1}return{setup:f,reset:ee,resetDefaultState:de,dispose:A,releaseStatesOfGeometry:P,releaseStatesOfProgram:z,initAttributes:M,enableAttribute:T,disableUnusedAttributes:C}}function Yw(r,e,t,n){const i=n.isWebGL2;let s;function a(d){s=d}function c(d,f){r.drawArrays(s,d,f),t.update(f,s,1)}function u(d,f,m){if(m===0)return;let g,x;if(i)g=r,x="drawArraysInstanced";else if(g=e.get("ANGLE_instanced_arrays"),x="drawArraysInstancedANGLE",g===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}g[x](s,d,f,m),t.update(f,s,m)}function h(d,f,m){if(m===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let x=0;x<m;x++)this.render(d[x],f[x]);else{g.multiDrawArraysWEBGL(s,d,0,f,0,m);let x=0;for(let S=0;S<m;S++)x+=f[S];t.update(x,s,1)}}this.setMode=a,this.render=c,this.renderInstances=u,this.renderMultiDraw=h}function Zw(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const N=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(N.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(N){if(N==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";N="mediump"}return N==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext";let c=t.precision!==void 0?t.precision:"highp";const u=s(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=a||e.has("WEBGL_draw_buffers"),d=t.logarithmicDepthBuffer===!0,f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=r.getParameter(r.MAX_TEXTURE_SIZE),x=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),S=r.getParameter(r.MAX_VERTEX_ATTRIBS),y=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),_=r.getParameter(r.MAX_VARYING_VECTORS),b=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),M=m>0,T=a||e.has("OES_texture_float"),R=M&&T,C=a?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:h,getMaxAnisotropy:i,getMaxPrecision:s,precision:c,logarithmicDepthBuffer:d,maxTextures:f,maxVertexTextures:m,maxTextureSize:g,maxCubemapSize:x,maxAttributes:S,maxVertexUniforms:y,maxVaryings:_,maxFragmentUniforms:b,vertexTextures:M,floatFragmentTextures:T,floatVertexTextures:R,maxSamples:C}}function Jw(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new _r,c=new yt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const g=f.length!==0||m||n!==0||i;return i=m,n=f.length,g},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,m){t=d(f,m,0)},this.setState=function(f,m,g){const x=f.clippingPlanes,S=f.clipIntersection,y=f.clipShadows,_=r.get(f);if(!i||x===null||x.length===0||s&&!y)s?d(null):h();else{const b=s?0:n,M=b*4;let T=_.clippingState||null;u.value=T,T=d(x,m,M,g);for(let R=0;R!==M;++R)T[R]=t[R];_.clippingState=T,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=b}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(f,m,g,x){const S=f!==null?f.length:0;let y=null;if(S!==0){if(y=u.value,x!==!0||y===null){const _=g+S*4,b=m.matrixWorldInverse;c.getNormalMatrix(b),(y===null||y.length<_)&&(y=new Float32Array(_));for(let M=0,T=g;M!==S;++M,T+=4)a.copy(f[M]).applyMatrix4(b,c),a.normal.toArray(y,T),y[T+3]=a.constant}u.value=y,u.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,y}}function Kw(r){let e=new WeakMap;function t(a,c){return c===Wa?a.mapping=Er:c===ja&&(a.mapping=Yr),a}function n(a){if(a&&a.isTexture){const c=a.mapping;if(c===Wa||c===ja)if(e.has(a)){const u=e.get(a).texture;return t(u,a.mapping)}else{const u=a.image;if(u&&u.height>0){const h=new ax(u.height/2);return h.fromEquirectangularTexture(r,a),e.set(a,h),a.addEventListener("dispose",i),t(h.texture,a.mapping)}else return null}}return a}function i(a){const c=a.target;c.removeEventListener("dispose",i);const u=e.get(c);u!==void 0&&(e.delete(c),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class er extends fl{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,c=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,a=s+h*this.view.width,c-=d*this.view.offsetY,u=c-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,c,u,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Fo=4,d0=[.125,.215,.35,.446,.526,.582],Ts=20,Fd=new er,f0=new ke;let zd=null,Bd=0,kd=0;const ws=(1+Math.sqrt(5))/2,wo=1/ws,p0=[new U(1,1,1),new U(-1,1,1),new U(1,1,-1),new U(-1,1,-1),new U(0,ws,wo),new U(0,ws,-wo),new U(wo,0,ws),new U(-wo,0,ws),new U(ws,wo,0),new U(-ws,wo,0)];class ip{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){zd=this._renderer.getRenderTarget(),Bd=this._renderer.getActiveCubeFace(),kd=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=_0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=g0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(zd,Bd,kd),e.scissorTest=!1,kc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Er||e.mapping===Yr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),zd=this._renderer.getRenderTarget(),Bd=this._renderer.getActiveCubeFace(),kd=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:tn,minFilter:tn,generateMipmaps:!1,type:Go,format:Wn,colorSpace:nr,depthBuffer:!1},i=m0(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=m0(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Qw(s)),this._blurMaterial=$w(s,e,t)}return i}_compileMaterial(e){const t=new an(this._lodPlanes[0],e);this._renderer.compile(t,Fd)}_sceneToCubeUV(e,t,n,i){const c=new jt(90,1,t,n),u=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],d=this._renderer,f=d.autoClear,m=d.toneMapping;d.getClearColor(f0),d.toneMapping=Qi,d.autoClear=!1;const g=new Qr({name:"PMREM.Background",side:An,depthWrite:!1,depthTest:!1}),x=new an(new Gs,g);let S=!1;const y=e.background;y?y.isColor&&(g.color.copy(y),e.background=null,S=!0):(g.color.copy(f0),S=!0);for(let _=0;_<6;_++){const b=_%3;b===0?(c.up.set(0,u[_],0),c.lookAt(h[_],0,0)):b===1?(c.up.set(0,0,u[_]),c.lookAt(0,h[_],0)):(c.up.set(0,u[_],0),c.lookAt(0,0,h[_]));const M=this._cubeSize;kc(i,b*M,_>2?M:0,M,M),d.setRenderTarget(i),S&&d.render(x,c),d.render(e,c)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=m,d.autoClear=f,e.background=y}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Er||e.mapping===Yr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=_0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=g0());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new an(this._lodPlanes[0],s),c=s.uniforms;c.envMap.value=e;const u=this._cubeSize;kc(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(a,Fd)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const s=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),a=p0[(i-1)%p0.length];this._blur(e,i-1,i,s,a)}t.autoClear=n}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,c){const u=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,f=new an(this._lodPlanes[i],h),m=h.uniforms,g=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*Ts-1),S=s/x,y=isFinite(s)?1+Math.floor(d*S):Ts;y>Ts&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${Ts}`);const _=[];let b=0;for(let N=0;N<Ts;++N){const B=N/S,A=Math.exp(-B*B/2);_.push(A),N===0?b+=A:N<y&&(b+=2*A)}for(let N=0;N<_.length;N++)_[N]=_[N]/b;m.envMap.value=e.texture,m.samples.value=y,m.weights.value=_,m.latitudinal.value=a==="latitudinal",c&&(m.poleAxis.value=c);const{_lodMax:M}=this;m.dTheta.value=x,m.mipInt.value=M-n;const T=this._sizeLods[i],R=3*T*(i>M-Fo?i-M+Fo:0),C=4*(this._cubeSize-T);kc(t,R,C,3*T,2*T),u.setRenderTarget(t),u.render(f,Fd)}}function Qw(r){const e=[],t=[],n=[];let i=r;const s=r-Fo+1+d0.length;for(let a=0;a<s;a++){const c=Math.pow(2,i);t.push(c);let u=1/c;a>r-Fo?u=d0[a-r+Fo-1]:a===0&&(u=0),n.push(u);const h=1/(c-2),d=-h,f=1+h,m=[d,d,f,d,f,f,d,d,f,f,d,f],g=6,x=6,S=3,y=2,_=1,b=new Float32Array(S*x*g),M=new Float32Array(y*x*g),T=new Float32Array(_*x*g);for(let C=0;C<g;C++){const N=C%3*2/3-1,B=C>2?0:-1,A=[N,B,0,N+2/3,B,0,N+2/3,B+1,0,N,B,0,N+2/3,B+1,0,N,B+1,0];b.set(A,S*x*C),M.set(m,y*x*C);const P=[C,C,C,C,C,C];T.set(P,_*x*C)}const R=new St;R.setAttribute("position",new Ut(b,S)),R.setAttribute("uv",new Ut(M,y)),R.setAttribute("faceIndex",new Ut(T,_)),e.push(R),i>Fo&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function m0(r,e,t){const n=new Ui(r,e,t);return n.texture.mapping=Jo,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function kc(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function $w(r,e,t){const n=new Float32Array(Ts),i=new U(0,1,0);return new Oi({name:"SphericalGaussianBlur",defines:{n:Ts,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Np(),fragmentShader:`
3478
+ }`,_t={alphahash_fragment:fE,alphahash_pars_fragment:pE,alphamap_fragment:mE,alphamap_pars_fragment:gE,alphatest_fragment:_E,alphatest_pars_fragment:vE,aomap_fragment:xE,aomap_pars_fragment:yE,batching_pars_vertex:SE,batching_vertex:ME,begin_vertex:EE,beginnormal_vertex:bE,bsdfs:wE,iridescence_fragment:TE,bumpmap_pars_fragment:AE,clipping_planes_fragment:CE,clipping_planes_pars_fragment:RE,clipping_planes_pars_vertex:PE,clipping_planes_vertex:LE,color_fragment:IE,color_pars_fragment:NE,color_pars_vertex:DE,color_vertex:UE,common:OE,cube_uv_reflection_fragment:FE,defaultnormal_vertex:zE,displacementmap_pars_vertex:BE,displacementmap_vertex:kE,emissivemap_fragment:HE,emissivemap_pars_fragment:VE,colorspace_fragment:GE,colorspace_pars_fragment:WE,envmap_fragment:jE,envmap_common_pars_fragment:XE,envmap_pars_fragment:qE,envmap_pars_vertex:YE,envmap_physical_pars_fragment:ob,envmap_vertex:ZE,fog_vertex:JE,fog_pars_vertex:KE,fog_fragment:QE,fog_pars_fragment:$E,gradientmap_pars_fragment:eb,lightmap_fragment:tb,lightmap_pars_fragment:nb,lights_lambert_fragment:ib,lights_lambert_pars_fragment:rb,lights_pars_begin:sb,lights_toon_fragment:ab,lights_toon_pars_fragment:lb,lights_phong_fragment:cb,lights_phong_pars_fragment:ub,lights_physical_fragment:hb,lights_physical_pars_fragment:db,lights_fragment_begin:fb,lights_fragment_maps:pb,lights_fragment_end:mb,logdepthbuf_fragment:gb,logdepthbuf_pars_fragment:_b,logdepthbuf_pars_vertex:vb,logdepthbuf_vertex:xb,map_fragment:yb,map_pars_fragment:Sb,map_particle_fragment:Mb,map_particle_pars_fragment:Eb,metalnessmap_fragment:bb,metalnessmap_pars_fragment:wb,morphcolor_vertex:Tb,morphnormal_vertex:Ab,morphtarget_pars_vertex:Cb,morphtarget_vertex:Rb,normal_fragment_begin:Pb,normal_fragment_maps:Lb,normal_pars_fragment:Ib,normal_pars_vertex:Nb,normal_vertex:Db,normalmap_pars_fragment:Ub,clearcoat_normal_fragment_begin:Ob,clearcoat_normal_fragment_maps:Fb,clearcoat_pars_fragment:zb,iridescence_pars_fragment:Bb,opaque_fragment:kb,packing:Hb,premultiplied_alpha_fragment:Vb,project_vertex:Gb,dithering_fragment:Wb,dithering_pars_fragment:jb,roughnessmap_fragment:Xb,roughnessmap_pars_fragment:qb,shadowmap_pars_fragment:Yb,shadowmap_pars_vertex:Zb,shadowmap_vertex:Jb,shadowmask_pars_fragment:Kb,skinbase_vertex:Qb,skinning_pars_vertex:$b,skinning_vertex:ew,skinnormal_vertex:tw,specularmap_fragment:nw,specularmap_pars_fragment:iw,tonemapping_fragment:rw,tonemapping_pars_fragment:sw,transmission_fragment:ow,transmission_pars_fragment:aw,uv_pars_fragment:lw,uv_pars_vertex:cw,uv_vertex:uw,worldpos_vertex:hw,background_vert:dw,background_frag:fw,backgroundCube_vert:pw,backgroundCube_frag:mw,cube_vert:gw,cube_frag:_w,depth_vert:vw,depth_frag:xw,distanceRGBA_vert:yw,distanceRGBA_frag:Sw,equirect_vert:Mw,equirect_frag:Ew,linedashed_vert:bw,linedashed_frag:ww,meshbasic_vert:Tw,meshbasic_frag:Aw,meshlambert_vert:Cw,meshlambert_frag:Rw,meshmatcap_vert:Pw,meshmatcap_frag:Lw,meshnormal_vert:Iw,meshnormal_frag:Nw,meshphong_vert:Dw,meshphong_frag:Uw,meshphysical_vert:Ow,meshphysical_frag:Fw,meshtoon_vert:zw,meshtoon_frag:Bw,points_vert:kw,points_frag:Hw,shadow_vert:Vw,shadow_frag:Gw,sprite_vert:Ww,sprite_frag:jw},Ce={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new yt},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new yt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new yt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new yt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new yt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new yt},normalScale:{value:new he(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new yt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new yt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new yt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new yt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0},uvTransform:{value:new yt}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new he(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new yt},alphaMap:{value:null},alphaMapTransform:{value:new yt},alphaTest:{value:0}}},Li={basic:{uniforms:Vn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.fog]),vertexShader:_t.meshbasic_vert,fragmentShader:_t.meshbasic_frag},lambert:{uniforms:Vn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new ke(0)}}]),vertexShader:_t.meshlambert_vert,fragmentShader:_t.meshlambert_frag},phong:{uniforms:Vn([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:_t.meshphong_vert,fragmentShader:_t.meshphong_frag},standard:{uniforms:Vn([Ce.common,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.roughnessmap,Ce.metalnessmap,Ce.fog,Ce.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag},toon:{uniforms:Vn([Ce.common,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.gradientmap,Ce.fog,Ce.lights,{emissive:{value:new ke(0)}}]),vertexShader:_t.meshtoon_vert,fragmentShader:_t.meshtoon_frag},matcap:{uniforms:Vn([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,{matcap:{value:null}}]),vertexShader:_t.meshmatcap_vert,fragmentShader:_t.meshmatcap_frag},points:{uniforms:Vn([Ce.points,Ce.fog]),vertexShader:_t.points_vert,fragmentShader:_t.points_frag},dashed:{uniforms:Vn([Ce.common,Ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_t.linedashed_vert,fragmentShader:_t.linedashed_frag},depth:{uniforms:Vn([Ce.common,Ce.displacementmap]),vertexShader:_t.depth_vert,fragmentShader:_t.depth_frag},normal:{uniforms:Vn([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,{opacity:{value:1}}]),vertexShader:_t.meshnormal_vert,fragmentShader:_t.meshnormal_frag},sprite:{uniforms:Vn([Ce.sprite,Ce.fog]),vertexShader:_t.sprite_vert,fragmentShader:_t.sprite_frag},background:{uniforms:{uvTransform:{value:new yt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:_t.background_vert,fragmentShader:_t.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:_t.backgroundCube_vert,fragmentShader:_t.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_t.cube_vert,fragmentShader:_t.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_t.equirect_vert,fragmentShader:_t.equirect_frag},distanceRGBA:{uniforms:Vn([Ce.common,Ce.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_t.distanceRGBA_vert,fragmentShader:_t.distanceRGBA_frag},shadow:{uniforms:Vn([Ce.lights,Ce.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:_t.shadow_vert,fragmentShader:_t.shadow_frag}};Li.physical={uniforms:Vn([Li.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new yt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new yt},clearcoatNormalScale:{value:new he(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new yt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new yt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new yt},sheen:{value:0},sheenColor:{value:new ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new yt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new yt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new yt},transmissionSamplerSize:{value:new he},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new yt},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new yt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new yt},anisotropyVector:{value:new he},anisotropyMap:{value:null},anisotropyMapTransform:{value:new yt}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag};const Bc={r:0,b:0,g:0};function Xw(r,e,t,n,i,s,a){const c=new ke(0);let u=s===!0?0:1,h,d,f=null,m=0,g=null;function x(y,_){let b=!1,M=_.isScene===!0?_.background:null;M&&M.isTexture&&(M=(_.backgroundBlurriness>0?t:e).get(M)),M===null?S(c,u):M&&M.isColor&&(S(M,1),b=!0);const T=r.xr.getEnvironmentBlendMode();T==="additive"?n.buffers.color.setClear(0,0,0,1,a):T==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||b)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),M&&(M.isCubeTexture||M.mapping===Jo)?(d===void 0&&(d=new an(new Gs(1,1,1),new Oi({name:"BackgroundCubeMaterial",uniforms:Xo(Li.backgroundCube.uniforms),vertexShader:Li.backgroundCube.vertexShader,fragmentShader:Li.backgroundCube.fragmentShader,side:An,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(R,C,N){this.matrixWorld.copyPosition(N.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),d.material.uniforms.envMap.value=M,d.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,d.material.toneMapped=Dt.getTransfer(M.colorSpace)!==zt,(f!==M||m!==M.version||g!==r.toneMapping)&&(d.material.needsUpdate=!0,f=M,m=M.version,g=r.toneMapping),d.layers.enableAll(),y.unshift(d,d.geometry,d.material,0,0,null)):M&&M.isTexture&&(h===void 0&&(h=new an(new gl(2,2),new Oi({name:"BackgroundMaterial",uniforms:Xo(Li.background.uniforms),vertexShader:Li.background.vertexShader,fragmentShader:Li.background.fragmentShader,side:Mr,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(h)),h.material.uniforms.t2D.value=M,h.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,h.material.toneMapped=Dt.getTransfer(M.colorSpace)!==zt,M.matrixAutoUpdate===!0&&M.updateMatrix(),h.material.uniforms.uvTransform.value.copy(M.matrix),(f!==M||m!==M.version||g!==r.toneMapping)&&(h.material.needsUpdate=!0,f=M,m=M.version,g=r.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null))}function S(y,_){y.getRGB(Bc,sx(r)),n.buffers.color.setClear(Bc.r,Bc.g,Bc.b,_,a)}return{getClearColor:function(){return c},setClearColor:function(y,_=1){c.set(y),u=_,S(c,u)},getClearAlpha:function(){return u},setClearAlpha:function(y){u=y,S(c,u)},render:x}}function qw(r,e,t,n){const i=r.getParameter(r.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||s!==null,c={},u=y(null);let h=u,d=!1;function f(H,q,ie,le,j){let Z=!1;if(a){const J=S(le,ie,q);h!==J&&(h=J,g(h.object)),Z=_(H,le,ie,j),Z&&b(H,le,ie,j)}else{const J=q.wireframe===!0;(h.geometry!==le.id||h.program!==ie.id||h.wireframe!==J)&&(h.geometry=le.id,h.program=ie.id,h.wireframe=J,Z=!0)}j!==null&&t.update(j,r.ELEMENT_ARRAY_BUFFER),(Z||d)&&(d=!1,B(H,q,ie,le),j!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(j).buffer))}function m(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function g(H){return n.isWebGL2?r.bindVertexArray(H):s.bindVertexArrayOES(H)}function x(H){return n.isWebGL2?r.deleteVertexArray(H):s.deleteVertexArrayOES(H)}function S(H,q,ie){const le=ie.wireframe===!0;let j=c[H.id];j===void 0&&(j={},c[H.id]=j);let Z=j[q.id];Z===void 0&&(Z={},j[q.id]=Z);let J=Z[le];return J===void 0&&(J=y(m()),Z[le]=J),J}function y(H){const q=[],ie=[],le=[];for(let j=0;j<i;j++)q[j]=0,ie[j]=0,le[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:q,enabledAttributes:ie,attributeDivisors:le,object:H,attributes:{},index:null}}function _(H,q,ie,le){const j=h.attributes,Z=q.attributes;let J=0;const te=ie.getAttributes();for(const ge in te)if(te[ge].location>=0){const fe=j[ge];let be=Z[ge];if(be===void 0&&(ge==="instanceMatrix"&&H.instanceMatrix&&(be=H.instanceMatrix),ge==="instanceColor"&&H.instanceColor&&(be=H.instanceColor)),fe===void 0||fe.attribute!==be||be&&fe.data!==be.data)return!0;J++}return h.attributesNum!==J||h.index!==le}function b(H,q,ie,le){const j={},Z=q.attributes;let J=0;const te=ie.getAttributes();for(const ge in te)if(te[ge].location>=0){let fe=Z[ge];fe===void 0&&(ge==="instanceMatrix"&&H.instanceMatrix&&(fe=H.instanceMatrix),ge==="instanceColor"&&H.instanceColor&&(fe=H.instanceColor));const be={};be.attribute=fe,fe&&fe.data&&(be.data=fe.data),j[ge]=be,J++}h.attributes=j,h.attributesNum=J,h.index=le}function M(){const H=h.newAttributes;for(let q=0,ie=H.length;q<ie;q++)H[q]=0}function T(H){R(H,0)}function R(H,q){const ie=h.newAttributes,le=h.enabledAttributes,j=h.attributeDivisors;ie[H]=1,le[H]===0&&(r.enableVertexAttribArray(H),le[H]=1),j[H]!==q&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](H,q),j[H]=q)}function C(){const H=h.newAttributes,q=h.enabledAttributes;for(let ie=0,le=q.length;ie<le;ie++)q[ie]!==H[ie]&&(r.disableVertexAttribArray(ie),q[ie]=0)}function N(H,q,ie,le,j,Z,J){J===!0?r.vertexAttribIPointer(H,q,ie,j,Z):r.vertexAttribPointer(H,q,ie,le,j,Z)}function B(H,q,ie,le){if(n.isWebGL2===!1&&(H.isInstancedMesh||le.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;M();const j=le.attributes,Z=ie.getAttributes(),J=q.defaultAttributeValues;for(const te in Z){const ge=Z[te];if(ge.location>=0){let K=j[te];if(K===void 0&&(te==="instanceMatrix"&&H.instanceMatrix&&(K=H.instanceMatrix),te==="instanceColor"&&H.instanceColor&&(K=H.instanceColor)),K!==void 0){const fe=K.normalized,be=K.itemSize,Oe=t.get(K);if(Oe===void 0)continue;const Ne=Oe.buffer,Je=Oe.type,rt=Oe.bytesPerElement,Pe=n.isWebGL2===!0&&(Je===r.INT||Je===r.UNSIGNED_INT||K.gpuType===_p);if(K.isInterleavedBufferAttribute){const Ae=K.data,k=Ae.stride,ve=K.offset;if(Ae.isInstancedInterleavedBuffer){for(let ue=0;ue<ge.locationSize;ue++)R(ge.location+ue,Ae.meshPerAttribute);H.isInstancedMesh!==!0&&le._maxInstanceCount===void 0&&(le._maxInstanceCount=Ae.meshPerAttribute*Ae.count)}else for(let ue=0;ue<ge.locationSize;ue++)T(ge.location+ue);r.bindBuffer(r.ARRAY_BUFFER,Ne);for(let ue=0;ue<ge.locationSize;ue++)N(ge.location+ue,be/ge.locationSize,Je,fe,k*rt,(ve+be/ge.locationSize*ue)*rt,Pe)}else{if(K.isInstancedBufferAttribute){for(let Ae=0;Ae<ge.locationSize;Ae++)R(ge.location+Ae,K.meshPerAttribute);H.isInstancedMesh!==!0&&le._maxInstanceCount===void 0&&(le._maxInstanceCount=K.meshPerAttribute*K.count)}else for(let Ae=0;Ae<ge.locationSize;Ae++)T(ge.location+Ae);r.bindBuffer(r.ARRAY_BUFFER,Ne);for(let Ae=0;Ae<ge.locationSize;Ae++)N(ge.location+Ae,be/ge.locationSize,Je,fe,be*rt,be/ge.locationSize*Ae*rt,Pe)}}else if(J!==void 0){const fe=J[te];if(fe!==void 0)switch(fe.length){case 2:r.vertexAttrib2fv(ge.location,fe);break;case 3:r.vertexAttrib3fv(ge.location,fe);break;case 4:r.vertexAttrib4fv(ge.location,fe);break;default:r.vertexAttrib1fv(ge.location,fe)}}}}C()}function A(){ee();for(const H in c){const q=c[H];for(const ie in q){const le=q[ie];for(const j in le)x(le[j].object),delete le[j];delete q[ie]}delete c[H]}}function P(H){if(c[H.id]===void 0)return;const q=c[H.id];for(const ie in q){const le=q[ie];for(const j in le)x(le[j].object),delete le[j];delete q[ie]}delete c[H.id]}function z(H){for(const q in c){const ie=c[q];if(ie[H.id]===void 0)continue;const le=ie[H.id];for(const j in le)x(le[j].object),delete le[j];delete ie[H.id]}}function ee(){de(),d=!0,h!==u&&(h=u,g(h.object))}function de(){u.geometry=null,u.program=null,u.wireframe=!1}return{setup:f,reset:ee,resetDefaultState:de,dispose:A,releaseStatesOfGeometry:P,releaseStatesOfProgram:z,initAttributes:M,enableAttribute:T,disableUnusedAttributes:C}}function Yw(r,e,t,n){const i=n.isWebGL2;let s;function a(d){s=d}function c(d,f){r.drawArrays(s,d,f),t.update(f,s,1)}function u(d,f,m){if(m===0)return;let g,x;if(i)g=r,x="drawArraysInstanced";else if(g=e.get("ANGLE_instanced_arrays"),x="drawArraysInstancedANGLE",g===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}g[x](s,d,f,m),t.update(f,s,m)}function h(d,f,m){if(m===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let x=0;x<m;x++)this.render(d[x],f[x]);else{g.multiDrawArraysWEBGL(s,d,0,f,0,m);let x=0;for(let S=0;S<m;S++)x+=f[S];t.update(x,s,1)}}this.setMode=a,this.render=c,this.renderInstances=u,this.renderMultiDraw=h}function Zw(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const N=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(N.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(N){if(N==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";N="mediump"}return N==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext";let c=t.precision!==void 0?t.precision:"highp";const u=s(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=a||e.has("WEBGL_draw_buffers"),d=t.logarithmicDepthBuffer===!0,f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=r.getParameter(r.MAX_TEXTURE_SIZE),x=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),S=r.getParameter(r.MAX_VERTEX_ATTRIBS),y=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),_=r.getParameter(r.MAX_VARYING_VECTORS),b=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),M=m>0,T=a||e.has("OES_texture_float"),R=M&&T,C=a?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:h,getMaxAnisotropy:i,getMaxPrecision:s,precision:c,logarithmicDepthBuffer:d,maxTextures:f,maxVertexTextures:m,maxTextureSize:g,maxCubemapSize:x,maxAttributes:S,maxVertexUniforms:y,maxVaryings:_,maxFragmentUniforms:b,vertexTextures:M,floatFragmentTextures:T,floatVertexTextures:R,maxSamples:C}}function Jw(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new _r,c=new yt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const g=f.length!==0||m||n!==0||i;return i=m,n=f.length,g},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,m){t=d(f,m,0)},this.setState=function(f,m,g){const x=f.clippingPlanes,S=f.clipIntersection,y=f.clipShadows,_=r.get(f);if(!i||x===null||x.length===0||s&&!y)s?d(null):h();else{const b=s?0:n,M=b*4;let T=_.clippingState||null;u.value=T,T=d(x,m,M,g);for(let R=0;R!==M;++R)T[R]=t[R];_.clippingState=T,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=b}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(f,m,g,x){const S=f!==null?f.length:0;let y=null;if(S!==0){if(y=u.value,x!==!0||y===null){const _=g+S*4,b=m.matrixWorldInverse;c.getNormalMatrix(b),(y===null||y.length<_)&&(y=new Float32Array(_));for(let M=0,T=g;M!==S;++M,T+=4)a.copy(f[M]).applyMatrix4(b,c),a.normal.toArray(y,T),y[T+3]=a.constant}u.value=y,u.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,y}}function Kw(r){let e=new WeakMap;function t(a,c){return c===Wa?a.mapping=Er:c===ja&&(a.mapping=Yr),a}function n(a){if(a&&a.isTexture){const c=a.mapping;if(c===Wa||c===ja)if(e.has(a)){const u=e.get(a).texture;return t(u,a.mapping)}else{const u=a.image;if(u&&u.height>0){const h=new ax(u.height/2);return h.fromEquirectangularTexture(r,a),e.set(a,h),a.addEventListener("dispose",i),t(h.texture,a.mapping)}else return null}}return a}function i(a){const c=a.target;c.removeEventListener("dispose",i);const u=e.get(c);u!==void 0&&(e.delete(c),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class er extends fl{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,c=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,a=s+h*this.view.width,c-=d*this.view.offsetY,u=c-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,c,u,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Fo=4,h0=[.125,.215,.35,.446,.526,.582],Ts=20,Fd=new er,d0=new ke;let zd=null,Bd=0,kd=0;const ws=(1+Math.sqrt(5))/2,wo=1/ws,f0=[new U(1,1,1),new U(-1,1,1),new U(1,1,-1),new U(-1,1,-1),new U(0,ws,wo),new U(0,ws,-wo),new U(wo,0,ws),new U(-wo,0,ws),new U(ws,wo,0),new U(-ws,wo,0)];class np{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){zd=this._renderer.getRenderTarget(),Bd=this._renderer.getActiveCubeFace(),kd=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=g0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=m0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(zd,Bd,kd),e.scissorTest=!1,kc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Er||e.mapping===Yr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),zd=this._renderer.getRenderTarget(),Bd=this._renderer.getActiveCubeFace(),kd=this._renderer.getActiveMipmapLevel();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:tn,minFilter:tn,generateMipmaps:!1,type:Go,format:Wn,colorSpace:nr,depthBuffer:!1},i=p0(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=p0(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Qw(s)),this._blurMaterial=$w(s,e,t)}return i}_compileMaterial(e){const t=new an(this._lodPlanes[0],e);this._renderer.compile(t,Fd)}_sceneToCubeUV(e,t,n,i){const c=new jt(90,1,t,n),u=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],d=this._renderer,f=d.autoClear,m=d.toneMapping;d.getClearColor(d0),d.toneMapping=Qi,d.autoClear=!1;const g=new Qr({name:"PMREM.Background",side:An,depthWrite:!1,depthTest:!1}),x=new an(new Gs,g);let S=!1;const y=e.background;y?y.isColor&&(g.color.copy(y),e.background=null,S=!0):(g.color.copy(d0),S=!0);for(let _=0;_<6;_++){const b=_%3;b===0?(c.up.set(0,u[_],0),c.lookAt(h[_],0,0)):b===1?(c.up.set(0,0,u[_]),c.lookAt(0,h[_],0)):(c.up.set(0,u[_],0),c.lookAt(0,0,h[_]));const M=this._cubeSize;kc(i,b*M,_>2?M:0,M,M),d.setRenderTarget(i),S&&d.render(x,c),d.render(e,c)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=m,d.autoClear=f,e.background=y}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Er||e.mapping===Yr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=g0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=m0());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new an(this._lodPlanes[0],s),c=s.uniforms;c.envMap.value=e;const u=this._cubeSize;kc(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(a,Fd)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const s=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),a=f0[(i-1)%f0.length];this._blur(e,i-1,i,s,a)}t.autoClear=n}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,c){const u=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,f=new an(this._lodPlanes[i],h),m=h.uniforms,g=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*Ts-1),S=s/x,y=isFinite(s)?1+Math.floor(d*S):Ts;y>Ts&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${Ts}`);const _=[];let b=0;for(let N=0;N<Ts;++N){const B=N/S,A=Math.exp(-B*B/2);_.push(A),N===0?b+=A:N<y&&(b+=2*A)}for(let N=0;N<_.length;N++)_[N]=_[N]/b;m.envMap.value=e.texture,m.samples.value=y,m.weights.value=_,m.latitudinal.value=a==="latitudinal",c&&(m.poleAxis.value=c);const{_lodMax:M}=this;m.dTheta.value=x,m.mipInt.value=M-n;const T=this._sizeLods[i],R=3*T*(i>M-Fo?i-M+Fo:0),C=4*(this._cubeSize-T);kc(t,R,C,3*T,2*T),u.setRenderTarget(t),u.render(f,Fd)}}function Qw(r){const e=[],t=[],n=[];let i=r;const s=r-Fo+1+h0.length;for(let a=0;a<s;a++){const c=Math.pow(2,i);t.push(c);let u=1/c;a>r-Fo?u=h0[a-r+Fo-1]:a===0&&(u=0),n.push(u);const h=1/(c-2),d=-h,f=1+h,m=[d,d,f,d,f,f,d,d,f,f,d,f],g=6,x=6,S=3,y=2,_=1,b=new Float32Array(S*x*g),M=new Float32Array(y*x*g),T=new Float32Array(_*x*g);for(let C=0;C<g;C++){const N=C%3*2/3-1,B=C>2?0:-1,A=[N,B,0,N+2/3,B,0,N+2/3,B+1,0,N,B,0,N+2/3,B+1,0,N,B+1,0];b.set(A,S*x*C),M.set(m,y*x*C);const P=[C,C,C,C,C,C];T.set(P,_*x*C)}const R=new St;R.setAttribute("position",new Ut(b,S)),R.setAttribute("uv",new Ut(M,y)),R.setAttribute("faceIndex",new Ut(T,_)),e.push(R),i>Fo&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function p0(r,e,t){const n=new Ui(r,e,t);return n.texture.mapping=Jo,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function kc(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function $w(r,e,t){const n=new Float32Array(Ts),i=new U(0,1,0);return new Oi({name:"SphericalGaussianBlur",defines:{n:Ts,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Ip(),fragmentShader:`
3479
3479
 
3480
3480
  precision mediump float;
3481
3481
  precision mediump int;
@@ -3535,7 +3535,7 @@ void main() {
3535
3535
  }
3536
3536
 
3537
3537
  }
3538
- `,blending:Sr,depthTest:!1,depthWrite:!1})}function g0(){return new Oi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Np(),fragmentShader:`
3538
+ `,blending:Sr,depthTest:!1,depthWrite:!1})}function m0(){return new Oi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ip(),fragmentShader:`
3539
3539
 
3540
3540
  precision mediump float;
3541
3541
  precision mediump int;
@@ -3554,7 +3554,7 @@ void main() {
3554
3554
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3555
3555
 
3556
3556
  }
3557
- `,blending:Sr,depthTest:!1,depthWrite:!1})}function _0(){return new Oi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Np(),fragmentShader:`
3557
+ `,blending:Sr,depthTest:!1,depthWrite:!1})}function g0(){return new Oi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ip(),fragmentShader:`
3558
3558
 
3559
3559
  precision mediump float;
3560
3560
  precision mediump int;
@@ -3570,7 +3570,7 @@ void main() {
3570
3570
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3571
3571
 
3572
3572
  }
3573
- `,blending:Sr,depthTest:!1,depthWrite:!1})}function Np(){return`
3573
+ `,blending:Sr,depthTest:!1,depthWrite:!1})}function Ip(){return`
3574
3574
 
3575
3575
  precision mediump float;
3576
3576
  precision mediump int;
@@ -3625,16 +3625,16 @@ void main() {
3625
3625
  gl_Position = vec4( position, 1.0 );
3626
3626
 
3627
3627
  }
3628
- `}function e1(r){let e=new WeakMap,t=null;function n(c){if(c&&c.isTexture){const u=c.mapping,h=u===Wa||u===ja,d=u===Er||u===Yr;if(h||d)if(c.isRenderTargetTexture&&c.needsPMREMUpdate===!0){c.needsPMREMUpdate=!1;let f=e.get(c);return t===null&&(t=new ip(r)),f=h?t.fromEquirectangular(c,f):t.fromCubemap(c,f),e.set(c,f),f.texture}else{if(e.has(c))return e.get(c).texture;{const f=c.image;if(h&&f&&f.height>0||d&&f&&i(f)){t===null&&(t=new ip(r));const m=h?t.fromEquirectangular(c):t.fromCubemap(c);return e.set(c,m),c.addEventListener("dispose",s),m.texture}else return null}}}return c}function i(c){let u=0;const h=6;for(let d=0;d<h;d++)c[d]!==void 0&&u++;return u===h}function s(c){const u=c.target;u.removeEventListener("dispose",s);const h=e.get(u);h!==void 0&&(e.delete(u),h.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function t1(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function n1(r,e,t,n){const i={},s=new WeakMap;function a(f){const m=f.target;m.index!==null&&e.remove(m.index);for(const x in m.attributes)e.remove(m.attributes[x]);for(const x in m.morphAttributes){const S=m.morphAttributes[x];for(let y=0,_=S.length;y<_;y++)e.remove(S[y])}m.removeEventListener("dispose",a),delete i[m.id];const g=s.get(m);g&&(e.remove(g),s.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(f,m){return i[m.id]===!0||(m.addEventListener("dispose",a),i[m.id]=!0,t.memory.geometries++),m}function u(f){const m=f.attributes;for(const x in m)e.update(m[x],r.ARRAY_BUFFER);const g=f.morphAttributes;for(const x in g){const S=g[x];for(let y=0,_=S.length;y<_;y++)e.update(S[y],r.ARRAY_BUFFER)}}function h(f){const m=[],g=f.index,x=f.attributes.position;let S=0;if(g!==null){const b=g.array;S=g.version;for(let M=0,T=b.length;M<T;M+=3){const R=b[M+0],C=b[M+1],N=b[M+2];m.push(R,C,C,N,N,R)}}else if(x!==void 0){const b=x.array;S=x.version;for(let M=0,T=b.length/3-1;M<T;M+=3){const R=M+0,C=M+1,N=M+2;m.push(R,C,C,N,N,R)}}else return;const y=new(tx(m)?Ip:Lp)(m,1);y.version=S;const _=s.get(f);_&&e.remove(_),s.set(f,y)}function d(f){const m=s.get(f);if(m){const g=f.index;g!==null&&m.version<g.version&&h(f)}else h(f);return s.get(f)}return{get:c,update:u,getWireframeAttribute:d}}function i1(r,e,t,n){const i=n.isWebGL2;let s;function a(g){s=g}let c,u;function h(g){c=g.type,u=g.bytesPerElement}function d(g,x){r.drawElements(s,x,c,g*u),t.update(x,s,1)}function f(g,x,S){if(S===0)return;let y,_;if(i)y=r,_="drawElementsInstanced";else if(y=e.get("ANGLE_instanced_arrays"),_="drawElementsInstancedANGLE",y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[_](s,x,c,g*u,S),t.update(x,s,S)}function m(g,x,S){if(S===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let _=0;_<S;_++)this.render(g[_]/u,x[_]);else{y.multiDrawElementsWEBGL(s,x,0,c,g,0,S);let _=0;for(let b=0;b<S;b++)_+=x[b];t.update(_,s,1)}}this.setMode=a,this.setIndex=h,this.render=d,this.renderInstances=f,this.renderMultiDraw=m}function r1(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,c){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=c*(s/3);break;case r.LINES:t.lines+=c*(s/2);break;case r.LINE_STRIP:t.lines+=c*(s-1);break;case r.LINE_LOOP:t.lines+=c*s;break;case r.POINTS:t.points+=c*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function s1(r,e){return r[0]-e[0]}function o1(r,e){return Math.abs(e[1])-Math.abs(r[1])}function a1(r,e,t){const n={},i=new Float32Array(8),s=new WeakMap,a=new At,c=[];for(let h=0;h<8;h++)c[h]=[h,0];function u(h,d,f){const m=h.morphTargetInfluences;if(e.isWebGL2===!0){const g=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,x=g!==void 0?g.length:0;let S=s.get(d);if(S===void 0||S.count!==x){let H=function(){ee.dispose(),s.delete(d),d.removeEventListener("dispose",H)};S!==void 0&&S.texture.dispose();const b=d.morphAttributes.position!==void 0,M=d.morphAttributes.normal!==void 0,T=d.morphAttributes.color!==void 0,R=d.morphAttributes.position||[],C=d.morphAttributes.normal||[],N=d.morphAttributes.color||[];let B=0;b===!0&&(B=1),M===!0&&(B=2),T===!0&&(B=3);let A=d.attributes.position.count*B,P=1;A>e.maxTextureSize&&(P=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const z=new Float32Array(A*P*4*x),ee=new Vu(z,A,P,x);ee.type=Ni,ee.needsUpdate=!0;const de=B*4;for(let q=0;q<x;q++){const ie=R[q],le=C[q],j=N[q],Z=A*P*4*q;for(let J=0;J<ie.count;J++){const te=J*de;b===!0&&(a.fromBufferAttribute(ie,J),z[Z+te+0]=a.x,z[Z+te+1]=a.y,z[Z+te+2]=a.z,z[Z+te+3]=0),M===!0&&(a.fromBufferAttribute(le,J),z[Z+te+4]=a.x,z[Z+te+5]=a.y,z[Z+te+6]=a.z,z[Z+te+7]=0),T===!0&&(a.fromBufferAttribute(j,J),z[Z+te+8]=a.x,z[Z+te+9]=a.y,z[Z+te+10]=a.z,z[Z+te+11]=j.itemSize===4?a.w:1)}}S={count:x,texture:ee,size:new he(A,P)},s.set(d,S),d.addEventListener("dispose",H)}let y=0;for(let b=0;b<m.length;b++)y+=m[b];const _=d.morphTargetsRelative?1:1-y;f.getUniforms().setValue(r,"morphTargetBaseInfluence",_),f.getUniforms().setValue(r,"morphTargetInfluences",m),f.getUniforms().setValue(r,"morphTargetsTexture",S.texture,t),f.getUniforms().setValue(r,"morphTargetsTextureSize",S.size)}else{const g=m===void 0?0:m.length;let x=n[d.id];if(x===void 0||x.length!==g){x=[];for(let M=0;M<g;M++)x[M]=[M,0];n[d.id]=x}for(let M=0;M<g;M++){const T=x[M];T[0]=M,T[1]=m[M]}x.sort(o1);for(let M=0;M<8;M++)M<g&&x[M][1]?(c[M][0]=x[M][0],c[M][1]=x[M][1]):(c[M][0]=Number.MAX_SAFE_INTEGER,c[M][1]=0);c.sort(s1);const S=d.morphAttributes.position,y=d.morphAttributes.normal;let _=0;for(let M=0;M<8;M++){const T=c[M],R=T[0],C=T[1];R!==Number.MAX_SAFE_INTEGER&&C?(S&&d.getAttribute("morphTarget"+M)!==S[R]&&d.setAttribute("morphTarget"+M,S[R]),y&&d.getAttribute("morphNormal"+M)!==y[R]&&d.setAttribute("morphNormal"+M,y[R]),i[M]=C,_+=C):(S&&d.hasAttribute("morphTarget"+M)===!0&&d.deleteAttribute("morphTarget"+M),y&&d.hasAttribute("morphNormal"+M)===!0&&d.deleteAttribute("morphNormal"+M),i[M]=0)}const b=d.morphTargetsRelative?1:1-_;f.getUniforms().setValue(r,"morphTargetBaseInfluence",b),f.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:u}}function l1(r,e,t,n){let i=new WeakMap;function s(u){const h=n.render.frame,d=u.geometry,f=e.get(u,d);if(i.get(f)!==h&&(e.update(f),i.set(f,h)),u.isInstancedMesh&&(u.hasEventListener("dispose",c)===!1&&u.addEventListener("dispose",c),i.get(u)!==h&&(t.update(u.instanceMatrix,r.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,r.ARRAY_BUFFER),i.set(u,h))),u.isSkinnedMesh){const m=u.skeleton;i.get(m)!==h&&(m.update(),i.set(m,h))}return f}function a(){i=new WeakMap}function c(u){const h=u.target;h.removeEventListener("dispose",c),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:s,dispose:a}}class Dp extends nn{constructor(e,t,n,i,s,a,c,u,h,d){if(d=d!==void 0?d:Xr,d!==Xr&&d!==ks)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&d===Xr&&(n=xr),n===void 0&&d===ks&&(n=jr),super(null,i,s,a,c,u,d,n,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=c!==void 0?c:en,this.minFilter=u!==void 0?u:en,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const cx=new nn,ux=new Dp(1,1);ux.compareFunction=Ap;const hx=new Vu,dx=new Pp,fx=new pl,v0=[],x0=[],y0=new Float32Array(16),S0=new Float32Array(9),M0=new Float32Array(4);function Ko(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=v0[i];if(s===void 0&&(s=new Float32Array(i),v0[i]=s),e!==0){n.toArray(s,0);for(let a=1,c=0;a!==e;++a)c+=t,r[a].toArray(s,c)}return s}function un(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function hn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Gu(r,e){let t=x0[e];t===void 0&&(t=new Int32Array(e),x0[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function c1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function u1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(un(t,e))return;r.uniform2fv(this.addr,e),hn(t,e)}}function h1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(un(t,e))return;r.uniform3fv(this.addr,e),hn(t,e)}}function d1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(un(t,e))return;r.uniform4fv(this.addr,e),hn(t,e)}}function f1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(un(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),hn(t,e)}else{if(un(t,n))return;M0.set(n),r.uniformMatrix2fv(this.addr,!1,M0),hn(t,n)}}function p1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(un(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),hn(t,e)}else{if(un(t,n))return;S0.set(n),r.uniformMatrix3fv(this.addr,!1,S0),hn(t,n)}}function m1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(un(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),hn(t,e)}else{if(un(t,n))return;y0.set(n),r.uniformMatrix4fv(this.addr,!1,y0),hn(t,n)}}function g1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function _1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(un(t,e))return;r.uniform2iv(this.addr,e),hn(t,e)}}function v1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(un(t,e))return;r.uniform3iv(this.addr,e),hn(t,e)}}function x1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(un(t,e))return;r.uniform4iv(this.addr,e),hn(t,e)}}function y1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function S1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(un(t,e))return;r.uniform2uiv(this.addr,e),hn(t,e)}}function M1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(un(t,e))return;r.uniform3uiv(this.addr,e),hn(t,e)}}function E1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(un(t,e))return;r.uniform4uiv(this.addr,e),hn(t,e)}}function b1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);const s=this.type===r.SAMPLER_2D_SHADOW?ux:cx;t.setTexture2D(e||s,i)}function w1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||dx,i)}function T1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||fx,i)}function A1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||hx,i)}function C1(r){switch(r){case 5126:return c1;case 35664:return u1;case 35665:return h1;case 35666:return d1;case 35674:return f1;case 35675:return p1;case 35676:return m1;case 5124:case 35670:return g1;case 35667:case 35671:return _1;case 35668:case 35672:return v1;case 35669:case 35673:return x1;case 5125:return y1;case 36294:return S1;case 36295:return M1;case 36296:return E1;case 35678:case 36198:case 36298:case 36306:case 35682:return b1;case 35679:case 36299:case 36307:return w1;case 35680:case 36300:case 36308:case 36293:return T1;case 36289:case 36303:case 36311:case 36292:return A1}}function R1(r,e){r.uniform1fv(this.addr,e)}function P1(r,e){const t=Ko(e,this.size,2);r.uniform2fv(this.addr,t)}function L1(r,e){const t=Ko(e,this.size,3);r.uniform3fv(this.addr,t)}function I1(r,e){const t=Ko(e,this.size,4);r.uniform4fv(this.addr,t)}function N1(r,e){const t=Ko(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function D1(r,e){const t=Ko(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function U1(r,e){const t=Ko(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function O1(r,e){r.uniform1iv(this.addr,e)}function F1(r,e){r.uniform2iv(this.addr,e)}function z1(r,e){r.uniform3iv(this.addr,e)}function B1(r,e){r.uniform4iv(this.addr,e)}function k1(r,e){r.uniform1uiv(this.addr,e)}function H1(r,e){r.uniform2uiv(this.addr,e)}function V1(r,e){r.uniform3uiv(this.addr,e)}function G1(r,e){r.uniform4uiv(this.addr,e)}function W1(r,e,t){const n=this.cache,i=e.length,s=Gu(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||cx,s[a])}function j1(r,e,t){const n=this.cache,i=e.length,s=Gu(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||dx,s[a])}function X1(r,e,t){const n=this.cache,i=e.length,s=Gu(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||fx,s[a])}function q1(r,e,t){const n=this.cache,i=e.length,s=Gu(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||hx,s[a])}function Y1(r){switch(r){case 5126:return R1;case 35664:return P1;case 35665:return L1;case 35666:return I1;case 35674:return N1;case 35675:return D1;case 35676:return U1;case 5124:case 35670:return O1;case 35667:case 35671:return F1;case 35668:case 35672:return z1;case 35669:case 35673:return B1;case 5125:return k1;case 36294:return H1;case 36295:return V1;case 36296:return G1;case 35678:case 36198:case 36298:case 36306:case 35682:return W1;case 35679:case 36299:case 36307:return j1;case 35680:case 36300:case 36308:case 36293:return X1;case 36289:case 36303:case 36311:case 36292:return q1}}class Z1{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=C1(t.type)}}class J1{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Y1(t.type)}}class K1{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const c=i[s];c.setValue(e,t[c.id],n)}}}const Hd=/(\w+)(\])?(\[|\.)?/g;function E0(r,e){r.seq.push(e),r.map[e.id]=e}function Q1(r,e,t){const n=r.name,i=n.length;for(Hd.lastIndex=0;;){const s=Hd.exec(n),a=Hd.lastIndex;let c=s[1];const u=s[2]==="]",h=s[3];if(u&&(c=c|0),h===void 0||h==="["&&a+2===i){E0(t,h===void 0?new Z1(c,r,e):new J1(c,r,e));break}else{let f=t.map[c];f===void 0&&(f=new K1(c),E0(t,f)),t=f}}}class bu{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),a=e.getUniformLocation(t,s.name);Q1(s,a,this)}}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const c=t[s],u=n[c.id];u.needsUpdate!==!1&&c.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function b0(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const $1=37297;let eT=0;function tT(r,e){const t=r.split(`
3628
+ `}function e1(r){let e=new WeakMap,t=null;function n(c){if(c&&c.isTexture){const u=c.mapping,h=u===Wa||u===ja,d=u===Er||u===Yr;if(h||d)if(c.isRenderTargetTexture&&c.needsPMREMUpdate===!0){c.needsPMREMUpdate=!1;let f=e.get(c);return t===null&&(t=new np(r)),f=h?t.fromEquirectangular(c,f):t.fromCubemap(c,f),e.set(c,f),f.texture}else{if(e.has(c))return e.get(c).texture;{const f=c.image;if(h&&f&&f.height>0||d&&f&&i(f)){t===null&&(t=new np(r));const m=h?t.fromEquirectangular(c):t.fromCubemap(c);return e.set(c,m),c.addEventListener("dispose",s),m.texture}else return null}}}return c}function i(c){let u=0;const h=6;for(let d=0;d<h;d++)c[d]!==void 0&&u++;return u===h}function s(c){const u=c.target;u.removeEventListener("dispose",s);const h=e.get(u);h!==void 0&&(e.delete(u),h.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function t1(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function n1(r,e,t,n){const i={},s=new WeakMap;function a(f){const m=f.target;m.index!==null&&e.remove(m.index);for(const x in m.attributes)e.remove(m.attributes[x]);for(const x in m.morphAttributes){const S=m.morphAttributes[x];for(let y=0,_=S.length;y<_;y++)e.remove(S[y])}m.removeEventListener("dispose",a),delete i[m.id];const g=s.get(m);g&&(e.remove(g),s.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(f,m){return i[m.id]===!0||(m.addEventListener("dispose",a),i[m.id]=!0,t.memory.geometries++),m}function u(f){const m=f.attributes;for(const x in m)e.update(m[x],r.ARRAY_BUFFER);const g=f.morphAttributes;for(const x in g){const S=g[x];for(let y=0,_=S.length;y<_;y++)e.update(S[y],r.ARRAY_BUFFER)}}function h(f){const m=[],g=f.index,x=f.attributes.position;let S=0;if(g!==null){const b=g.array;S=g.version;for(let M=0,T=b.length;M<T;M+=3){const R=b[M+0],C=b[M+1],N=b[M+2];m.push(R,C,C,N,N,R)}}else if(x!==void 0){const b=x.array;S=x.version;for(let M=0,T=b.length/3-1;M<T;M+=3){const R=M+0,C=M+1,N=M+2;m.push(R,C,C,N,N,R)}}else return;const y=new(tx(m)?Lp:Pp)(m,1);y.version=S;const _=s.get(f);_&&e.remove(_),s.set(f,y)}function d(f){const m=s.get(f);if(m){const g=f.index;g!==null&&m.version<g.version&&h(f)}else h(f);return s.get(f)}return{get:c,update:u,getWireframeAttribute:d}}function i1(r,e,t,n){const i=n.isWebGL2;let s;function a(g){s=g}let c,u;function h(g){c=g.type,u=g.bytesPerElement}function d(g,x){r.drawElements(s,x,c,g*u),t.update(x,s,1)}function f(g,x,S){if(S===0)return;let y,_;if(i)y=r,_="drawElementsInstanced";else if(y=e.get("ANGLE_instanced_arrays"),_="drawElementsInstancedANGLE",y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[_](s,x,c,g*u,S),t.update(x,s,S)}function m(g,x,S){if(S===0)return;const y=e.get("WEBGL_multi_draw");if(y===null)for(let _=0;_<S;_++)this.render(g[_]/u,x[_]);else{y.multiDrawElementsWEBGL(s,x,0,c,g,0,S);let _=0;for(let b=0;b<S;b++)_+=x[b];t.update(_,s,1)}}this.setMode=a,this.setIndex=h,this.render=d,this.renderInstances=f,this.renderMultiDraw=m}function r1(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,c){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=c*(s/3);break;case r.LINES:t.lines+=c*(s/2);break;case r.LINE_STRIP:t.lines+=c*(s-1);break;case r.LINE_LOOP:t.lines+=c*s;break;case r.POINTS:t.points+=c*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function s1(r,e){return r[0]-e[0]}function o1(r,e){return Math.abs(e[1])-Math.abs(r[1])}function a1(r,e,t){const n={},i=new Float32Array(8),s=new WeakMap,a=new At,c=[];for(let h=0;h<8;h++)c[h]=[h,0];function u(h,d,f){const m=h.morphTargetInfluences;if(e.isWebGL2===!0){const g=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,x=g!==void 0?g.length:0;let S=s.get(d);if(S===void 0||S.count!==x){let H=function(){ee.dispose(),s.delete(d),d.removeEventListener("dispose",H)};S!==void 0&&S.texture.dispose();const b=d.morphAttributes.position!==void 0,M=d.morphAttributes.normal!==void 0,T=d.morphAttributes.color!==void 0,R=d.morphAttributes.position||[],C=d.morphAttributes.normal||[],N=d.morphAttributes.color||[];let B=0;b===!0&&(B=1),M===!0&&(B=2),T===!0&&(B=3);let A=d.attributes.position.count*B,P=1;A>e.maxTextureSize&&(P=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const z=new Float32Array(A*P*4*x),ee=new Vu(z,A,P,x);ee.type=Ni,ee.needsUpdate=!0;const de=B*4;for(let q=0;q<x;q++){const ie=R[q],le=C[q],j=N[q],Z=A*P*4*q;for(let J=0;J<ie.count;J++){const te=J*de;b===!0&&(a.fromBufferAttribute(ie,J),z[Z+te+0]=a.x,z[Z+te+1]=a.y,z[Z+te+2]=a.z,z[Z+te+3]=0),M===!0&&(a.fromBufferAttribute(le,J),z[Z+te+4]=a.x,z[Z+te+5]=a.y,z[Z+te+6]=a.z,z[Z+te+7]=0),T===!0&&(a.fromBufferAttribute(j,J),z[Z+te+8]=a.x,z[Z+te+9]=a.y,z[Z+te+10]=a.z,z[Z+te+11]=j.itemSize===4?a.w:1)}}S={count:x,texture:ee,size:new he(A,P)},s.set(d,S),d.addEventListener("dispose",H)}let y=0;for(let b=0;b<m.length;b++)y+=m[b];const _=d.morphTargetsRelative?1:1-y;f.getUniforms().setValue(r,"morphTargetBaseInfluence",_),f.getUniforms().setValue(r,"morphTargetInfluences",m),f.getUniforms().setValue(r,"morphTargetsTexture",S.texture,t),f.getUniforms().setValue(r,"morphTargetsTextureSize",S.size)}else{const g=m===void 0?0:m.length;let x=n[d.id];if(x===void 0||x.length!==g){x=[];for(let M=0;M<g;M++)x[M]=[M,0];n[d.id]=x}for(let M=0;M<g;M++){const T=x[M];T[0]=M,T[1]=m[M]}x.sort(o1);for(let M=0;M<8;M++)M<g&&x[M][1]?(c[M][0]=x[M][0],c[M][1]=x[M][1]):(c[M][0]=Number.MAX_SAFE_INTEGER,c[M][1]=0);c.sort(s1);const S=d.morphAttributes.position,y=d.morphAttributes.normal;let _=0;for(let M=0;M<8;M++){const T=c[M],R=T[0],C=T[1];R!==Number.MAX_SAFE_INTEGER&&C?(S&&d.getAttribute("morphTarget"+M)!==S[R]&&d.setAttribute("morphTarget"+M,S[R]),y&&d.getAttribute("morphNormal"+M)!==y[R]&&d.setAttribute("morphNormal"+M,y[R]),i[M]=C,_+=C):(S&&d.hasAttribute("morphTarget"+M)===!0&&d.deleteAttribute("morphTarget"+M),y&&d.hasAttribute("morphNormal"+M)===!0&&d.deleteAttribute("morphNormal"+M),i[M]=0)}const b=d.morphTargetsRelative?1:1-_;f.getUniforms().setValue(r,"morphTargetBaseInfluence",b),f.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:u}}function l1(r,e,t,n){let i=new WeakMap;function s(u){const h=n.render.frame,d=u.geometry,f=e.get(u,d);if(i.get(f)!==h&&(e.update(f),i.set(f,h)),u.isInstancedMesh&&(u.hasEventListener("dispose",c)===!1&&u.addEventListener("dispose",c),i.get(u)!==h&&(t.update(u.instanceMatrix,r.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,r.ARRAY_BUFFER),i.set(u,h))),u.isSkinnedMesh){const m=u.skeleton;i.get(m)!==h&&(m.update(),i.set(m,h))}return f}function a(){i=new WeakMap}function c(u){const h=u.target;h.removeEventListener("dispose",c),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:s,dispose:a}}class Np extends nn{constructor(e,t,n,i,s,a,c,u,h,d){if(d=d!==void 0?d:Xr,d!==Xr&&d!==ks)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&d===Xr&&(n=xr),n===void 0&&d===ks&&(n=jr),super(null,i,s,a,c,u,d,n,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=c!==void 0?c:en,this.minFilter=u!==void 0?u:en,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const cx=new nn,ux=new Np(1,1);ux.compareFunction=Tp;const hx=new Vu,dx=new Rp,fx=new pl,_0=[],v0=[],x0=new Float32Array(16),y0=new Float32Array(9),S0=new Float32Array(4);function Ko(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=_0[i];if(s===void 0&&(s=new Float32Array(i),_0[i]=s),e!==0){n.toArray(s,0);for(let a=1,c=0;a!==e;++a)c+=t,r[a].toArray(s,c)}return s}function un(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function hn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Gu(r,e){let t=v0[e];t===void 0&&(t=new Int32Array(e),v0[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function c1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function u1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(un(t,e))return;r.uniform2fv(this.addr,e),hn(t,e)}}function h1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(un(t,e))return;r.uniform3fv(this.addr,e),hn(t,e)}}function d1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(un(t,e))return;r.uniform4fv(this.addr,e),hn(t,e)}}function f1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(un(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),hn(t,e)}else{if(un(t,n))return;S0.set(n),r.uniformMatrix2fv(this.addr,!1,S0),hn(t,n)}}function p1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(un(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),hn(t,e)}else{if(un(t,n))return;y0.set(n),r.uniformMatrix3fv(this.addr,!1,y0),hn(t,n)}}function m1(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(un(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),hn(t,e)}else{if(un(t,n))return;x0.set(n),r.uniformMatrix4fv(this.addr,!1,x0),hn(t,n)}}function g1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function _1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(un(t,e))return;r.uniform2iv(this.addr,e),hn(t,e)}}function v1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(un(t,e))return;r.uniform3iv(this.addr,e),hn(t,e)}}function x1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(un(t,e))return;r.uniform4iv(this.addr,e),hn(t,e)}}function y1(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function S1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(un(t,e))return;r.uniform2uiv(this.addr,e),hn(t,e)}}function M1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(un(t,e))return;r.uniform3uiv(this.addr,e),hn(t,e)}}function E1(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(un(t,e))return;r.uniform4uiv(this.addr,e),hn(t,e)}}function b1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);const s=this.type===r.SAMPLER_2D_SHADOW?ux:cx;t.setTexture2D(e||s,i)}function w1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||dx,i)}function T1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||fx,i)}function A1(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||hx,i)}function C1(r){switch(r){case 5126:return c1;case 35664:return u1;case 35665:return h1;case 35666:return d1;case 35674:return f1;case 35675:return p1;case 35676:return m1;case 5124:case 35670:return g1;case 35667:case 35671:return _1;case 35668:case 35672:return v1;case 35669:case 35673:return x1;case 5125:return y1;case 36294:return S1;case 36295:return M1;case 36296:return E1;case 35678:case 36198:case 36298:case 36306:case 35682:return b1;case 35679:case 36299:case 36307:return w1;case 35680:case 36300:case 36308:case 36293:return T1;case 36289:case 36303:case 36311:case 36292:return A1}}function R1(r,e){r.uniform1fv(this.addr,e)}function P1(r,e){const t=Ko(e,this.size,2);r.uniform2fv(this.addr,t)}function L1(r,e){const t=Ko(e,this.size,3);r.uniform3fv(this.addr,t)}function I1(r,e){const t=Ko(e,this.size,4);r.uniform4fv(this.addr,t)}function N1(r,e){const t=Ko(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function D1(r,e){const t=Ko(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function U1(r,e){const t=Ko(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function O1(r,e){r.uniform1iv(this.addr,e)}function F1(r,e){r.uniform2iv(this.addr,e)}function z1(r,e){r.uniform3iv(this.addr,e)}function B1(r,e){r.uniform4iv(this.addr,e)}function k1(r,e){r.uniform1uiv(this.addr,e)}function H1(r,e){r.uniform2uiv(this.addr,e)}function V1(r,e){r.uniform3uiv(this.addr,e)}function G1(r,e){r.uniform4uiv(this.addr,e)}function W1(r,e,t){const n=this.cache,i=e.length,s=Gu(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTexture2D(e[a]||cx,s[a])}function j1(r,e,t){const n=this.cache,i=e.length,s=Gu(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||dx,s[a])}function X1(r,e,t){const n=this.cache,i=e.length,s=Gu(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||fx,s[a])}function q1(r,e,t){const n=this.cache,i=e.length,s=Gu(t,i);un(n,s)||(r.uniform1iv(this.addr,s),hn(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||hx,s[a])}function Y1(r){switch(r){case 5126:return R1;case 35664:return P1;case 35665:return L1;case 35666:return I1;case 35674:return N1;case 35675:return D1;case 35676:return U1;case 5124:case 35670:return O1;case 35667:case 35671:return F1;case 35668:case 35672:return z1;case 35669:case 35673:return B1;case 5125:return k1;case 36294:return H1;case 36295:return V1;case 36296:return G1;case 35678:case 36198:case 36298:case 36306:case 35682:return W1;case 35679:case 36299:case 36307:return j1;case 35680:case 36300:case 36308:case 36293:return X1;case 36289:case 36303:case 36311:case 36292:return q1}}class Z1{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=C1(t.type)}}class J1{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Y1(t.type)}}class K1{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const c=i[s];c.setValue(e,t[c.id],n)}}}const Hd=/(\w+)(\])?(\[|\.)?/g;function M0(r,e){r.seq.push(e),r.map[e.id]=e}function Q1(r,e,t){const n=r.name,i=n.length;for(Hd.lastIndex=0;;){const s=Hd.exec(n),a=Hd.lastIndex;let c=s[1];const u=s[2]==="]",h=s[3];if(u&&(c=c|0),h===void 0||h==="["&&a+2===i){M0(t,h===void 0?new Z1(c,r,e):new J1(c,r,e));break}else{let f=t.map[c];f===void 0&&(f=new K1(c),M0(t,f)),t=f}}}class bu{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),a=e.getUniformLocation(t,s.name);Q1(s,a,this)}}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const c=t[s],u=n[c.id];u.needsUpdate!==!1&&c.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function E0(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const $1=37297;let eT=0;function tT(r,e){const t=r.split(`
3629
3629
  `),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const c=a+1;n.push(`${c===e?">":" "} ${c}: ${t[a]}`)}return n.join(`
3630
- `)}function nT(r){const e=Dt.getPrimaries(Dt.workingColorSpace),t=Dt.getPrimaries(r);let n;switch(e===t?n="":e===$a&&t===Qa?n="LinearDisplayP3ToLinearSRGB":e===Qa&&t===$a&&(n="LinearSRGBToLinearDisplayP3"),r){case nr:case hl:return[n,"LinearTransferOETF"];case cn:case Hu:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function w0(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
3630
+ `)}function nT(r){const e=Dt.getPrimaries(Dt.workingColorSpace),t=Dt.getPrimaries(r);let n;switch(e===t?n="":e===$a&&t===Qa?n="LinearDisplayP3ToLinearSRGB":e===Qa&&t===$a&&(n="LinearSRGBToLinearDisplayP3"),r){case nr:case hl:return[n,"LinearTransferOETF"];case cn:case Hu:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function b0(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
3631
3631
 
3632
3632
  `+i+`
3633
3633
 
3634
3634
  `+tT(r.getShaderSource(e),a)}else return i}function iT(r,e){const t=nT(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function rT(r,e){let t;switch(e){case Av:t="Linear";break;case Cv:t="Reinhard";break;case Rv:t="OptimizedCineon";break;case Fu:t="ACESFilmic";break;case Lv:t="AgX";break;case Pv:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function sT(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(zo).join(`
3635
3635
  `)}function oT(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":""].filter(zo).join(`
3636
3636
  `)}function aT(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3637
- `)}function lT(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let c=1;s.type===r.FLOAT_MAT2&&(c=2),s.type===r.FLOAT_MAT3&&(c=3),s.type===r.FLOAT_MAT4&&(c=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:c}}return t}function zo(r){return r!==""}function T0(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function A0(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const cT=/^[ \t]*#include +<([\w\d./]+)>/gm;function rp(r){return r.replace(cT,hT)}const uT=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function hT(r,e){let t=_t[e];if(t===void 0){const n=uT.get(e);if(n!==void 0)t=_t[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return rp(t)}const dT=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function C0(r){return r.replace(dT,fT)}function fT(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function R0(r){let e="precision "+r.precision+` float;
3637
+ `)}function lT(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let c=1;s.type===r.FLOAT_MAT2&&(c=2),s.type===r.FLOAT_MAT3&&(c=3),s.type===r.FLOAT_MAT4&&(c=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:c}}return t}function zo(r){return r!==""}function w0(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function T0(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const cT=/^[ \t]*#include +<([\w\d./]+)>/gm;function ip(r){return r.replace(cT,hT)}const uT=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function hT(r,e){let t=_t[e];if(t===void 0){const n=uT.get(e);if(n!==void 0)t=_t[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return ip(t)}const dT=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function A0(r){return r.replace(dT,fT)}function fT(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function C0(r){let e="precision "+r.precision+` float;
3638
3638
  precision `+r.precision+" int;";return r.precision==="highp"?e+=`
3639
3639
  #define HIGH_PRECISION`:r.precision==="mediump"?e+=`
3640
3640
  #define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
@@ -3643,20 +3643,20 @@ precision `+r.precision+" int;";return r.precision==="highp"?e+=`
3643
3643
  `),_.length>0&&(_+=`
3644
3644
  `),b=[g,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S].filter(zo).join(`
3645
3645
  `),b.length>0&&(b+=`
3646
- `)):(_=[R0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
3646
+ `)):(_=[C0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
3647
3647
  `].filter(zo).join(`
3648
- `),b=[g,R0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+d:"",t.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Qi?"#define TONE_MAPPING":"",t.toneMapping!==Qi?_t.tonemapping_pars_fragment:"",t.toneMapping!==Qi?rT("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",_t.colorspace_pars_fragment,iT("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3648
+ `),b=[g,C0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+d:"",t.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Qi?"#define TONE_MAPPING":"",t.toneMapping!==Qi?_t.tonemapping_pars_fragment:"",t.toneMapping!==Qi?rT("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",_t.colorspace_pars_fragment,iT("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3649
3649
  `].filter(zo).join(`
3650
- `)),a=rp(a),a=T0(a,t),a=A0(a,t),c=rp(c),c=T0(c,t),c=A0(c,t),a=C0(a),c=C0(c),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(M=`#version 300 es
3650
+ `)),a=ip(a),a=w0(a,t),a=T0(a,t),c=ip(c),c=w0(c,t),c=T0(c,t),a=A0(a),c=A0(c),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(M=`#version 300 es
3651
3651
  `,_=[x,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
3652
3652
  `)+`
3653
- `+_,b=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===tp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===tp?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3653
+ `+_,b=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===ep?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ep?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3654
3654
  `)+`
3655
- `+b);const T=M+_+a,R=M+b+c,C=b0(i,i.VERTEX_SHADER,T),N=b0(i,i.FRAGMENT_SHADER,R);i.attachShader(y,C),i.attachShader(y,N),t.index0AttributeName!==void 0?i.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);function B(ee){if(r.debug.checkShaderErrors){const de=i.getProgramInfoLog(y).trim(),H=i.getShaderInfoLog(C).trim(),q=i.getShaderInfoLog(N).trim();let ie=!0,le=!0;if(i.getProgramParameter(y,i.LINK_STATUS)===!1)if(ie=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,y,C,N);else{const j=w0(i,C,"vertex"),Z=w0(i,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(y,i.VALIDATE_STATUS)+`
3655
+ `+b);const T=M+_+a,R=M+b+c,C=E0(i,i.VERTEX_SHADER,T),N=E0(i,i.FRAGMENT_SHADER,R);i.attachShader(y,C),i.attachShader(y,N),t.index0AttributeName!==void 0?i.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);function B(ee){if(r.debug.checkShaderErrors){const de=i.getProgramInfoLog(y).trim(),H=i.getShaderInfoLog(C).trim(),q=i.getShaderInfoLog(N).trim();let ie=!0,le=!0;if(i.getProgramParameter(y,i.LINK_STATUS)===!1)if(ie=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,y,C,N);else{const j=b0(i,C,"vertex"),Z=b0(i,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(y,i.VALIDATE_STATUS)+`
3656
3656
 
3657
3657
  Program Info Log: `+de+`
3658
3658
  `+j+`
3659
- `+Z)}else de!==""?console.warn("THREE.WebGLProgram: Program Info Log:",de):(H===""||q==="")&&(le=!1);le&&(ee.diagnostics={runnable:ie,programLog:de,vertexShader:{log:H,prefix:_},fragmentShader:{log:q,prefix:b}})}i.deleteShader(C),i.deleteShader(N),A=new bu(i,y),P=lT(i,y)}let A;this.getUniforms=function(){return A===void 0&&B(this),A};let P;this.getAttributes=function(){return P===void 0&&B(this),P};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(y,$1)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=eT++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=C,this.fragmentShader=N,this}let yT=0;class ST{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new MT(e),t.set(e,n)),n}}class MT{constructor(e){this.id=yT++,this.code=e,this.usedTimes=0}}function ET(r,e,t,n,i,s,a){const c=new Os,u=new ST,h=[],d=i.isWebGL2,f=i.logarithmicDepthBuffer,m=i.vertexTextures;let g=i.precision;const x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function S(A){return A===0?"uv":`uv${A}`}function y(A,P,z,ee,de){const H=ee.fog,q=de.geometry,ie=A.isMeshStandardMaterial?ee.environment:null,le=(A.isMeshStandardMaterial?t:e).get(A.envMap||ie),j=le&&le.mapping===Jo?le.image.height:null,Z=x[A.type];A.precision!==null&&(g=i.getMaxPrecision(A.precision),g!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",g,"instead."));const J=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,te=J!==void 0?J.length:0;let ge=0;q.morphAttributes.position!==void 0&&(ge=1),q.morphAttributes.normal!==void 0&&(ge=2),q.morphAttributes.color!==void 0&&(ge=3);let K,fe,be,Oe;if(Z){const Ht=Li[Z];K=Ht.vertexShader,fe=Ht.fragmentShader}else K=A.vertexShader,fe=A.fragmentShader,u.update(A),be=u.getVertexShaderID(A),Oe=u.getFragmentShaderID(A);const Ne=r.getRenderTarget(),Je=de.isInstancedMesh===!0,rt=de.isBatchedMesh===!0,Pe=!!A.map,Ae=!!A.matcap,k=!!le,ve=!!A.aoMap,ue=!!A.lightMap,Ee=!!A.bumpMap,pe=!!A.normalMap,Ve=!!A.displacementMap,Le=!!A.emissiveMap,D=!!A.metalnessMap,I=!!A.roughnessMap,Q=A.anisotropy>0,ye=A.clearcoat>0,xe=A.iridescence>0,me=A.sheen>0,Xe=A.transmission>0,Re=Q&&!!A.anisotropyMap,Ie=ye&&!!A.clearcoatMap,et=ye&&!!A.clearcoatNormalMap,ht=ye&&!!A.clearcoatRoughnessMap,Se=xe&&!!A.iridescenceMap,wt=xe&&!!A.iridescenceThicknessMap,gt=me&&!!A.sheenColorMap,ct=me&&!!A.sheenRoughnessMap,$e=!!A.specularMap,Ge=!!A.specularColorMap,V=!!A.specularIntensityMap,_e=Xe&&!!A.transmissionMap,Be=Xe&&!!A.thicknessMap,Fe=!!A.gradientMap,Me=!!A.alphaMap,G=A.alphaTest>0,Te=!!A.alphaHash,De=!!A.extensions,tt=!!q.attributes.uv1,Ye=!!q.attributes.uv2,bt=!!q.attributes.uv3;let Tt=Qi;return A.toneMapped&&(Ne===null||Ne.isXRRenderTarget===!0)&&(Tt=r.toneMapping),{isWebGL2:d,shaderID:Z,shaderType:A.type,shaderName:A.name,vertexShader:K,fragmentShader:fe,defines:A.defines,customVertexShaderID:be,customFragmentShaderID:Oe,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:g,batching:rt,instancing:Je,instancingColor:Je&&de.instanceColor!==null,supportsVertexTextures:m,outputColorSpace:Ne===null?r.outputColorSpace:Ne.isXRRenderTarget===!0?Ne.texture.colorSpace:nr,map:Pe,matcap:Ae,envMap:k,envMapMode:k&&le.mapping,envMapCubeUVHeight:j,aoMap:ve,lightMap:ue,bumpMap:Ee,normalMap:pe,displacementMap:m&&Ve,emissiveMap:Le,normalMapObjectSpace:pe&&A.normalMapType===Xv,normalMapTangentSpace:pe&&A.normalMapType===Kr,metalnessMap:D,roughnessMap:I,anisotropy:Q,anisotropyMap:Re,clearcoat:ye,clearcoatMap:Ie,clearcoatNormalMap:et,clearcoatRoughnessMap:ht,iridescence:xe,iridescenceMap:Se,iridescenceThicknessMap:wt,sheen:me,sheenColorMap:gt,sheenRoughnessMap:ct,specularMap:$e,specularColorMap:Ge,specularIntensityMap:V,transmission:Xe,transmissionMap:_e,thicknessMap:Be,gradientMap:Fe,opaque:A.transparent===!1&&A.blending===Ns,alphaMap:Me,alphaTest:G,alphaHash:Te,combine:A.combine,mapUv:Pe&&S(A.map.channel),aoMapUv:ve&&S(A.aoMap.channel),lightMapUv:ue&&S(A.lightMap.channel),bumpMapUv:Ee&&S(A.bumpMap.channel),normalMapUv:pe&&S(A.normalMap.channel),displacementMapUv:Ve&&S(A.displacementMap.channel),emissiveMapUv:Le&&S(A.emissiveMap.channel),metalnessMapUv:D&&S(A.metalnessMap.channel),roughnessMapUv:I&&S(A.roughnessMap.channel),anisotropyMapUv:Re&&S(A.anisotropyMap.channel),clearcoatMapUv:Ie&&S(A.clearcoatMap.channel),clearcoatNormalMapUv:et&&S(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ht&&S(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Se&&S(A.iridescenceMap.channel),iridescenceThicknessMapUv:wt&&S(A.iridescenceThicknessMap.channel),sheenColorMapUv:gt&&S(A.sheenColorMap.channel),sheenRoughnessMapUv:ct&&S(A.sheenRoughnessMap.channel),specularMapUv:$e&&S(A.specularMap.channel),specularColorMapUv:Ge&&S(A.specularColorMap.channel),specularIntensityMapUv:V&&S(A.specularIntensityMap.channel),transmissionMapUv:_e&&S(A.transmissionMap.channel),thicknessMapUv:Be&&S(A.thicknessMap.channel),alphaMapUv:Me&&S(A.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(pe||Q),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,vertexUv1s:tt,vertexUv2s:Ye,vertexUv3s:bt,pointsUvs:de.isPoints===!0&&!!q.attributes.uv&&(Pe||Me),fog:!!H,useFog:A.fog===!0,fogExp2:H&&H.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:de.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:te,morphTextureStride:ge,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:Tt,useLegacyLights:r._useLegacyLights,decodeVideoTexture:Pe&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===zt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===Si,flipSided:A.side===An,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:De&&A.extensions.derivatives===!0,extensionFragDepth:De&&A.extensions.fragDepth===!0,extensionDrawBuffers:De&&A.extensions.drawBuffers===!0,extensionShaderTextureLOD:De&&A.extensions.shaderTextureLOD===!0,extensionClipCullDistance:De&&A.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:d||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()}}function _(A){const P=[];if(A.shaderID?P.push(A.shaderID):(P.push(A.customVertexShaderID),P.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)P.push(z),P.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(b(P,A),M(P,A),P.push(r.outputColorSpace)),P.push(A.customProgramCacheKey),P.join()}function b(A,P){A.push(P.precision),A.push(P.outputColorSpace),A.push(P.envMapMode),A.push(P.envMapCubeUVHeight),A.push(P.mapUv),A.push(P.alphaMapUv),A.push(P.lightMapUv),A.push(P.aoMapUv),A.push(P.bumpMapUv),A.push(P.normalMapUv),A.push(P.displacementMapUv),A.push(P.emissiveMapUv),A.push(P.metalnessMapUv),A.push(P.roughnessMapUv),A.push(P.anisotropyMapUv),A.push(P.clearcoatMapUv),A.push(P.clearcoatNormalMapUv),A.push(P.clearcoatRoughnessMapUv),A.push(P.iridescenceMapUv),A.push(P.iridescenceThicknessMapUv),A.push(P.sheenColorMapUv),A.push(P.sheenRoughnessMapUv),A.push(P.specularMapUv),A.push(P.specularColorMapUv),A.push(P.specularIntensityMapUv),A.push(P.transmissionMapUv),A.push(P.thicknessMapUv),A.push(P.combine),A.push(P.fogExp2),A.push(P.sizeAttenuation),A.push(P.morphTargetsCount),A.push(P.morphAttributeCount),A.push(P.numDirLights),A.push(P.numPointLights),A.push(P.numSpotLights),A.push(P.numSpotLightMaps),A.push(P.numHemiLights),A.push(P.numRectAreaLights),A.push(P.numDirLightShadows),A.push(P.numPointLightShadows),A.push(P.numSpotLightShadows),A.push(P.numSpotLightShadowsWithMaps),A.push(P.numLightProbes),A.push(P.shadowMapType),A.push(P.toneMapping),A.push(P.numClippingPlanes),A.push(P.numClipIntersection),A.push(P.depthPacking)}function M(A,P){c.disableAll(),P.isWebGL2&&c.enable(0),P.supportsVertexTextures&&c.enable(1),P.instancing&&c.enable(2),P.instancingColor&&c.enable(3),P.matcap&&c.enable(4),P.envMap&&c.enable(5),P.normalMapObjectSpace&&c.enable(6),P.normalMapTangentSpace&&c.enable(7),P.clearcoat&&c.enable(8),P.iridescence&&c.enable(9),P.alphaTest&&c.enable(10),P.vertexColors&&c.enable(11),P.vertexAlphas&&c.enable(12),P.vertexUv1s&&c.enable(13),P.vertexUv2s&&c.enable(14),P.vertexUv3s&&c.enable(15),P.vertexTangents&&c.enable(16),P.anisotropy&&c.enable(17),P.alphaHash&&c.enable(18),P.batching&&c.enable(19),A.push(c.mask),c.disableAll(),P.fog&&c.enable(0),P.useFog&&c.enable(1),P.flatShading&&c.enable(2),P.logarithmicDepthBuffer&&c.enable(3),P.skinning&&c.enable(4),P.morphTargets&&c.enable(5),P.morphNormals&&c.enable(6),P.morphColors&&c.enable(7),P.premultipliedAlpha&&c.enable(8),P.shadowMapEnabled&&c.enable(9),P.useLegacyLights&&c.enable(10),P.doubleSided&&c.enable(11),P.flipSided&&c.enable(12),P.useDepthPacking&&c.enable(13),P.dithering&&c.enable(14),P.transmission&&c.enable(15),P.sheen&&c.enable(16),P.opaque&&c.enable(17),P.pointsUvs&&c.enable(18),P.decodeVideoTexture&&c.enable(19),A.push(c.mask)}function T(A){const P=x[A.type];let z;if(P){const ee=Li[P];z=Iu.clone(ee.uniforms)}else z=A.uniforms;return z}function R(A,P){let z;for(let ee=0,de=h.length;ee<de;ee++){const H=h[ee];if(H.cacheKey===P){z=H,++z.usedTimes;break}}return z===void 0&&(z=new xT(r,P,A,s),h.push(z)),z}function C(A){if(--A.usedTimes===0){const P=h.indexOf(A);h[P]=h[h.length-1],h.pop(),A.destroy()}}function N(A){u.remove(A)}function B(){u.dispose()}return{getParameters:y,getProgramCacheKey:_,getUniforms:T,acquireProgram:R,releaseProgram:C,releaseShaderCache:N,programs:h,dispose:B}}function bT(){let r=new WeakMap;function e(s){let a=r.get(s);return a===void 0&&(a={},r.set(s,a)),a}function t(s){r.delete(s)}function n(s,a,c){r.get(s)[a]=c}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function wT(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function P0(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function L0(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(f,m,g,x,S,y){let _=r[e];return _===void 0?(_={id:f.id,object:f,geometry:m,material:g,groupOrder:x,renderOrder:f.renderOrder,z:S,group:y},r[e]=_):(_.id=f.id,_.object=f,_.geometry=m,_.material=g,_.groupOrder=x,_.renderOrder=f.renderOrder,_.z=S,_.group=y),e++,_}function c(f,m,g,x,S,y){const _=a(f,m,g,x,S,y);g.transmission>0?n.push(_):g.transparent===!0?i.push(_):t.push(_)}function u(f,m,g,x,S,y){const _=a(f,m,g,x,S,y);g.transmission>0?n.unshift(_):g.transparent===!0?i.unshift(_):t.unshift(_)}function h(f,m){t.length>1&&t.sort(f||wT),n.length>1&&n.sort(m||P0),i.length>1&&i.sort(m||P0)}function d(){for(let f=e,m=r.length;f<m;f++){const g=r[f];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:c,unshift:u,finish:d,sort:h}}function TT(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new L0,r.set(n,[a])):i>=s.length?(a=new L0,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function AT(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new ke};break;case"SpotLight":t={position:new U,direction:new U,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":t={color:new ke,position:new U,halfWidth:new U,halfHeight:new U};break}return r[e.id]=t,t}}}function CT(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let RT=0;function PT(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function LT(r,e){const t=new AT,n=CT(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new U);const s=new U,a=new lt,c=new lt;function u(d,f){let m=0,g=0,x=0;for(let ee=0;ee<9;ee++)i.probe[ee].set(0,0,0);let S=0,y=0,_=0,b=0,M=0,T=0,R=0,C=0,N=0,B=0,A=0;d.sort(PT);const P=f===!0?Math.PI:1;for(let ee=0,de=d.length;ee<de;ee++){const H=d[ee],q=H.color,ie=H.intensity,le=H.distance,j=H.shadow&&H.shadow.map?H.shadow.map.texture:null;if(H.isAmbientLight)m+=q.r*ie*P,g+=q.g*ie*P,x+=q.b*ie*P;else if(H.isLightProbe){for(let Z=0;Z<9;Z++)i.probe[Z].addScaledVector(H.sh.coefficients[Z],ie);A++}else if(H.isDirectionalLight){const Z=t.get(H);if(Z.color.copy(H.color).multiplyScalar(H.intensity*P),H.castShadow){const J=H.shadow,te=n.get(H);te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,i.directionalShadow[S]=te,i.directionalShadowMap[S]=j,i.directionalShadowMatrix[S]=H.shadow.matrix,T++}i.directional[S]=Z,S++}else if(H.isSpotLight){const Z=t.get(H);Z.position.setFromMatrixPosition(H.matrixWorld),Z.color.copy(q).multiplyScalar(ie*P),Z.distance=le,Z.coneCos=Math.cos(H.angle),Z.penumbraCos=Math.cos(H.angle*(1-H.penumbra)),Z.decay=H.decay,i.spot[_]=Z;const J=H.shadow;if(H.map&&(i.spotLightMap[N]=H.map,N++,J.updateMatrices(H),H.castShadow&&B++),i.spotLightMatrix[_]=J.matrix,H.castShadow){const te=n.get(H);te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,i.spotShadow[_]=te,i.spotShadowMap[_]=j,C++}_++}else if(H.isRectAreaLight){const Z=t.get(H);Z.color.copy(q).multiplyScalar(ie),Z.halfWidth.set(H.width*.5,0,0),Z.halfHeight.set(0,H.height*.5,0),i.rectArea[b]=Z,b++}else if(H.isPointLight){const Z=t.get(H);if(Z.color.copy(H.color).multiplyScalar(H.intensity*P),Z.distance=H.distance,Z.decay=H.decay,H.castShadow){const J=H.shadow,te=n.get(H);te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,te.shadowCameraNear=J.camera.near,te.shadowCameraFar=J.camera.far,i.pointShadow[y]=te,i.pointShadowMap[y]=j,i.pointShadowMatrix[y]=H.shadow.matrix,R++}i.point[y]=Z,y++}else if(H.isHemisphereLight){const Z=t.get(H);Z.skyColor.copy(H.color).multiplyScalar(ie*P),Z.groundColor.copy(H.groundColor).multiplyScalar(ie*P),i.hemi[M]=Z,M++}}b>0&&(e.isWebGL2?r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ce.LTC_FLOAT_1,i.rectAreaLTC2=Ce.LTC_FLOAT_2):(i.rectAreaLTC1=Ce.LTC_HALF_1,i.rectAreaLTC2=Ce.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ce.LTC_FLOAT_1,i.rectAreaLTC2=Ce.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Ce.LTC_HALF_1,i.rectAreaLTC2=Ce.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=m,i.ambient[1]=g,i.ambient[2]=x;const z=i.hash;(z.directionalLength!==S||z.pointLength!==y||z.spotLength!==_||z.rectAreaLength!==b||z.hemiLength!==M||z.numDirectionalShadows!==T||z.numPointShadows!==R||z.numSpotShadows!==C||z.numSpotMaps!==N||z.numLightProbes!==A)&&(i.directional.length=S,i.spot.length=_,i.rectArea.length=b,i.point.length=y,i.hemi.length=M,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=R,i.pointShadowMap.length=R,i.spotShadow.length=C,i.spotShadowMap.length=C,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=R,i.spotLightMatrix.length=C+N-B,i.spotLightMap.length=N,i.numSpotLightShadowsWithMaps=B,i.numLightProbes=A,z.directionalLength=S,z.pointLength=y,z.spotLength=_,z.rectAreaLength=b,z.hemiLength=M,z.numDirectionalShadows=T,z.numPointShadows=R,z.numSpotShadows=C,z.numSpotMaps=N,z.numLightProbes=A,i.version=RT++)}function h(d,f){let m=0,g=0,x=0,S=0,y=0;const _=f.matrixWorldInverse;for(let b=0,M=d.length;b<M;b++){const T=d[b];if(T.isDirectionalLight){const R=i.directional[m];R.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),R.direction.sub(s),R.direction.transformDirection(_),m++}else if(T.isSpotLight){const R=i.spot[x];R.position.setFromMatrixPosition(T.matrixWorld),R.position.applyMatrix4(_),R.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),R.direction.sub(s),R.direction.transformDirection(_),x++}else if(T.isRectAreaLight){const R=i.rectArea[S];R.position.setFromMatrixPosition(T.matrixWorld),R.position.applyMatrix4(_),c.identity(),a.copy(T.matrixWorld),a.premultiply(_),c.extractRotation(a),R.halfWidth.set(T.width*.5,0,0),R.halfHeight.set(0,T.height*.5,0),R.halfWidth.applyMatrix4(c),R.halfHeight.applyMatrix4(c),S++}else if(T.isPointLight){const R=i.point[g];R.position.setFromMatrixPosition(T.matrixWorld),R.position.applyMatrix4(_),g++}else if(T.isHemisphereLight){const R=i.hemi[y];R.direction.setFromMatrixPosition(T.matrixWorld),R.direction.transformDirection(_),y++}}}return{setup:u,setupView:h,state:i}}function I0(r,e){const t=new LT(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function a(f){n.push(f)}function c(f){i.push(f)}function u(f){t.setup(n,f)}function h(f){t.setupView(n,f)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:u,setupLightsView:h,pushLight:a,pushShadow:c}}function IT(r,e){let t=new WeakMap;function n(s,a=0){const c=t.get(s);let u;return c===void 0?(u=new I0(r,e),t.set(s,[u])):a>=c.length?(u=new I0(r,e),c.push(u)):u=c[a],u}function i(){t=new WeakMap}return{get:n,dispose:i}}class Up extends zn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Wv,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Op extends zn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const NT=`void main() {
3659
+ `+Z)}else de!==""?console.warn("THREE.WebGLProgram: Program Info Log:",de):(H===""||q==="")&&(le=!1);le&&(ee.diagnostics={runnable:ie,programLog:de,vertexShader:{log:H,prefix:_},fragmentShader:{log:q,prefix:b}})}i.deleteShader(C),i.deleteShader(N),A=new bu(i,y),P=lT(i,y)}let A;this.getUniforms=function(){return A===void 0&&B(this),A};let P;this.getAttributes=function(){return P===void 0&&B(this),P};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=i.getProgramParameter(y,$1)),z},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=eT++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=C,this.fragmentShader=N,this}let yT=0;class ST{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new MT(e),t.set(e,n)),n}}class MT{constructor(e){this.id=yT++,this.code=e,this.usedTimes=0}}function ET(r,e,t,n,i,s,a){const c=new Os,u=new ST,h=[],d=i.isWebGL2,f=i.logarithmicDepthBuffer,m=i.vertexTextures;let g=i.precision;const x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function S(A){return A===0?"uv":`uv${A}`}function y(A,P,z,ee,de){const H=ee.fog,q=de.geometry,ie=A.isMeshStandardMaterial?ee.environment:null,le=(A.isMeshStandardMaterial?t:e).get(A.envMap||ie),j=le&&le.mapping===Jo?le.image.height:null,Z=x[A.type];A.precision!==null&&(g=i.getMaxPrecision(A.precision),g!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",g,"instead."));const J=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,te=J!==void 0?J.length:0;let ge=0;q.morphAttributes.position!==void 0&&(ge=1),q.morphAttributes.normal!==void 0&&(ge=2),q.morphAttributes.color!==void 0&&(ge=3);let K,fe,be,Oe;if(Z){const Ht=Li[Z];K=Ht.vertexShader,fe=Ht.fragmentShader}else K=A.vertexShader,fe=A.fragmentShader,u.update(A),be=u.getVertexShaderID(A),Oe=u.getFragmentShaderID(A);const Ne=r.getRenderTarget(),Je=de.isInstancedMesh===!0,rt=de.isBatchedMesh===!0,Pe=!!A.map,Ae=!!A.matcap,k=!!le,ve=!!A.aoMap,ue=!!A.lightMap,Ee=!!A.bumpMap,pe=!!A.normalMap,Ve=!!A.displacementMap,Le=!!A.emissiveMap,D=!!A.metalnessMap,I=!!A.roughnessMap,Q=A.anisotropy>0,ye=A.clearcoat>0,xe=A.iridescence>0,me=A.sheen>0,Xe=A.transmission>0,Re=Q&&!!A.anisotropyMap,Ie=ye&&!!A.clearcoatMap,et=ye&&!!A.clearcoatNormalMap,ht=ye&&!!A.clearcoatRoughnessMap,Se=xe&&!!A.iridescenceMap,wt=xe&&!!A.iridescenceThicknessMap,gt=me&&!!A.sheenColorMap,ct=me&&!!A.sheenRoughnessMap,$e=!!A.specularMap,Ge=!!A.specularColorMap,V=!!A.specularIntensityMap,_e=Xe&&!!A.transmissionMap,Be=Xe&&!!A.thicknessMap,Fe=!!A.gradientMap,Me=!!A.alphaMap,G=A.alphaTest>0,Te=!!A.alphaHash,De=!!A.extensions,tt=!!q.attributes.uv1,Ye=!!q.attributes.uv2,bt=!!q.attributes.uv3;let Tt=Qi;return A.toneMapped&&(Ne===null||Ne.isXRRenderTarget===!0)&&(Tt=r.toneMapping),{isWebGL2:d,shaderID:Z,shaderType:A.type,shaderName:A.name,vertexShader:K,fragmentShader:fe,defines:A.defines,customVertexShaderID:be,customFragmentShaderID:Oe,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:g,batching:rt,instancing:Je,instancingColor:Je&&de.instanceColor!==null,supportsVertexTextures:m,outputColorSpace:Ne===null?r.outputColorSpace:Ne.isXRRenderTarget===!0?Ne.texture.colorSpace:nr,map:Pe,matcap:Ae,envMap:k,envMapMode:k&&le.mapping,envMapCubeUVHeight:j,aoMap:ve,lightMap:ue,bumpMap:Ee,normalMap:pe,displacementMap:m&&Ve,emissiveMap:Le,normalMapObjectSpace:pe&&A.normalMapType===Xv,normalMapTangentSpace:pe&&A.normalMapType===Kr,metalnessMap:D,roughnessMap:I,anisotropy:Q,anisotropyMap:Re,clearcoat:ye,clearcoatMap:Ie,clearcoatNormalMap:et,clearcoatRoughnessMap:ht,iridescence:xe,iridescenceMap:Se,iridescenceThicknessMap:wt,sheen:me,sheenColorMap:gt,sheenRoughnessMap:ct,specularMap:$e,specularColorMap:Ge,specularIntensityMap:V,transmission:Xe,transmissionMap:_e,thicknessMap:Be,gradientMap:Fe,opaque:A.transparent===!1&&A.blending===Ns,alphaMap:Me,alphaTest:G,alphaHash:Te,combine:A.combine,mapUv:Pe&&S(A.map.channel),aoMapUv:ve&&S(A.aoMap.channel),lightMapUv:ue&&S(A.lightMap.channel),bumpMapUv:Ee&&S(A.bumpMap.channel),normalMapUv:pe&&S(A.normalMap.channel),displacementMapUv:Ve&&S(A.displacementMap.channel),emissiveMapUv:Le&&S(A.emissiveMap.channel),metalnessMapUv:D&&S(A.metalnessMap.channel),roughnessMapUv:I&&S(A.roughnessMap.channel),anisotropyMapUv:Re&&S(A.anisotropyMap.channel),clearcoatMapUv:Ie&&S(A.clearcoatMap.channel),clearcoatNormalMapUv:et&&S(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ht&&S(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Se&&S(A.iridescenceMap.channel),iridescenceThicknessMapUv:wt&&S(A.iridescenceThicknessMap.channel),sheenColorMapUv:gt&&S(A.sheenColorMap.channel),sheenRoughnessMapUv:ct&&S(A.sheenRoughnessMap.channel),specularMapUv:$e&&S(A.specularMap.channel),specularColorMapUv:Ge&&S(A.specularColorMap.channel),specularIntensityMapUv:V&&S(A.specularIntensityMap.channel),transmissionMapUv:_e&&S(A.transmissionMap.channel),thicknessMapUv:Be&&S(A.thicknessMap.channel),alphaMapUv:Me&&S(A.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(pe||Q),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,vertexUv1s:tt,vertexUv2s:Ye,vertexUv3s:bt,pointsUvs:de.isPoints===!0&&!!q.attributes.uv&&(Pe||Me),fog:!!H,useFog:A.fog===!0,fogExp2:H&&H.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:de.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:te,morphTextureStride:ge,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:Tt,useLegacyLights:r._useLegacyLights,decodeVideoTexture:Pe&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===zt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===Si,flipSided:A.side===An,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:De&&A.extensions.derivatives===!0,extensionFragDepth:De&&A.extensions.fragDepth===!0,extensionDrawBuffers:De&&A.extensions.drawBuffers===!0,extensionShaderTextureLOD:De&&A.extensions.shaderTextureLOD===!0,extensionClipCullDistance:De&&A.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:d||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()}}function _(A){const P=[];if(A.shaderID?P.push(A.shaderID):(P.push(A.customVertexShaderID),P.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)P.push(z),P.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(b(P,A),M(P,A),P.push(r.outputColorSpace)),P.push(A.customProgramCacheKey),P.join()}function b(A,P){A.push(P.precision),A.push(P.outputColorSpace),A.push(P.envMapMode),A.push(P.envMapCubeUVHeight),A.push(P.mapUv),A.push(P.alphaMapUv),A.push(P.lightMapUv),A.push(P.aoMapUv),A.push(P.bumpMapUv),A.push(P.normalMapUv),A.push(P.displacementMapUv),A.push(P.emissiveMapUv),A.push(P.metalnessMapUv),A.push(P.roughnessMapUv),A.push(P.anisotropyMapUv),A.push(P.clearcoatMapUv),A.push(P.clearcoatNormalMapUv),A.push(P.clearcoatRoughnessMapUv),A.push(P.iridescenceMapUv),A.push(P.iridescenceThicknessMapUv),A.push(P.sheenColorMapUv),A.push(P.sheenRoughnessMapUv),A.push(P.specularMapUv),A.push(P.specularColorMapUv),A.push(P.specularIntensityMapUv),A.push(P.transmissionMapUv),A.push(P.thicknessMapUv),A.push(P.combine),A.push(P.fogExp2),A.push(P.sizeAttenuation),A.push(P.morphTargetsCount),A.push(P.morphAttributeCount),A.push(P.numDirLights),A.push(P.numPointLights),A.push(P.numSpotLights),A.push(P.numSpotLightMaps),A.push(P.numHemiLights),A.push(P.numRectAreaLights),A.push(P.numDirLightShadows),A.push(P.numPointLightShadows),A.push(P.numSpotLightShadows),A.push(P.numSpotLightShadowsWithMaps),A.push(P.numLightProbes),A.push(P.shadowMapType),A.push(P.toneMapping),A.push(P.numClippingPlanes),A.push(P.numClipIntersection),A.push(P.depthPacking)}function M(A,P){c.disableAll(),P.isWebGL2&&c.enable(0),P.supportsVertexTextures&&c.enable(1),P.instancing&&c.enable(2),P.instancingColor&&c.enable(3),P.matcap&&c.enable(4),P.envMap&&c.enable(5),P.normalMapObjectSpace&&c.enable(6),P.normalMapTangentSpace&&c.enable(7),P.clearcoat&&c.enable(8),P.iridescence&&c.enable(9),P.alphaTest&&c.enable(10),P.vertexColors&&c.enable(11),P.vertexAlphas&&c.enable(12),P.vertexUv1s&&c.enable(13),P.vertexUv2s&&c.enable(14),P.vertexUv3s&&c.enable(15),P.vertexTangents&&c.enable(16),P.anisotropy&&c.enable(17),P.alphaHash&&c.enable(18),P.batching&&c.enable(19),A.push(c.mask),c.disableAll(),P.fog&&c.enable(0),P.useFog&&c.enable(1),P.flatShading&&c.enable(2),P.logarithmicDepthBuffer&&c.enable(3),P.skinning&&c.enable(4),P.morphTargets&&c.enable(5),P.morphNormals&&c.enable(6),P.morphColors&&c.enable(7),P.premultipliedAlpha&&c.enable(8),P.shadowMapEnabled&&c.enable(9),P.useLegacyLights&&c.enable(10),P.doubleSided&&c.enable(11),P.flipSided&&c.enable(12),P.useDepthPacking&&c.enable(13),P.dithering&&c.enable(14),P.transmission&&c.enable(15),P.sheen&&c.enable(16),P.opaque&&c.enable(17),P.pointsUvs&&c.enable(18),P.decodeVideoTexture&&c.enable(19),A.push(c.mask)}function T(A){const P=x[A.type];let z;if(P){const ee=Li[P];z=Iu.clone(ee.uniforms)}else z=A.uniforms;return z}function R(A,P){let z;for(let ee=0,de=h.length;ee<de;ee++){const H=h[ee];if(H.cacheKey===P){z=H,++z.usedTimes;break}}return z===void 0&&(z=new xT(r,P,A,s),h.push(z)),z}function C(A){if(--A.usedTimes===0){const P=h.indexOf(A);h[P]=h[h.length-1],h.pop(),A.destroy()}}function N(A){u.remove(A)}function B(){u.dispose()}return{getParameters:y,getProgramCacheKey:_,getUniforms:T,acquireProgram:R,releaseProgram:C,releaseShaderCache:N,programs:h,dispose:B}}function bT(){let r=new WeakMap;function e(s){let a=r.get(s);return a===void 0&&(a={},r.set(s,a)),a}function t(s){r.delete(s)}function n(s,a,c){r.get(s)[a]=c}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function wT(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function R0(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function P0(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(f,m,g,x,S,y){let _=r[e];return _===void 0?(_={id:f.id,object:f,geometry:m,material:g,groupOrder:x,renderOrder:f.renderOrder,z:S,group:y},r[e]=_):(_.id=f.id,_.object=f,_.geometry=m,_.material=g,_.groupOrder=x,_.renderOrder=f.renderOrder,_.z=S,_.group=y),e++,_}function c(f,m,g,x,S,y){const _=a(f,m,g,x,S,y);g.transmission>0?n.push(_):g.transparent===!0?i.push(_):t.push(_)}function u(f,m,g,x,S,y){const _=a(f,m,g,x,S,y);g.transmission>0?n.unshift(_):g.transparent===!0?i.unshift(_):t.unshift(_)}function h(f,m){t.length>1&&t.sort(f||wT),n.length>1&&n.sort(m||R0),i.length>1&&i.sort(m||R0)}function d(){for(let f=e,m=r.length;f<m;f++){const g=r[f];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:c,unshift:u,finish:d,sort:h}}function TT(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new P0,r.set(n,[a])):i>=s.length?(a=new P0,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function AT(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new ke};break;case"SpotLight":t={position:new U,direction:new U,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":t={color:new ke,position:new U,halfWidth:new U,halfHeight:new U};break}return r[e.id]=t,t}}}function CT(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let RT=0;function PT(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function LT(r,e){const t=new AT,n=CT(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new U);const s=new U,a=new lt,c=new lt;function u(d,f){let m=0,g=0,x=0;for(let ee=0;ee<9;ee++)i.probe[ee].set(0,0,0);let S=0,y=0,_=0,b=0,M=0,T=0,R=0,C=0,N=0,B=0,A=0;d.sort(PT);const P=f===!0?Math.PI:1;for(let ee=0,de=d.length;ee<de;ee++){const H=d[ee],q=H.color,ie=H.intensity,le=H.distance,j=H.shadow&&H.shadow.map?H.shadow.map.texture:null;if(H.isAmbientLight)m+=q.r*ie*P,g+=q.g*ie*P,x+=q.b*ie*P;else if(H.isLightProbe){for(let Z=0;Z<9;Z++)i.probe[Z].addScaledVector(H.sh.coefficients[Z],ie);A++}else if(H.isDirectionalLight){const Z=t.get(H);if(Z.color.copy(H.color).multiplyScalar(H.intensity*P),H.castShadow){const J=H.shadow,te=n.get(H);te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,i.directionalShadow[S]=te,i.directionalShadowMap[S]=j,i.directionalShadowMatrix[S]=H.shadow.matrix,T++}i.directional[S]=Z,S++}else if(H.isSpotLight){const Z=t.get(H);Z.position.setFromMatrixPosition(H.matrixWorld),Z.color.copy(q).multiplyScalar(ie*P),Z.distance=le,Z.coneCos=Math.cos(H.angle),Z.penumbraCos=Math.cos(H.angle*(1-H.penumbra)),Z.decay=H.decay,i.spot[_]=Z;const J=H.shadow;if(H.map&&(i.spotLightMap[N]=H.map,N++,J.updateMatrices(H),H.castShadow&&B++),i.spotLightMatrix[_]=J.matrix,H.castShadow){const te=n.get(H);te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,i.spotShadow[_]=te,i.spotShadowMap[_]=j,C++}_++}else if(H.isRectAreaLight){const Z=t.get(H);Z.color.copy(q).multiplyScalar(ie),Z.halfWidth.set(H.width*.5,0,0),Z.halfHeight.set(0,H.height*.5,0),i.rectArea[b]=Z,b++}else if(H.isPointLight){const Z=t.get(H);if(Z.color.copy(H.color).multiplyScalar(H.intensity*P),Z.distance=H.distance,Z.decay=H.decay,H.castShadow){const J=H.shadow,te=n.get(H);te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,te.shadowCameraNear=J.camera.near,te.shadowCameraFar=J.camera.far,i.pointShadow[y]=te,i.pointShadowMap[y]=j,i.pointShadowMatrix[y]=H.shadow.matrix,R++}i.point[y]=Z,y++}else if(H.isHemisphereLight){const Z=t.get(H);Z.skyColor.copy(H.color).multiplyScalar(ie*P),Z.groundColor.copy(H.groundColor).multiplyScalar(ie*P),i.hemi[M]=Z,M++}}b>0&&(e.isWebGL2?r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ce.LTC_FLOAT_1,i.rectAreaLTC2=Ce.LTC_FLOAT_2):(i.rectAreaLTC1=Ce.LTC_HALF_1,i.rectAreaLTC2=Ce.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ce.LTC_FLOAT_1,i.rectAreaLTC2=Ce.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Ce.LTC_HALF_1,i.rectAreaLTC2=Ce.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=m,i.ambient[1]=g,i.ambient[2]=x;const z=i.hash;(z.directionalLength!==S||z.pointLength!==y||z.spotLength!==_||z.rectAreaLength!==b||z.hemiLength!==M||z.numDirectionalShadows!==T||z.numPointShadows!==R||z.numSpotShadows!==C||z.numSpotMaps!==N||z.numLightProbes!==A)&&(i.directional.length=S,i.spot.length=_,i.rectArea.length=b,i.point.length=y,i.hemi.length=M,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=R,i.pointShadowMap.length=R,i.spotShadow.length=C,i.spotShadowMap.length=C,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=R,i.spotLightMatrix.length=C+N-B,i.spotLightMap.length=N,i.numSpotLightShadowsWithMaps=B,i.numLightProbes=A,z.directionalLength=S,z.pointLength=y,z.spotLength=_,z.rectAreaLength=b,z.hemiLength=M,z.numDirectionalShadows=T,z.numPointShadows=R,z.numSpotShadows=C,z.numSpotMaps=N,z.numLightProbes=A,i.version=RT++)}function h(d,f){let m=0,g=0,x=0,S=0,y=0;const _=f.matrixWorldInverse;for(let b=0,M=d.length;b<M;b++){const T=d[b];if(T.isDirectionalLight){const R=i.directional[m];R.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),R.direction.sub(s),R.direction.transformDirection(_),m++}else if(T.isSpotLight){const R=i.spot[x];R.position.setFromMatrixPosition(T.matrixWorld),R.position.applyMatrix4(_),R.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),R.direction.sub(s),R.direction.transformDirection(_),x++}else if(T.isRectAreaLight){const R=i.rectArea[S];R.position.setFromMatrixPosition(T.matrixWorld),R.position.applyMatrix4(_),c.identity(),a.copy(T.matrixWorld),a.premultiply(_),c.extractRotation(a),R.halfWidth.set(T.width*.5,0,0),R.halfHeight.set(0,T.height*.5,0),R.halfWidth.applyMatrix4(c),R.halfHeight.applyMatrix4(c),S++}else if(T.isPointLight){const R=i.point[g];R.position.setFromMatrixPosition(T.matrixWorld),R.position.applyMatrix4(_),g++}else if(T.isHemisphereLight){const R=i.hemi[y];R.direction.setFromMatrixPosition(T.matrixWorld),R.direction.transformDirection(_),y++}}}return{setup:u,setupView:h,state:i}}function L0(r,e){const t=new LT(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function a(f){n.push(f)}function c(f){i.push(f)}function u(f){t.setup(n,f)}function h(f){t.setupView(n,f)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:u,setupLightsView:h,pushLight:a,pushShadow:c}}function IT(r,e){let t=new WeakMap;function n(s,a=0){const c=t.get(s);let u;return c===void 0?(u=new L0(r,e),t.set(s,[u])):a>=c.length?(u=new L0(r,e),c.push(u)):u=c[a],u}function i(){t=new WeakMap}return{get:n,dispose:i}}class Dp extends zn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Wv,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Up extends zn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const NT=`void main() {
3660
3660
  gl_Position = vec4( position, 1.0 );
3661
3661
  }`,DT=`uniform sampler2D shadow_pass;
3662
3662
  uniform vec2 resolution;
@@ -3684,7 +3684,7 @@ void main() {
3684
3684
  squared_mean = squared_mean / samples;
3685
3685
  float std_dev = sqrt( squared_mean - mean * mean );
3686
3686
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3687
- }`;function UT(r,e,t){let n=new ml;const i=new he,s=new he,a=new At,c=new Up({depthPacking:jv}),u=new Op,h={},d=t.maxTextureSize,f={[Mr]:An,[An]:Mr,[Si]:Si},m=new Oi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new he},radius:{value:4}},vertexShader:NT,fragmentShader:DT}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const x=new St;x.setAttribute("position",new Ut(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new an(x,m),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ou;let _=this.type;this.render=function(C,N,B){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||C.length===0)return;const A=r.getRenderTarget(),P=r.getActiveCubeFace(),z=r.getActiveMipmapLevel(),ee=r.state;ee.setBlending(Sr),ee.buffers.color.setClear(1,1,1,1),ee.buffers.depth.setTest(!0),ee.setScissorTest(!1);const de=_!==Ri&&this.type===Ri,H=_===Ri&&this.type!==Ri;for(let q=0,ie=C.length;q<ie;q++){const le=C[q],j=le.shadow;if(j===void 0){console.warn("THREE.WebGLShadowMap:",le,"has no shadow.");continue}if(j.autoUpdate===!1&&j.needsUpdate===!1)continue;i.copy(j.mapSize);const Z=j.getFrameExtents();if(i.multiply(Z),s.copy(j.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/Z.x),i.x=s.x*Z.x,j.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/Z.y),i.y=s.y*Z.y,j.mapSize.y=s.y)),j.map===null||de===!0||H===!0){const te=this.type!==Ri?{minFilter:en,magFilter:en}:{};j.map!==null&&j.map.dispose(),j.map=new Ui(i.x,i.y,te),j.map.texture.name=le.name+".shadowMap",j.camera.updateProjectionMatrix()}r.setRenderTarget(j.map),r.clear();const J=j.getViewportCount();for(let te=0;te<J;te++){const ge=j.getViewport(te);a.set(s.x*ge.x,s.y*ge.y,s.x*ge.z,s.y*ge.w),ee.viewport(a),j.updateMatrices(le,te),n=j.getFrustum(),T(N,B,j.camera,le,this.type)}j.isPointLightShadow!==!0&&this.type===Ri&&b(j,B),j.needsUpdate=!1}_=this.type,y.needsUpdate=!1,r.setRenderTarget(A,P,z)};function b(C,N){const B=e.update(S);m.defines.VSM_SAMPLES!==C.blurSamples&&(m.defines.VSM_SAMPLES=C.blurSamples,g.defines.VSM_SAMPLES=C.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new Ui(i.x,i.y)),m.uniforms.shadow_pass.value=C.map.texture,m.uniforms.resolution.value=C.mapSize,m.uniforms.radius.value=C.radius,r.setRenderTarget(C.mapPass),r.clear(),r.renderBufferDirect(N,null,B,m,S,null),g.uniforms.shadow_pass.value=C.mapPass.texture,g.uniforms.resolution.value=C.mapSize,g.uniforms.radius.value=C.radius,r.setRenderTarget(C.map),r.clear(),r.renderBufferDirect(N,null,B,g,S,null)}function M(C,N,B,A){let P=null;const z=B.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(z!==void 0)P=z;else if(P=B.isPointLight===!0?u:c,r.localClippingEnabled&&N.clipShadows===!0&&Array.isArray(N.clippingPlanes)&&N.clippingPlanes.length!==0||N.displacementMap&&N.displacementScale!==0||N.alphaMap&&N.alphaTest>0||N.map&&N.alphaTest>0){const ee=P.uuid,de=N.uuid;let H=h[ee];H===void 0&&(H={},h[ee]=H);let q=H[de];q===void 0&&(q=P.clone(),H[de]=q,N.addEventListener("dispose",R)),P=q}if(P.visible=N.visible,P.wireframe=N.wireframe,A===Ri?P.side=N.shadowSide!==null?N.shadowSide:N.side:P.side=N.shadowSide!==null?N.shadowSide:f[N.side],P.alphaMap=N.alphaMap,P.alphaTest=N.alphaTest,P.map=N.map,P.clipShadows=N.clipShadows,P.clippingPlanes=N.clippingPlanes,P.clipIntersection=N.clipIntersection,P.displacementMap=N.displacementMap,P.displacementScale=N.displacementScale,P.displacementBias=N.displacementBias,P.wireframeLinewidth=N.wireframeLinewidth,P.linewidth=N.linewidth,B.isPointLight===!0&&P.isMeshDistanceMaterial===!0){const ee=r.properties.get(P);ee.light=B}return P}function T(C,N,B,A,P){if(C.visible===!1)return;if(C.layers.test(N.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&P===Ri)&&(!C.frustumCulled||n.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,C.matrixWorld);const de=e.update(C),H=C.material;if(Array.isArray(H)){const q=de.groups;for(let ie=0,le=q.length;ie<le;ie++){const j=q[ie],Z=H[j.materialIndex];if(Z&&Z.visible){const J=M(C,Z,A,P);C.onBeforeShadow(r,C,N,B,de,J,j),r.renderBufferDirect(B,null,de,J,C,j),C.onAfterShadow(r,C,N,B,de,J,j)}}}else if(H.visible){const q=M(C,H,A,P);C.onBeforeShadow(r,C,N,B,de,q,null),r.renderBufferDirect(B,null,de,q,C,null),C.onAfterShadow(r,C,N,B,de,q,null)}}const ee=C.children;for(let de=0,H=ee.length;de<H;de++)T(ee[de],N,B,A,P)}function R(C){C.target.removeEventListener("dispose",R);for(const B in h){const A=h[B],P=C.target.uuid;P in A&&(A[P].dispose(),delete A[P])}}}function OT(r,e,t){const n=t.isWebGL2;function i(){let G=!1;const Te=new At;let De=null;const tt=new At(0,0,0,0);return{setMask:function(Ye){De!==Ye&&!G&&(r.colorMask(Ye,Ye,Ye,Ye),De=Ye)},setLocked:function(Ye){G=Ye},setClear:function(Ye,bt,Tt,Ot,Ht){Ht===!0&&(Ye*=Ot,bt*=Ot,Tt*=Ot),Te.set(Ye,bt,Tt,Ot),tt.equals(Te)===!1&&(r.clearColor(Ye,bt,Tt,Ot),tt.copy(Te))},reset:function(){G=!1,De=null,tt.set(-1,0,0,0)}}}function s(){let G=!1,Te=null,De=null,tt=null;return{setTest:function(Ye){Ye?rt(r.DEPTH_TEST):Pe(r.DEPTH_TEST)},setMask:function(Ye){Te!==Ye&&!G&&(r.depthMask(Ye),Te=Ye)},setFunc:function(Ye){if(De!==Ye){switch(Ye){case vv:r.depthFunc(r.NEVER);break;case xv:r.depthFunc(r.ALWAYS);break;case yv:r.depthFunc(r.LESS);break;case Ga:r.depthFunc(r.LEQUAL);break;case Sv:r.depthFunc(r.EQUAL);break;case Mv:r.depthFunc(r.GEQUAL);break;case Ev:r.depthFunc(r.GREATER);break;case bv:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}De=Ye}},setLocked:function(Ye){G=Ye},setClear:function(Ye){tt!==Ye&&(r.clearDepth(Ye),tt=Ye)},reset:function(){G=!1,Te=null,De=null,tt=null}}}function a(){let G=!1,Te=null,De=null,tt=null,Ye=null,bt=null,Tt=null,Ot=null,Ht=null;return{setTest:function(Ct){G||(Ct?rt(r.STENCIL_TEST):Pe(r.STENCIL_TEST))},setMask:function(Ct){Te!==Ct&&!G&&(r.stencilMask(Ct),Te=Ct)},setFunc:function(Ct,yn,ci){(De!==Ct||tt!==yn||Ye!==ci)&&(r.stencilFunc(Ct,yn,ci),De=Ct,tt=yn,Ye=ci)},setOp:function(Ct,yn,ci){(bt!==Ct||Tt!==yn||Ot!==ci)&&(r.stencilOp(Ct,yn,ci),bt=Ct,Tt=yn,Ot=ci)},setLocked:function(Ct){G=Ct},setClear:function(Ct){Ht!==Ct&&(r.clearStencil(Ct),Ht=Ct)},reset:function(){G=!1,Te=null,De=null,tt=null,Ye=null,bt=null,Tt=null,Ot=null,Ht=null}}}const c=new i,u=new s,h=new a,d=new WeakMap,f=new WeakMap;let m={},g={},x=new WeakMap,S=[],y=null,_=!1,b=null,M=null,T=null,R=null,C=null,N=null,B=null,A=new ke(0,0,0),P=0,z=!1,ee=null,de=null,H=null,q=null,ie=null;const le=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let j=!1,Z=0;const J=r.getParameter(r.VERSION);J.indexOf("WebGL")!==-1?(Z=parseFloat(/^WebGL (\d)/.exec(J)[1]),j=Z>=1):J.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),j=Z>=2);let te=null,ge={};const K=r.getParameter(r.SCISSOR_BOX),fe=r.getParameter(r.VIEWPORT),be=new At().fromArray(K),Oe=new At().fromArray(fe);function Ne(G,Te,De,tt){const Ye=new Uint8Array(4),bt=r.createTexture();r.bindTexture(G,bt),r.texParameteri(G,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(G,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Tt=0;Tt<De;Tt++)n&&(G===r.TEXTURE_3D||G===r.TEXTURE_2D_ARRAY)?r.texImage3D(Te,0,r.RGBA,1,1,tt,0,r.RGBA,r.UNSIGNED_BYTE,Ye):r.texImage2D(Te+Tt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Ye);return bt}const Je={};Je[r.TEXTURE_2D]=Ne(r.TEXTURE_2D,r.TEXTURE_2D,1),Je[r.TEXTURE_CUBE_MAP]=Ne(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(Je[r.TEXTURE_2D_ARRAY]=Ne(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Je[r.TEXTURE_3D]=Ne(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),c.setClear(0,0,0,1),u.setClear(1),h.setClear(0),rt(r.DEPTH_TEST),u.setFunc(Ga),Le(!1),D(Mf),rt(r.CULL_FACE),pe(Sr);function rt(G){m[G]!==!0&&(r.enable(G),m[G]=!0)}function Pe(G){m[G]!==!1&&(r.disable(G),m[G]=!1)}function Ae(G,Te){return g[G]!==Te?(r.bindFramebuffer(G,Te),g[G]=Te,n&&(G===r.DRAW_FRAMEBUFFER&&(g[r.FRAMEBUFFER]=Te),G===r.FRAMEBUFFER&&(g[r.DRAW_FRAMEBUFFER]=Te)),!0):!1}function k(G,Te){let De=S,tt=!1;if(G)if(De=x.get(Te),De===void 0&&(De=[],x.set(Te,De)),G.isWebGLMultipleRenderTargets){const Ye=G.texture;if(De.length!==Ye.length||De[0]!==r.COLOR_ATTACHMENT0){for(let bt=0,Tt=Ye.length;bt<Tt;bt++)De[bt]=r.COLOR_ATTACHMENT0+bt;De.length=Ye.length,tt=!0}}else De[0]!==r.COLOR_ATTACHMENT0&&(De[0]=r.COLOR_ATTACHMENT0,tt=!0);else De[0]!==r.BACK&&(De[0]=r.BACK,tt=!0);tt&&(t.isWebGL2?r.drawBuffers(De):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(De))}function ve(G){return y!==G?(r.useProgram(G),y=G,!0):!1}const ue={[Gr]:r.FUNC_ADD,[iv]:r.FUNC_SUBTRACT,[rv]:r.FUNC_REVERSE_SUBTRACT};if(n)ue[Tf]=r.MIN,ue[Af]=r.MAX;else{const G=e.get("EXT_blend_minmax");G!==null&&(ue[Tf]=G.MIN_EXT,ue[Af]=G.MAX_EXT)}const Ee={[sv]:r.ZERO,[ov]:r.ONE,[av]:r.SRC_COLOR,[Au]:r.SRC_ALPHA,[fv]:r.SRC_ALPHA_SATURATE,[hv]:r.DST_COLOR,[cv]:r.DST_ALPHA,[lv]:r.ONE_MINUS_SRC_COLOR,[Cu]:r.ONE_MINUS_SRC_ALPHA,[dv]:r.ONE_MINUS_DST_COLOR,[uv]:r.ONE_MINUS_DST_ALPHA,[pv]:r.CONSTANT_COLOR,[mv]:r.ONE_MINUS_CONSTANT_COLOR,[gv]:r.CONSTANT_ALPHA,[_v]:r.ONE_MINUS_CONSTANT_ALPHA};function pe(G,Te,De,tt,Ye,bt,Tt,Ot,Ht,Ct){if(G===Sr){_===!0&&(Pe(r.BLEND),_=!1);return}if(_===!1&&(rt(r.BLEND),_=!0),G!==nv){if(G!==b||Ct!==z){if((M!==Gr||C!==Gr)&&(r.blendEquation(r.FUNC_ADD),M=Gr,C=Gr),Ct)switch(G){case Ns:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ef:r.blendFunc(r.ONE,r.ONE);break;case bf:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case wf:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Ns:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ef:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case bf:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case wf:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}T=null,R=null,N=null,B=null,A.set(0,0,0),P=0,b=G,z=Ct}return}Ye=Ye||Te,bt=bt||De,Tt=Tt||tt,(Te!==M||Ye!==C)&&(r.blendEquationSeparate(ue[Te],ue[Ye]),M=Te,C=Ye),(De!==T||tt!==R||bt!==N||Tt!==B)&&(r.blendFuncSeparate(Ee[De],Ee[tt],Ee[bt],Ee[Tt]),T=De,R=tt,N=bt,B=Tt),(Ot.equals(A)===!1||Ht!==P)&&(r.blendColor(Ot.r,Ot.g,Ot.b,Ht),A.copy(Ot),P=Ht),b=G,z=!1}function Ve(G,Te){G.side===Si?Pe(r.CULL_FACE):rt(r.CULL_FACE);let De=G.side===An;Te&&(De=!De),Le(De),G.blending===Ns&&G.transparent===!1?pe(Sr):pe(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.blendColor,G.blendAlpha,G.premultipliedAlpha),u.setFunc(G.depthFunc),u.setTest(G.depthTest),u.setMask(G.depthWrite),c.setMask(G.colorWrite);const tt=G.stencilWrite;h.setTest(tt),tt&&(h.setMask(G.stencilWriteMask),h.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),h.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),Q(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?rt(r.SAMPLE_ALPHA_TO_COVERAGE):Pe(r.SAMPLE_ALPHA_TO_COVERAGE)}function Le(G){ee!==G&&(G?r.frontFace(r.CW):r.frontFace(r.CCW),ee=G)}function D(G){G!==$_?(rt(r.CULL_FACE),G!==de&&(G===Mf?r.cullFace(r.BACK):G===ev?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Pe(r.CULL_FACE),de=G}function I(G){G!==H&&(j&&r.lineWidth(G),H=G)}function Q(G,Te,De){G?(rt(r.POLYGON_OFFSET_FILL),(q!==Te||ie!==De)&&(r.polygonOffset(Te,De),q=Te,ie=De)):Pe(r.POLYGON_OFFSET_FILL)}function ye(G){G?rt(r.SCISSOR_TEST):Pe(r.SCISSOR_TEST)}function xe(G){G===void 0&&(G=r.TEXTURE0+le-1),te!==G&&(r.activeTexture(G),te=G)}function me(G,Te,De){De===void 0&&(te===null?De=r.TEXTURE0+le-1:De=te);let tt=ge[De];tt===void 0&&(tt={type:void 0,texture:void 0},ge[De]=tt),(tt.type!==G||tt.texture!==Te)&&(te!==De&&(r.activeTexture(De),te=De),r.bindTexture(G,Te||Je[G]),tt.type=G,tt.texture=Te)}function Xe(){const G=ge[te];G!==void 0&&G.type!==void 0&&(r.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function Re(){try{r.compressedTexImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Ie(){try{r.compressedTexImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function et(){try{r.texSubImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ht(){try{r.texSubImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Se(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function wt(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function gt(){try{r.texStorage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ct(){try{r.texStorage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function $e(){try{r.texImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Ge(){try{r.texImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function V(G){be.equals(G)===!1&&(r.scissor(G.x,G.y,G.z,G.w),be.copy(G))}function _e(G){Oe.equals(G)===!1&&(r.viewport(G.x,G.y,G.z,G.w),Oe.copy(G))}function Be(G,Te){let De=f.get(Te);De===void 0&&(De=new WeakMap,f.set(Te,De));let tt=De.get(G);tt===void 0&&(tt=r.getUniformBlockIndex(Te,G.name),De.set(G,tt))}function Fe(G,Te){const tt=f.get(Te).get(G);d.get(Te)!==tt&&(r.uniformBlockBinding(Te,tt,G.__bindingPointIndex),d.set(Te,tt))}function Me(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),n===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),m={},te=null,ge={},g={},x=new WeakMap,S=[],y=null,_=!1,b=null,M=null,T=null,R=null,C=null,N=null,B=null,A=new ke(0,0,0),P=0,z=!1,ee=null,de=null,H=null,q=null,ie=null,be.set(0,0,r.canvas.width,r.canvas.height),Oe.set(0,0,r.canvas.width,r.canvas.height),c.reset(),u.reset(),h.reset()}return{buffers:{color:c,depth:u,stencil:h},enable:rt,disable:Pe,bindFramebuffer:Ae,drawBuffers:k,useProgram:ve,setBlending:pe,setMaterial:Ve,setFlipSided:Le,setCullFace:D,setLineWidth:I,setPolygonOffset:Q,setScissorTest:ye,activeTexture:xe,bindTexture:me,unbindTexture:Xe,compressedTexImage2D:Re,compressedTexImage3D:Ie,texImage2D:$e,texImage3D:Ge,updateUBOMapping:Be,uniformBlockBinding:Fe,texStorage2D:gt,texStorage3D:ct,texSubImage2D:et,texSubImage3D:ht,compressedTexSubImage2D:Se,compressedTexSubImage3D:wt,scissor:V,viewport:_e,reset:Me}}function FT(r,e,t,n,i,s,a){const c=i.isWebGL2,u=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,h=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new WeakMap;let f;const m=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(D,I){return g?new OffscreenCanvas(D,I):tl("canvas")}function S(D,I,Q,ye){let xe=1;if((D.width>ye||D.height>ye)&&(xe=ye/Math.max(D.width,D.height)),xe<1||I===!0)if(typeof HTMLImageElement<"u"&&D instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&D instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&D instanceof ImageBitmap){const me=I?Lu:Math.floor,Xe=me(xe*D.width),Re=me(xe*D.height);f===void 0&&(f=x(Xe,Re));const Ie=Q?x(Xe,Re):f;return Ie.width=Xe,Ie.height=Re,Ie.getContext("2d").drawImage(D,0,0,Xe,Re),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+D.width+"x"+D.height+") to ("+Xe+"x"+Re+")."),Ie}else return"data"in D&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+D.width+"x"+D.height+")."),D;return D}function y(D){return np(D.width)&&np(D.height)}function _(D){return c?!1:D.wrapS!==Un||D.wrapT!==Un||D.minFilter!==en&&D.minFilter!==tn}function b(D,I){return D.generateMipmaps&&I&&D.minFilter!==en&&D.minFilter!==tn}function M(D){r.generateMipmap(D)}function T(D,I,Q,ye,xe=!1){if(c===!1)return I;if(D!==null){if(r[D]!==void 0)return r[D];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+D+"'")}let me=I;if(I===r.RED&&(Q===r.FLOAT&&(me=r.R32F),Q===r.HALF_FLOAT&&(me=r.R16F),Q===r.UNSIGNED_BYTE&&(me=r.R8)),I===r.RED_INTEGER&&(Q===r.UNSIGNED_BYTE&&(me=r.R8UI),Q===r.UNSIGNED_SHORT&&(me=r.R16UI),Q===r.UNSIGNED_INT&&(me=r.R32UI),Q===r.BYTE&&(me=r.R8I),Q===r.SHORT&&(me=r.R16I),Q===r.INT&&(me=r.R32I)),I===r.RG&&(Q===r.FLOAT&&(me=r.RG32F),Q===r.HALF_FLOAT&&(me=r.RG16F),Q===r.UNSIGNED_BYTE&&(me=r.RG8)),I===r.RGBA){const Xe=xe?Ka:Dt.getTransfer(ye);Q===r.FLOAT&&(me=r.RGBA32F),Q===r.HALF_FLOAT&&(me=r.RGBA16F),Q===r.UNSIGNED_BYTE&&(me=Xe===zt?r.SRGB8_ALPHA8:r.RGBA8),Q===r.UNSIGNED_SHORT_4_4_4_4&&(me=r.RGBA4),Q===r.UNSIGNED_SHORT_5_5_5_1&&(me=r.RGB5_A1)}return(me===r.R16F||me===r.R32F||me===r.RG16F||me===r.RG32F||me===r.RGBA16F||me===r.RGBA32F)&&e.get("EXT_color_buffer_float"),me}function R(D,I,Q){return b(D,Q)===!0||D.isFramebufferTexture&&D.minFilter!==en&&D.minFilter!==tn?Math.log2(Math.max(I.width,I.height))+1:D.mipmaps!==void 0&&D.mipmaps.length>0?D.mipmaps.length:D.isCompressedTexture&&Array.isArray(D.image)?I.mipmaps.length:1}function C(D){return D===en||D===Ru||D===za?r.NEAREST:r.LINEAR}function N(D){const I=D.target;I.removeEventListener("dispose",N),A(I),I.isVideoTexture&&d.delete(I)}function B(D){const I=D.target;I.removeEventListener("dispose",B),z(I)}function A(D){const I=n.get(D);if(I.__webglInit===void 0)return;const Q=D.source,ye=m.get(Q);if(ye){const xe=ye[I.__cacheKey];xe.usedTimes--,xe.usedTimes===0&&P(D),Object.keys(ye).length===0&&m.delete(Q)}n.remove(D)}function P(D){const I=n.get(D);r.deleteTexture(I.__webglTexture);const Q=D.source,ye=m.get(Q);delete ye[I.__cacheKey],a.memory.textures--}function z(D){const I=D.texture,Q=n.get(D),ye=n.get(I);if(ye.__webglTexture!==void 0&&(r.deleteTexture(ye.__webglTexture),a.memory.textures--),D.depthTexture&&D.depthTexture.dispose(),D.isWebGLCubeRenderTarget)for(let xe=0;xe<6;xe++){if(Array.isArray(Q.__webglFramebuffer[xe]))for(let me=0;me<Q.__webglFramebuffer[xe].length;me++)r.deleteFramebuffer(Q.__webglFramebuffer[xe][me]);else r.deleteFramebuffer(Q.__webglFramebuffer[xe]);Q.__webglDepthbuffer&&r.deleteRenderbuffer(Q.__webglDepthbuffer[xe])}else{if(Array.isArray(Q.__webglFramebuffer))for(let xe=0;xe<Q.__webglFramebuffer.length;xe++)r.deleteFramebuffer(Q.__webglFramebuffer[xe]);else r.deleteFramebuffer(Q.__webglFramebuffer);if(Q.__webglDepthbuffer&&r.deleteRenderbuffer(Q.__webglDepthbuffer),Q.__webglMultisampledFramebuffer&&r.deleteFramebuffer(Q.__webglMultisampledFramebuffer),Q.__webglColorRenderbuffer)for(let xe=0;xe<Q.__webglColorRenderbuffer.length;xe++)Q.__webglColorRenderbuffer[xe]&&r.deleteRenderbuffer(Q.__webglColorRenderbuffer[xe]);Q.__webglDepthRenderbuffer&&r.deleteRenderbuffer(Q.__webglDepthRenderbuffer)}if(D.isWebGLMultipleRenderTargets)for(let xe=0,me=I.length;xe<me;xe++){const Xe=n.get(I[xe]);Xe.__webglTexture&&(r.deleteTexture(Xe.__webglTexture),a.memory.textures--),n.remove(I[xe])}n.remove(I),n.remove(D)}let ee=0;function de(){ee=0}function H(){const D=ee;return D>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+D+" texture units while this GPU supports only "+i.maxTextures),ee+=1,D}function q(D){const I=[];return I.push(D.wrapS),I.push(D.wrapT),I.push(D.wrapR||0),I.push(D.magFilter),I.push(D.minFilter),I.push(D.anisotropy),I.push(D.internalFormat),I.push(D.format),I.push(D.type),I.push(D.generateMipmaps),I.push(D.premultiplyAlpha),I.push(D.flipY),I.push(D.unpackAlignment),I.push(D.colorSpace),I.join()}function ie(D,I){const Q=n.get(D);if(D.isVideoTexture&&Ve(D),D.isRenderTargetTexture===!1&&D.version>0&&Q.__version!==D.version){const ye=D.image;if(ye===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ye.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{be(Q,D,I);return}}t.bindTexture(r.TEXTURE_2D,Q.__webglTexture,r.TEXTURE0+I)}function le(D,I){const Q=n.get(D);if(D.version>0&&Q.__version!==D.version){be(Q,D,I);return}t.bindTexture(r.TEXTURE_2D_ARRAY,Q.__webglTexture,r.TEXTURE0+I)}function j(D,I){const Q=n.get(D);if(D.version>0&&Q.__version!==D.version){be(Q,D,I);return}t.bindTexture(r.TEXTURE_3D,Q.__webglTexture,r.TEXTURE0+I)}function Z(D,I){const Q=n.get(D);if(D.version>0&&Q.__version!==D.version){Oe(Q,D,I);return}t.bindTexture(r.TEXTURE_CUBE_MAP,Q.__webglTexture,r.TEXTURE0+I)}const J={[Xa]:r.REPEAT,[Un]:r.CLAMP_TO_EDGE,[qa]:r.MIRRORED_REPEAT},te={[en]:r.NEAREST,[Ru]:r.NEAREST_MIPMAP_NEAREST,[za]:r.NEAREST_MIPMAP_LINEAR,[tn]:r.LINEAR,[_p]:r.LINEAR_MIPMAP_NEAREST,[Zr]:r.LINEAR_MIPMAP_LINEAR},ge={[qv]:r.NEVER,[$v]:r.ALWAYS,[Yv]:r.LESS,[Ap]:r.LEQUAL,[Zv]:r.EQUAL,[Qv]:r.GEQUAL,[Jv]:r.GREATER,[Kv]:r.NOTEQUAL};function K(D,I,Q){if(Q?(r.texParameteri(D,r.TEXTURE_WRAP_S,J[I.wrapS]),r.texParameteri(D,r.TEXTURE_WRAP_T,J[I.wrapT]),(D===r.TEXTURE_3D||D===r.TEXTURE_2D_ARRAY)&&r.texParameteri(D,r.TEXTURE_WRAP_R,J[I.wrapR]),r.texParameteri(D,r.TEXTURE_MAG_FILTER,te[I.magFilter]),r.texParameteri(D,r.TEXTURE_MIN_FILTER,te[I.minFilter])):(r.texParameteri(D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(D===r.TEXTURE_3D||D===r.TEXTURE_2D_ARRAY)&&r.texParameteri(D,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(I.wrapS!==Un||I.wrapT!==Un)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(D,r.TEXTURE_MAG_FILTER,C(I.magFilter)),r.texParameteri(D,r.TEXTURE_MIN_FILTER,C(I.minFilter)),I.minFilter!==en&&I.minFilter!==tn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),I.compareFunction&&(r.texParameteri(D,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(D,r.TEXTURE_COMPARE_FUNC,ge[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ye=e.get("EXT_texture_filter_anisotropic");if(I.magFilter===en||I.minFilter!==za&&I.minFilter!==Zr||I.type===Ni&&e.has("OES_texture_float_linear")===!1||c===!1&&I.type===Go&&e.has("OES_texture_half_float_linear")===!1)return;(I.anisotropy>1||n.get(I).__currentAnisotropy)&&(r.texParameterf(D,ye.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,i.getMaxAnisotropy())),n.get(I).__currentAnisotropy=I.anisotropy)}}function fe(D,I){let Q=!1;D.__webglInit===void 0&&(D.__webglInit=!0,I.addEventListener("dispose",N));const ye=I.source;let xe=m.get(ye);xe===void 0&&(xe={},m.set(ye,xe));const me=q(I);if(me!==D.__cacheKey){xe[me]===void 0&&(xe[me]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,Q=!0),xe[me].usedTimes++;const Xe=xe[D.__cacheKey];Xe!==void 0&&(xe[D.__cacheKey].usedTimes--,Xe.usedTimes===0&&P(I)),D.__cacheKey=me,D.__webglTexture=xe[me].texture}return Q}function be(D,I,Q){let ye=r.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(ye=r.TEXTURE_2D_ARRAY),I.isData3DTexture&&(ye=r.TEXTURE_3D);const xe=fe(D,I),me=I.source;t.bindTexture(ye,D.__webglTexture,r.TEXTURE0+Q);const Xe=n.get(me);if(me.version!==Xe.__version||xe===!0){t.activeTexture(r.TEXTURE0+Q);const Re=Dt.getPrimaries(Dt.workingColorSpace),Ie=I.colorSpace===oi?null:Dt.getPrimaries(I.colorSpace),et=I.colorSpace===oi||Re===Ie?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,I.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,I.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,et);const ht=_(I)&&y(I.image)===!1;let Se=S(I.image,ht,!1,i.maxTextureSize);Se=Le(I,Se);const wt=y(Se)||c,gt=s.convert(I.format,I.colorSpace);let ct=s.convert(I.type),$e=T(I.internalFormat,gt,ct,I.colorSpace,I.isVideoTexture);K(ye,I,wt);let Ge;const V=I.mipmaps,_e=c&&I.isVideoTexture!==!0&&$e!==bp,Be=Xe.__version===void 0||xe===!0,Fe=R(I,Se,wt);if(I.isDepthTexture)$e=r.DEPTH_COMPONENT,c?I.type===Ni?$e=r.DEPTH_COMPONENT32F:I.type===xr?$e=r.DEPTH_COMPONENT24:I.type===jr?$e=r.DEPTH24_STENCIL8:$e=r.DEPTH_COMPONENT16:I.type===Ni&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),I.format===Xr&&$e===r.DEPTH_COMPONENT&&I.type!==Bu&&I.type!==xr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),I.type=xr,ct=s.convert(I.type)),I.format===ks&&$e===r.DEPTH_COMPONENT&&($e=r.DEPTH_STENCIL,I.type!==jr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),I.type=jr,ct=s.convert(I.type))),Be&&(_e?t.texStorage2D(r.TEXTURE_2D,1,$e,Se.width,Se.height):t.texImage2D(r.TEXTURE_2D,0,$e,Se.width,Se.height,0,gt,ct,null));else if(I.isDataTexture)if(V.length>0&&wt){_e&&Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,V[0].width,V[0].height);for(let Me=0,G=V.length;Me<G;Me++)Ge=V[Me],_e?t.texSubImage2D(r.TEXTURE_2D,Me,0,0,Ge.width,Ge.height,gt,ct,Ge.data):t.texImage2D(r.TEXTURE_2D,Me,$e,Ge.width,Ge.height,0,gt,ct,Ge.data);I.generateMipmaps=!1}else _e?(Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,Se.width,Se.height),t.texSubImage2D(r.TEXTURE_2D,0,0,0,Se.width,Se.height,gt,ct,Se.data)):t.texImage2D(r.TEXTURE_2D,0,$e,Se.width,Se.height,0,gt,ct,Se.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){_e&&Be&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Fe,$e,V[0].width,V[0].height,Se.depth);for(let Me=0,G=V.length;Me<G;Me++)Ge=V[Me],I.format!==Wn?gt!==null?_e?t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Me,0,0,0,Ge.width,Ge.height,Se.depth,gt,Ge.data,0,0):t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Me,$e,Ge.width,Ge.height,Se.depth,0,Ge.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_e?t.texSubImage3D(r.TEXTURE_2D_ARRAY,Me,0,0,0,Ge.width,Ge.height,Se.depth,gt,ct,Ge.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Me,$e,Ge.width,Ge.height,Se.depth,0,gt,ct,Ge.data)}else{_e&&Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,V[0].width,V[0].height);for(let Me=0,G=V.length;Me<G;Me++)Ge=V[Me],I.format!==Wn?gt!==null?_e?t.compressedTexSubImage2D(r.TEXTURE_2D,Me,0,0,Ge.width,Ge.height,gt,Ge.data):t.compressedTexImage2D(r.TEXTURE_2D,Me,$e,Ge.width,Ge.height,0,Ge.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_e?t.texSubImage2D(r.TEXTURE_2D,Me,0,0,Ge.width,Ge.height,gt,ct,Ge.data):t.texImage2D(r.TEXTURE_2D,Me,$e,Ge.width,Ge.height,0,gt,ct,Ge.data)}else if(I.isDataArrayTexture)_e?(Be&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Fe,$e,Se.width,Se.height,Se.depth),t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Se.width,Se.height,Se.depth,gt,ct,Se.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,$e,Se.width,Se.height,Se.depth,0,gt,ct,Se.data);else if(I.isData3DTexture)_e?(Be&&t.texStorage3D(r.TEXTURE_3D,Fe,$e,Se.width,Se.height,Se.depth),t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Se.width,Se.height,Se.depth,gt,ct,Se.data)):t.texImage3D(r.TEXTURE_3D,0,$e,Se.width,Se.height,Se.depth,0,gt,ct,Se.data);else if(I.isFramebufferTexture){if(Be)if(_e)t.texStorage2D(r.TEXTURE_2D,Fe,$e,Se.width,Se.height);else{let Me=Se.width,G=Se.height;for(let Te=0;Te<Fe;Te++)t.texImage2D(r.TEXTURE_2D,Te,$e,Me,G,0,gt,ct,null),Me>>=1,G>>=1}}else if(V.length>0&&wt){_e&&Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,V[0].width,V[0].height);for(let Me=0,G=V.length;Me<G;Me++)Ge=V[Me],_e?t.texSubImage2D(r.TEXTURE_2D,Me,0,0,gt,ct,Ge):t.texImage2D(r.TEXTURE_2D,Me,$e,gt,ct,Ge);I.generateMipmaps=!1}else _e?(Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,Se.width,Se.height),t.texSubImage2D(r.TEXTURE_2D,0,0,0,gt,ct,Se)):t.texImage2D(r.TEXTURE_2D,0,$e,gt,ct,Se);b(I,wt)&&M(ye),Xe.__version=me.version,I.onUpdate&&I.onUpdate(I)}D.__version=I.version}function Oe(D,I,Q){if(I.image.length!==6)return;const ye=fe(D,I),xe=I.source;t.bindTexture(r.TEXTURE_CUBE_MAP,D.__webglTexture,r.TEXTURE0+Q);const me=n.get(xe);if(xe.version!==me.__version||ye===!0){t.activeTexture(r.TEXTURE0+Q);const Xe=Dt.getPrimaries(Dt.workingColorSpace),Re=I.colorSpace===oi?null:Dt.getPrimaries(I.colorSpace),Ie=I.colorSpace===oi||Xe===Re?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,I.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,I.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ie);const et=I.isCompressedTexture||I.image[0].isCompressedTexture,ht=I.image[0]&&I.image[0].isDataTexture,Se=[];for(let Me=0;Me<6;Me++)!et&&!ht?Se[Me]=S(I.image[Me],!1,!0,i.maxCubemapSize):Se[Me]=ht?I.image[Me].image:I.image[Me],Se[Me]=Le(I,Se[Me]);const wt=Se[0],gt=y(wt)||c,ct=s.convert(I.format,I.colorSpace),$e=s.convert(I.type),Ge=T(I.internalFormat,ct,$e,I.colorSpace),V=c&&I.isVideoTexture!==!0,_e=me.__version===void 0||ye===!0;let Be=R(I,wt,gt);K(r.TEXTURE_CUBE_MAP,I,gt);let Fe;if(et){V&&_e&&t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Ge,wt.width,wt.height);for(let Me=0;Me<6;Me++){Fe=Se[Me].mipmaps;for(let G=0;G<Fe.length;G++){const Te=Fe[G];I.format!==Wn?ct!==null?V?t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G,0,0,Te.width,Te.height,ct,Te.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G,Ge,Te.width,Te.height,0,Te.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G,0,0,Te.width,Te.height,ct,$e,Te.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G,Ge,Te.width,Te.height,0,ct,$e,Te.data)}}}else{Fe=I.mipmaps,V&&_e&&(Fe.length>0&&Be++,t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Ge,Se[0].width,Se[0].height));for(let Me=0;Me<6;Me++)if(ht){V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,0,0,Se[Me].width,Se[Me].height,ct,$e,Se[Me].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,Ge,Se[Me].width,Se[Me].height,0,ct,$e,Se[Me].data);for(let G=0;G<Fe.length;G++){const De=Fe[G].image[Me].image;V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G+1,0,0,De.width,De.height,ct,$e,De.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G+1,Ge,De.width,De.height,0,ct,$e,De.data)}}else{V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,0,0,ct,$e,Se[Me]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,Ge,ct,$e,Se[Me]);for(let G=0;G<Fe.length;G++){const Te=Fe[G];V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G+1,0,0,ct,$e,Te.image[Me]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G+1,Ge,ct,$e,Te.image[Me])}}}b(I,gt)&&M(r.TEXTURE_CUBE_MAP),me.__version=xe.version,I.onUpdate&&I.onUpdate(I)}D.__version=I.version}function Ne(D,I,Q,ye,xe,me){const Xe=s.convert(Q.format,Q.colorSpace),Re=s.convert(Q.type),Ie=T(Q.internalFormat,Xe,Re,Q.colorSpace);if(!n.get(I).__hasExternalTextures){const ht=Math.max(1,I.width>>me),Se=Math.max(1,I.height>>me);xe===r.TEXTURE_3D||xe===r.TEXTURE_2D_ARRAY?t.texImage3D(xe,me,Ie,ht,Se,I.depth,0,Xe,Re,null):t.texImage2D(xe,me,Ie,ht,Se,0,Xe,Re,null)}t.bindFramebuffer(r.FRAMEBUFFER,D),pe(I)?u.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ye,xe,n.get(Q).__webglTexture,0,Ee(I)):(xe===r.TEXTURE_2D||xe>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&xe<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,ye,xe,n.get(Q).__webglTexture,me),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Je(D,I,Q){if(r.bindRenderbuffer(r.RENDERBUFFER,D),I.depthBuffer&&!I.stencilBuffer){let ye=c===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(Q||pe(I)){const xe=I.depthTexture;xe&&xe.isDepthTexture&&(xe.type===Ni?ye=r.DEPTH_COMPONENT32F:xe.type===xr&&(ye=r.DEPTH_COMPONENT24));const me=Ee(I);pe(I)?u.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,me,ye,I.width,I.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,me,ye,I.width,I.height)}else r.renderbufferStorage(r.RENDERBUFFER,ye,I.width,I.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,D)}else if(I.depthBuffer&&I.stencilBuffer){const ye=Ee(I);Q&&pe(I)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,ye,r.DEPTH24_STENCIL8,I.width,I.height):pe(I)?u.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,ye,r.DEPTH24_STENCIL8,I.width,I.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,I.width,I.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,D)}else{const ye=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let xe=0;xe<ye.length;xe++){const me=ye[xe],Xe=s.convert(me.format,me.colorSpace),Re=s.convert(me.type),Ie=T(me.internalFormat,Xe,Re,me.colorSpace),et=Ee(I);Q&&pe(I)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,et,Ie,I.width,I.height):pe(I)?u.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,et,Ie,I.width,I.height):r.renderbufferStorage(r.RENDERBUFFER,Ie,I.width,I.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function rt(D,I){if(I&&I.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,D),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(I.depthTexture).__webglTexture||I.depthTexture.image.width!==I.width||I.depthTexture.image.height!==I.height)&&(I.depthTexture.image.width=I.width,I.depthTexture.image.height=I.height,I.depthTexture.needsUpdate=!0),ie(I.depthTexture,0);const ye=n.get(I.depthTexture).__webglTexture,xe=Ee(I);if(I.depthTexture.format===Xr)pe(I)?u.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,ye,0,xe):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,ye,0);else if(I.depthTexture.format===ks)pe(I)?u.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,ye,0,xe):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,ye,0);else throw new Error("Unknown depthTexture format")}function Pe(D){const I=n.get(D),Q=D.isWebGLCubeRenderTarget===!0;if(D.depthTexture&&!I.__autoAllocateDepthBuffer){if(Q)throw new Error("target.depthTexture not supported in Cube render targets");rt(I.__webglFramebuffer,D)}else if(Q){I.__webglDepthbuffer=[];for(let ye=0;ye<6;ye++)t.bindFramebuffer(r.FRAMEBUFFER,I.__webglFramebuffer[ye]),I.__webglDepthbuffer[ye]=r.createRenderbuffer(),Je(I.__webglDepthbuffer[ye],D,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,I.__webglFramebuffer),I.__webglDepthbuffer=r.createRenderbuffer(),Je(I.__webglDepthbuffer,D,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function Ae(D,I,Q){const ye=n.get(D);I!==void 0&&Ne(ye.__webglFramebuffer,D,D.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),Q!==void 0&&Pe(D)}function k(D){const I=D.texture,Q=n.get(D),ye=n.get(I);D.addEventListener("dispose",B),D.isWebGLMultipleRenderTargets!==!0&&(ye.__webglTexture===void 0&&(ye.__webglTexture=r.createTexture()),ye.__version=I.version,a.memory.textures++);const xe=D.isWebGLCubeRenderTarget===!0,me=D.isWebGLMultipleRenderTargets===!0,Xe=y(D)||c;if(xe){Q.__webglFramebuffer=[];for(let Re=0;Re<6;Re++)if(c&&I.mipmaps&&I.mipmaps.length>0){Q.__webglFramebuffer[Re]=[];for(let Ie=0;Ie<I.mipmaps.length;Ie++)Q.__webglFramebuffer[Re][Ie]=r.createFramebuffer()}else Q.__webglFramebuffer[Re]=r.createFramebuffer()}else{if(c&&I.mipmaps&&I.mipmaps.length>0){Q.__webglFramebuffer=[];for(let Re=0;Re<I.mipmaps.length;Re++)Q.__webglFramebuffer[Re]=r.createFramebuffer()}else Q.__webglFramebuffer=r.createFramebuffer();if(me)if(i.drawBuffers){const Re=D.texture;for(let Ie=0,et=Re.length;Ie<et;Ie++){const ht=n.get(Re[Ie]);ht.__webglTexture===void 0&&(ht.__webglTexture=r.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(c&&D.samples>0&&pe(D)===!1){const Re=me?I:[I];Q.__webglMultisampledFramebuffer=r.createFramebuffer(),Q.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,Q.__webglMultisampledFramebuffer);for(let Ie=0;Ie<Re.length;Ie++){const et=Re[Ie];Q.__webglColorRenderbuffer[Ie]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,Q.__webglColorRenderbuffer[Ie]);const ht=s.convert(et.format,et.colorSpace),Se=s.convert(et.type),wt=T(et.internalFormat,ht,Se,et.colorSpace,D.isXRRenderTarget===!0),gt=Ee(D);r.renderbufferStorageMultisample(r.RENDERBUFFER,gt,wt,D.width,D.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ie,r.RENDERBUFFER,Q.__webglColorRenderbuffer[Ie])}r.bindRenderbuffer(r.RENDERBUFFER,null),D.depthBuffer&&(Q.__webglDepthRenderbuffer=r.createRenderbuffer(),Je(Q.__webglDepthRenderbuffer,D,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(xe){t.bindTexture(r.TEXTURE_CUBE_MAP,ye.__webglTexture),K(r.TEXTURE_CUBE_MAP,I,Xe);for(let Re=0;Re<6;Re++)if(c&&I.mipmaps&&I.mipmaps.length>0)for(let Ie=0;Ie<I.mipmaps.length;Ie++)Ne(Q.__webglFramebuffer[Re][Ie],D,I,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Re,Ie);else Ne(Q.__webglFramebuffer[Re],D,I,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0);b(I,Xe)&&M(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(me){const Re=D.texture;for(let Ie=0,et=Re.length;Ie<et;Ie++){const ht=Re[Ie],Se=n.get(ht);t.bindTexture(r.TEXTURE_2D,Se.__webglTexture),K(r.TEXTURE_2D,ht,Xe),Ne(Q.__webglFramebuffer,D,ht,r.COLOR_ATTACHMENT0+Ie,r.TEXTURE_2D,0),b(ht,Xe)&&M(r.TEXTURE_2D)}t.unbindTexture()}else{let Re=r.TEXTURE_2D;if((D.isWebGL3DRenderTarget||D.isWebGLArrayRenderTarget)&&(c?Re=D.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Re,ye.__webglTexture),K(Re,I,Xe),c&&I.mipmaps&&I.mipmaps.length>0)for(let Ie=0;Ie<I.mipmaps.length;Ie++)Ne(Q.__webglFramebuffer[Ie],D,I,r.COLOR_ATTACHMENT0,Re,Ie);else Ne(Q.__webglFramebuffer,D,I,r.COLOR_ATTACHMENT0,Re,0);b(I,Xe)&&M(Re),t.unbindTexture()}D.depthBuffer&&Pe(D)}function ve(D){const I=y(D)||c,Q=D.isWebGLMultipleRenderTargets===!0?D.texture:[D.texture];for(let ye=0,xe=Q.length;ye<xe;ye++){const me=Q[ye];if(b(me,I)){const Xe=D.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Re=n.get(me).__webglTexture;t.bindTexture(Xe,Re),M(Xe),t.unbindTexture()}}}function ue(D){if(c&&D.samples>0&&pe(D)===!1){const I=D.isWebGLMultipleRenderTargets?D.texture:[D.texture],Q=D.width,ye=D.height;let xe=r.COLOR_BUFFER_BIT;const me=[],Xe=D.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Re=n.get(D),Ie=D.isWebGLMultipleRenderTargets===!0;if(Ie)for(let et=0;et<I.length;et++)t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+et,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+et,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Re.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglFramebuffer);for(let et=0;et<I.length;et++){me.push(r.COLOR_ATTACHMENT0+et),D.depthBuffer&&me.push(Xe);const ht=Re.__ignoreDepthValues!==void 0?Re.__ignoreDepthValues:!1;if(ht===!1&&(D.depthBuffer&&(xe|=r.DEPTH_BUFFER_BIT),D.stencilBuffer&&(xe|=r.STENCIL_BUFFER_BIT)),Ie&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Re.__webglColorRenderbuffer[et]),ht===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[Xe]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[Xe])),Ie){const Se=n.get(I[et]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Se,0)}r.blitFramebuffer(0,0,Q,ye,0,0,Q,ye,xe,r.NEAREST),h&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,me)}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Ie)for(let et=0;et<I.length;et++){t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+et,r.RENDERBUFFER,Re.__webglColorRenderbuffer[et]);const ht=n.get(I[et]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+et,r.TEXTURE_2D,ht,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglMultisampledFramebuffer)}}function Ee(D){return Math.min(i.maxSamples,D.samples)}function pe(D){const I=n.get(D);return c&&D.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function Ve(D){const I=a.render.frame;d.get(D)!==I&&(d.set(D,I),D.update())}function Le(D,I){const Q=D.colorSpace,ye=D.format,xe=D.type;return D.isCompressedTexture===!0||D.isVideoTexture===!0||D.format===Pu||Q!==nr&&Q!==oi&&(Dt.getTransfer(Q)===zt?c===!1?e.has("EXT_sRGB")===!0&&ye===Wn?(D.format=Pu,D.minFilter=tn,D.generateMipmaps=!1):I=Rp.sRGBToLinear(I):(ye!==Wn||xe!==$i)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Q)),I}this.allocateTextureUnit=H,this.resetTextureUnits=de,this.setTexture2D=ie,this.setTexture2DArray=le,this.setTexture3D=j,this.setTextureCube=Z,this.rebindTextures=Ae,this.setupRenderTarget=k,this.updateRenderTargetMipmap=ve,this.updateMultisampleRenderTarget=ue,this.setupDepthRenderbuffer=Pe,this.setupFrameBufferTexture=Ne,this.useMultisampledRTT=pe}function px(r,e,t){const n=t.isWebGL2;function i(s,a=oi){let c;const u=Dt.getTransfer(a);if(s===$i)return r.UNSIGNED_BYTE;if(s===xp)return r.UNSIGNED_SHORT_4_4_4_4;if(s===yp)return r.UNSIGNED_SHORT_5_5_5_1;if(s===Nv)return r.BYTE;if(s===Dv)return r.SHORT;if(s===Bu)return r.UNSIGNED_SHORT;if(s===vp)return r.INT;if(s===xr)return r.UNSIGNED_INT;if(s===Ni)return r.FLOAT;if(s===Go)return n?r.HALF_FLOAT:(c=e.get("OES_texture_half_float"),c!==null?c.HALF_FLOAT_OES:null);if(s===Uv)return r.ALPHA;if(s===Wn)return r.RGBA;if(s===Ov)return r.LUMINANCE;if(s===Fv)return r.LUMINANCE_ALPHA;if(s===Xr)return r.DEPTH_COMPONENT;if(s===ks)return r.DEPTH_STENCIL;if(s===Pu)return c=e.get("EXT_sRGB"),c!==null?c.SRGB_ALPHA_EXT:null;if(s===zv)return r.RED;if(s===Sp)return r.RED_INTEGER;if(s===Bv)return r.RG;if(s===Mp)return r.RG_INTEGER;if(s===Ep)return r.RGBA_INTEGER;if(s===vu||s===xu||s===yu||s===Su)if(u===zt)if(c=e.get("WEBGL_compressed_texture_s3tc_srgb"),c!==null){if(s===vu)return c.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===xu)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===yu)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Su)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(c=e.get("WEBGL_compressed_texture_s3tc"),c!==null){if(s===vu)return c.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===xu)return c.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===yu)return c.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Su)return c.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Rf||s===Pf||s===Lf||s===If)if(c=e.get("WEBGL_compressed_texture_pvrtc"),c!==null){if(s===Rf)return c.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Pf)return c.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Lf)return c.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===If)return c.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===bp)return c=e.get("WEBGL_compressed_texture_etc1"),c!==null?c.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Nf||s===Df)if(c=e.get("WEBGL_compressed_texture_etc"),c!==null){if(s===Nf)return u===zt?c.COMPRESSED_SRGB8_ETC2:c.COMPRESSED_RGB8_ETC2;if(s===Df)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:c.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Uf||s===Of||s===Ff||s===zf||s===Bf||s===kf||s===Hf||s===Vf||s===Gf||s===Wf||s===jf||s===Xf||s===qf||s===Yf)if(c=e.get("WEBGL_compressed_texture_astc"),c!==null){if(s===Uf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:c.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Of)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:c.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Ff)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:c.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===zf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:c.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Bf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:c.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===kf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:c.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Hf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:c.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Vf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:c.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Gf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:c.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Wf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:c.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===jf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:c.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Xf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:c.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===qf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:c.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Yf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:c.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Mu||s===Zf||s===Jf)if(c=e.get("EXT_texture_compression_bptc"),c!==null){if(s===Mu)return u===zt?c.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:c.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Zf)return c.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Jf)return c.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===kv||s===Kf||s===Qf||s===$f)if(c=e.get("EXT_texture_compression_rgtc"),c!==null){if(s===Mu)return c.COMPRESSED_RED_RGTC1_EXT;if(s===Kf)return c.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Qf)return c.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===$f)return c.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===jr?n?r.UNSIGNED_INT_24_8:(c=e.get("WEBGL_depth_texture"),c!==null?c.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class mx extends jt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Bo extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const zT={type:"move"};class Vd{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Bo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Bo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Bo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const c=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const S of e.hand.values()){const y=t.getJointPose(S,n),_=this._getHandJoint(h,S);y!==null&&(_.matrix.fromArray(y.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=y.radius),_.visible=y!==null}const d=h.joints["index-finger-tip"],f=h.joints["thumb-tip"],m=d.position.distanceTo(f.position),g=.02,x=.005;h.inputState.pinching&&m>g+x?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&m<=g-x&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(zT)))}return c!==null&&(c.visible=i!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Bo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class BT extends wr{constructor(e,t){super();const n=this;let i=null,s=1,a=null,c="local-floor",u=1,h=null,d=null,f=null,m=null,g=null,x=null;const S=t.getContextAttributes();let y=null,_=null;const b=[],M=[],T=new he;let R=null;const C=new jt;C.layers.enable(1),C.viewport=new At;const N=new jt;N.layers.enable(2),N.viewport=new At;const B=[C,N],A=new mx;A.layers.enable(1),A.layers.enable(2);let P=null,z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let fe=b[K];return fe===void 0&&(fe=new Vd,b[K]=fe),fe.getTargetRaySpace()},this.getControllerGrip=function(K){let fe=b[K];return fe===void 0&&(fe=new Vd,b[K]=fe),fe.getGripSpace()},this.getHand=function(K){let fe=b[K];return fe===void 0&&(fe=new Vd,b[K]=fe),fe.getHandSpace()};function ee(K){const fe=M.indexOf(K.inputSource);if(fe===-1)return;const be=b[fe];be!==void 0&&(be.update(K.inputSource,K.frame,h||a),be.dispatchEvent({type:K.type,data:K.inputSource}))}function de(){i.removeEventListener("select",ee),i.removeEventListener("selectstart",ee),i.removeEventListener("selectend",ee),i.removeEventListener("squeeze",ee),i.removeEventListener("squeezestart",ee),i.removeEventListener("squeezeend",ee),i.removeEventListener("end",de),i.removeEventListener("inputsourceschange",H);for(let K=0;K<b.length;K++){const fe=M[K];fe!==null&&(M[K]=null,b[K].disconnect(fe))}P=null,z=null,e.setRenderTarget(y),g=null,m=null,f=null,i=null,_=null,ge.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(T.width,T.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(K){s=K,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(K){c=K,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||a},this.setReferenceSpace=function(K){h=K},this.getBaseLayer=function(){return m!==null?m:g},this.getBinding=function(){return f},this.getFrame=function(){return x},this.getSession=function(){return i},this.setSession=async function(K){if(i=K,i!==null){if(y=e.getRenderTarget(),i.addEventListener("select",ee),i.addEventListener("selectstart",ee),i.addEventListener("selectend",ee),i.addEventListener("squeeze",ee),i.addEventListener("squeezestart",ee),i.addEventListener("squeezeend",ee),i.addEventListener("end",de),i.addEventListener("inputsourceschange",H),S.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(T),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const fe={antialias:i.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(i,t,fe),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),_=new Ui(g.framebufferWidth,g.framebufferHeight,{format:Wn,type:$i,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil})}else{let fe=null,be=null,Oe=null;S.depth&&(Oe=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,fe=S.stencil?ks:Xr,be=S.stencil?jr:xr);const Ne={colorFormat:t.RGBA8,depthFormat:Oe,scaleFactor:s};f=new XRWebGLBinding(i,t),m=f.createProjectionLayer(Ne),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),_=new Ui(m.textureWidth,m.textureHeight,{format:Wn,type:$i,depthTexture:new Dp(m.textureWidth,m.textureHeight,be,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0});const Je=e.properties.get(_);Je.__ignoreDepthValues=m.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(u),h=null,a=await i.requestReferenceSpace(c),ge.setContext(i),ge.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function H(K){for(let fe=0;fe<K.removed.length;fe++){const be=K.removed[fe],Oe=M.indexOf(be);Oe>=0&&(M[Oe]=null,b[Oe].disconnect(be))}for(let fe=0;fe<K.added.length;fe++){const be=K.added[fe];let Oe=M.indexOf(be);if(Oe===-1){for(let Je=0;Je<b.length;Je++)if(Je>=M.length){M.push(be),Oe=Je;break}else if(M[Je]===null){M[Je]=be,Oe=Je;break}if(Oe===-1)break}const Ne=b[Oe];Ne&&Ne.connect(be)}}const q=new U,ie=new U;function le(K,fe,be){q.setFromMatrixPosition(fe.matrixWorld),ie.setFromMatrixPosition(be.matrixWorld);const Oe=q.distanceTo(ie),Ne=fe.projectionMatrix.elements,Je=be.projectionMatrix.elements,rt=Ne[14]/(Ne[10]-1),Pe=Ne[14]/(Ne[10]+1),Ae=(Ne[9]+1)/Ne[5],k=(Ne[9]-1)/Ne[5],ve=(Ne[8]-1)/Ne[0],ue=(Je[8]+1)/Je[0],Ee=rt*ve,pe=rt*ue,Ve=Oe/(-ve+ue),Le=Ve*-ve;fe.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(Le),K.translateZ(Ve),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();const D=rt+Ve,I=Pe+Ve,Q=Ee-Le,ye=pe+(Oe-Le),xe=Ae*Pe/I*D,me=k*Pe/I*D;K.projectionMatrix.makePerspective(Q,ye,xe,me,D,I),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}function j(K,fe){fe===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(fe.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(i===null)return;A.near=N.near=C.near=K.near,A.far=N.far=C.far=K.far,(P!==A.near||z!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),P=A.near,z=A.far);const fe=K.parent,be=A.cameras;j(A,fe);for(let Oe=0;Oe<be.length;Oe++)j(be[Oe],fe);be.length===2?le(A,C,N):A.projectionMatrix.copy(C.projectionMatrix),Z(K,A,fe)};function Z(K,fe,be){be===null?K.matrix.copy(fe.matrixWorld):(K.matrix.copy(be.matrixWorld),K.matrix.invert(),K.matrix.multiply(fe.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0),K.projectionMatrix.copy(fe.projectionMatrix),K.projectionMatrixInverse.copy(fe.projectionMatrixInverse),K.isPerspectiveCamera&&(K.fov=jo*2*Math.atan(1/K.projectionMatrix.elements[5]),K.zoom=1)}this.getCamera=function(){return A},this.getFoveation=function(){if(!(m===null&&g===null))return u},this.setFoveation=function(K){u=K,m!==null&&(m.fixedFoveation=K),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=K)};let J=null;function te(K,fe){if(d=fe.getViewerPose(h||a),x=fe,d!==null){const be=d.views;g!==null&&(e.setRenderTargetFramebuffer(_,g.framebuffer),e.setRenderTarget(_));let Oe=!1;be.length!==A.cameras.length&&(A.cameras.length=0,Oe=!0);for(let Ne=0;Ne<be.length;Ne++){const Je=be[Ne];let rt=null;if(g!==null)rt=g.getViewport(Je);else{const Ae=f.getViewSubImage(m,Je);rt=Ae.viewport,Ne===0&&(e.setRenderTargetTextures(_,Ae.colorTexture,m.ignoreDepthValues?void 0:Ae.depthStencilTexture),e.setRenderTarget(_))}let Pe=B[Ne];Pe===void 0&&(Pe=new jt,Pe.layers.enable(Ne),Pe.viewport=new At,B[Ne]=Pe),Pe.matrix.fromArray(Je.transform.matrix),Pe.matrix.decompose(Pe.position,Pe.quaternion,Pe.scale),Pe.projectionMatrix.fromArray(Je.projectionMatrix),Pe.projectionMatrixInverse.copy(Pe.projectionMatrix).invert(),Pe.viewport.set(rt.x,rt.y,rt.width,rt.height),Ne===0&&(A.matrix.copy(Pe.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),Oe===!0&&A.cameras.push(Pe)}}for(let be=0;be<b.length;be++){const Oe=M[be],Ne=b[be];Oe!==null&&Ne!==void 0&&Ne.update(Oe,fe,h||a)}J&&J(K,fe),fe.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:fe}),x=null}const ge=new lx;ge.setAnimationLoop(te),this.setAnimationLoop=function(K){J=K},this.dispose=function(){}}}function kT(r,e){function t(y,_){y.matrixAutoUpdate===!0&&y.updateMatrix(),_.value.copy(y.matrix)}function n(y,_){_.color.getRGB(y.fogColor.value,sx(r)),_.isFog?(y.fogNear.value=_.near,y.fogFar.value=_.far):_.isFogExp2&&(y.fogDensity.value=_.density)}function i(y,_,b,M,T){_.isMeshBasicMaterial||_.isMeshLambertMaterial?s(y,_):_.isMeshToonMaterial?(s(y,_),f(y,_)):_.isMeshPhongMaterial?(s(y,_),d(y,_)):_.isMeshStandardMaterial?(s(y,_),m(y,_),_.isMeshPhysicalMaterial&&g(y,_,T)):_.isMeshMatcapMaterial?(s(y,_),x(y,_)):_.isMeshDepthMaterial?s(y,_):_.isMeshDistanceMaterial?(s(y,_),S(y,_)):_.isMeshNormalMaterial?s(y,_):_.isLineBasicMaterial?(a(y,_),_.isLineDashedMaterial&&c(y,_)):_.isPointsMaterial?u(y,_,b,M):_.isSpriteMaterial?h(y,_):_.isShadowMaterial?(y.color.value.copy(_.color),y.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function s(y,_){y.opacity.value=_.opacity,_.color&&y.diffuse.value.copy(_.color),_.emissive&&y.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.bumpMap&&(y.bumpMap.value=_.bumpMap,t(_.bumpMap,y.bumpMapTransform),y.bumpScale.value=_.bumpScale,_.side===An&&(y.bumpScale.value*=-1)),_.normalMap&&(y.normalMap.value=_.normalMap,t(_.normalMap,y.normalMapTransform),y.normalScale.value.copy(_.normalScale),_.side===An&&y.normalScale.value.negate()),_.displacementMap&&(y.displacementMap.value=_.displacementMap,t(_.displacementMap,y.displacementMapTransform),y.displacementScale.value=_.displacementScale,y.displacementBias.value=_.displacementBias),_.emissiveMap&&(y.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,y.emissiveMapTransform)),_.specularMap&&(y.specularMap.value=_.specularMap,t(_.specularMap,y.specularMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest);const b=e.get(_).envMap;if(b&&(y.envMap.value=b,y.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=_.reflectivity,y.ior.value=_.ior,y.refractionRatio.value=_.refractionRatio),_.lightMap){y.lightMap.value=_.lightMap;const M=r._useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=_.lightMapIntensity*M,t(_.lightMap,y.lightMapTransform)}_.aoMap&&(y.aoMap.value=_.aoMap,y.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,y.aoMapTransform))}function a(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform))}function c(y,_){y.dashSize.value=_.dashSize,y.totalSize.value=_.dashSize+_.gapSize,y.scale.value=_.scale}function u(y,_,b,M){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.size.value=_.size*b,y.scale.value=M*.5,_.map&&(y.map.value=_.map,t(_.map,y.uvTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function h(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.rotation.value=_.rotation,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function d(y,_){y.specular.value.copy(_.specular),y.shininess.value=Math.max(_.shininess,1e-4)}function f(y,_){_.gradientMap&&(y.gradientMap.value=_.gradientMap)}function m(y,_){y.metalness.value=_.metalness,_.metalnessMap&&(y.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,y.metalnessMapTransform)),y.roughness.value=_.roughness,_.roughnessMap&&(y.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,y.roughnessMapTransform)),e.get(_).envMap&&(y.envMapIntensity.value=_.envMapIntensity)}function g(y,_,b){y.ior.value=_.ior,_.sheen>0&&(y.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),y.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(y.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,y.sheenColorMapTransform)),_.sheenRoughnessMap&&(y.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,y.sheenRoughnessMapTransform))),_.clearcoat>0&&(y.clearcoat.value=_.clearcoat,y.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(y.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,y.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(y.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===An&&y.clearcoatNormalScale.value.negate())),_.iridescence>0&&(y.iridescence.value=_.iridescence,y.iridescenceIOR.value=_.iridescenceIOR,y.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(y.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,y.iridescenceMapTransform)),_.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),_.transmission>0&&(y.transmission.value=_.transmission,y.transmissionSamplerMap.value=b.texture,y.transmissionSamplerSize.value.set(b.width,b.height),_.transmissionMap&&(y.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,y.transmissionMapTransform)),y.thickness.value=_.thickness,_.thicknessMap&&(y.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=_.attenuationDistance,y.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(y.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(y.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=_.specularIntensity,y.specularColor.value.copy(_.specularColor),_.specularColorMap&&(y.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,y.specularColorMapTransform)),_.specularIntensityMap&&(y.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,y.specularIntensityMapTransform))}function x(y,_){_.matcap&&(y.matcap.value=_.matcap)}function S(y,_){const b=e.get(_).light;y.referencePosition.value.setFromMatrixPosition(b.matrixWorld),y.nearDistance.value=b.shadow.camera.near,y.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function HT(r,e,t,n){let i={},s={},a=[];const c=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function u(b,M){const T=M.program;n.uniformBlockBinding(b,T)}function h(b,M){let T=i[b.id];T===void 0&&(x(b),T=d(b),i[b.id]=T,b.addEventListener("dispose",y));const R=M.program;n.updateUBOMapping(b,R);const C=e.render.frame;s[b.id]!==C&&(m(b),s[b.id]=C)}function d(b){const M=f();b.__bindingPointIndex=M;const T=r.createBuffer(),R=b.__size,C=b.usage;return r.bindBuffer(r.UNIFORM_BUFFER,T),r.bufferData(r.UNIFORM_BUFFER,R,C),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,M,T),T}function f(){for(let b=0;b<c;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(b){const M=i[b.id],T=b.uniforms,R=b.__cache;r.bindBuffer(r.UNIFORM_BUFFER,M);for(let C=0,N=T.length;C<N;C++){const B=Array.isArray(T[C])?T[C]:[T[C]];for(let A=0,P=B.length;A<P;A++){const z=B[A];if(g(z,C,A,R)===!0){const ee=z.__offset,de=Array.isArray(z.value)?z.value:[z.value];let H=0;for(let q=0;q<de.length;q++){const ie=de[q],le=S(ie);typeof ie=="number"||typeof ie=="boolean"?(z.__data[0]=ie,r.bufferSubData(r.UNIFORM_BUFFER,ee+H,z.__data)):ie.isMatrix3?(z.__data[0]=ie.elements[0],z.__data[1]=ie.elements[1],z.__data[2]=ie.elements[2],z.__data[3]=0,z.__data[4]=ie.elements[3],z.__data[5]=ie.elements[4],z.__data[6]=ie.elements[5],z.__data[7]=0,z.__data[8]=ie.elements[6],z.__data[9]=ie.elements[7],z.__data[10]=ie.elements[8],z.__data[11]=0):(ie.toArray(z.__data,H),H+=le.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,ee,z.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function g(b,M,T,R){const C=b.value,N=M+"_"+T;if(R[N]===void 0)return typeof C=="number"||typeof C=="boolean"?R[N]=C:R[N]=C.clone(),!0;{const B=R[N];if(typeof C=="number"||typeof C=="boolean"){if(B!==C)return R[N]=C,!0}else if(B.equals(C)===!1)return B.copy(C),!0}return!1}function x(b){const M=b.uniforms;let T=0;const R=16;for(let N=0,B=M.length;N<B;N++){const A=Array.isArray(M[N])?M[N]:[M[N]];for(let P=0,z=A.length;P<z;P++){const ee=A[P],de=Array.isArray(ee.value)?ee.value:[ee.value];for(let H=0,q=de.length;H<q;H++){const ie=de[H],le=S(ie),j=T%R;j!==0&&R-j<le.boundary&&(T+=R-j),ee.__data=new Float32Array(le.storage/Float32Array.BYTES_PER_ELEMENT),ee.__offset=T,T+=le.storage}}}const C=T%R;return C>0&&(T+=R-C),b.__size=T,b.__cache={},this}function S(b){const M={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(M.boundary=4,M.storage=4):b.isVector2?(M.boundary=8,M.storage=8):b.isVector3||b.isColor?(M.boundary=16,M.storage=12):b.isVector4?(M.boundary=16,M.storage=16):b.isMatrix3?(M.boundary=48,M.storage=48):b.isMatrix4?(M.boundary=64,M.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),M}function y(b){const M=b.target;M.removeEventListener("dispose",y);const T=a.indexOf(M.__bindingPointIndex);a.splice(T,1),r.deleteBuffer(i[M.id]),delete i[M.id],delete s[M.id]}function _(){for(const b in i)r.deleteBuffer(i[b]);a=[],i={},s={}}return{bind:u,update:h,dispose:_}}class Fp{constructor(e={}){const{canvas:t=nx(),context:n=null,depth:i=!0,stencil:s=!0,alpha:a=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let m;n!==null?m=n.getContextAttributes().alpha:m=a;const g=new Uint32Array(4),x=new Int32Array(4);let S=null,y=null;const _=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=cn,this._useLegacyLights=!1,this.toneMapping=Qi,this.toneMappingExposure=1;const M=this;let T=!1,R=0,C=0,N=null,B=-1,A=null;const P=new At,z=new At;let ee=null;const de=new ke(0);let H=0,q=t.width,ie=t.height,le=1,j=null,Z=null;const J=new At(0,0,q,ie),te=new At(0,0,q,ie);let ge=!1;const K=new ml;let fe=!1,be=!1,Oe=null;const Ne=new lt,Je=new he,rt=new U,Pe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ae(){return N===null?le:1}let k=n;function ve(O,$){for(let se=0;se<O.length;se++){const oe=O[se],re=t.getContext(oe,$);if(re!==null)return re}return null}try{const O={alpha:!0,depth:i,stencil:s,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Zo}`),t.addEventListener("webglcontextlost",Me,!1),t.addEventListener("webglcontextrestored",G,!1),t.addEventListener("webglcontextcreationerror",Te,!1),k===null){const $=["webgl2","webgl","experimental-webgl"];if(M.isWebGL1Renderer===!0&&$.shift(),k=ve($,O),k===null)throw ve($)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&k instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),k.getShaderPrecisionFormat===void 0&&(k.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(O){throw console.error("THREE.WebGLRenderer: "+O.message),O}let ue,Ee,pe,Ve,Le,D,I,Q,ye,xe,me,Xe,Re,Ie,et,ht,Se,wt,gt,ct,$e,Ge,V,_e;function Be(){ue=new t1(k),Ee=new Zw(k,ue,e),ue.init(Ee),Ge=new px(k,ue,Ee),pe=new OT(k,ue,Ee),Ve=new r1(k),Le=new bT,D=new FT(k,ue,pe,Le,Ee,Ge,Ve),I=new Kw(M),Q=new e1(M),ye=new dE(k,Ee),V=new qw(k,ue,ye,Ee),xe=new n1(k,ye,Ve,V),me=new l1(k,xe,ye,Ve),gt=new a1(k,Ee,D),ht=new Jw(Le),Xe=new ET(M,I,Q,ue,Ee,V,ht),Re=new kT(M,Le),Ie=new TT,et=new IT(ue,Ee),wt=new Xw(M,I,Q,pe,me,m,u),Se=new UT(M,me,Ee),_e=new HT(k,Ve,Ee,pe),ct=new Yw(k,ue,Ve,Ee),$e=new i1(k,ue,Ve,Ee),Ve.programs=Xe.programs,M.capabilities=Ee,M.extensions=ue,M.properties=Le,M.renderLists=Ie,M.shadowMap=Se,M.state=pe,M.info=Ve}Be();const Fe=new BT(M,k);this.xr=Fe,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const O=ue.get("WEBGL_lose_context");O&&O.loseContext()},this.forceContextRestore=function(){const O=ue.get("WEBGL_lose_context");O&&O.restoreContext()},this.getPixelRatio=function(){return le},this.setPixelRatio=function(O){O!==void 0&&(le=O,this.setSize(q,ie,!1))},this.getSize=function(O){return O.set(q,ie)},this.setSize=function(O,$,se=!0){if(Fe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=O,ie=$,t.width=Math.floor(O*le),t.height=Math.floor($*le),se===!0&&(t.style.width=O+"px",t.style.height=$+"px"),this.setViewport(0,0,O,$)},this.getDrawingBufferSize=function(O){return O.set(q*le,ie*le).floor()},this.setDrawingBufferSize=function(O,$,se){q=O,ie=$,le=se,t.width=Math.floor(O*se),t.height=Math.floor($*se),this.setViewport(0,0,O,$)},this.getCurrentViewport=function(O){return O.copy(P)},this.getViewport=function(O){return O.copy(J)},this.setViewport=function(O,$,se,oe){O.isVector4?J.set(O.x,O.y,O.z,O.w):J.set(O,$,se,oe),pe.viewport(P.copy(J).multiplyScalar(le).floor())},this.getScissor=function(O){return O.copy(te)},this.setScissor=function(O,$,se,oe){O.isVector4?te.set(O.x,O.y,O.z,O.w):te.set(O,$,se,oe),pe.scissor(z.copy(te).multiplyScalar(le).floor())},this.getScissorTest=function(){return ge},this.setScissorTest=function(O){pe.setScissorTest(ge=O)},this.setOpaqueSort=function(O){j=O},this.setTransparentSort=function(O){Z=O},this.getClearColor=function(O){return O.copy(wt.getClearColor())},this.setClearColor=function(){wt.setClearColor.apply(wt,arguments)},this.getClearAlpha=function(){return wt.getClearAlpha()},this.setClearAlpha=function(){wt.setClearAlpha.apply(wt,arguments)},this.clear=function(O=!0,$=!0,se=!0){let oe=0;if(O){let re=!1;if(N!==null){const He=N.texture.format;re=He===Ep||He===Mp||He===Sp}if(re){const He=N.texture.type,Ke=He===$i||He===xr||He===Bu||He===jr||He===xp||He===yp,st=wt.getClearColor(),ot=wt.getClearAlpha(),dt=st.r,ut=st.g,ft=st.b;Ke?(g[0]=dt,g[1]=ut,g[2]=ft,g[3]=ot,k.clearBufferuiv(k.COLOR,0,g)):(x[0]=dt,x[1]=ut,x[2]=ft,x[3]=ot,k.clearBufferiv(k.COLOR,0,x))}else oe|=k.COLOR_BUFFER_BIT}$&&(oe|=k.DEPTH_BUFFER_BIT),se&&(oe|=k.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k.clear(oe)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Me,!1),t.removeEventListener("webglcontextrestored",G,!1),t.removeEventListener("webglcontextcreationerror",Te,!1),Ie.dispose(),et.dispose(),Le.dispose(),I.dispose(),Q.dispose(),me.dispose(),V.dispose(),_e.dispose(),Xe.dispose(),Fe.dispose(),Fe.removeEventListener("sessionstart",Ht),Fe.removeEventListener("sessionend",Ct),Oe&&(Oe.dispose(),Oe=null),yn.stop()};function Me(O){O.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function G(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const O=Ve.autoReset,$=Se.enabled,se=Se.autoUpdate,oe=Se.needsUpdate,re=Se.type;Be(),Ve.autoReset=O,Se.enabled=$,Se.autoUpdate=se,Se.needsUpdate=oe,Se.type=re}function Te(O){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",O.statusMessage)}function De(O){const $=O.target;$.removeEventListener("dispose",De),tt($)}function tt(O){Ye(O),Le.remove(O)}function Ye(O){const $=Le.get(O).programs;$!==void 0&&($.forEach(function(se){Xe.releaseProgram(se)}),O.isShaderMaterial&&Xe.releaseShaderCache(O))}this.renderBufferDirect=function(O,$,se,oe,re,He){$===null&&($=Pe);const Ke=re.isMesh&&re.matrixWorld.determinant()<0,st=dh(O,$,se,oe,re);pe.setMaterial(oe,Ke);let ot=se.index,dt=1;if(oe.wireframe===!0){if(ot=xe.getWireframeAttribute(se),ot===void 0)return;dt=2}const ut=se.drawRange,ft=se.attributes.position;let Gt=ut.start*dt,Sn=(ut.start+ut.count)*dt;He!==null&&(Gt=Math.max(Gt,He.start*dt),Sn=Math.min(Sn,(He.start+He.count)*dt)),ot!==null?(Gt=Math.max(Gt,0),Sn=Math.min(Sn,ot.count)):ft!=null&&(Gt=Math.max(Gt,0),Sn=Math.min(Sn,ft.count));const Bt=Sn-Gt;if(Bt<0||Bt===1/0)return;V.setup(re,oe,st,se,ot);let dn,at=ct;if(ot!==null&&(dn=ye.get(ot),at=$e,at.setIndex(dn)),re.isMesh)oe.wireframe===!0?(pe.setLineWidth(oe.wireframeLinewidth*Ae()),at.setMode(k.LINES)):at.setMode(k.TRIANGLES);else if(re.isLine){let We=oe.linewidth;We===void 0&&(We=1),pe.setLineWidth(We*Ae()),re.isLineSegments?at.setMode(k.LINES):re.isLineLoop?at.setMode(k.LINE_LOOP):at.setMode(k.LINE_STRIP)}else re.isPoints?at.setMode(k.POINTS):re.isSprite&&at.setMode(k.TRIANGLES);if(re.isBatchedMesh)at.renderMultiDraw(re._multiDrawStarts,re._multiDrawCounts,re._multiDrawCount);else if(re.isInstancedMesh)at.renderInstances(Gt,Bt,re.count);else if(se.isInstancedBufferGeometry){const We=se._maxInstanceCount!==void 0?se._maxInstanceCount:1/0,ui=Math.min(se.instanceCount,We);at.renderInstances(Gt,Bt,ui)}else at.render(Gt,Bt)};function bt(O,$,se){O.transparent===!0&&O.side===Si&&O.forceSinglePass===!1?(O.side=An,O.needsUpdate=!0,Ys(O,$,se),O.side=Mr,O.needsUpdate=!0,Ys(O,$,se),O.side=Si):Ys(O,$,se)}this.compile=function(O,$,se=null){se===null&&(se=O),y=et.get(se),y.init(),b.push(y),se.traverseVisible(function(re){re.isLight&&re.layers.test($.layers)&&(y.pushLight(re),re.castShadow&&y.pushShadow(re))}),O!==se&&O.traverseVisible(function(re){re.isLight&&re.layers.test($.layers)&&(y.pushLight(re),re.castShadow&&y.pushShadow(re))}),y.setupLights(M._useLegacyLights);const oe=new Set;return O.traverse(function(re){const He=re.material;if(He)if(Array.isArray(He))for(let Ke=0;Ke<He.length;Ke++){const st=He[Ke];bt(st,se,re),oe.add(st)}else bt(He,se,re),oe.add(He)}),b.pop(),y=null,oe},this.compileAsync=function(O,$,se=null){const oe=this.compile(O,$,se);return new Promise(re=>{function He(){if(oe.forEach(function(Ke){Le.get(Ke).currentProgram.isReady()&&oe.delete(Ke)}),oe.size===0){re(O);return}setTimeout(He,10)}ue.get("KHR_parallel_shader_compile")!==null?He():setTimeout(He,10)})};let Tt=null;function Ot(O){Tt&&Tt(O)}function Ht(){yn.stop()}function Ct(){yn.start()}const yn=new lx;yn.setAnimationLoop(Ot),typeof self<"u"&&yn.setContext(self),this.setAnimationLoop=function(O){Tt=O,Fe.setAnimationLoop(O),O===null?yn.stop():yn.start()},Fe.addEventListener("sessionstart",Ht),Fe.addEventListener("sessionend",Ct),this.render=function(O,$){if($!==void 0&&$.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),$.parent===null&&$.matrixWorldAutoUpdate===!0&&$.updateMatrixWorld(),Fe.enabled===!0&&Fe.isPresenting===!0&&(Fe.cameraAutoUpdate===!0&&Fe.updateCamera($),$=Fe.getCamera()),O.isScene===!0&&O.onBeforeRender(M,O,$,N),y=et.get(O,b.length),y.init(),b.push(y),Ne.multiplyMatrices($.projectionMatrix,$.matrixWorldInverse),K.setFromProjectionMatrix(Ne),be=this.localClippingEnabled,fe=ht.init(this.clippingPlanes,be),S=Ie.get(O,_.length),S.init(),_.push(S),ci(O,$,0,M.sortObjects),S.finish(),M.sortObjects===!0&&S.sort(j,Z),this.info.render.frame++,fe===!0&&ht.beginShadows();const se=y.state.shadowsArray;if(Se.render(se,O,$),fe===!0&&ht.endShadows(),this.info.autoReset===!0&&this.info.reset(),wt.render(S,O),y.setupLights(M._useLegacyLights),$.isArrayCamera){const oe=$.cameras;for(let re=0,He=oe.length;re<He;re++){const Ke=oe[re];ea(S,O,Ke,Ke.viewport)}}else ea(S,O,$);N!==null&&(D.updateMultisampleRenderTarget(N),D.updateRenderTargetMipmap(N)),O.isScene===!0&&O.onAfterRender(M,O,$),V.resetDefaultState(),B=-1,A=null,b.pop(),b.length>0?y=b[b.length-1]:y=null,_.pop(),_.length>0?S=_[_.length-1]:S=null};function ci(O,$,se,oe){if(O.visible===!1)return;if(O.layers.test($.layers)){if(O.isGroup)se=O.renderOrder;else if(O.isLOD)O.autoUpdate===!0&&O.update($);else if(O.isLight)y.pushLight(O),O.castShadow&&y.pushShadow(O);else if(O.isSprite){if(!O.frustumCulled||K.intersectsSprite(O)){oe&&rt.setFromMatrixPosition(O.matrixWorld).applyMatrix4(Ne);const Ke=me.update(O),st=O.material;st.visible&&S.push(O,Ke,st,se,rt.z,null)}}else if((O.isMesh||O.isLine||O.isPoints)&&(!O.frustumCulled||K.intersectsObject(O))){const Ke=me.update(O),st=O.material;if(oe&&(O.boundingSphere!==void 0?(O.boundingSphere===null&&O.computeBoundingSphere(),rt.copy(O.boundingSphere.center)):(Ke.boundingSphere===null&&Ke.computeBoundingSphere(),rt.copy(Ke.boundingSphere.center)),rt.applyMatrix4(O.matrixWorld).applyMatrix4(Ne)),Array.isArray(st)){const ot=Ke.groups;for(let dt=0,ut=ot.length;dt<ut;dt++){const ft=ot[dt],Gt=st[ft.materialIndex];Gt&&Gt.visible&&S.push(O,Ke,Gt,se,rt.z,ft)}}else st.visible&&S.push(O,Ke,st,se,rt.z,null)}}const He=O.children;for(let Ke=0,st=He.length;Ke<st;Ke++)ci(He[Ke],$,se,oe)}function ea(O,$,se,oe){const re=O.opaque,He=O.transmissive,Ke=O.transparent;y.setupLightsView(se),fe===!0&&ht.setGlobalState(M.clippingPlanes,se),He.length>0&&ta(re,He,$,se),oe&&pe.viewport(P.copy(oe)),re.length>0&&qs(re,$,se),He.length>0&&qs(He,$,se),Ke.length>0&&qs(Ke,$,se),pe.buffers.depth.setTest(!0),pe.buffers.depth.setMask(!0),pe.buffers.color.setMask(!0),pe.setPolygonOffset(!1)}function ta(O,$,se,oe){if((se.isScene===!0?se.overrideMaterial:null)!==null)return;const He=Ee.isWebGL2;Oe===null&&(Oe=new Ui(1,1,{generateMipmaps:!0,type:ue.has("EXT_color_buffer_half_float")?Go:$i,minFilter:Zr,samples:He?4:0})),M.getDrawingBufferSize(Je),He?Oe.setSize(Je.x,Je.y):Oe.setSize(Lu(Je.x),Lu(Je.y));const Ke=M.getRenderTarget();M.setRenderTarget(Oe),M.getClearColor(de),H=M.getClearAlpha(),H<1&&M.setClearColor(16777215,.5),M.clear();const st=M.toneMapping;M.toneMapping=Qi,qs(O,se,oe),D.updateMultisampleRenderTarget(Oe),D.updateRenderTargetMipmap(Oe);let ot=!1;for(let dt=0,ut=$.length;dt<ut;dt++){const ft=$[dt],Gt=ft.object,Sn=ft.geometry,Bt=ft.material,dn=ft.group;if(Bt.side===Si&&Gt.layers.test(oe.layers)){const at=Bt.side;Bt.side=An,Bt.needsUpdate=!0,Tr(Gt,se,oe,Sn,Bt,dn),Bt.side=at,Bt.needsUpdate=!0,ot=!0}}ot===!0&&(D.updateMultisampleRenderTarget(Oe),D.updateRenderTargetMipmap(Oe)),M.setRenderTarget(Ke),M.setClearColor(de,H),M.toneMapping=st}function qs(O,$,se){const oe=$.isScene===!0?$.overrideMaterial:null;for(let re=0,He=O.length;re<He;re++){const Ke=O[re],st=Ke.object,ot=Ke.geometry,dt=oe===null?Ke.material:oe,ut=Ke.group;st.layers.test(se.layers)&&Tr(st,$,se,ot,dt,ut)}}function Tr(O,$,se,oe,re,He){O.onBeforeRender(M,$,se,oe,re,He),O.modelViewMatrix.multiplyMatrices(se.matrixWorldInverse,O.matrixWorld),O.normalMatrix.getNormalMatrix(O.modelViewMatrix),re.onBeforeRender(M,$,se,oe,O,He),re.transparent===!0&&re.side===Si&&re.forceSinglePass===!1?(re.side=An,re.needsUpdate=!0,M.renderBufferDirect(se,$,oe,re,O,He),re.side=Mr,re.needsUpdate=!0,M.renderBufferDirect(se,$,oe,re,O,He),re.side=Si):M.renderBufferDirect(se,$,oe,re,O,He),O.onAfterRender(M,$,se,oe,re,He)}function Ys(O,$,se){$.isScene!==!0&&($=Pe);const oe=Le.get(O),re=y.state.lights,He=y.state.shadowsArray,Ke=re.state.version,st=Xe.getParameters(O,re.state,He,$,se),ot=Xe.getProgramCacheKey(st);let dt=oe.programs;oe.environment=O.isMeshStandardMaterial?$.environment:null,oe.fog=$.fog,oe.envMap=(O.isMeshStandardMaterial?Q:I).get(O.envMap||oe.environment),dt===void 0&&(O.addEventListener("dispose",De),dt=new Map,oe.programs=dt);let ut=dt.get(ot);if(ut!==void 0){if(oe.currentProgram===ut&&oe.lightsStateVersion===Ke)return wl(O,st),ut}else st.uniforms=Xe.getUniforms(O),O.onBuild(se,st,M),O.onBeforeCompile(st,M),ut=Xe.acquireProgram(st,ot),dt.set(ot,ut),oe.uniforms=st.uniforms;const ft=oe.uniforms;return(!O.isShaderMaterial&&!O.isRawShaderMaterial||O.clipping===!0)&&(ft.clippingPlanes=ht.uniform),wl(O,st),oe.needsLights=ph(O),oe.lightsStateVersion=Ke,oe.needsLights&&(ft.ambientLightColor.value=re.state.ambient,ft.lightProbe.value=re.state.probe,ft.directionalLights.value=re.state.directional,ft.directionalLightShadows.value=re.state.directionalShadow,ft.spotLights.value=re.state.spot,ft.spotLightShadows.value=re.state.spotShadow,ft.rectAreaLights.value=re.state.rectArea,ft.ltc_1.value=re.state.rectAreaLTC1,ft.ltc_2.value=re.state.rectAreaLTC2,ft.pointLights.value=re.state.point,ft.pointLightShadows.value=re.state.pointShadow,ft.hemisphereLights.value=re.state.hemi,ft.directionalShadowMap.value=re.state.directionalShadowMap,ft.directionalShadowMatrix.value=re.state.directionalShadowMatrix,ft.spotShadowMap.value=re.state.spotShadowMap,ft.spotLightMatrix.value=re.state.spotLightMatrix,ft.spotLightMap.value=re.state.spotLightMap,ft.pointShadowMap.value=re.state.pointShadowMap,ft.pointShadowMatrix.value=re.state.pointShadowMatrix),oe.currentProgram=ut,oe.uniformsList=null,ut}function bl(O){if(O.uniformsList===null){const $=O.currentProgram.getUniforms();O.uniformsList=bu.seqWithValue($.seq,O.uniforms)}return O.uniformsList}function wl(O,$){const se=Le.get(O);se.outputColorSpace=$.outputColorSpace,se.batching=$.batching,se.instancing=$.instancing,se.instancingColor=$.instancingColor,se.skinning=$.skinning,se.morphTargets=$.morphTargets,se.morphNormals=$.morphNormals,se.morphColors=$.morphColors,se.morphTargetsCount=$.morphTargetsCount,se.numClippingPlanes=$.numClippingPlanes,se.numIntersection=$.numClipIntersection,se.vertexAlphas=$.vertexAlphas,se.vertexTangents=$.vertexTangents,se.toneMapping=$.toneMapping}function dh(O,$,se,oe,re){$.isScene!==!0&&($=Pe),D.resetTextureUnits();const He=$.fog,Ke=oe.isMeshStandardMaterial?$.environment:null,st=N===null?M.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:nr,ot=(oe.isMeshStandardMaterial?Q:I).get(oe.envMap||Ke),dt=oe.vertexColors===!0&&!!se.attributes.color&&se.attributes.color.itemSize===4,ut=!!se.attributes.tangent&&(!!oe.normalMap||oe.anisotropy>0),ft=!!se.morphAttributes.position,Gt=!!se.morphAttributes.normal,Sn=!!se.morphAttributes.color;let Bt=Qi;oe.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(Bt=M.toneMapping);const dn=se.morphAttributes.position||se.morphAttributes.normal||se.morphAttributes.color,at=dn!==void 0?dn.length:0,We=Le.get(oe),ui=y.state.lights;if(fe===!0&&(be===!0||O!==A)){const Mn=O===A&&oe.id===B;ht.setState(oe,O,Mn)}let Mt=!1;oe.version===We.__version?(We.needsLights&&We.lightsStateVersion!==ui.state.version||We.outputColorSpace!==st||re.isBatchedMesh&&We.batching===!1||!re.isBatchedMesh&&We.batching===!0||re.isInstancedMesh&&We.instancing===!1||!re.isInstancedMesh&&We.instancing===!0||re.isSkinnedMesh&&We.skinning===!1||!re.isSkinnedMesh&&We.skinning===!0||re.isInstancedMesh&&We.instancingColor===!0&&re.instanceColor===null||re.isInstancedMesh&&We.instancingColor===!1&&re.instanceColor!==null||We.envMap!==ot||oe.fog===!0&&We.fog!==He||We.numClippingPlanes!==void 0&&(We.numClippingPlanes!==ht.numPlanes||We.numIntersection!==ht.numIntersection)||We.vertexAlphas!==dt||We.vertexTangents!==ut||We.morphTargets!==ft||We.morphNormals!==Gt||We.morphColors!==Sn||We.toneMapping!==Bt||Ee.isWebGL2===!0&&We.morphTargetsCount!==at)&&(Mt=!0):(Mt=!0,We.__version=oe.version);let qt=We.currentProgram;Mt===!0&&(qt=Ys(oe,$,re));let ki=!1,hi=!1,fn=!1;const Kt=qt.getUniforms(),Hi=We.uniforms;if(pe.useProgram(qt.program)&&(ki=!0,hi=!0,fn=!0),oe.id!==B&&(B=oe.id,hi=!0),ki||A!==O){Kt.setValue(k,"projectionMatrix",O.projectionMatrix),Kt.setValue(k,"viewMatrix",O.matrixWorldInverse);const Mn=Kt.map.cameraPosition;Mn!==void 0&&Mn.setValue(k,rt.setFromMatrixPosition(O.matrixWorld)),Ee.logarithmicDepthBuffer&&Kt.setValue(k,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(oe.isMeshPhongMaterial||oe.isMeshToonMaterial||oe.isMeshLambertMaterial||oe.isMeshBasicMaterial||oe.isMeshStandardMaterial||oe.isShaderMaterial)&&Kt.setValue(k,"isOrthographic",O.isOrthographicCamera===!0),A!==O&&(A=O,hi=!0,fn=!0)}if(re.isSkinnedMesh){Kt.setOptional(k,re,"bindMatrix"),Kt.setOptional(k,re,"bindMatrixInverse");const Mn=re.skeleton;Mn&&(Ee.floatVertexTextures?(Mn.boneTexture===null&&Mn.computeBoneTexture(),Kt.setValue(k,"boneTexture",Mn.boneTexture,D)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}re.isBatchedMesh&&(Kt.setOptional(k,re,"batchingTexture"),Kt.setValue(k,"batchingTexture",re._matricesTexture,D));const Zs=se.morphAttributes;if((Zs.position!==void 0||Zs.normal!==void 0||Zs.color!==void 0&&Ee.isWebGL2===!0)&&gt.update(re,se,qt),(hi||We.receiveShadow!==re.receiveShadow)&&(We.receiveShadow=re.receiveShadow,Kt.setValue(k,"receiveShadow",re.receiveShadow)),oe.isMeshGouraudMaterial&&oe.envMap!==null&&(Hi.envMap.value=ot,Hi.flipEnvMap.value=ot.isCubeTexture&&ot.isRenderTargetTexture===!1?-1:1),hi&&(Kt.setValue(k,"toneMappingExposure",M.toneMappingExposure),We.needsLights&&fh(Hi,fn),He&&oe.fog===!0&&Re.refreshFogUniforms(Hi,He),Re.refreshMaterialUniforms(Hi,oe,le,ie,Oe),bu.upload(k,bl(We),Hi,D)),oe.isShaderMaterial&&oe.uniformsNeedUpdate===!0&&(bu.upload(k,bl(We),Hi,D),oe.uniformsNeedUpdate=!1),oe.isSpriteMaterial&&Kt.setValue(k,"center",re.center),Kt.setValue(k,"modelViewMatrix",re.modelViewMatrix),Kt.setValue(k,"normalMatrix",re.normalMatrix),Kt.setValue(k,"modelMatrix",re.matrixWorld),oe.isShaderMaterial||oe.isRawShaderMaterial){const Mn=oe.uniformsGroups;for(let Js=0,$n=Mn.length;Js<$n;Js++)if(Ee.isWebGL2){const Tl=Mn[Js];_e.update(Tl,qt),_e.bind(Tl,qt)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return qt}function fh(O,$){O.ambientLightColor.needsUpdate=$,O.lightProbe.needsUpdate=$,O.directionalLights.needsUpdate=$,O.directionalLightShadows.needsUpdate=$,O.pointLights.needsUpdate=$,O.pointLightShadows.needsUpdate=$,O.spotLights.needsUpdate=$,O.spotLightShadows.needsUpdate=$,O.rectAreaLights.needsUpdate=$,O.hemisphereLights.needsUpdate=$}function ph(O){return O.isMeshLambertMaterial||O.isMeshToonMaterial||O.isMeshPhongMaterial||O.isMeshStandardMaterial||O.isShadowMaterial||O.isShaderMaterial&&O.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(O,$,se){Le.get(O.texture).__webglTexture=$,Le.get(O.depthTexture).__webglTexture=se;const oe=Le.get(O);oe.__hasExternalTextures=!0,oe.__hasExternalTextures&&(oe.__autoAllocateDepthBuffer=se===void 0,oe.__autoAllocateDepthBuffer||ue.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),oe.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(O,$){const se=Le.get(O);se.__webglFramebuffer=$,se.__useDefaultFramebuffer=$===void 0},this.setRenderTarget=function(O,$=0,se=0){N=O,R=$,C=se;let oe=!0,re=null,He=!1,Ke=!1;if(O){const ot=Le.get(O);ot.__useDefaultFramebuffer!==void 0?(pe.bindFramebuffer(k.FRAMEBUFFER,null),oe=!1):ot.__webglFramebuffer===void 0?D.setupRenderTarget(O):ot.__hasExternalTextures&&D.rebindTextures(O,Le.get(O.texture).__webglTexture,Le.get(O.depthTexture).__webglTexture);const dt=O.texture;(dt.isData3DTexture||dt.isDataArrayTexture||dt.isCompressedArrayTexture)&&(Ke=!0);const ut=Le.get(O).__webglFramebuffer;O.isWebGLCubeRenderTarget?(Array.isArray(ut[$])?re=ut[$][se]:re=ut[$],He=!0):Ee.isWebGL2&&O.samples>0&&D.useMultisampledRTT(O)===!1?re=Le.get(O).__webglMultisampledFramebuffer:Array.isArray(ut)?re=ut[se]:re=ut,P.copy(O.viewport),z.copy(O.scissor),ee=O.scissorTest}else P.copy(J).multiplyScalar(le).floor(),z.copy(te).multiplyScalar(le).floor(),ee=ge;if(pe.bindFramebuffer(k.FRAMEBUFFER,re)&&Ee.drawBuffers&&oe&&pe.drawBuffers(O,re),pe.viewport(P),pe.scissor(z),pe.setScissorTest(ee),He){const ot=Le.get(O.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+$,ot.__webglTexture,se)}else if(Ke){const ot=Le.get(O.texture),dt=$||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,ot.__webglTexture,se||0,dt)}B=-1},this.readRenderTargetPixels=function(O,$,se,oe,re,He,Ke){if(!(O&&O.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let st=Le.get(O).__webglFramebuffer;if(O.isWebGLCubeRenderTarget&&Ke!==void 0&&(st=st[Ke]),st){pe.bindFramebuffer(k.FRAMEBUFFER,st);try{const ot=O.texture,dt=ot.format,ut=ot.type;if(dt!==Wn&&Ge.convert(dt)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ft=ut===Go&&(ue.has("EXT_color_buffer_half_float")||Ee.isWebGL2&&ue.has("EXT_color_buffer_float"));if(ut!==$i&&Ge.convert(ut)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_TYPE)&&!(ut===Ni&&(Ee.isWebGL2||ue.has("OES_texture_float")||ue.has("WEBGL_color_buffer_float")))&&!ft){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}$>=0&&$<=O.width-oe&&se>=0&&se<=O.height-re&&k.readPixels($,se,oe,re,Ge.convert(dt),Ge.convert(ut),He)}finally{const ot=N!==null?Le.get(N).__webglFramebuffer:null;pe.bindFramebuffer(k.FRAMEBUFFER,ot)}}},this.copyFramebufferToTexture=function(O,$,se=0){const oe=Math.pow(2,-se),re=Math.floor($.image.width*oe),He=Math.floor($.image.height*oe);D.setTexture2D($,0),k.copyTexSubImage2D(k.TEXTURE_2D,se,0,0,O.x,O.y,re,He),pe.unbindTexture()},this.copyTextureToTexture=function(O,$,se,oe=0){const re=$.image.width,He=$.image.height,Ke=Ge.convert(se.format),st=Ge.convert(se.type);D.setTexture2D(se,0),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,se.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,se.unpackAlignment),$.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,oe,O.x,O.y,re,He,Ke,st,$.image.data):$.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,oe,O.x,O.y,$.mipmaps[0].width,$.mipmaps[0].height,Ke,$.mipmaps[0].data):k.texSubImage2D(k.TEXTURE_2D,oe,O.x,O.y,Ke,st,$.image),oe===0&&se.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),pe.unbindTexture()},this.copyTextureToTexture3D=function(O,$,se,oe,re=0){if(M.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const He=O.max.x-O.min.x+1,Ke=O.max.y-O.min.y+1,st=O.max.z-O.min.z+1,ot=Ge.convert(oe.format),dt=Ge.convert(oe.type);let ut;if(oe.isData3DTexture)D.setTexture3D(oe,0),ut=k.TEXTURE_3D;else if(oe.isDataArrayTexture||oe.isCompressedArrayTexture)D.setTexture2DArray(oe,0),ut=k.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,oe.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,oe.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,oe.unpackAlignment);const ft=k.getParameter(k.UNPACK_ROW_LENGTH),Gt=k.getParameter(k.UNPACK_IMAGE_HEIGHT),Sn=k.getParameter(k.UNPACK_SKIP_PIXELS),Bt=k.getParameter(k.UNPACK_SKIP_ROWS),dn=k.getParameter(k.UNPACK_SKIP_IMAGES),at=se.isCompressedTexture?se.mipmaps[re]:se.image;k.pixelStorei(k.UNPACK_ROW_LENGTH,at.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,at.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,O.min.x),k.pixelStorei(k.UNPACK_SKIP_ROWS,O.min.y),k.pixelStorei(k.UNPACK_SKIP_IMAGES,O.min.z),se.isDataTexture||se.isData3DTexture?k.texSubImage3D(ut,re,$.x,$.y,$.z,He,Ke,st,ot,dt,at.data):se.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),k.compressedTexSubImage3D(ut,re,$.x,$.y,$.z,He,Ke,st,ot,at.data)):k.texSubImage3D(ut,re,$.x,$.y,$.z,He,Ke,st,ot,dt,at),k.pixelStorei(k.UNPACK_ROW_LENGTH,ft),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Gt),k.pixelStorei(k.UNPACK_SKIP_PIXELS,Sn),k.pixelStorei(k.UNPACK_SKIP_ROWS,Bt),k.pixelStorei(k.UNPACK_SKIP_IMAGES,dn),re===0&&oe.generateMipmaps&&k.generateMipmap(ut),pe.unbindTexture()},this.initTexture=function(O){O.isCubeTexture?D.setTextureCube(O,0):O.isData3DTexture?D.setTexture3D(O,0):O.isDataArrayTexture||O.isCompressedArrayTexture?D.setTexture2DArray(O,0):D.setTexture2D(O,0),pe.unbindTexture()},this.resetState=function(){R=0,C=0,N=null,pe.reset(),V.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Hu?"display-p3":"srgb",t.unpackColorSpace=Dt.workingColorSpace===hl?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===cn?qr:Tp}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===qr?cn:nr}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class gx extends Fp{}gx.prototype.isWebGL1Renderer=!0;class Wu{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new ke(e),this.density=t}clone(){return new Wu(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class ju{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new ke(e),this.near=t,this.far=n}clone(){return new ju(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class zp extends Nt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Xu{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=el,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=li()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=li()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=li()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Hn=new U;class ai{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Hn.fromBufferAttribute(this,t),Hn.applyMatrix4(e),this.setXYZ(t,Hn.x,Hn.y,Hn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Hn.fromBufferAttribute(this,t),Hn.applyNormalMatrix(e),this.setXYZ(t,Hn.x,Hn.y,Hn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Hn.fromBufferAttribute(this,t),Hn.transformDirection(e),this.setXYZ(t,Hn.x,Hn.y,Hn.z);return this}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Kn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Kn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Kn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Kn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array),s=vt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new Ut(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new ai(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Bp extends zn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ke(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let To;const wa=new U,Ao=new U,Co=new U,Ro=new he,Ta=new he,_x=new lt,Hc=new U,Aa=new U,Vc=new U,N0=new he,Gd=new he,D0=new he;class vx extends Nt{constructor(e=new Bp){if(super(),this.isSprite=!0,this.type="Sprite",To===void 0){To=new St;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Xu(t,5);To.setIndex([0,1,2,0,2,3]),To.setAttribute("position",new ai(n,3,0,!1)),To.setAttribute("uv",new ai(n,2,3,!1))}this.geometry=To,this.material=e,this.center=new he(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ao.setFromMatrixScale(this.matrixWorld),_x.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Co.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ao.multiplyScalar(-Co.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;Gc(Hc.set(-.5,-.5,0),Co,a,Ao,i,s),Gc(Aa.set(.5,-.5,0),Co,a,Ao,i,s),Gc(Vc.set(.5,.5,0),Co,a,Ao,i,s),N0.set(0,0),Gd.set(1,0),D0.set(1,1);let c=e.ray.intersectTriangle(Hc,Aa,Vc,!1,wa);if(c===null&&(Gc(Aa.set(-.5,.5,0),Co,a,Ao,i,s),Gd.set(0,1),c=e.ray.intersectTriangle(Hc,Vc,Aa,!1,wa),c===null))return;const u=e.ray.origin.distanceTo(wa);u<e.near||u>e.far||t.push({distance:u,point:wa.clone(),uv:Jn.getInterpolation(wa,Hc,Aa,Vc,N0,Gd,D0,new he),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Gc(r,e,t,n,i,s){Ro.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Ta.x=s*Ro.x-i*Ro.y,Ta.y=i*Ro.x+s*Ro.y):Ta.copy(Ro),r.copy(e),r.x+=Ta.x,r.y+=Ta.y,r.applyMatrix4(_x)}const Wc=new U,U0=new U;class xx extends Nt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Wc.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Wc);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Wc.setFromMatrixPosition(e.matrixWorld),U0.setFromMatrixPosition(this.matrixWorld);const n=Wc.distanceTo(U0)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let a=t[i].distance;if(t[i].object.visible&&(a-=a*t[i].hysteresis),n>=a)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const O0=new U,F0=new At,z0=new At,VT=new U,B0=new lt,jc=new U,Wd=new xn,k0=new lt,jd=new Vs;class yx extends an{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Cf,this.bindMatrix=new lt,this.bindMatrixInverse=new lt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new vn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,jc),this.boundingBox.expandByPoint(jc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new xn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,jc),this.boundingSphere.expandByPoint(jc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Wd.copy(this.boundingSphere),Wd.applyMatrix4(i),e.ray.intersectsSphere(Wd)!==!1&&(k0.copy(i).invert(),jd.copy(e.ray).applyMatrix4(k0),!(this.boundingBox!==null&&jd.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,jd)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new At,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Cf?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Iv?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;F0.fromBufferAttribute(i.attributes.skinIndex,e),z0.fromBufferAttribute(i.attributes.skinWeight,e),O0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=z0.getComponent(s);if(a!==0){const c=F0.getComponent(s);B0.multiplyMatrices(n.bones[c].matrixWorld,n.boneInverses[c]),t.addScaledVector(VT.copy(O0).applyMatrix4(B0),a)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}class kp extends Nt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Fs extends nn{constructor(e=null,t=1,n=1,i,s,a,c,u,h=en,d=en,f,m){super(null,a,c,u,h,d,i,s,f,m),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const H0=new lt,GT=new lt;class qu{constructor(e=[],t=[]){this.uuid=li(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new lt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new lt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const c=e[s]?e[s].matrixWorld:GT;H0.multiplyMatrices(c,t[s]),H0.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new qu(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Fs(t,e,e,Wn,Ni);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new kp),this.bones.push(a),this.boneInverses.push(new lt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const c=n[i];e.boneInverses.push(c.toArray())}return e}}class qo extends Ut{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Po=new lt,V0=new lt,Xc=[],G0=new vn,WT=new lt,Ca=new an,Ra=new xn;class Sx extends an{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new qo(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,WT)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new vn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Po),G0.copy(e.boundingBox).applyMatrix4(Po),this.boundingBox.union(G0)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new xn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Po),Ra.copy(e.boundingSphere).applyMatrix4(Po),this.boundingSphere.union(Ra)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ca.geometry=this.geometry,Ca.material=this.material,Ca.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ra.copy(this.boundingSphere),Ra.applyMatrix4(n),e.ray.intersectsSphere(Ra)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Po),V0.multiplyMatrices(n,Po),Ca.matrixWorld=V0,Ca.raycast(e,Xc);for(let a=0,c=Xc.length;a<c;a++){const u=Xc[a];u.instanceId=s,u.object=this,t.push(u)}Xc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new qo(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}function jT(r,e){return r.z-e.z}function XT(r,e){return e.z-r.z}class qT{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t){const n=this.pool,i=this.list;this.index>=n.length&&n.push({start:-1,count:-1,z:-1});const s=n[this.index];i.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=t}reset(){this.list.length=0,this.index=0}}const Lo="batchId",kr=new lt,W0=new lt,YT=new lt,j0=new lt,Xd=new ml,qc=new vn,ms=new xn,Pa=new U,qd=new qT,Dn=new an,Yc=[];function ZT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let a=0;a<n;a++)e.setComponent(s+t,a,r.getComponent(s,a))}else e.array.set(r.array,t*n);e.needsUpdate=!0}class Mx extends an{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,t,n=t*2,i){super(new St,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxGeometryCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Fs(t,e,e,Wn,Ni);this._matricesTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxGeometryCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(const c in e.attributes){const u=e.getAttribute(c),{array:h,itemSize:d,normalized:f}=u,m=new h.constructor(n*d),g=new u.constructor(m,d,f);g.setUsage(u.usage),t.setAttribute(c,g)}if(e.getIndex()!==null){const c=n>65536?new Uint32Array(s):new Uint16Array(s);t.setIndex(new Ut(c,1))}const a=i>65536?new Uint32Array(n):new Uint16Array(n);t.setAttribute(Lo,new Ut(a,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(Lo))throw new Error(`BatchedMesh: Geometry cannot use attribute "${Lo}"`);const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(n===Lo)continue;if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new vn);const e=this._geometryCount,t=this.boundingBox,n=this._active;t.makeEmpty();for(let i=0;i<e;i++)n[i]!==!1&&(this.getMatrixAt(i,kr),this.getBoundingBoxAt(i,qc).applyMatrix4(kr),t.union(qc))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new xn);const e=this._geometryCount,t=this.boundingSphere,n=this._active;t.makeEmpty();for(let i=0;i<e;i++)n[i]!==!1&&(this.getMatrixAt(i,kr),this.getBoundingSphereAt(i,ms).applyMatrix4(kr),t.union(ms))}addGeometry(e,t=-1,n=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const a=this._reservedRanges,c=this._drawRanges,u=this._bounds;this._geometryCount!==0&&(s=a[a.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const h=e.getIndex(),d=h!==null;if(d&&(n===-1?i.indexCount=h.count:i.indexCount=n,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const f=this._visibility,m=this._active,g=this._matricesTexture,x=this._matricesTexture.image.data;f.push(!0),m.push(!0);const S=this._geometryCount;this._geometryCount++,YT.toArray(x,S*16),g.needsUpdate=!0,a.push(i),c.push({start:d?i.indexStart:i.vertexStart,count:-1}),u.push({boxInitialized:!1,box:new vn,sphereInitialized:!1,sphere:new xn});const y=this.geometry.getAttribute(Lo);for(let _=0;_<i.vertexCount;_++)y.setX(i.vertexStart+_,S);return y.needsUpdate=!0,this.setGeometryAt(S,e),S}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),c=this._reservedRanges[e];if(i&&a.count>c.indexCount||t.attributes.position.count>c.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const u=c.vertexStart,h=c.vertexCount;for(const g in n.attributes){if(g===Lo)continue;const x=t.getAttribute(g),S=n.getAttribute(g);ZT(x,S,u);const y=x.itemSize;for(let _=x.count,b=h;_<b;_++){const M=u+_;for(let T=0;T<y;T++)S.setComponent(M,T,0)}S.needsUpdate=!0}if(i){const g=c.indexStart;for(let x=0;x<a.count;x++)s.setX(g+x,u+a.getX(x));for(let x=a.count,S=c.indexCount;x<S;x++)s.setX(g+x,u);s.needsUpdate=!0}const d=this._bounds[e];t.boundingBox!==null?(d.box.copy(t.boundingBox),d.boxInitialized=!0):d.boxInitialized=!1,t.boundingSphere!==null?(d.sphere.copy(t.boundingSphere),d.sphereInitialized=!0):d.sphereInitialized=!1;const f=this._drawRanges[e],m=t.getAttribute("position");return f.count=i?a.count:m.count,this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._active;return e>=t.length||t[e]===!1?this:(t[e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(this._active[e]===!1)return this;const i=this._bounds[e],s=i.box,a=this.geometry;if(i.boxInitialized===!1){s.makeEmpty();const c=a.index,u=a.attributes.position,h=this._drawRanges[e];for(let d=h.start,f=h.start+h.count;d<f;d++){let m=d;c&&(m=c.getX(m)),s.expandByPoint(Pa.fromBufferAttribute(u,m))}i.boxInitialized=!0}return t.copy(s),t}getBoundingSphereAt(e,t){if(this._active[e]===!1)return this;const i=this._bounds[e],s=i.sphere,a=this.geometry;if(i.sphereInitialized===!1){s.makeEmpty(),this.getBoundingBoxAt(e,qc),qc.getCenter(s.center);const c=a.index,u=a.attributes.position,h=this._drawRanges[e];let d=0;for(let f=h.start,m=h.start+h.count;f<m;f++){let g=f;c&&(g=c.getX(g)),Pa.fromBufferAttribute(u,g),d=Math.max(d,s.center.distanceToSquared(Pa))}s.radius=Math.sqrt(d),i.sphereInitialized=!0}return t.copy(s),t}setMatrixAt(e,t){const n=this._active,i=this._matricesTexture,s=this._matricesTexture.image.data,a=this._geometryCount;return e>=a||n[e]===!1?this:(t.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._active,i=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||n[e]===!1?null:t.fromArray(i,e*16)}setVisibleAt(e,t){const n=this._visibility,i=this._active,s=this._geometryCount;return e>=s||i[e]===!1||n[e]===t?this:(n[e]=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._visibility,n=this._active,i=this._geometryCount;return e>=i||n[e]===!1?!1:t[e]}raycast(e,t){const n=this._visibility,i=this._active,s=this._drawRanges,a=this._geometryCount,c=this.matrixWorld,u=this.geometry;Dn.material=this.material,Dn.geometry.index=u.index,Dn.geometry.attributes=u.attributes,Dn.geometry.boundingBox===null&&(Dn.geometry.boundingBox=new vn),Dn.geometry.boundingSphere===null&&(Dn.geometry.boundingSphere=new xn);for(let h=0;h<a;h++){if(!n[h]||!i[h])continue;const d=s[h];Dn.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(h,Dn.matrixWorld).premultiply(c),this.getBoundingBoxAt(h,Dn.geometry.boundingBox),this.getBoundingSphereAt(h,Dn.geometry.boundingSphere),Dn.raycast(e,Yc);for(let f=0,m=Yc.length;f<m;f++){const g=Yc[f];g.object=this,g.batchId=h,t.push(g)}Yc.length=0}Dn.material=null,Dn.geometry.index=null,Dn.geometry.attributes={},Dn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),c=a===null?1:a.array.BYTES_PER_ELEMENT,u=this._visibility,h=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,m=this.perObjectFrustumCulled;m&&(j0.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Xd.setFromProjectionMatrix(j0,e.isWebGPURenderer?Wo:Di));let g=0;if(this.sortObjects){W0.copy(this.matrixWorld).invert(),Pa.setFromMatrixPosition(n.matrixWorld).applyMatrix4(W0);for(let y=0,_=u.length;y<_;y++)if(u[y]){this.getMatrixAt(y,kr),this.getBoundingSphereAt(y,ms).applyMatrix4(kr);let b=!1;if(m&&(b=!Xd.intersectsSphere(ms)),!b){const M=Pa.distanceTo(ms.center);qd.push(f[y],M)}}const x=qd.list,S=this.customSort;S===null?x.sort(s.transparent?XT:jT):S.call(this,x,n);for(let y=0,_=x.length;y<_;y++){const b=x[y];h[g]=b.start*c,d[g]=b.count,g++}qd.reset()}else for(let x=0,S=u.length;x<S;x++)if(u[x]){let y=!1;if(m&&(this.getMatrixAt(x,kr),this.getBoundingSphereAt(x,ms).applyMatrix4(kr),y=!Xd.intersectsSphere(ms)),!y){const _=f[x];h[g]=_.start*c,d[g]=_.count,g++}}this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class jn extends zn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ke(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const X0=new U,q0=new U,Y0=new lt,Yd=new Vs,Zc=new xn;let Jr=class extends Nt{constructor(e=new St,t=new jn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)X0.fromBufferAttribute(t,i-1),q0.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=X0.distanceTo(q0);e.setAttribute("lineDistance",new qe(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Zc.copy(n.boundingSphere),Zc.applyMatrix4(i),Zc.radius+=s,e.ray.intersectsSphere(Zc)===!1)return;Y0.copy(i).invert(),Yd.copy(e.ray).applyMatrix4(Y0);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=new U,d=new U,f=new U,m=new U,g=this.isLineSegments?2:1,x=n.index,y=n.attributes.position;if(x!==null){const _=Math.max(0,a.start),b=Math.min(x.count,a.start+a.count);for(let M=_,T=b-1;M<T;M+=g){const R=x.getX(M),C=x.getX(M+1);if(h.fromBufferAttribute(y,R),d.fromBufferAttribute(y,C),Yd.distanceSqToSegment(h,d,m,f)>u)continue;m.applyMatrix4(this.matrixWorld);const B=e.ray.origin.distanceTo(m);B<e.near||B>e.far||t.push({distance:B,point:f.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,a.start),b=Math.min(y.count,a.start+a.count);for(let M=_,T=b-1;M<T;M+=g){if(h.fromBufferAttribute(y,M),d.fromBufferAttribute(y,M+1),Yd.distanceSqToSegment(h,d,m,f)>u)continue;m.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(m);C<e.near||C>e.far||t.push({distance:C,point:f.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}};const Z0=new U,J0=new U;class ir extends Jr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Z0.fromBufferAttribute(t,i),J0.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Z0.distanceTo(J0);e.setAttribute("lineDistance",new qe(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Ex extends Jr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Yu extends zn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ke(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const K0=new lt,sp=new Vs,Jc=new xn,Kc=new U;let bx=class extends Nt{constructor(e=new St,t=new Yu){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Jc.copy(n.boundingSphere),Jc.applyMatrix4(i),Jc.radius+=s,e.ray.intersectsSphere(Jc)===!1)return;K0.copy(i).invert(),sp.copy(e.ray).applyMatrix4(K0);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=n.index,f=n.attributes.position;if(h!==null){const m=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let x=m,S=g;x<S;x++){const y=h.getX(x);Kc.fromBufferAttribute(f,y),Q0(Kc,y,u,i,e,t,this)}}else{const m=Math.max(0,a.start),g=Math.min(f.count,a.start+a.count);for(let x=m,S=g;x<S;x++)Kc.fromBufferAttribute(f,x),Q0(Kc,x,u,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}};function Q0(r,e,t,n,i,s,a){const c=sp.distanceSqToPoint(r);if(c<t){const u=new U;sp.closestPointToPoint(r,u),u.applyMatrix4(n);const h=i.ray.origin.distanceTo(u);if(h<i.near||h>i.far)return;s.push({distance:h,distanceToRay:Math.sqrt(c),point:u,index:e,face:null,object:a})}}class JT extends nn{constructor(e,t,n,i,s,a,c,u,h){super(e,t,n,i,s,a,c,u,h),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:tn,this.magFilter=s!==void 0?s:tn,this.generateMipmaps=!1;const d=this;function f(){d.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class KT extends nn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=en,this.minFilter=en,this.generateMipmaps=!1,this.needsUpdate=!0}}class Zu extends nn{constructor(e,t,n,i,s,a,c,u,h,d,f,m){super(null,a,c,u,h,d,i,s,f,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class QT extends Zu{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Un}}class $T extends Zu{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Er),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class eA extends nn{constructor(e,t,n,i,s,a,c,u,h){super(e,t,n,i,s,a,c,u,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Fi{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let c=0,u=s-1,h;for(;c<=u;)if(i=Math.floor(c+(u-c)/2),h=n[i]-a,h<0)c=i+1;else if(h>0)u=i-1;else{u=i;break}if(i=u,n[i]===a)return i/(s-1);const d=n[i],m=n[i+1]-d,g=(a-d)/m;return(i+g)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),c=this.getPoint(s),u=t||(a.isVector2?new he:new U);return u.copy(c).sub(a).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new U,i=[],s=[],a=[],c=new U,u=new lt;for(let g=0;g<=e;g++){const x=g/e;i[g]=this.getTangentAt(x,new U)}s[0]=new U,a[0]=new U;let h=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=h&&(h=d,n.set(1,0,0)),f<=h&&(h=f,n.set(0,1,0)),m<=h&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],c),a[0].crossVectors(i[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),a[g]=a[g-1].clone(),c.crossVectors(i[g-1],i[g]),c.length()>Number.EPSILON){c.normalize();const x=Math.acos(Jt(i[g-1].dot(i[g]),-1,1));s[g].applyMatrix4(u.makeRotationAxis(c,x))}a[g].crossVectors(i[g],s[g])}if(t===!0){let g=Math.acos(Jt(s[0].dot(s[e]),-1,1));g/=e,i[0].dot(c.crossVectors(s[0],s[e]))>0&&(g=-g);for(let x=1;x<=e;x++)s[x].applyMatrix4(u.makeRotationAxis(i[x],g*x)),a[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Ju extends Fi{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,c=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=c,this.aRotation=u}getPoint(e,t){const n=t||new he,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const c=this.aStartAngle+e*s;let u=this.aX+this.xRadius*Math.cos(c),h=this.aY+this.yRadius*Math.sin(c);if(this.aRotation!==0){const d=Math.cos(this.aRotation),f=Math.sin(this.aRotation),m=u-this.aX,g=h-this.aY;u=m*d-g*f+this.aX,h=m*f+g*d+this.aY}return n.set(u,h)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class wx extends Ju{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function Hp(){let r=0,e=0,t=0,n=0;function i(s,a,c,u){r=s,e=c,t=-3*s+3*a-2*c-u,n=2*s-2*a+c+u}return{initCatmullRom:function(s,a,c,u,h){i(a,c,h*(c-s),h*(u-a))},initNonuniformCatmullRom:function(s,a,c,u,h,d,f){let m=(a-s)/h-(c-s)/(h+d)+(c-a)/d,g=(c-a)/d-(u-a)/(d+f)+(u-c)/f;m*=d,g*=d,i(a,c,m,g)},calc:function(s){const a=s*s,c=a*s;return r+e*s+t*a+n*c}}}const Qc=new U,Zd=new Hp,Jd=new Hp,Kd=new Hp;class Vp extends Fi{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new U){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let c=Math.floor(a),u=a-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/s)+1)*s:u===0&&c===s-1&&(c=s-2,u=1);let h,d;this.closed||c>0?h=i[(c-1)%s]:(Qc.subVectors(i[0],i[1]).add(i[0]),h=Qc);const f=i[c%s],m=i[(c+1)%s];if(this.closed||c+2<s?d=i[(c+2)%s]:(Qc.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=Qc),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let x=Math.pow(h.distanceToSquared(f),g),S=Math.pow(f.distanceToSquared(m),g),y=Math.pow(m.distanceToSquared(d),g);S<1e-4&&(S=1),x<1e-4&&(x=S),y<1e-4&&(y=S),Zd.initNonuniformCatmullRom(h.x,f.x,m.x,d.x,x,S,y),Jd.initNonuniformCatmullRom(h.y,f.y,m.y,d.y,x,S,y),Kd.initNonuniformCatmullRom(h.z,f.z,m.z,d.z,x,S,y)}else this.curveType==="catmullrom"&&(Zd.initCatmullRom(h.x,f.x,m.x,d.x,this.tension),Jd.initCatmullRom(h.y,f.y,m.y,d.y,this.tension),Kd.initCatmullRom(h.z,f.z,m.z,d.z,this.tension));return n.set(Zd.calc(u),Jd.calc(u),Kd.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new U().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function $0(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,c=r*r,u=r*c;return(2*t-2*n+s+a)*u+(-3*t+3*n-2*s-a)*c+s*r+t}function tA(r,e){const t=1-r;return t*t*e}function nA(r,e){return 2*(1-r)*r*e}function iA(r,e){return r*r*e}function Ha(r,e,t,n){return tA(r,e)+nA(r,t)+iA(r,n)}function rA(r,e){const t=1-r;return t*t*t*e}function sA(r,e){const t=1-r;return 3*t*t*r*e}function oA(r,e){return 3*(1-r)*r*r*e}function aA(r,e){return r*r*r*e}function Va(r,e,t,n,i){return rA(r,e)+sA(r,t)+oA(r,n)+aA(r,i)}class Gp extends Fi{constructor(e=new he,t=new he,n=new he,i=new he){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new he){const n=t,i=this.v0,s=this.v1,a=this.v2,c=this.v3;return n.set(Va(e,i.x,s.x,a.x,c.x),Va(e,i.y,s.y,a.y,c.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Tx extends Fi{constructor(e=new U,t=new U,n=new U,i=new U){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new U){const n=t,i=this.v0,s=this.v1,a=this.v2,c=this.v3;return n.set(Va(e,i.x,s.x,a.x,c.x),Va(e,i.y,s.y,a.y,c.y),Va(e,i.z,s.z,a.z,c.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Wp extends Fi{constructor(e=new he,t=new he){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new he){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new he){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ax extends Fi{constructor(e=new U,t=new U){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new U){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class jp extends Fi{constructor(e=new he,t=new he,n=new he){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new he){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Ha(e,i.x,s.x,a.x),Ha(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ku extends Fi{constructor(e=new U,t=new U,n=new U){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new U){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Ha(e,i.x,s.x,a.x),Ha(e,i.y,s.y,a.y),Ha(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Xp extends Fi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new he){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),c=s-a,u=i[a===0?a:a-1],h=i[a],d=i[a>i.length-2?i.length-1:a+1],f=i[a>i.length-3?i.length-1:a+2];return n.set($0(c,u.x,h.x,d.x,f.x),$0(c,u.y,h.y,d.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new he().fromArray(i))}return this}}var Nu=Object.freeze({__proto__:null,ArcCurve:wx,CatmullRomCurve3:Vp,CubicBezierCurve:Gp,CubicBezierCurve3:Tx,EllipseCurve:Ju,LineCurve:Wp,LineCurve3:Ax,QuadraticBezierCurve:jp,QuadraticBezierCurve3:Ku,SplineCurve:Xp});class Cx extends Fi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Nu[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,c=this.curves[s],u=c.getLength(),h=u===0?0:1-a/u;return c.getPointAt(h,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],c=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,u=a.getPoints(c);for(let h=0;h<u.length;h++){const d=u[h];n&&n.equals(d)||(t.push(d),n=d)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Nu[i.type]().fromJSON(i))}return this}}class nl extends Cx{constructor(e){super(),this.type="Path",this.currentPoint=new he,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Wp(this.currentPoint.clone(),new he(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new jp(this.currentPoint.clone(),new he(e,t),new he(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const c=new Gp(this.currentPoint.clone(),new he(e,t),new he(n,i),new he(s,a));return this.curves.push(c),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Xp(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+c,t+u,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,c,u){const h=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+h,t+d,n,i,s,a,c,u),this}absellipse(e,t,n,i,s,a,c,u){const h=new Ju(e,t,n,i,s,a,c,u);if(this.curves.length>0){const f=h.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(h);const d=h.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class _l extends St{constructor(e=[new he(0,-.5),new he(.5,0),new he(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Jt(i,0,Math.PI*2);const s=[],a=[],c=[],u=[],h=[],d=1/t,f=new U,m=new he,g=new U,x=new U,S=new U;let y=0,_=0;for(let b=0;b<=e.length-1;b++)switch(b){case 0:y=e[b+1].x-e[b].x,_=e[b+1].y-e[b].y,g.x=_*1,g.y=-y,g.z=_*0,S.copy(g),g.normalize(),u.push(g.x,g.y,g.z);break;case e.length-1:u.push(S.x,S.y,S.z);break;default:y=e[b+1].x-e[b].x,_=e[b+1].y-e[b].y,g.x=_*1,g.y=-y,g.z=_*0,x.copy(g),g.x+=S.x,g.y+=S.y,g.z+=S.z,g.normalize(),u.push(g.x,g.y,g.z),S.copy(x)}for(let b=0;b<=t;b++){const M=n+b*d*i,T=Math.sin(M),R=Math.cos(M);for(let C=0;C<=e.length-1;C++){f.x=e[C].x*T,f.y=e[C].y,f.z=e[C].x*R,a.push(f.x,f.y,f.z),m.x=b/t,m.y=C/(e.length-1),c.push(m.x,m.y);const N=u[3*C+0]*T,B=u[3*C+1],A=u[3*C+0]*R;h.push(N,B,A)}}for(let b=0;b<t;b++)for(let M=0;M<e.length-1;M++){const T=M+b*e.length,R=T,C=T+e.length,N=T+e.length+1,B=T+1;s.push(R,C,B),s.push(N,B,C)}this.setIndex(s),this.setAttribute("position",new qe(a,3)),this.setAttribute("uv",new qe(c,2)),this.setAttribute("normal",new qe(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _l(e.points,e.segments,e.phiStart,e.phiLength)}}class Qu extends _l{constructor(e=1,t=1,n=4,i=8){const s=new nl;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new Qu(e.radius,e.length,e.capSegments,e.radialSegments)}}class $u extends St{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],a=[],c=[],u=[],h=new U,d=new he;a.push(0,0,0),c.push(0,0,1),u.push(.5,.5);for(let f=0,m=3;f<=t;f++,m+=3){const g=n+f/t*i;h.x=e*Math.cos(g),h.y=e*Math.sin(g),a.push(h.x,h.y,h.z),c.push(0,0,1),d.x=(a[m]/e+1)/2,d.y=(a[m+1]/e+1)/2,u.push(d.x,d.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new qe(a,3)),this.setAttribute("normal",new qe(c,3)),this.setAttribute("uv",new qe(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $u(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Qo extends St{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,c=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:c,thetaLength:u};const h=this;i=Math.floor(i),s=Math.floor(s);const d=[],f=[],m=[],g=[];let x=0;const S=[],y=n/2;let _=0;b(),a===!1&&(e>0&&M(!0),t>0&&M(!1)),this.setIndex(d),this.setAttribute("position",new qe(f,3)),this.setAttribute("normal",new qe(m,3)),this.setAttribute("uv",new qe(g,2));function b(){const T=new U,R=new U;let C=0;const N=(t-e)/n;for(let B=0;B<=s;B++){const A=[],P=B/s,z=P*(t-e)+e;for(let ee=0;ee<=i;ee++){const de=ee/i,H=de*u+c,q=Math.sin(H),ie=Math.cos(H);R.x=z*q,R.y=-P*n+y,R.z=z*ie,f.push(R.x,R.y,R.z),T.set(q,N,ie).normalize(),m.push(T.x,T.y,T.z),g.push(de,1-P),A.push(x++)}S.push(A)}for(let B=0;B<i;B++)for(let A=0;A<s;A++){const P=S[A][B],z=S[A+1][B],ee=S[A+1][B+1],de=S[A][B+1];d.push(P,z,de),d.push(z,ee,de),C+=6}h.addGroup(_,C,0),_+=C}function M(T){const R=x,C=new he,N=new U;let B=0;const A=T===!0?e:t,P=T===!0?1:-1;for(let ee=1;ee<=i;ee++)f.push(0,y*P,0),m.push(0,P,0),g.push(.5,.5),x++;const z=x;for(let ee=0;ee<=i;ee++){const H=ee/i*u+c,q=Math.cos(H),ie=Math.sin(H);N.x=A*ie,N.y=y*P,N.z=A*q,f.push(N.x,N.y,N.z),m.push(0,P,0),C.x=q*.5+.5,C.y=ie*.5*P+.5,g.push(C.x,C.y),x++}for(let ee=0;ee<i;ee++){const de=R+ee,H=z+ee;T===!0?d.push(H,H+1,de):d.push(H+1,H,de),B+=3}h.addGroup(_,B,T===!0?1:2),_+=B}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class eh extends Qo{constructor(e=1,t=1,n=32,i=1,s=!1,a=0,c=Math.PI*2){super(0,e,t,n,i,s,a,c),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:c}}static fromJSON(e){return new eh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class $r extends St{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],a=[];c(i),h(n),d(),this.setAttribute("position",new qe(s,3)),this.setAttribute("normal",new qe(s.slice(),3)),this.setAttribute("uv",new qe(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function c(b){const M=new U,T=new U,R=new U;for(let C=0;C<t.length;C+=3)g(t[C+0],M),g(t[C+1],T),g(t[C+2],R),u(M,T,R,b)}function u(b,M,T,R){const C=R+1,N=[];for(let B=0;B<=C;B++){N[B]=[];const A=b.clone().lerp(T,B/C),P=M.clone().lerp(T,B/C),z=C-B;for(let ee=0;ee<=z;ee++)ee===0&&B===C?N[B][ee]=A:N[B][ee]=A.clone().lerp(P,ee/z)}for(let B=0;B<C;B++)for(let A=0;A<2*(C-B)-1;A++){const P=Math.floor(A/2);A%2===0?(m(N[B][P+1]),m(N[B+1][P]),m(N[B][P])):(m(N[B][P+1]),m(N[B+1][P+1]),m(N[B+1][P]))}}function h(b){const M=new U;for(let T=0;T<s.length;T+=3)M.x=s[T+0],M.y=s[T+1],M.z=s[T+2],M.normalize().multiplyScalar(b),s[T+0]=M.x,s[T+1]=M.y,s[T+2]=M.z}function d(){const b=new U;for(let M=0;M<s.length;M+=3){b.x=s[M+0],b.y=s[M+1],b.z=s[M+2];const T=y(b)/2/Math.PI+.5,R=_(b)/Math.PI+.5;a.push(T,1-R)}x(),f()}function f(){for(let b=0;b<a.length;b+=6){const M=a[b+0],T=a[b+2],R=a[b+4],C=Math.max(M,T,R),N=Math.min(M,T,R);C>.9&&N<.1&&(M<.2&&(a[b+0]+=1),T<.2&&(a[b+2]+=1),R<.2&&(a[b+4]+=1))}}function m(b){s.push(b.x,b.y,b.z)}function g(b,M){const T=b*3;M.x=e[T+0],M.y=e[T+1],M.z=e[T+2]}function x(){const b=new U,M=new U,T=new U,R=new U,C=new he,N=new he,B=new he;for(let A=0,P=0;A<s.length;A+=9,P+=6){b.set(s[A+0],s[A+1],s[A+2]),M.set(s[A+3],s[A+4],s[A+5]),T.set(s[A+6],s[A+7],s[A+8]),C.set(a[P+0],a[P+1]),N.set(a[P+2],a[P+3]),B.set(a[P+4],a[P+5]),R.copy(b).add(M).add(T).divideScalar(3);const z=y(R);S(C,P+0,b,z),S(N,P+2,M,z),S(B,P+4,T,z)}}function S(b,M,T,R){R<0&&b.x===1&&(a[M]=b.x-1),T.x===0&&T.z===0&&(a[M]=R/2/Math.PI+.5)}function y(b){return Math.atan2(b.z,-b.x)}function _(b){return Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $r(e.vertices,e.indices,e.radius,e.details)}}class th extends $r{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[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];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new th(e.radius,e.detail)}}const $c=new U,eu=new U,Qd=new U,tu=new Jn;class Rx extends St{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(Us*t),a=e.getIndex(),c=e.getAttribute("position"),u=a?a.count:c.count,h=[0,0,0],d=["a","b","c"],f=new Array(3),m={},g=[];for(let x=0;x<u;x+=3){a?(h[0]=a.getX(x),h[1]=a.getX(x+1),h[2]=a.getX(x+2)):(h[0]=x,h[1]=x+1,h[2]=x+2);const{a:S,b:y,c:_}=tu;if(S.fromBufferAttribute(c,h[0]),y.fromBufferAttribute(c,h[1]),_.fromBufferAttribute(c,h[2]),tu.getNormal(Qd),f[0]=`${Math.round(S.x*i)},${Math.round(S.y*i)},${Math.round(S.z*i)}`,f[1]=`${Math.round(y.x*i)},${Math.round(y.y*i)},${Math.round(y.z*i)}`,f[2]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let b=0;b<3;b++){const M=(b+1)%3,T=f[b],R=f[M],C=tu[d[b]],N=tu[d[M]],B=`${T}_${R}`,A=`${R}_${T}`;A in m&&m[A]?(Qd.dot(m[A].normal)<=s&&(g.push(C.x,C.y,C.z),g.push(N.x,N.y,N.z)),m[A]=null):B in m||(m[B]={index0:h[b],index1:h[M],normal:Qd.clone()})}}for(const x in m)if(m[x]){const{index0:S,index1:y}=m[x];$c.fromBufferAttribute(c,S),eu.fromBufferAttribute(c,y),g.push($c.x,$c.y,$c.z),g.push(eu.x,eu.y,eu.z)}this.setAttribute("position",new qe(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class zs extends nl{constructor(e){super(e),this.uuid=li(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new nl().fromJSON(i))}return this}}const lA={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=Px(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let c,u,h,d,f,m,g;if(n&&(s=fA(r,e,s,t)),r.length>80*t){c=h=r[0],u=d=r[1];for(let x=t;x<i;x+=t)f=r[x],m=r[x+1],f<c&&(c=f),m<u&&(u=m),f>h&&(h=f),m>d&&(d=m);g=Math.max(h-c,d-u),g=g!==0?32767/g:0}return il(s,a,t,c,u,g,0),a}};function Px(r,e,t,n,i){let s,a;if(i===bA(r,e,t,n)>0)for(s=e;s<t;s+=n)a=e_(s,r[s],r[s+1],a);else for(s=t-n;s>=e;s-=n)a=e_(s,r[s],r[s+1],a);return a&&nh(a,a.next)&&(sl(a),a=a.next),a}function Hs(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(nh(t,t.next)||Xt(t.prev,t,t.next)===0)){if(sl(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function il(r,e,t,n,i,s,a){if(!r)return;!a&&s&&vA(r,n,i,s);let c=r,u,h;for(;r.prev!==r.next;){if(u=r.prev,h=r.next,s?uA(r,n,i,s):cA(r)){e.push(u.i/t|0),e.push(r.i/t|0),e.push(h.i/t|0),sl(r),r=h.next,c=h.next;continue}if(r=h,r===c){a?a===1?(r=hA(Hs(r),e,t),il(r,e,t,n,i,s,2)):a===2&&dA(r,e,t,n,i,s):il(Hs(r),e,t,n,i,s,1);break}}}function cA(r){const e=r.prev,t=r,n=r.next;if(Xt(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,c=e.y,u=t.y,h=n.y,d=i<s?i<a?i:a:s<a?s:a,f=c<u?c<h?c:h:u<h?u:h,m=i>s?i>a?i:a:s>a?s:a,g=c>u?c>h?c:h:u>h?u:h;let x=n.next;for(;x!==e;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=g&&ko(i,c,s,u,a,h,x.x,x.y)&&Xt(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function uA(r,e,t,n){const i=r.prev,s=r,a=r.next;if(Xt(i,s,a)>=0)return!1;const c=i.x,u=s.x,h=a.x,d=i.y,f=s.y,m=a.y,g=c<u?c<h?c:h:u<h?u:h,x=d<f?d<m?d:m:f<m?f:m,S=c>u?c>h?c:h:u>h?u:h,y=d>f?d>m?d:m:f>m?f:m,_=op(g,x,e,t,n),b=op(S,y,e,t,n);let M=r.prevZ,T=r.nextZ;for(;M&&M.z>=_&&T&&T.z<=b;){if(M.x>=g&&M.x<=S&&M.y>=x&&M.y<=y&&M!==i&&M!==a&&ko(c,d,u,f,h,m,M.x,M.y)&&Xt(M.prev,M,M.next)>=0||(M=M.prevZ,T.x>=g&&T.x<=S&&T.y>=x&&T.y<=y&&T!==i&&T!==a&&ko(c,d,u,f,h,m,T.x,T.y)&&Xt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;M&&M.z>=_;){if(M.x>=g&&M.x<=S&&M.y>=x&&M.y<=y&&M!==i&&M!==a&&ko(c,d,u,f,h,m,M.x,M.y)&&Xt(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;T&&T.z<=b;){if(T.x>=g&&T.x<=S&&T.y>=x&&T.y<=y&&T!==i&&T!==a&&ko(c,d,u,f,h,m,T.x,T.y)&&Xt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function hA(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!nh(i,s)&&Lx(i,n,n.next,s)&&rl(i,s)&&rl(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),sl(n),sl(n.next),n=r=s),n=n.next}while(n!==r);return Hs(n)}function dA(r,e,t,n,i,s){let a=r;do{let c=a.next.next;for(;c!==a.prev;){if(a.i!==c.i&&SA(a,c)){let u=Ix(a,c);a=Hs(a,a.next),u=Hs(u,u.next),il(a,e,t,n,i,s,0),il(u,e,t,n,i,s,0);return}c=c.next}a=a.next}while(a!==r)}function fA(r,e,t,n){const i=[];let s,a,c,u,h;for(s=0,a=e.length;s<a;s++)c=e[s]*n,u=s<a-1?e[s+1]*n:r.length,h=Px(r,c,u,n,!1),h===h.next&&(h.steiner=!0),i.push(yA(h));for(i.sort(pA),s=0;s<i.length;s++)t=mA(i[s],t);return t}function pA(r,e){return r.x-e.x}function mA(r,e){const t=gA(r,e);if(!t)return e;const n=Ix(t,r);return Hs(n,n.next),Hs(t,t.next)}function gA(r,e){let t=e,n=-1/0,i;const s=r.x,a=r.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){const m=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(m<=s&&m>n&&(n=m,i=t.x<t.next.x?t:t.next,m===s))return i}t=t.next}while(t!==e);if(!i)return null;const c=i,u=i.x,h=i.y;let d=1/0,f;t=i;do s>=t.x&&t.x>=u&&s!==t.x&&ko(a<h?s:n,a,u,h,a<h?n:s,a,t.x,t.y)&&(f=Math.abs(a-t.y)/(s-t.x),rl(t,r)&&(f<d||f===d&&(t.x>i.x||t.x===i.x&&_A(i,t)))&&(i=t,d=f)),t=t.next;while(t!==c);return i}function _A(r,e){return Xt(r.prev,r,e.prev)<0&&Xt(e.next,r,r.next)<0}function vA(r,e,t,n){let i=r;do i.z===0&&(i.z=op(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,xA(i)}function xA(r){let e,t,n,i,s,a,c,u,h=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,c=0,e=0;e<h&&(c++,n=n.nextZ,!!n);e++);for(u=h;c>0||u>0&&n;)c!==0&&(u===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,c--):(i=n,n=n.nextZ,u--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,h*=2}while(a>1);return r}function op(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function yA(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function ko(r,e,t,n,i,s,a,c){return(i-a)*(e-c)>=(r-a)*(s-c)&&(r-a)*(n-c)>=(t-a)*(e-c)&&(t-a)*(s-c)>=(i-a)*(n-c)}function SA(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!MA(r,e)&&(rl(r,e)&&rl(e,r)&&EA(r,e)&&(Xt(r.prev,r,e.prev)||Xt(r,e.prev,e))||nh(r,e)&&Xt(r.prev,r,r.next)>0&&Xt(e.prev,e,e.next)>0)}function Xt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function nh(r,e){return r.x===e.x&&r.y===e.y}function Lx(r,e,t,n){const i=iu(Xt(r,e,t)),s=iu(Xt(r,e,n)),a=iu(Xt(t,n,r)),c=iu(Xt(t,n,e));return!!(i!==s&&a!==c||i===0&&nu(r,t,e)||s===0&&nu(r,n,e)||a===0&&nu(t,r,n)||c===0&&nu(t,e,n))}function nu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function iu(r){return r>0?1:r<0?-1:0}function MA(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Lx(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rl(r,e){return Xt(r.prev,r,r.next)<0?Xt(r,e,r.next)>=0&&Xt(r,r.prev,e)>=0:Xt(r,e,r.prev)<0||Xt(r,r.next,e)<0}function EA(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Ix(r,e){const t=new ap(r.i,r.x,r.y),n=new ap(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function e_(r,e,t,n){const i=new ap(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function sl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function ap(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function bA(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class tr{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return tr.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];t_(e),n_(n,e);let a=e.length;t.forEach(t_);for(let u=0;u<t.length;u++)i.push(a),a+=t[u].length,n_(n,t[u]);const c=lA.triangulate(n,i);for(let u=0;u<c.length;u+=3)s.push(c.slice(u,u+3));return s}}function t_(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function n_(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class ih extends St{constructor(e=new zs([new he(.5,.5),new he(-.5,.5),new he(-.5,-.5),new he(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let c=0,u=e.length;c<u;c++){const h=e[c];a(h)}this.setAttribute("position",new qe(i,3)),this.setAttribute("uv",new qe(s,2)),this.computeVertexNormals();function a(c){const u=[],h=t.curveSegments!==void 0?t.curveSegments:12,d=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1;let m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,x=t.bevelSize!==void 0?t.bevelSize:g-.1,S=t.bevelOffset!==void 0?t.bevelOffset:0,y=t.bevelSegments!==void 0?t.bevelSegments:3;const _=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:wA;let M,T=!1,R,C,N,B;_&&(M=_.getSpacedPoints(d),T=!0,m=!1,R=_.computeFrenetFrames(d,!1),C=new U,N=new U,B=new U),m||(y=0,g=0,x=0,S=0);const A=c.extractPoints(h);let P=A.shape;const z=A.holes;if(!tr.isClockWise(P)){P=P.reverse();for(let k=0,ve=z.length;k<ve;k++){const ue=z[k];tr.isClockWise(ue)&&(z[k]=ue.reverse())}}const de=tr.triangulateShape(P,z),H=P;for(let k=0,ve=z.length;k<ve;k++){const ue=z[k];P=P.concat(ue)}function q(k,ve,ue){return ve||console.error("THREE.ExtrudeGeometry: vec does not exist"),k.clone().addScaledVector(ve,ue)}const ie=P.length,le=de.length;function j(k,ve,ue){let Ee,pe,Ve;const Le=k.x-ve.x,D=k.y-ve.y,I=ue.x-k.x,Q=ue.y-k.y,ye=Le*Le+D*D,xe=Le*Q-D*I;if(Math.abs(xe)>Number.EPSILON){const me=Math.sqrt(ye),Xe=Math.sqrt(I*I+Q*Q),Re=ve.x-D/me,Ie=ve.y+Le/me,et=ue.x-Q/Xe,ht=ue.y+I/Xe,Se=((et-Re)*Q-(ht-Ie)*I)/(Le*Q-D*I);Ee=Re+Le*Se-k.x,pe=Ie+D*Se-k.y;const wt=Ee*Ee+pe*pe;if(wt<=2)return new he(Ee,pe);Ve=Math.sqrt(wt/2)}else{let me=!1;Le>Number.EPSILON?I>Number.EPSILON&&(me=!0):Le<-Number.EPSILON?I<-Number.EPSILON&&(me=!0):Math.sign(D)===Math.sign(Q)&&(me=!0),me?(Ee=-D,pe=Le,Ve=Math.sqrt(ye)):(Ee=Le,pe=D,Ve=Math.sqrt(ye/2))}return new he(Ee/Ve,pe/Ve)}const Z=[];for(let k=0,ve=H.length,ue=ve-1,Ee=k+1;k<ve;k++,ue++,Ee++)ue===ve&&(ue=0),Ee===ve&&(Ee=0),Z[k]=j(H[k],H[ue],H[Ee]);const J=[];let te,ge=Z.concat();for(let k=0,ve=z.length;k<ve;k++){const ue=z[k];te=[];for(let Ee=0,pe=ue.length,Ve=pe-1,Le=Ee+1;Ee<pe;Ee++,Ve++,Le++)Ve===pe&&(Ve=0),Le===pe&&(Le=0),te[Ee]=j(ue[Ee],ue[Ve],ue[Le]);J.push(te),ge=ge.concat(te)}for(let k=0;k<y;k++){const ve=k/y,ue=g*Math.cos(ve*Math.PI/2),Ee=x*Math.sin(ve*Math.PI/2)+S;for(let pe=0,Ve=H.length;pe<Ve;pe++){const Le=q(H[pe],Z[pe],Ee);Ne(Le.x,Le.y,-ue)}for(let pe=0,Ve=z.length;pe<Ve;pe++){const Le=z[pe];te=J[pe];for(let D=0,I=Le.length;D<I;D++){const Q=q(Le[D],te[D],Ee);Ne(Q.x,Q.y,-ue)}}}const K=x+S;for(let k=0;k<ie;k++){const ve=m?q(P[k],ge[k],K):P[k];T?(N.copy(R.normals[0]).multiplyScalar(ve.x),C.copy(R.binormals[0]).multiplyScalar(ve.y),B.copy(M[0]).add(N).add(C),Ne(B.x,B.y,B.z)):Ne(ve.x,ve.y,0)}for(let k=1;k<=d;k++)for(let ve=0;ve<ie;ve++){const ue=m?q(P[ve],ge[ve],K):P[ve];T?(N.copy(R.normals[k]).multiplyScalar(ue.x),C.copy(R.binormals[k]).multiplyScalar(ue.y),B.copy(M[k]).add(N).add(C),Ne(B.x,B.y,B.z)):Ne(ue.x,ue.y,f/d*k)}for(let k=y-1;k>=0;k--){const ve=k/y,ue=g*Math.cos(ve*Math.PI/2),Ee=x*Math.sin(ve*Math.PI/2)+S;for(let pe=0,Ve=H.length;pe<Ve;pe++){const Le=q(H[pe],Z[pe],Ee);Ne(Le.x,Le.y,f+ue)}for(let pe=0,Ve=z.length;pe<Ve;pe++){const Le=z[pe];te=J[pe];for(let D=0,I=Le.length;D<I;D++){const Q=q(Le[D],te[D],Ee);T?Ne(Q.x,Q.y+M[d-1].y,M[d-1].x+ue):Ne(Q.x,Q.y,f+ue)}}}fe(),be();function fe(){const k=i.length/3;if(m){let ve=0,ue=ie*ve;for(let Ee=0;Ee<le;Ee++){const pe=de[Ee];Je(pe[2]+ue,pe[1]+ue,pe[0]+ue)}ve=d+y*2,ue=ie*ve;for(let Ee=0;Ee<le;Ee++){const pe=de[Ee];Je(pe[0]+ue,pe[1]+ue,pe[2]+ue)}}else{for(let ve=0;ve<le;ve++){const ue=de[ve];Je(ue[2],ue[1],ue[0])}for(let ve=0;ve<le;ve++){const ue=de[ve];Je(ue[0]+ie*d,ue[1]+ie*d,ue[2]+ie*d)}}n.addGroup(k,i.length/3-k,0)}function be(){const k=i.length/3;let ve=0;Oe(H,ve),ve+=H.length;for(let ue=0,Ee=z.length;ue<Ee;ue++){const pe=z[ue];Oe(pe,ve),ve+=pe.length}n.addGroup(k,i.length/3-k,1)}function Oe(k,ve){let ue=k.length;for(;--ue>=0;){const Ee=ue;let pe=ue-1;pe<0&&(pe=k.length-1);for(let Ve=0,Le=d+y*2;Ve<Le;Ve++){const D=ie*Ve,I=ie*(Ve+1),Q=ve+Ee+D,ye=ve+pe+D,xe=ve+pe+I,me=ve+Ee+I;rt(Q,ye,xe,me)}}}function Ne(k,ve,ue){u.push(k),u.push(ve),u.push(ue)}function Je(k,ve,ue){Pe(k),Pe(ve),Pe(ue);const Ee=i.length/3,pe=b.generateTopUV(n,i,Ee-3,Ee-2,Ee-1);Ae(pe[0]),Ae(pe[1]),Ae(pe[2])}function rt(k,ve,ue,Ee){Pe(k),Pe(ve),Pe(Ee),Pe(ve),Pe(ue),Pe(Ee);const pe=i.length/3,Ve=b.generateSideWallUV(n,i,pe-6,pe-3,pe-2,pe-1);Ae(Ve[0]),Ae(Ve[1]),Ae(Ve[3]),Ae(Ve[1]),Ae(Ve[2]),Ae(Ve[3])}function Pe(k){i.push(u[k*3+0]),i.push(u[k*3+1]),i.push(u[k*3+2])}function Ae(k){s.push(k.x),s.push(k.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return TA(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const c=t[e.shapes[s]];n.push(c)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Nu[i.type]().fromJSON(i)),new ih(n,e.options)}}const wA={generateTopUV:function(r,e,t,n,i){const s=e[t*3],a=e[t*3+1],c=e[n*3],u=e[n*3+1],h=e[i*3],d=e[i*3+1];return[new he(s,a),new he(c,u),new he(h,d)]},generateSideWallUV:function(r,e,t,n,i,s){const a=e[t*3],c=e[t*3+1],u=e[t*3+2],h=e[n*3],d=e[n*3+1],f=e[n*3+2],m=e[i*3],g=e[i*3+1],x=e[i*3+2],S=e[s*3],y=e[s*3+1],_=e[s*3+2];return Math.abs(c-d)<Math.abs(a-h)?[new he(a,1-u),new he(h,1-f),new he(m,1-x),new he(S,1-_)]:[new he(c,1-u),new he(d,1-f),new he(g,1-x),new he(y,1-_)]}};function TA(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class rh extends $r{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[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];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rh(e.radius,e.detail)}}class vl extends $r{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new vl(e.radius,e.detail)}}class sh extends St{constructor(e=.5,t=1,n=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const c=[],u=[],h=[],d=[];let f=e;const m=(t-e)/i,g=new U,x=new he;for(let S=0;S<=i;S++){for(let y=0;y<=n;y++){const _=s+y/n*a;g.x=f*Math.cos(_),g.y=f*Math.sin(_),u.push(g.x,g.y,g.z),h.push(0,0,1),x.x=(g.x/t+1)/2,x.y=(g.y/t+1)/2,d.push(x.x,x.y)}f+=m}for(let S=0;S<i;S++){const y=S*(n+1);for(let _=0;_<n;_++){const b=_+y,M=b,T=b+n+1,R=b+n+2,C=b+1;c.push(M,T,C),c.push(T,R,C)}}this.setIndex(c),this.setAttribute("position",new qe(u,3)),this.setAttribute("normal",new qe(h,3)),this.setAttribute("uv",new qe(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sh(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class oh extends St{constructor(e=new zs([new he(0,.5),new he(-.5,-.5),new he(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let c=0,u=0;if(Array.isArray(e)===!1)h(e);else for(let d=0;d<e.length;d++)h(e[d]),this.addGroup(c,u,d),c+=u,u=0;this.setIndex(n),this.setAttribute("position",new qe(i,3)),this.setAttribute("normal",new qe(s,3)),this.setAttribute("uv",new qe(a,2));function h(d){const f=i.length/3,m=d.extractPoints(t);let g=m.shape;const x=m.holes;tr.isClockWise(g)===!1&&(g=g.reverse());for(let y=0,_=x.length;y<_;y++){const b=x[y];tr.isClockWise(b)===!0&&(x[y]=b.reverse())}const S=tr.triangulateShape(g,x);for(let y=0,_=x.length;y<_;y++){const b=x[y];g=g.concat(b)}for(let y=0,_=g.length;y<_;y++){const b=g[y];i.push(b.x,b.y,0),s.push(0,0,1),a.push(b.x,b.y)}for(let y=0,_=S.length;y<_;y++){const b=S[y],M=b[0]+f,T=b[1]+f,R=b[2]+f;n.push(M,T,R),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return AA(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new oh(n,e.curveSegments)}}function AA(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class xl extends St{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:c},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(a+c,Math.PI);let h=0;const d=[],f=new U,m=new U,g=[],x=[],S=[],y=[];for(let _=0;_<=n;_++){const b=[],M=_/n;let T=0;_===0&&a===0?T=.5/t:_===n&&u===Math.PI&&(T=-.5/t);for(let R=0;R<=t;R++){const C=R/t;f.x=-e*Math.cos(i+C*s)*Math.sin(a+M*c),f.y=e*Math.cos(a+M*c),f.z=e*Math.sin(i+C*s)*Math.sin(a+M*c),x.push(f.x,f.y,f.z),m.copy(f).normalize(),S.push(m.x,m.y,m.z),y.push(C+T,1-M),b.push(h++)}d.push(b)}for(let _=0;_<n;_++)for(let b=0;b<t;b++){const M=d[_][b+1],T=d[_][b],R=d[_+1][b],C=d[_+1][b+1];(_!==0||a>0)&&g.push(M,T,C),(_!==n-1||u<Math.PI)&&g.push(T,R,C)}this.setIndex(g),this.setAttribute("position",new qe(x,3)),this.setAttribute("normal",new qe(S,3)),this.setAttribute("uv",new qe(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class ah extends $r{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ah(e.radius,e.detail)}}class lh extends St{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],u=[],h=[],d=new U,f=new U,m=new U;for(let g=0;g<=n;g++)for(let x=0;x<=i;x++){const S=x/i*s,y=g/n*Math.PI*2;f.x=(e+t*Math.cos(y))*Math.cos(S),f.y=(e+t*Math.cos(y))*Math.sin(S),f.z=t*Math.sin(y),c.push(f.x,f.y,f.z),d.x=e*Math.cos(S),d.y=e*Math.sin(S),m.subVectors(f,d).normalize(),u.push(m.x,m.y,m.z),h.push(x/i),h.push(g/n)}for(let g=1;g<=n;g++)for(let x=1;x<=i;x++){const S=(i+1)*g+x-1,y=(i+1)*(g-1)+x-1,_=(i+1)*(g-1)+x,b=(i+1)*g+x;a.push(S,y,b),a.push(y,_,b)}this.setIndex(a),this.setAttribute("position",new qe(c,3)),this.setAttribute("normal",new qe(u,3)),this.setAttribute("uv",new qe(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class ch extends St{constructor(e=1,t=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const c=[],u=[],h=[],d=[],f=new U,m=new U,g=new U,x=new U,S=new U,y=new U,_=new U;for(let M=0;M<=n;++M){const T=M/n*s*Math.PI*2;b(T,s,a,e,g),b(T+.01,s,a,e,x),y.subVectors(x,g),_.addVectors(x,g),S.crossVectors(y,_),_.crossVectors(S,y),S.normalize(),_.normalize();for(let R=0;R<=i;++R){const C=R/i*Math.PI*2,N=-t*Math.cos(C),B=t*Math.sin(C);f.x=g.x+(N*_.x+B*S.x),f.y=g.y+(N*_.y+B*S.y),f.z=g.z+(N*_.z+B*S.z),u.push(f.x,f.y,f.z),m.subVectors(f,g).normalize(),h.push(m.x,m.y,m.z),d.push(M/n),d.push(R/i)}}for(let M=1;M<=n;M++)for(let T=1;T<=i;T++){const R=(i+1)*(M-1)+(T-1),C=(i+1)*M+(T-1),N=(i+1)*M+T,B=(i+1)*(M-1)+T;c.push(R,C,B),c.push(C,N,B)}this.setIndex(c),this.setAttribute("position",new qe(u,3)),this.setAttribute("normal",new qe(h,3)),this.setAttribute("uv",new qe(d,2));function b(M,T,R,C,N){const B=Math.cos(M),A=Math.sin(M),P=R/T*M,z=Math.cos(P);N.x=C*(2+z)*.5*B,N.y=C*(2+z)*A*.5,N.z=C*Math.sin(P)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ch(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class uh extends St{constructor(e=new Ku(new U(-1,-1,0),new U(-1,1,0),new U(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const c=new U,u=new U,h=new he;let d=new U;const f=[],m=[],g=[],x=[];S(),this.setIndex(x),this.setAttribute("position",new qe(f,3)),this.setAttribute("normal",new qe(m,3)),this.setAttribute("uv",new qe(g,2));function S(){for(let M=0;M<t;M++)y(M);y(s===!1?t:0),b(),_()}function y(M){d=e.getPointAt(M/t,d);const T=a.normals[M],R=a.binormals[M];for(let C=0;C<=i;C++){const N=C/i*Math.PI*2,B=Math.sin(N),A=-Math.cos(N);u.x=A*T.x+B*R.x,u.y=A*T.y+B*R.y,u.z=A*T.z+B*R.z,u.normalize(),m.push(u.x,u.y,u.z),c.x=d.x+n*u.x,c.y=d.y+n*u.y,c.z=d.z+n*u.z,f.push(c.x,c.y,c.z)}}function _(){for(let M=1;M<=t;M++)for(let T=1;T<=i;T++){const R=(i+1)*(M-1)+(T-1),C=(i+1)*M+(T-1),N=(i+1)*M+T,B=(i+1)*(M-1)+T;x.push(R,C,B),x.push(C,N,B)}}function b(){for(let M=0;M<=t;M++)for(let T=0;T<=i;T++)h.x=M/t,h.y=T/i,g.push(h.x,h.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new uh(new Nu[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class qp extends St{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new U,s=new U;if(e.index!==null){const a=e.attributes.position,c=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:c.count,materialIndex:0}]);for(let h=0,d=u.length;h<d;++h){const f=u[h],m=f.start,g=f.count;for(let x=m,S=m+g;x<S;x+=3)for(let y=0;y<3;y++){const _=c.getX(x+y),b=c.getX(x+(y+1)%3);i.fromBufferAttribute(a,_),s.fromBufferAttribute(a,b),i_(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let c=0,u=a.count/3;c<u;c++)for(let h=0;h<3;h++){const d=3*c+h,f=3*c+(h+1)%3;i.fromBufferAttribute(a,d),s.fromBufferAttribute(a,f),i_(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new qe(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function i_(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var r_=Object.freeze({__proto__:null,BoxGeometry:Gs,CapsuleGeometry:Qu,CircleGeometry:$u,ConeGeometry:eh,CylinderGeometry:Qo,DodecahedronGeometry:th,EdgesGeometry:Rx,ExtrudeGeometry:ih,IcosahedronGeometry:rh,LatheGeometry:_l,OctahedronGeometry:vl,PlaneGeometry:gl,PolyhedronGeometry:$r,RingGeometry:sh,ShapeGeometry:oh,SphereGeometry:xl,TetrahedronGeometry:ah,TorusGeometry:lh,TorusKnotGeometry:ch,TubeGeometry:uh,WireframeGeometry:qp});class Nx extends zn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ke(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Dx extends Oi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Yp extends zn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ke(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 ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ux extends Yp{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new he(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ke(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ke(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ke(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Ox extends zn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ke(16777215),this.specular=new ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ul,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Fx extends zn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ke(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class zx extends zn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Bx extends zn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ul,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class kx extends zn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ke(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Hx extends jn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Ps(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Vx(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Gx(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function lp(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const c=t[s]*e;for(let u=0;u!==e;++u)i[a++]=r[c+u]}return i}function Zp(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}function CA(r,e,t,n,i=30){const s=r.clone();s.name=e;const a=[];for(let u=0;u<s.tracks.length;++u){const h=s.tracks[u],d=h.getValueSize(),f=[],m=[];for(let g=0;g<h.times.length;++g){const x=h.times[g]*i;if(!(x<t||x>=n)){f.push(h.times[g]);for(let S=0;S<d;++S)m.push(h.values[g*d+S])}}f.length!==0&&(h.times=Ps(f,h.times.constructor),h.values=Ps(m,h.values.constructor),a.push(h))}s.tracks=a;let c=1/0;for(let u=0;u<s.tracks.length;++u)c>s.tracks[u].times[0]&&(c=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*c);return s.resetDuration(),s}function RA(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let a=0;a<i;++a){const c=t.tracks[a],u=c.ValueTypeName;if(u==="bool"||u==="string")continue;const h=r.tracks.find(function(_){return _.name===c.name&&_.ValueTypeName===u});if(h===void 0)continue;let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);let m=0;const g=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=g/3);const x=c.times.length-1;let S;if(s<=c.times[0]){const _=d,b=f-d;S=c.values.slice(_,b)}else if(s>=c.times[x]){const _=x*f+d,b=_+f-d;S=c.values.slice(_,b)}else{const _=c.createInterpolant(),b=d,M=f-d;_.evaluate(s),S=_.resultBuffer.slice(b,M)}u==="quaternion"&&new On().fromArray(S).normalize().conjugate().toArray(S);const y=h.times.length;for(let _=0;_<y;++_){const b=_*g+m;if(u==="quaternion")On.multiplyQuaternionsFlat(h.values,b,S,0,h.values,b);else{const M=g-m*2;for(let T=0;T<M;++T)h.values[b+T]-=S[T]}}}return r.blendMode=wp,r}const PA={convertArray:Ps,isTypedArray:Vx,getKeyframeOrder:Gx,sortedArray:lp,flattenJSON:Zp,subclip:CA,makeClipAdditive:RA};class yl{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let c=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const c=t[1];e<c&&(n=2,s=c);for(let u=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const c=n+a>>>1;e<t[c]?a=c:n=c+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Wx extends yl{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:As,endingEnd:As}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,c=i[s],u=i[a];if(c===void 0)switch(this.getSettings_().endingStart){case Cs:s=e,c=2*t-n;break;case Ja:s=i.length-2,c=t+i[s]-i[s+1];break;default:s=e,c=n}if(u===void 0)switch(this.getSettings_().endingEnd){case Cs:a=e,u=2*n-t;break;case Ja:a=1,u=n+i[1]-i[0];break;default:a=e-1,u=t}const h=(n-t)*.5,d=this.valueSize;this._weightPrev=h/(t-c),this._weightNext=h/(u-n),this._offsetPrev=s*d,this._offsetNext=a*d}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=this._offsetPrev,f=this._offsetNext,m=this._weightPrev,g=this._weightNext,x=(n-t)/(i-t),S=x*x,y=S*x,_=-m*y+2*m*S-m*x,b=(1+m)*y+(-1.5-2*m)*S+(-.5+m)*x+1,M=(-1-g)*y+(1.5+g)*S+.5*x,T=g*y-g*S;for(let R=0;R!==c;++R)s[R]=_*a[d+R]+b*a[h+R]+M*a[u+R]+T*a[f+R];return s}}class Jp extends yl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=(n-t)/(i-t),f=1-d;for(let m=0;m!==c;++m)s[m]=a[h+m]*f+a[u+m]*d;return s}}class jx extends yl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class zi{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ps(t,this.TimeBufferType),this.values=Ps(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Ps(e.times,Array),values:Ps(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new jx(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Jp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Wx(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ya:t=this.InterpolantFactoryMethodDiscrete;break;case Za:t=this.InterpolantFactoryMethodLinear;break;case Eu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ya;case this.InterpolantFactoryMethodLinear:return Za;case this.InterpolantFactoryMethodSmooth:return Eu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const c=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*c,a*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let c=0;c!==s;c++){const u=n[c];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,c,u),e=!1;break}if(a!==null&&a>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,c,u,a),e=!1;break}a=u}if(i!==void 0&&Vx(i))for(let c=0,u=i.length;c!==u;++c){const h=i[c];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,c,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Eu,s=e.length-1;let a=1;for(let c=1;c<s;++c){let u=!1;const h=e[c],d=e[c+1];if(h!==d&&(c!==1||h!==e[0]))if(i)u=!0;else{const f=c*n,m=f-n,g=f+n;for(let x=0;x!==n;++x){const S=t[f+x];if(S!==t[m+x]||S!==t[g+x]){u=!0;break}}}if(u){if(c!==a){e[a]=e[c];const f=c*n,m=a*n;for(let g=0;g!==n;++g)t[m+g]=t[f+g]}++a}}if(s>0){e[a]=e[s];for(let c=s*n,u=a*n,h=0;h!==n;++h)t[u+h]=t[c+h];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=Za;class Ws extends zi{}Ws.prototype.ValueTypeName="bool";Ws.prototype.ValueBufferType=Array;Ws.prototype.DefaultInterpolation=Ya;Ws.prototype.InterpolantFactoryMethodLinear=void 0;Ws.prototype.InterpolantFactoryMethodSmooth=void 0;class Kp extends zi{}Kp.prototype.ValueTypeName="color";class ol extends zi{}ol.prototype.ValueTypeName="number";class Xx extends yl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=(n-t)/(i-t);let h=e*c;for(let d=h+c;h!==d;h+=4)On.slerpFlat(s,0,a,h-c,a,h,u);return s}}class $o extends zi{InterpolantFactoryMethodLinear(e){return new Xx(this.times,this.values,this.getValueSize(),e)}}$o.prototype.ValueTypeName="quaternion";$o.prototype.DefaultInterpolation=Za;$o.prototype.InterpolantFactoryMethodSmooth=void 0;class js extends zi{}js.prototype.ValueTypeName="string";js.prototype.ValueBufferType=Array;js.prototype.DefaultInterpolation=Ya;js.prototype.InterpolantFactoryMethodLinear=void 0;js.prototype.InterpolantFactoryMethodSmooth=void 0;class al extends zi{}al.prototype.ValueTypeName="vector";class ll{constructor(e,t=-1,n,i=ku){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=li(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,c=n.length;a!==c;++a)t.push(IA(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(zi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let c=0;c<s;c++){let u=[],h=[];u.push((c+s-1)%s,c,(c+1)%s),h.push(0,1,0);const d=Gx(u);u=lp(u,1,d),h=lp(h,1,d),!i&&u[0]===0&&(u.push(s),h.push(h[0])),a.push(new ol(".morphTargetInfluences["+t[c].name+"]",u,h).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let c=0,u=e.length;c<u;c++){const h=e[c],d=h.name.match(s);if(d&&d.length>1){const f=d[1];let m=i[f];m||(i[f]=m=[]),m.push(h)}}const a=[];for(const c in i)a.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(f,m,g,x,S){if(g.length!==0){const y=[],_=[];Zp(g,y,_,x),y.length!==0&&S.push(new f(m,y,_))}},i=[],s=e.name||"default",a=e.fps||30,c=e.blendMode;let u=e.length||-1;const h=e.hierarchy||[];for(let f=0;f<h.length;f++){const m=h[f].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const g={};let x;for(x=0;x<m.length;x++)if(m[x].morphTargets)for(let S=0;S<m[x].morphTargets.length;S++)g[m[x].morphTargets[S]]=-1;for(const S in g){const y=[],_=[];for(let b=0;b!==m[x].morphTargets.length;++b){const M=m[x];y.push(M.time),_.push(M.morphTarget===S?1:0)}i.push(new ol(".morphTargetInfluence["+S+"]",y,_))}u=g.length*a}else{const g=".bones["+t[f].name+"]";n(al,g+".position",m,"pos",i),n($o,g+".quaternion",m,"rot",i),n(al,g+".scale",m,"scl",i)}}return i.length===0?null:new this(s,u,i,c)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function LA(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ol;case"vector":case"vector2":case"vector3":case"vector4":return al;case"color":return Kp;case"quaternion":return $o;case"bool":case"boolean":return Ws;case"string":return js}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function IA(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=LA(r.type);if(r.times===void 0){const t=[],n=[];Zp(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const yr={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Qp{constructor(e,t,n){const i=this;let s=!1,a=0,c=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(d){c++,s===!1&&i.onStart!==void 0&&i.onStart(d,a,c),s=!0},this.itemEnd=function(d){a++,i.onProgress!==void 0&&i.onProgress(d,a,c),a===c&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return u?u(d):d},this.setURLModifier=function(d){return u=d,this},this.addHandler=function(d,f){return h.push(d,f),this},this.removeHandler=function(d){const f=h.indexOf(d);return f!==-1&&h.splice(f,2),this},this.getHandler=function(d){for(let f=0,m=h.length;f<m;f+=2){const g=h[f],x=h[f+1];if(g.global&&(g.lastIndex=0),g.test(d))return x}return null}}}const qx=new Qp;class Qn{constructor(e){this.manager=e!==void 0?e:qx,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Qn.DEFAULT_MATERIAL_NAME="__DEFAULT";const mr={};class NA extends Error{constructor(e,t){super(e),this.response=t}}class br extends Qn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=yr.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(mr[e]!==void 0){mr[e].push({onLoad:t,onProgress:n,onError:i});return}mr[e]=[],mr[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),c=this.mimeType,u=this.responseType;fetch(a).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const d=mr[e],f=h.body.getReader(),m=h.headers.get("Content-Length")||h.headers.get("X-File-Size"),g=m?parseInt(m):0,x=g!==0;let S=0;const y=new ReadableStream({start(_){b();function b(){f.read().then(({done:M,value:T})=>{if(M)_.close();else{S+=T.byteLength;const R=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:g});for(let C=0,N=d.length;C<N;C++){const B=d[C];B.onProgress&&B.onProgress(R)}_.enqueue(T),b()}})}}});return new Response(y)}else throw new NA(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(u){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(d=>new DOMParser().parseFromString(d,c));case"json":return h.json();default:if(c===void 0)return h.text();{const f=/charset="?([^;"\s]*)"?/i.exec(c),m=f&&f[1]?f[1].toLowerCase():void 0,g=new TextDecoder(m);return h.arrayBuffer().then(x=>g.decode(x))}}}).then(h=>{yr.add(e,h);const d=mr[e];delete mr[e];for(let f=0,m=d.length;f<m;f++){const g=d[f];g.onLoad&&g.onLoad(h)}}).catch(h=>{const d=mr[e];if(d===void 0)throw this.manager.itemError(e),h;delete mr[e];for(let f=0,m=d.length;f<m;f++){const g=d[f];g.onError&&g.onError(h)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class DA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new br(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=ll.parse(e[n]);t.push(i)}return t}}class UA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=[],c=new Zu,u=new br(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(s.withCredentials);let h=0;function d(f){u.load(e[f],function(m){const g=s.parse(m,!0);a[f]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},h+=1,h===6&&(g.mipmapCount===1&&(c.minFilter=tn),c.image=a,c.format=g.format,c.needsUpdate=!0,t&&t(c))},n,i)}if(Array.isArray(e))for(let f=0,m=e.length;f<m;++f)d(f);else u.load(e,function(f){const m=s.parse(f,!0);if(m.isCubemap){const g=m.mipmaps.length/m.mipmapCount;for(let x=0;x<g;x++){a[x]={mipmaps:[]};for(let S=0;S<m.mipmapCount;S++)a[x].mipmaps.push(m.mipmaps[x*m.mipmapCount+S]),a[x].format=m.format,a[x].width=m.width,a[x].height=m.height}c.image=a}else c.image.width=m.width,c.image.height=m.height,c.mipmaps=m.mipmaps;m.mipmapCount===1&&(c.minFilter=tn),c.format=m.format,c.needsUpdate=!0,t&&t(c)},n,i);return c}}class cl extends Qn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=yr.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const c=tl("img");function u(){d(),yr.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(f){d(),i&&i(f),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){c.removeEventListener("load",u,!1),c.removeEventListener("error",h,!1)}return c.addEventListener("load",u,!1),c.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(c.crossOrigin=this.crossOrigin),s.manager.itemStart(e),c.src=e,c}}class OA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=new pl;s.colorSpace=cn;const a=new cl(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let c=0;function u(h){a.load(e[h],function(d){s.images[h]=d,c++,c===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let h=0;h<e.length;++h)u(h);return s}}class FA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Fs,c=new br(this.manager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(s.withCredentials),c.load(e,function(u){let h;try{h=s.parse(u)}catch(d){if(i!==void 0)i(d);else{console.error(d);return}}h.image!==void 0?a.image=h.image:h.data!==void 0&&(a.image.width=h.width,a.image.height=h.height,a.image.data=h.data),a.wrapS=h.wrapS!==void 0?h.wrapS:Un,a.wrapT=h.wrapT!==void 0?h.wrapT:Un,a.magFilter=h.magFilter!==void 0?h.magFilter:tn,a.minFilter=h.minFilter!==void 0?h.minFilter:tn,a.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0?a.colorSpace=h.colorSpace:h.encoding!==void 0&&(a.encoding=h.encoding),h.flipY!==void 0&&(a.flipY=h.flipY),h.format!==void 0&&(a.format=h.format),h.type!==void 0&&(a.type=h.type),h.mipmaps!==void 0&&(a.mipmaps=h.mipmaps,a.minFilter=Zr),h.mipmapCount===1&&(a.minFilter=tn),h.generateMipmaps!==void 0&&(a.generateMipmaps=h.generateMipmaps),a.needsUpdate=!0,t&&t(a,h)},n,i),a}}class zA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=new nn,a=new cl(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(c){s.image=c,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class es extends Nt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ke(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class Yx extends es{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ke(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const $d=new lt,s_=new U,o_=new U;class $p{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new he(512,512),this.map=null,this.mapPass=null,this.matrix=new lt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ml,this._frameExtents=new he(1,1),this._viewportCount=1,this._viewports=[new At(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;s_.setFromMatrixPosition(e.matrixWorld),t.position.copy(s_),o_.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(o_),t.updateMatrixWorld(),$d.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix($d),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply($d)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class BA extends $p{constructor(){super(new jt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=jo*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Zx extends es{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.target=new Nt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new BA}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const a_=new lt,La=new U,ef=new U;class kA extends $p{constructor(){super(new jt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new he(4,2),this._viewportCount=6,this._viewports=[new At(2,1,1,1),new At(0,1,1,1),new At(3,1,1,1),new At(1,1,1,1),new At(3,0,1,1),new At(1,0,1,1)],this._cubeDirections=[new U(1,0,0),new U(-1,0,0),new U(0,0,1),new U(0,0,-1),new U(0,1,0),new U(0,-1,0)],this._cubeUps=[new U(0,1,0),new U(0,1,0),new U(0,1,0),new U(0,1,0),new U(0,0,1),new U(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),La.setFromMatrixPosition(e.matrixWorld),n.position.copy(La),ef.copy(n.position),ef.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(ef),n.updateMatrixWorld(),i.makeTranslation(-La.x,-La.y,-La.z),a_.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(a_)}}class Jx extends es{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new kA}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class HA extends $p{constructor(){super(new er(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Kx extends es{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.target=new Nt,this.shadow=new HA}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Qx extends es{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class $x extends es{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class ey{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new U)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class ty extends es{constructor(e=new ey,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class hh extends Qn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,a=new br(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=hh.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new ke().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new ke().setHex(a.value);break;case"v2":i.uniforms[s].value=new he().fromArray(a.value);break;case"v3":i.uniforms[s].value=new U().fromArray(a.value);break;case"v4":i.uniforms[s].value=new At().fromArray(a.value);break;case"m3":i.uniforms[s].value=new yt().fromArray(a.value);break;case"m4":i.uniforms[s].value=new lt().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new he().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new he().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:Nx,SpriteMaterial:Bp,RawShaderMaterial:Dx,ShaderMaterial:Oi,PointsMaterial:Yu,MeshPhysicalMaterial:Ux,MeshStandardMaterial:Yp,MeshPhongMaterial:Ox,MeshToonMaterial:Fx,MeshNormalMaterial:zx,MeshLambertMaterial:Bx,MeshDepthMaterial:Up,MeshDistanceMaterial:Op,MeshBasicMaterial:Qr,MeshMatcapMaterial:kx,LineDashedMaterial:Hx,LineBasicMaterial:jn,Material:zn};return new t[e]}}class cp{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class em extends St{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class ny extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new br(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(g,x){if(t[x]!==void 0)return t[x];const y=g.interleavedBuffers[x],_=s(g,y.buffer),b=Oo(y.type,_),M=new Xu(b,y.stride);return M.uuid=y.uuid,t[x]=M,M}function s(g,x){if(n[x]!==void 0)return n[x];const y=g.arrayBuffers[x],_=new Uint32Array(y).buffer;return n[x]=_,_}const a=e.isInstancedBufferGeometry?new em:new St,c=e.data.index;if(c!==void 0){const g=Oo(c.type,c.array);a.setIndex(new Ut(g,1))}const u=e.data.attributes;for(const g in u){const x=u[g];let S;if(x.isInterleavedBufferAttribute){const y=i(e.data,x.data);S=new ai(y,x.itemSize,x.offset,x.normalized)}else{const y=Oo(x.type,x.array),_=x.isInstancedBufferAttribute?qo:Ut;S=new _(y,x.itemSize,x.normalized)}x.name!==void 0&&(S.name=x.name),x.usage!==void 0&&S.setUsage(x.usage),a.setAttribute(g,S)}const h=e.data.morphAttributes;if(h)for(const g in h){const x=h[g],S=[];for(let y=0,_=x.length;y<_;y++){const b=x[y];let M;if(b.isInterleavedBufferAttribute){const T=i(e.data,b.data);M=new ai(T,b.itemSize,b.offset,b.normalized)}else{const T=Oo(b.type,b.array);M=new Ut(T,b.itemSize,b.normalized)}b.name!==void 0&&(M.name=b.name),S.push(M)}a.morphAttributes[g]=S}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const f=e.data.groups||e.data.drawcalls||e.data.offsets;if(f!==void 0)for(let g=0,x=f.length;g!==x;++g){const S=f[g];a.addGroup(S.start,S.count,S.materialIndex)}const m=e.data.boundingSphere;if(m!==void 0){const g=new U;m.center!==void 0&&g.fromArray(m.center),a.boundingSphere=new xn(g,m.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class VA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?cp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const c=new br(this.manager);c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(u){let h=null;try{h=JSON.parse(u)}catch(f){i!==void 0&&i(f),console.error("THREE:ObjectLoader: Can't parse "+e+".",f.message);return}const d=h.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?cp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new br(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),c=JSON.parse(a),u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(c)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){t!==void 0&&t(h)}),c=this.parseTextures(e.textures,a),u=this.parseMaterials(e.materials,c),h=this.parseObject(e.object,s,u,c,n),d=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,d),t!==void 0){let f=!1;for(const m in a)if(a[m].data instanceof HTMLImageElement){f=!0;break}f===!1&&t(h)}return h}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),c=this.parseMaterials(e.materials,a),u=this.parseObject(e.object,i,c,a,t),h=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,h),u}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new zs().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const c=new qu().fromJSON(e[s],i);n[c.uuid]=c}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new ny;for(let s=0,a=e.length;s<a;s++){let c;const u=e[s];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":c=i.parse(u);break;default:u.type in r_?c=r_[u.type].fromJSON(u,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${u.type}"`)}c.uuid=u.uuid,u.name!==void 0&&(c.name=u.name),u.userData!==void 0&&(c.userData=u.userData),n[u.uuid]=c}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new hh;s.setTextures(t);for(let a=0,c=e.length;a<c;a++){const u=e[a];n[u.uuid]===void 0&&(n[u.uuid]=s.parse(u)),i[u.uuid]=n[u.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=ll.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function a(u){return n.manager.itemStart(u),s.load(u,function(){n.manager.itemEnd(u)},void 0,function(){n.manager.itemError(u),n.manager.itemEnd(u)})}function c(u){if(typeof u=="string"){const h=u,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return a(d)}else return u.data?{data:Oo(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new Qp(t);s=new cl(u),s.setCrossOrigin(this.crossOrigin);for(let h=0,d=e.length;h<d;h++){const f=e[h],m=f.url;if(Array.isArray(m)){const g=[];for(let x=0,S=m.length;x<S;x++){const y=m[x],_=c(y);_!==null&&(_ instanceof HTMLImageElement?g.push(_):g.push(new Fs(_.data,_.width,_.height)))}i[f.uuid]=new Rs(g)}else{const g=c(f.url);i[f.uuid]=new Rs(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(a){if(typeof a=="string"){const c=a,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:t.resourcePath+c;return await i.loadAsync(u)}else return a.data?{data:Oo(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new cl(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,c=e.length;a<c;a++){const u=e[a],h=u.url;if(Array.isArray(h)){const d=[];for(let f=0,m=h.length;f<m;f++){const g=h[f],x=await s(g);x!==null&&(x instanceof HTMLImageElement?d.push(x):d.push(new Fs(x.data,x.width,x.height)))}n[u.uuid]=new Rs(d)}else{const d=await s(u.url);n[u.uuid]=new Rs(d)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const c=e[s];c.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',c.uuid),t[c.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",c.image);const u=t[c.image],h=u.data;let d;Array.isArray(h)?(d=new pl,h.length===6&&(d.needsUpdate=!0)):(h&&h.data?d=new Fs:d=new nn,h&&(d.needsUpdate=!0)),d.source=u,d.uuid=c.uuid,c.name!==void 0&&(d.name=c.name),c.mapping!==void 0&&(d.mapping=n(c.mapping,GA)),c.channel!==void 0&&(d.channel=c.channel),c.offset!==void 0&&d.offset.fromArray(c.offset),c.repeat!==void 0&&d.repeat.fromArray(c.repeat),c.center!==void 0&&d.center.fromArray(c.center),c.rotation!==void 0&&(d.rotation=c.rotation),c.wrap!==void 0&&(d.wrapS=n(c.wrap[0],l_),d.wrapT=n(c.wrap[1],l_)),c.format!==void 0&&(d.format=c.format),c.internalFormat!==void 0&&(d.internalFormat=c.internalFormat),c.type!==void 0&&(d.type=c.type),c.colorSpace!==void 0&&(d.colorSpace=c.colorSpace),c.encoding!==void 0&&(d.encoding=c.encoding),c.minFilter!==void 0&&(d.minFilter=n(c.minFilter,c_)),c.magFilter!==void 0&&(d.magFilter=n(c.magFilter,c_)),c.anisotropy!==void 0&&(d.anisotropy=c.anisotropy),c.flipY!==void 0&&(d.flipY=c.flipY),c.generateMipmaps!==void 0&&(d.generateMipmaps=c.generateMipmaps),c.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=c.premultiplyAlpha),c.unpackAlignment!==void 0&&(d.unpackAlignment=c.unpackAlignment),c.compareFunction!==void 0&&(d.compareFunction=c.compareFunction),c.userData!==void 0&&(d.userData=c.userData),i[c.uuid]=d}return i}parseObject(e,t,n,i,s){let a;function c(m){return t[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",m),t[m]}function u(m){if(m!==void 0){if(Array.isArray(m)){const g=[];for(let x=0,S=m.length;x<S;x++){const y=m[x];n[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",y),g.push(n[y])}return g}return n[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),n[m]}}function h(m){return i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",m),i[m]}let d,f;switch(e.type){case"Scene":a=new zp,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new ke(e.background):a.background=h(e.background)),e.environment!==void 0&&(a.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new ju(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Wu(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":a=new jt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new er(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new Qx(e.color,e.intensity);break;case"DirectionalLight":a=new Kx(e.color,e.intensity);break;case"PointLight":a=new Jx(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new $x(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Zx(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new Yx(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new ty().fromJSON(e);break;case"SkinnedMesh":d=c(e.geometry),f=u(e.material),a=new yx(d,f),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":d=c(e.geometry),f=u(e.material),a=new an(d,f);break;case"InstancedMesh":d=c(e.geometry),f=u(e.material);const m=e.count,g=e.instanceMatrix,x=e.instanceColor;a=new Sx(d,f,m),a.instanceMatrix=new qo(new Float32Array(g.array),16),x!==void 0&&(a.instanceColor=new qo(new Float32Array(x.array),x.itemSize));break;case"BatchedMesh":d=c(e.geometry),f=u(e.material),a=new Mx(e.maxGeometryCount,e.maxVertexCount,e.maxIndexCount,f),a.geometry=d,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._visibility=e.visibility,a._active=e.active,a._bounds=e.bounds.map(S=>{const y=new vn;y.min.fromArray(S.boxMin),y.max.fromArray(S.boxMax);const _=new xn;return _.radius=S.sphereRadius,_.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:y,sphereInitialized:S.sphereInitialized,sphere:_}}),a._maxGeometryCount=e.maxGeometryCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._geometryCount=e.geometryCount,a._matricesTexture=h(e.matricesTexture.uuid);break;case"LOD":a=new xx;break;case"Line":a=new Jr(c(e.geometry),u(e.material));break;case"LineLoop":a=new Ex(c(e.geometry),u(e.material));break;case"LineSegments":a=new ir(c(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new bx(c(e.geometry),u(e.material));break;case"Sprite":a=new vx(u(e.material));break;case"Group":a=new Bo;break;case"Bone":a=new kp;break;default:a=new Nt}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let g=0;g<m.length;g++)a.add(this.parseObject(m[g],t,n,i,s))}if(e.animations!==void 0){const m=e.animations;for(let g=0;g<m.length;g++){const x=m[g];a.animations.push(s[x])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const m=e.levels;for(let g=0;g<m.length;g++){const x=m[g],S=a.getObjectByProperty("uuid",x.object);S!==void 0&&a.addLevel(S,x.distance,x.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}}const GA={UVMapping:zu,CubeReflectionMapping:Er,CubeRefractionMapping:Yr,EquirectangularReflectionMapping:Wa,EquirectangularRefractionMapping:ja,CubeUVReflectionMapping:Jo},l_={RepeatWrapping:Xa,ClampToEdgeWrapping:Un,MirroredRepeatWrapping:qa},c_={NearestFilter:en,NearestMipmapNearestFilter:Ru,NearestMipmapLinearFilter:za,LinearFilter:tn,LinearMipmapNearestFilter:_p,LinearMipmapLinearFilter:Zr};class WA extends Qn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=yr.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(h=>{t&&t(h),s.manager.itemEnd(e)}).catch(h=>{i&&i(h)});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader;const u=fetch(e,c).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return yr.add(e,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){i&&i(h),yr.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});yr.add(e,u),s.manager.itemStart(e)}}let ru;class tm{static getContext(){return ru===void 0&&(ru=new(window.AudioContext||window.webkitAudioContext)),ru}static setContext(e){ru=e}}class jA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new br(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(u){try{const h=u.slice(0);tm.getContext().decodeAudioData(h,function(f){t(f)}).catch(c)}catch(h){c(h)}},n,i);function c(u){i?i(u):console.error(u),s.manager.itemError(e)}}}const u_=new lt,h_=new lt,gs=new lt;class XA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new jt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new jt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,gs.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(Us*t.fov*.5)/t.zoom;let c,u;h_.elements[12]=-i,u_.elements[12]=i,c=-a*t.aspect+s,u=a*t.aspect+s,gs.elements[0]=2*t.near/(u-c),gs.elements[8]=(u+c)/(u-c),this.cameraL.projectionMatrix.copy(gs),c=-a*t.aspect-s,u=a*t.aspect-s,gs.elements[0]=2*t.near/(u-c),gs.elements[8]=(u+c)/(u-c),this.cameraR.projectionMatrix.copy(gs)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(h_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(u_)}}class nm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=d_(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=d_();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function d_(){return(typeof performance>"u"?Date:performance).now()}const _s=new U,f_=new On,qA=new U,vs=new U;class YA extends Nt{constructor(){super(),this.type="AudioListener",this.context=tm.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new nm}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(_s,f_,qA),vs.set(0,0,-1).applyQuaternion(f_),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(_s.x,i),t.positionY.linearRampToValueAtTime(_s.y,i),t.positionZ.linearRampToValueAtTime(_s.z,i),t.forwardX.linearRampToValueAtTime(vs.x,i),t.forwardY.linearRampToValueAtTime(vs.y,i),t.forwardZ.linearRampToValueAtTime(vs.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(_s.x,_s.y,_s.z),t.setOrientation(vs.x,vs.y,vs.z,n.x,n.y,n.z)}}class iy extends Nt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const xs=new U,p_=new On,ZA=new U,ys=new U;class JA extends iy{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(xs,p_,ZA),ys.set(0,0,1).applyQuaternion(p_);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(xs.x,n),t.positionY.linearRampToValueAtTime(xs.y,n),t.positionZ.linearRampToValueAtTime(xs.z,n),t.orientationX.linearRampToValueAtTime(ys.x,n),t.orientationY.linearRampToValueAtTime(ys.y,n),t.orientationZ.linearRampToValueAtTime(ys.z,n)}else t.setPosition(xs.x,xs.y,xs.z),t.setOrientation(ys.x,ys.y,ys.z)}}class KA{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class ry{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let c=0;c!==i;++c)n[s+c]=n[c];a=t}else{a+=t;const c=t/a;this._mixBufferRegion(n,s,0,c,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let u=t,h=t+t;u!==h;++u)if(n[u]!==n[u+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){On.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;On.multiplyQuaternionsFlat(e,a,e,t,e,n),On.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let c=0;c!==s;++c){const u=t+c;e[u]=e[u]*a+e[n+c]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const c=t+a;e[c]=e[c]+e[n+a]*i}}}const im="\\[\\]\\.:\\/",QA=new RegExp("["+im+"]","g"),rm="[^"+im+"]",$A="[^"+im.replace("\\.","")+"]",eC=/((?:WC+[\/:])*)/.source.replace("WC",rm),tC=/(WCOD+)?/.source.replace("WCOD",$A),nC=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",rm),iC=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",rm),rC=new RegExp("^"+eC+tC+nC+iC+"$"),sC=["material","materials","bones","map"];class oC{constructor(e,t,n){const i=n||Rt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Rt{constructor(e,t,n){this.path=t,this.parsedPath=n||Rt.parseTrackName(t),this.node=Rt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Rt.Composite(e,t,n):new Rt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(QA,"")}static parseTrackName(e){const t=rC.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);sC.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const c=s[a];if(c.name===t||c.uuid===t)return c;const u=n(c.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=Rt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===h){h=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const a=e[i];if(a===void 0){const h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?c=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}u=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(u=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Rt.Composite=oC;Rt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Rt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Rt.prototype.GetterByBindingType=[Rt.prototype._getValue_direct,Rt.prototype._getValue_array,Rt.prototype._getValue_arrayElement,Rt.prototype._getValue_toArray];Rt.prototype.SetterByBindingTypeAndVersioning=[[Rt.prototype._setValue_direct,Rt.prototype._setValue_direct_setNeedsUpdate,Rt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Rt.prototype._setValue_array,Rt.prototype._setValue_array_setNeedsUpdate,Rt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Rt.prototype._setValue_arrayElement,Rt.prototype._setValue_arrayElement_setNeedsUpdate,Rt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Rt.prototype._setValue_fromArray,Rt.prototype._setValue_fromArray_setNeedsUpdate,Rt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class aC{constructor(){this.isAnimationObjectGroup=!0,this.uuid=li(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let c,u=e.length,h=this.nCachedObjects_;for(let d=0,f=arguments.length;d!==f;++d){const m=arguments[d],g=m.uuid;let x=t[g];if(x===void 0){x=u++,t[g]=x,e.push(m);for(let S=0,y=a;S!==y;++S)s[S].push(new Rt(m,n[S],i[S]))}else if(x<h){c=e[x];const S=--h,y=e[S];t[y.uuid]=x,e[x]=y,t[g]=S,e[S]=m;for(let _=0,b=a;_!==b;++_){const M=s[_],T=M[S];let R=M[x];M[x]=T,R===void 0&&(R=new Rt(m,n[_],i[_])),M[S]=R}}else e[x]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=h}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let a=0,c=arguments.length;a!==c;++a){const u=arguments[a],h=u.uuid,d=t[h];if(d!==void 0&&d>=s){const f=s++,m=e[f];t[m.uuid]=d,e[d]=m,t[h]=f,e[f]=u;for(let g=0,x=i;g!==x;++g){const S=n[g],y=S[f],_=S[d];S[d]=y,S[f]=_}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=e.length;for(let c=0,u=arguments.length;c!==u;++c){const h=arguments[c],d=h.uuid,f=t[d];if(f!==void 0)if(delete t[d],f<s){const m=--s,g=e[m],x=--a,S=e[x];t[g.uuid]=f,e[f]=g,t[S.uuid]=m,e[m]=S,e.pop();for(let y=0,_=i;y!==_;++y){const b=n[y],M=b[m],T=b[x];b[f]=M,b[m]=T,b.pop()}}else{const m=--a,g=e[m];m>0&&(t[g.uuid]=f),e[f]=g,e.pop();for(let x=0,S=i;x!==S;++x){const y=n[x];y[f]=y[m],y.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,c=this._parsedPaths,u=this._objects,h=u.length,d=this.nCachedObjects_,f=new Array(h);i=s.length,n[e]=i,a.push(e),c.push(t),s.push(f);for(let m=d,g=u.length;m!==g;++m){const x=u[m];f[m]=new Rt(x,e,t)}return f}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,c=a.length-1,u=a[c],h=e[c];t[h]=n,a[n]=u,a.pop(),s[n]=s[c],s.pop(),i[n]=i[c],i.pop()}}}class sy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,c=new Array(a),u={endingStart:As,endingEnd:As};for(let h=0;h!==a;++h){const d=s[h].createInterpolant(null);c[h]=d,d.settings=u}this._interpolantSettings=u,this._interpolants=c,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Vv,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,a=s/i,c=i/s;e.warp(1,a,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const u=c.parameterPositions,h=c.sampleValues;return u[0]=s,u[1]=s+n,h[0]=e/a,h[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const u=(e-s)*n;u<0||n===0?t=0:(this._startTime=null,t=n*u)}t*=this._updateTimeScale(e);const a=this._updateTime(t),c=this._updateWeight(e);if(c>0){const u=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case wp:for(let d=0,f=u.length;d!==f;++d)u[d].evaluate(a),h[d].accumulateAdditive(c);break;case ku:default:for(let d=0,f=u.length;d!==f;++d)u[d].evaluate(a),h[d].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===Gv;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===Hv){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,s+=Math.abs(c);const u=this.repetitions-s;if(u<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(u===1){const h=e<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Cs,i.endingEnd=Cs):(e?i.endingStart=this.zeroSlopeAtStart?Cs:As:i.endingStart=Ja,t?i.endingEnd=this.zeroSlopeAtEnd?Cs:As:i.endingEnd=Ja)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const c=a.parameterPositions,u=a.sampleValues;return c[0]=s,u[0]=t,c[1]=s+e,u[1]=n,this}}const lC=new Float32Array(1);class cC extends wr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,c=e._interpolants,u=n.uuid,h=this._bindingsByRootAndName;let d=h[u];d===void 0&&(d={},h[u]=d);for(let f=0;f!==s;++f){const m=i[f],g=m.name;let x=d[g];if(x!==void 0)++x.referenceCount,a[f]=x;else{if(x=a[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,u,g));continue}const S=t&&t._propertyBindings[f].binding.parsedPath;x=new ry(Rt.create(n,g,S),m.ValueTypeName,m.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,u,g),a[f]=x}c[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const c=a.knownActions;e._byClipCacheIndex=c.length,c.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,c=a[s],u=c.knownActions,h=u[u.length-1],d=e._byClipCacheIndex;h._byClipCacheIndex=d,u[d]=h,u.pop(),e._byClipCacheIndex=null;const f=c.actionByRoot,m=(e._localRoot||this._root).uuid;delete f[m],u.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,c=a[i],u=t[t.length-1],h=e._cacheIndex;u._cacheIndex=h,t[h]=u,t.pop(),delete c[s],Object.keys(c).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Jp(new Float32Array(2),new Float32Array(2),1,lC),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?ll.findByName(i,e):e;const c=a!==null?a.uuid:e,u=this._actionsByClip[c];let h=null;if(n===void 0&&(a!==null?n=a.blendMode:n=ku),u!==void 0){const f=u.actionByRoot[s];if(f!==void 0&&f.blendMode===n)return f;h=u.knownActions[0],a===null&&(a=h._clip)}if(a===null)return null;const d=new sy(this,a,t,n);return this._bindAction(d,h),this._addInactiveAction(d,c,s),d}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?ll.findByName(n,e):e,a=s?s.uuid:e,c=this._actionsByClip[a];return c!==void 0&&c.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,s,a);const c=this._bindings,u=this._nActiveBindings;for(let h=0;h!==u;++h)c[h].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let c=0,u=a.length;c!==u;++c){const h=a[c];this._deactivateAction(h);const d=h._cacheIndex,f=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,f._cacheIndex=d,t[d]=f,t.pop(),this._removeInactiveBindingsForAction(h)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const c=n[a].actionByRoot,u=c[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const c=s[a];c.restoreOriginalState(),this._removeInactiveBinding(c)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class sm{constructor(e){this.value=e}clone(){return new sm(this.value.clone===void 0?this.value:this.value.clone())}}let uC=0;class hC extends wr{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:uC++}),this.name="",this.usage=el,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class Du extends Xu{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class dC{constructor(e,t,n,i,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class oy{constructor(e,t,n=0,i=1/0){this.ray=new Vs(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Os,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return up(e,this,n,t),n.sort(m_),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)up(e[i],this,n,t);return n.sort(m_),n}}function m_(r,e){return r.distance-e.distance}function up(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,a=i.length;s<a;s++)up(i[s],e,t,!0)}}class hp{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Jt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class fC{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const g_=new he;class pC{constructor(e=new he(1/0,1/0),t=new he(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=g_.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,g_).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const __=new U,su=new U;class ay{constructor(e=new U,t=new U){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){__.subVectors(e,this.start),su.subVectors(this.end,this.start);const n=su.dot(su);let s=su.dot(__)/n;return t&&(s=Jt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const v_=new U;class mC extends Nt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new St,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,c=1,u=32;a<u;a++,c++){const h=a/u*Math.PI*2,d=c/u*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(d),Math.sin(d),1)}n.setAttribute("position",new qe(i,3));const s=new jn({fog:!1,toneMapped:!1});this.cone=new ir(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),v_.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(v_),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Hr=new U,ou=new lt,tf=new lt;class gC extends ir{constructor(e){const t=ly(e),n=new St,i=[],s=[],a=new ke(0,0,1),c=new ke(0,1,0);for(let h=0;h<t.length;h++){const d=t[h];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(a.r,a.g,a.b),s.push(c.r,c.g,c.b))}n.setAttribute("position",new qe(i,3)),n.setAttribute("color",new qe(s,3));const u=new jn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,u),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");tf.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const c=t[s];c.parent&&c.parent.isBone&&(ou.multiplyMatrices(tf,c.matrixWorld),Hr.setFromMatrixPosition(ou),i.setXYZ(a,Hr.x,Hr.y,Hr.z),ou.multiplyMatrices(tf,c.parent.matrixWorld),Hr.setFromMatrixPosition(ou),i.setXYZ(a+1,Hr.x,Hr.y,Hr.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function ly(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,ly(r.children[t]));return e}class _C extends an{constructor(e,t,n){const i=new xl(t,4,2),s=new Qr({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const vC=new U,x_=new ke,y_=new ke;class xC extends Nt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new vl(t);i.rotateY(Math.PI*.5),this.material=new Qr({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new Ut(a,3)),this.add(new an(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");x_.copy(this.light.color),y_.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?x_:y_;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(vC.setFromMatrixPosition(this.light.matrixWorld).negate())}}class yC extends ir{constructor(e=10,t=10,n=4473924,i=8947848){n=new ke(n),i=new ke(i);const s=t/2,a=e/t,c=e/2,u=[],h=[];for(let m=0,g=0,x=-c;m<=t;m++,x+=a){u.push(-c,0,x,c,0,x),u.push(x,0,-c,x,0,c);const S=m===s?n:i;S.toArray(h,g),g+=3,S.toArray(h,g),g+=3,S.toArray(h,g),g+=3,S.toArray(h,g),g+=3}const d=new St;d.setAttribute("position",new qe(u,3)),d.setAttribute("color",new qe(h,3));const f=new jn({vertexColors:!0,toneMapped:!1});super(d,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class SC extends ir{constructor(e=10,t=16,n=8,i=64,s=4473924,a=8947848){s=new ke(s),a=new ke(a);const c=[],u=[];if(t>1)for(let f=0;f<t;f++){const m=f/t*(Math.PI*2),g=Math.sin(m)*e,x=Math.cos(m)*e;c.push(0,0,0),c.push(g,0,x);const S=f&1?s:a;u.push(S.r,S.g,S.b),u.push(S.r,S.g,S.b)}for(let f=0;f<n;f++){const m=f&1?s:a,g=e-e/n*f;for(let x=0;x<i;x++){let S=x/i*(Math.PI*2),y=Math.sin(S)*g,_=Math.cos(S)*g;c.push(y,0,_),u.push(m.r,m.g,m.b),S=(x+1)/i*(Math.PI*2),y=Math.sin(S)*g,_=Math.cos(S)*g,c.push(y,0,_),u.push(m.r,m.g,m.b)}}const h=new St;h.setAttribute("position",new qe(c,3)),h.setAttribute("color",new qe(u,3));const d=new jn({vertexColors:!0,toneMapped:!1});super(h,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const S_=new U,au=new U,M_=new U;class MC extends Nt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new St;i.setAttribute("position",new qe([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new jn({fog:!1,toneMapped:!1});this.lightPlane=new Jr(i,s),this.add(this.lightPlane),i=new St,i.setAttribute("position",new qe([0,0,0,0,0,1],3)),this.targetLine=new Jr(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),S_.setFromMatrixPosition(this.light.matrixWorld),au.setFromMatrixPosition(this.light.target.matrixWorld),M_.subVectors(au,S_),this.lightPlane.lookAt(au),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(au),this.targetLine.scale.z=M_.length()}}const lu=new U,Zt=new fl;class EC extends ir{constructor(e){const t=new St,n=new jn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4");function c(x,S){u(x),u(S)}function u(x){i.push(0,0,0),s.push(0,0,0),a[x]===void 0&&(a[x]=[]),a[x].push(i.length/3-1)}t.setAttribute("position",new qe(i,3)),t.setAttribute("color",new qe(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const h=new ke(16755200),d=new ke(16711680),f=new ke(43775),m=new ke(16777215),g=new ke(3355443);this.setColors(h,d,f,m,g)}setColors(e,t,n,i,s){const c=this.geometry.getAttribute("color");c.setXYZ(0,e.r,e.g,e.b),c.setXYZ(1,e.r,e.g,e.b),c.setXYZ(2,e.r,e.g,e.b),c.setXYZ(3,e.r,e.g,e.b),c.setXYZ(4,e.r,e.g,e.b),c.setXYZ(5,e.r,e.g,e.b),c.setXYZ(6,e.r,e.g,e.b),c.setXYZ(7,e.r,e.g,e.b),c.setXYZ(8,e.r,e.g,e.b),c.setXYZ(9,e.r,e.g,e.b),c.setXYZ(10,e.r,e.g,e.b),c.setXYZ(11,e.r,e.g,e.b),c.setXYZ(12,e.r,e.g,e.b),c.setXYZ(13,e.r,e.g,e.b),c.setXYZ(14,e.r,e.g,e.b),c.setXYZ(15,e.r,e.g,e.b),c.setXYZ(16,e.r,e.g,e.b),c.setXYZ(17,e.r,e.g,e.b),c.setXYZ(18,e.r,e.g,e.b),c.setXYZ(19,e.r,e.g,e.b),c.setXYZ(20,e.r,e.g,e.b),c.setXYZ(21,e.r,e.g,e.b),c.setXYZ(22,e.r,e.g,e.b),c.setXYZ(23,e.r,e.g,e.b),c.setXYZ(24,t.r,t.g,t.b),c.setXYZ(25,t.r,t.g,t.b),c.setXYZ(26,t.r,t.g,t.b),c.setXYZ(27,t.r,t.g,t.b),c.setXYZ(28,t.r,t.g,t.b),c.setXYZ(29,t.r,t.g,t.b),c.setXYZ(30,t.r,t.g,t.b),c.setXYZ(31,t.r,t.g,t.b),c.setXYZ(32,n.r,n.g,n.b),c.setXYZ(33,n.r,n.g,n.b),c.setXYZ(34,n.r,n.g,n.b),c.setXYZ(35,n.r,n.g,n.b),c.setXYZ(36,n.r,n.g,n.b),c.setXYZ(37,n.r,n.g,n.b),c.setXYZ(38,i.r,i.g,i.b),c.setXYZ(39,i.r,i.g,i.b),c.setXYZ(40,s.r,s.g,s.b),c.setXYZ(41,s.r,s.g,s.b),c.setXYZ(42,s.r,s.g,s.b),c.setXYZ(43,s.r,s.g,s.b),c.setXYZ(44,s.r,s.g,s.b),c.setXYZ(45,s.r,s.g,s.b),c.setXYZ(46,s.r,s.g,s.b),c.setXYZ(47,s.r,s.g,s.b),c.setXYZ(48,s.r,s.g,s.b),c.setXYZ(49,s.r,s.g,s.b),c.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Zt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),$t("c",t,e,Zt,0,0,-1),$t("t",t,e,Zt,0,0,1),$t("n1",t,e,Zt,-n,-i,-1),$t("n2",t,e,Zt,n,-i,-1),$t("n3",t,e,Zt,-n,i,-1),$t("n4",t,e,Zt,n,i,-1),$t("f1",t,e,Zt,-n,-i,1),$t("f2",t,e,Zt,n,-i,1),$t("f3",t,e,Zt,-n,i,1),$t("f4",t,e,Zt,n,i,1),$t("u1",t,e,Zt,n*.7,i*1.1,-1),$t("u2",t,e,Zt,-n*.7,i*1.1,-1),$t("u3",t,e,Zt,0,i*2,-1),$t("cf1",t,e,Zt,-n,0,1),$t("cf2",t,e,Zt,n,0,1),$t("cf3",t,e,Zt,0,-i,1),$t("cf4",t,e,Zt,0,i,1),$t("cn1",t,e,Zt,-n,0,-1),$t("cn2",t,e,Zt,n,0,-1),$t("cn3",t,e,Zt,0,-i,-1),$t("cn4",t,e,Zt,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function $t(r,e,t,n,i,s,a){lu.set(i,s,a).unproject(n);const c=e[r];if(c!==void 0){const u=t.getAttribute("position");for(let h=0,d=c.length;h<d;h++)u.setXYZ(c[h],lu.x,lu.y,lu.z)}}const cu=new vn;class bC extends ir{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new St;s.setIndex(new Ut(n,1)),s.setAttribute("position",new Ut(i,3)),super(s,new jn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&cu.setFromObject(this.object),cu.isEmpty())return;const t=cu.min,n=cu.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class wC extends ir{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new St;s.setIndex(new Ut(n,1)),s.setAttribute("position",new qe(i,3)),super(s,new jn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class TC extends Jr{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new St;a.setAttribute("position",new qe(s,3)),a.computeBoundingSphere(),super(a,new jn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],u=new St;u.setAttribute("position",new qe(c,3)),u.computeBoundingSphere(),this.add(new an(u,new Qr({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const E_=new U;let uu,nf;class AC extends Nt{constructor(e=new U(0,0,1),t=new U(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",uu===void 0&&(uu=new St,uu.setAttribute("position",new qe([0,0,0,0,1,0],3)),nf=new Qo(0,.5,1,5,1),nf.translate(0,-.5,0)),this.position.copy(t),this.line=new Jr(uu,new jn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new an(nf,new Qr({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{E_.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(E_,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class CC extends ir{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new St;i.setAttribute("position",new qe(t,3)),i.setAttribute("color",new qe(n,3));const s=new jn({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new ke,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class RC{constructor(){this.type="ShapePath",this.color=new ke,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new nl,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,a){return this.currentPath.bezierCurveTo(e,t,n,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(_){const b=[];for(let M=0,T=_.length;M<T;M++){const R=_[M],C=new zs;C.curves=R.curves,b.push(C)}return b}function n(_,b){const M=b.length;let T=!1;for(let R=M-1,C=0;C<M;R=C++){let N=b[R],B=b[C],A=B.x-N.x,P=B.y-N.y;if(Math.abs(P)>Number.EPSILON){if(P<0&&(N=b[C],A=-A,B=b[R],P=-P),_.y<N.y||_.y>B.y)continue;if(_.y===N.y){if(_.x===N.x)return!0}else{const z=P*(_.x-N.x)-A*(_.y-N.y);if(z===0)return!0;if(z<0)continue;T=!T}}else{if(_.y!==N.y)continue;if(B.x<=_.x&&_.x<=N.x||N.x<=_.x&&_.x<=B.x)return!0}}return T}const i=tr.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,c,u;const h=[];if(s.length===1)return c=s[0],u=new zs,u.curves=c.curves,h.push(u),h;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],m=[];let g=[],x=0,S;m[x]=void 0,g[x]=[];for(let _=0,b=s.length;_<b;_++)c=s[_],S=c.getPoints(),a=i(S),a=e?!a:a,a?(!d&&m[x]&&x++,m[x]={s:new zs,p:S},m[x].s.curves=c.curves,d&&x++,g[x]=[]):g[x].push({h:c,p:S[0]});if(!m[0])return t(s);if(m.length>1){let _=!1,b=0;for(let M=0,T=m.length;M<T;M++)f[M]=[];for(let M=0,T=m.length;M<T;M++){const R=g[M];for(let C=0;C<R.length;C++){const N=R[C];let B=!0;for(let A=0;A<m.length;A++)n(N.p,m[A].p)&&(M!==A&&b++,B?(B=!1,f[A].push(N)):_=!0);B&&f[M].push(N)}}b>0&&_===!1&&(g=f)}let y;for(let _=0,b=m.length;_<b;_++){u=m[_].s,h.push(u),y=g[_];for(let M=0,T=y.length;M<T;M++)u.holes.push(y[M].h)}return h}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Zo}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Zo);const PC=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Fu,AddEquation:Gr,AddOperation:Tv,AdditiveAnimationBlendMode:wp,AdditiveBlending:Ef,AgXToneMapping:Lv,AlphaFormat:Uv,AlwaysCompare:$v,AlwaysDepth:xv,AlwaysStencilFunc:ep,AmbientLight:Qx,AnimationAction:sy,AnimationClip:ll,AnimationLoader:DA,AnimationMixer:cC,AnimationObjectGroup:aC,AnimationUtils:PA,ArcCurve:wx,ArrayCamera:mx,ArrowHelper:AC,AttachedBindMode:Cf,Audio:iy,AudioAnalyser:KA,AudioContext:tm,AudioListener:YA,AudioLoader:jA,AxesHelper:CC,BackSide:An,BasicDepthPacking:Wv,BasicShadowMap:tv,BatchedMesh:Mx,Bone:kp,BooleanKeyframeTrack:Ws,Box2:pC,Box3:vn,Box3Helper:wC,BoxGeometry:Gs,BoxHelper:bC,BufferAttribute:Ut,BufferGeometry:St,BufferGeometryLoader:ny,ByteType:Nv,Cache:yr,Camera:fl,CameraHelper:EC,CanvasTexture:eA,CapsuleGeometry:Qu,CatmullRomCurve3:Vp,CineonToneMapping:Rv,CircleGeometry:$u,ClampToEdgeWrapping:Un,Clock:nm,Color:ke,ColorKeyframeTrack:Kp,ColorManagement:Dt,CompressedArrayTexture:QT,CompressedCubeTexture:$T,CompressedTexture:Zu,CompressedTextureLoader:UA,ConeGeometry:eh,ConstantAlphaFactor:gv,ConstantColorFactor:pv,CubeCamera:ox,CubeReflectionMapping:Er,CubeRefractionMapping:Yr,CubeTexture:pl,CubeTextureLoader:OA,CubeUVReflectionMapping:Jo,CubicBezierCurve:Gp,CubicBezierCurve3:Tx,CubicInterpolant:Wx,CullFaceBack:Mf,CullFaceFront:ev,CullFaceFrontBack:GS,CullFaceNone:$_,Curve:Fi,CurvePath:Cx,CustomBlending:nv,CustomToneMapping:Pv,CylinderGeometry:Qo,Cylindrical:fC,Data3DTexture:Pp,DataArrayTexture:Vu,DataTexture:Fs,DataTextureLoader:FA,DataUtils:KM,DecrementStencilOp:tM,DecrementWrapStencilOp:iM,DefaultLoadingManager:qx,DepthFormat:Xr,DepthStencilFormat:ks,DepthTexture:Dp,DetachedBindMode:Iv,DirectionalLight:Kx,DirectionalLightHelper:MC,DiscreteInterpolant:jx,DisplayP3ColorSpace:Hu,DodecahedronGeometry:th,DoubleSide:Si,DstAlphaFactor:cv,DstColorFactor:hv,DynamicCopyUsage:_M,DynamicDrawUsage:Ds,DynamicReadUsage:pM,EdgesGeometry:Rx,EllipseCurve:Ju,EqualCompare:Zv,EqualDepth:Sv,EqualStencilFunc:aM,EquirectangularReflectionMapping:Wa,EquirectangularRefractionMapping:ja,Euler:dl,EventDispatcher:wr,ExtrudeGeometry:ih,FileLoader:br,Float16BufferAttribute:iE,Float32BufferAttribute:qe,Float64BufferAttribute:rE,FloatType:Ni,Fog:ju,FogExp2:Wu,FramebufferTexture:KT,FrontSide:Mr,Frustum:ml,GLBufferAttribute:dC,GLSL1:xM,GLSL3:tp,GreaterCompare:Jv,GreaterDepth:Ev,GreaterEqualCompare:Qv,GreaterEqualDepth:Mv,GreaterEqualStencilFunc:hM,GreaterStencilFunc:cM,GridHelper:yC,Group:Bo,HalfFloatType:Go,HemisphereLight:Yx,HemisphereLightHelper:xC,IcosahedronGeometry:rh,ImageBitmapLoader:WA,ImageLoader:cl,ImageUtils:Rp,IncrementStencilOp:eM,IncrementWrapStencilOp:nM,InstancedBufferAttribute:qo,InstancedBufferGeometry:em,InstancedInterleavedBuffer:Du,InstancedMesh:Sx,Int16BufferAttribute:tE,Int32BufferAttribute:nE,Int8BufferAttribute:QM,IntType:vp,InterleavedBuffer:Xu,InterleavedBufferAttribute:ai,Interpolant:yl,InterpolateDiscrete:Ya,InterpolateLinear:Za,InterpolateSmooth:Eu,InvertStencilOp:rM,KeepStencilOp:bs,KeyframeTrack:zi,LOD:xx,LatheGeometry:_l,Layers:Os,LessCompare:Yv,LessDepth:yv,LessEqualCompare:Ap,LessEqualDepth:Ga,LessEqualStencilFunc:lM,LessStencilFunc:oM,Light:es,LightProbe:ty,Line:Jr,Line3:ay,LineBasicMaterial:jn,LineCurve:Wp,LineCurve3:Ax,LineDashedMaterial:Hx,LineLoop:Ex,LineSegments:ir,LinearDisplayP3ColorSpace:hl,LinearEncoding:Tp,LinearFilter:tn,LinearInterpolant:Jp,LinearMipMapLinearFilter:YS,LinearMipMapNearestFilter:qS,LinearMipmapLinearFilter:Zr,LinearMipmapNearestFilter:_p,LinearSRGBColorSpace:nr,LinearToneMapping:Av,LinearTransfer:Ka,Loader:Qn,LoaderUtils:cp,LoadingManager:Qp,LoopOnce:Hv,LoopPingPong:Gv,LoopRepeat:Vv,LuminanceAlphaFormat:Fv,LuminanceFormat:Ov,MOUSE:Ms,Material:zn,MaterialLoader:hh,MathUtils:ex,Matrix3:yt,Matrix4:lt,MaxEquation:Af,Mesh:an,MeshBasicMaterial:Qr,MeshDepthMaterial:Up,MeshDistanceMaterial:Op,MeshLambertMaterial:Bx,MeshMatcapMaterial:kx,MeshNormalMaterial:zx,MeshPhongMaterial:Ox,MeshPhysicalMaterial:Ux,MeshStandardMaterial:Yp,MeshToonMaterial:Fx,MinEquation:Tf,MirroredRepeatWrapping:qa,MixOperation:wv,MultiplyBlending:wf,MultiplyOperation:ul,NearestFilter:en,NearestMipMapLinearFilter:XS,NearestMipMapNearestFilter:jS,NearestMipmapLinearFilter:za,NearestMipmapNearestFilter:Ru,NeverCompare:qv,NeverDepth:vv,NeverStencilFunc:sM,NoBlending:Sr,NoColorSpace:oi,NoToneMapping:Qi,NormalAnimationBlendMode:ku,NormalBlending:Ns,NotEqualCompare:Kv,NotEqualDepth:bv,NotEqualStencilFunc:uM,NumberKeyframeTrack:ol,Object3D:Nt,ObjectLoader:VA,ObjectSpaceNormalMap:Xv,OctahedronGeometry:vl,OneFactor:ov,OneMinusConstantAlphaFactor:_v,OneMinusConstantColorFactor:mv,OneMinusDstAlphaFactor:uv,OneMinusDstColorFactor:dv,OneMinusSrcAlphaFactor:Cu,OneMinusSrcColorFactor:lv,OrthographicCamera:er,P3Primaries:$a,PCFShadowMap:Ou,PCFSoftShadowMap:Fa,PMREMGenerator:ip,Path:nl,PerspectiveCamera:jt,Plane:_r,PlaneGeometry:gl,PlaneHelper:TC,PointLight:Jx,PointLightHelper:_C,Points:bx,PointsMaterial:Yu,PolarGridHelper:SC,PolyhedronGeometry:$r,PositionalAudio:JA,PropertyBinding:Rt,PropertyMixer:ry,QuadraticBezierCurve:jp,QuadraticBezierCurve3:Ku,Quaternion:On,QuaternionKeyframeTrack:$o,QuaternionLinearInterpolant:Xx,RED_GREEN_RGTC2_Format:Qf,RED_RGTC1_Format:kv,REVISION:Zo,RGBADepthPacking:jv,RGBAFormat:Wn,RGBAIntegerFormat:Ep,RGBA_ASTC_10x10_Format:Xf,RGBA_ASTC_10x5_Format:Gf,RGBA_ASTC_10x6_Format:Wf,RGBA_ASTC_10x8_Format:jf,RGBA_ASTC_12x10_Format:qf,RGBA_ASTC_12x12_Format:Yf,RGBA_ASTC_4x4_Format:Uf,RGBA_ASTC_5x4_Format:Of,RGBA_ASTC_5x5_Format:Ff,RGBA_ASTC_6x5_Format:zf,RGBA_ASTC_6x6_Format:Bf,RGBA_ASTC_8x5_Format:kf,RGBA_ASTC_8x6_Format:Hf,RGBA_ASTC_8x8_Format:Vf,RGBA_BPTC_Format:Mu,RGBA_ETC2_EAC_Format:Df,RGBA_PVRTC_2BPPV1_Format:If,RGBA_PVRTC_4BPPV1_Format:Lf,RGBA_S3TC_DXT1_Format:xu,RGBA_S3TC_DXT3_Format:yu,RGBA_S3TC_DXT5_Format:Su,RGB_BPTC_SIGNED_Format:Zf,RGB_BPTC_UNSIGNED_Format:Jf,RGB_ETC1_Format:bp,RGB_ETC2_Format:Nf,RGB_PVRTC_2BPPV1_Format:Pf,RGB_PVRTC_4BPPV1_Format:Rf,RGB_S3TC_DXT1_Format:vu,RGFormat:Bv,RGIntegerFormat:Mp,RawShaderMaterial:Dx,Ray:Vs,Raycaster:oy,Rec709Primaries:Qa,RectAreaLight:$x,RedFormat:zv,RedIntegerFormat:Sp,ReinhardToneMapping:Cv,RenderTarget:ix,RepeatWrapping:Xa,ReplaceStencilOp:$S,ReverseSubtractEquation:rv,RingGeometry:sh,SIGNED_RED_GREEN_RGTC2_Format:$f,SIGNED_RED_RGTC1_Format:Kf,SRGBColorSpace:cn,SRGBTransfer:zt,Scene:zp,ShaderChunk:_t,ShaderLib:Li,ShaderMaterial:Oi,ShadowMaterial:Nx,Shape:zs,ShapeGeometry:oh,ShapePath:RC,ShapeUtils:tr,ShortType:Dv,Skeleton:qu,SkeletonHelper:gC,SkinnedMesh:yx,Source:Rs,Sphere:xn,SphereGeometry:xl,Spherical:hp,SphericalHarmonics3:ey,SplineCurve:Xp,SpotLight:Zx,SpotLightHelper:mC,Sprite:vx,SpriteMaterial:Bp,SrcAlphaFactor:Au,SrcAlphaSaturateFactor:fv,SrcColorFactor:av,StaticCopyUsage:gM,StaticDrawUsage:el,StaticReadUsage:fM,StereoCamera:XA,StreamCopyUsage:vM,StreamDrawUsage:dM,StreamReadUsage:mM,StringKeyframeTrack:js,SubtractEquation:iv,SubtractiveBlending:bf,TOUCH:Es,TangentSpaceNormalMap:Kr,TetrahedronGeometry:ah,Texture:nn,TextureLoader:zA,TorusGeometry:lh,TorusKnotGeometry:ch,Triangle:Jn,TriangleFanDrawMode:KS,TriangleStripDrawMode:JS,TrianglesDrawMode:ZS,TubeGeometry:uh,TwoPassDoubleSide:WS,UVMapping:zu,Uint16BufferAttribute:Lp,Uint32BufferAttribute:Ip,Uint8BufferAttribute:$M,Uint8ClampedBufferAttribute:eE,Uniform:sm,UniformsGroup:hC,UniformsLib:Ce,UniformsUtils:Iu,UnsignedByteType:$i,UnsignedInt248Type:jr,UnsignedIntType:xr,UnsignedShort4444Type:xp,UnsignedShort5551Type:yp,UnsignedShortType:Bu,VSMShadowMap:Ri,Vector2:he,Vector3:U,Vector4:At,VectorKeyframeTrack:al,VideoTexture:JT,WebGL1Renderer:gx,WebGL3DRenderTarget:BM,WebGLArrayRenderTarget:zM,WebGLCoordinateSystem:Di,WebGLCubeRenderTarget:ax,WebGLMultipleRenderTargets:kM,WebGLRenderTarget:Ui,WebGLRenderer:Fp,WebGLUtils:px,WebGPUCoordinateSystem:Wo,WireframeGeometry:qp,WrapAroundEnding:Ja,ZeroCurvatureEnding:As,ZeroFactor:sv,ZeroSlopeEnding:Cs,ZeroStencilOp:QS,_SRGBAFormat:Pu,createCanvasElement:nx,sRGBEncoding:qr},Symbol.toStringTag,{value:"Module"}));var cy={exports:{}},Xs={};/**
3687
+ }`;function UT(r,e,t){let n=new ml;const i=new he,s=new he,a=new At,c=new Dp({depthPacking:jv}),u=new Up,h={},d=t.maxTextureSize,f={[Mr]:An,[An]:Mr,[Si]:Si},m=new Oi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new he},radius:{value:4}},vertexShader:NT,fragmentShader:DT}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const x=new St;x.setAttribute("position",new Ut(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new an(x,m),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ou;let _=this.type;this.render=function(C,N,B){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||C.length===0)return;const A=r.getRenderTarget(),P=r.getActiveCubeFace(),z=r.getActiveMipmapLevel(),ee=r.state;ee.setBlending(Sr),ee.buffers.color.setClear(1,1,1,1),ee.buffers.depth.setTest(!0),ee.setScissorTest(!1);const de=_!==Ri&&this.type===Ri,H=_===Ri&&this.type!==Ri;for(let q=0,ie=C.length;q<ie;q++){const le=C[q],j=le.shadow;if(j===void 0){console.warn("THREE.WebGLShadowMap:",le,"has no shadow.");continue}if(j.autoUpdate===!1&&j.needsUpdate===!1)continue;i.copy(j.mapSize);const Z=j.getFrameExtents();if(i.multiply(Z),s.copy(j.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/Z.x),i.x=s.x*Z.x,j.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/Z.y),i.y=s.y*Z.y,j.mapSize.y=s.y)),j.map===null||de===!0||H===!0){const te=this.type!==Ri?{minFilter:en,magFilter:en}:{};j.map!==null&&j.map.dispose(),j.map=new Ui(i.x,i.y,te),j.map.texture.name=le.name+".shadowMap",j.camera.updateProjectionMatrix()}r.setRenderTarget(j.map),r.clear();const J=j.getViewportCount();for(let te=0;te<J;te++){const ge=j.getViewport(te);a.set(s.x*ge.x,s.y*ge.y,s.x*ge.z,s.y*ge.w),ee.viewport(a),j.updateMatrices(le,te),n=j.getFrustum(),T(N,B,j.camera,le,this.type)}j.isPointLightShadow!==!0&&this.type===Ri&&b(j,B),j.needsUpdate=!1}_=this.type,y.needsUpdate=!1,r.setRenderTarget(A,P,z)};function b(C,N){const B=e.update(S);m.defines.VSM_SAMPLES!==C.blurSamples&&(m.defines.VSM_SAMPLES=C.blurSamples,g.defines.VSM_SAMPLES=C.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new Ui(i.x,i.y)),m.uniforms.shadow_pass.value=C.map.texture,m.uniforms.resolution.value=C.mapSize,m.uniforms.radius.value=C.radius,r.setRenderTarget(C.mapPass),r.clear(),r.renderBufferDirect(N,null,B,m,S,null),g.uniforms.shadow_pass.value=C.mapPass.texture,g.uniforms.resolution.value=C.mapSize,g.uniforms.radius.value=C.radius,r.setRenderTarget(C.map),r.clear(),r.renderBufferDirect(N,null,B,g,S,null)}function M(C,N,B,A){let P=null;const z=B.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(z!==void 0)P=z;else if(P=B.isPointLight===!0?u:c,r.localClippingEnabled&&N.clipShadows===!0&&Array.isArray(N.clippingPlanes)&&N.clippingPlanes.length!==0||N.displacementMap&&N.displacementScale!==0||N.alphaMap&&N.alphaTest>0||N.map&&N.alphaTest>0){const ee=P.uuid,de=N.uuid;let H=h[ee];H===void 0&&(H={},h[ee]=H);let q=H[de];q===void 0&&(q=P.clone(),H[de]=q,N.addEventListener("dispose",R)),P=q}if(P.visible=N.visible,P.wireframe=N.wireframe,A===Ri?P.side=N.shadowSide!==null?N.shadowSide:N.side:P.side=N.shadowSide!==null?N.shadowSide:f[N.side],P.alphaMap=N.alphaMap,P.alphaTest=N.alphaTest,P.map=N.map,P.clipShadows=N.clipShadows,P.clippingPlanes=N.clippingPlanes,P.clipIntersection=N.clipIntersection,P.displacementMap=N.displacementMap,P.displacementScale=N.displacementScale,P.displacementBias=N.displacementBias,P.wireframeLinewidth=N.wireframeLinewidth,P.linewidth=N.linewidth,B.isPointLight===!0&&P.isMeshDistanceMaterial===!0){const ee=r.properties.get(P);ee.light=B}return P}function T(C,N,B,A,P){if(C.visible===!1)return;if(C.layers.test(N.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&P===Ri)&&(!C.frustumCulled||n.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,C.matrixWorld);const de=e.update(C),H=C.material;if(Array.isArray(H)){const q=de.groups;for(let ie=0,le=q.length;ie<le;ie++){const j=q[ie],Z=H[j.materialIndex];if(Z&&Z.visible){const J=M(C,Z,A,P);C.onBeforeShadow(r,C,N,B,de,J,j),r.renderBufferDirect(B,null,de,J,C,j),C.onAfterShadow(r,C,N,B,de,J,j)}}}else if(H.visible){const q=M(C,H,A,P);C.onBeforeShadow(r,C,N,B,de,q,null),r.renderBufferDirect(B,null,de,q,C,null),C.onAfterShadow(r,C,N,B,de,q,null)}}const ee=C.children;for(let de=0,H=ee.length;de<H;de++)T(ee[de],N,B,A,P)}function R(C){C.target.removeEventListener("dispose",R);for(const B in h){const A=h[B],P=C.target.uuid;P in A&&(A[P].dispose(),delete A[P])}}}function OT(r,e,t){const n=t.isWebGL2;function i(){let G=!1;const Te=new At;let De=null;const tt=new At(0,0,0,0);return{setMask:function(Ye){De!==Ye&&!G&&(r.colorMask(Ye,Ye,Ye,Ye),De=Ye)},setLocked:function(Ye){G=Ye},setClear:function(Ye,bt,Tt,Ot,Ht){Ht===!0&&(Ye*=Ot,bt*=Ot,Tt*=Ot),Te.set(Ye,bt,Tt,Ot),tt.equals(Te)===!1&&(r.clearColor(Ye,bt,Tt,Ot),tt.copy(Te))},reset:function(){G=!1,De=null,tt.set(-1,0,0,0)}}}function s(){let G=!1,Te=null,De=null,tt=null;return{setTest:function(Ye){Ye?rt(r.DEPTH_TEST):Pe(r.DEPTH_TEST)},setMask:function(Ye){Te!==Ye&&!G&&(r.depthMask(Ye),Te=Ye)},setFunc:function(Ye){if(De!==Ye){switch(Ye){case vv:r.depthFunc(r.NEVER);break;case xv:r.depthFunc(r.ALWAYS);break;case yv:r.depthFunc(r.LESS);break;case Ga:r.depthFunc(r.LEQUAL);break;case Sv:r.depthFunc(r.EQUAL);break;case Mv:r.depthFunc(r.GEQUAL);break;case Ev:r.depthFunc(r.GREATER);break;case bv:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}De=Ye}},setLocked:function(Ye){G=Ye},setClear:function(Ye){tt!==Ye&&(r.clearDepth(Ye),tt=Ye)},reset:function(){G=!1,Te=null,De=null,tt=null}}}function a(){let G=!1,Te=null,De=null,tt=null,Ye=null,bt=null,Tt=null,Ot=null,Ht=null;return{setTest:function(Ct){G||(Ct?rt(r.STENCIL_TEST):Pe(r.STENCIL_TEST))},setMask:function(Ct){Te!==Ct&&!G&&(r.stencilMask(Ct),Te=Ct)},setFunc:function(Ct,yn,ci){(De!==Ct||tt!==yn||Ye!==ci)&&(r.stencilFunc(Ct,yn,ci),De=Ct,tt=yn,Ye=ci)},setOp:function(Ct,yn,ci){(bt!==Ct||Tt!==yn||Ot!==ci)&&(r.stencilOp(Ct,yn,ci),bt=Ct,Tt=yn,Ot=ci)},setLocked:function(Ct){G=Ct},setClear:function(Ct){Ht!==Ct&&(r.clearStencil(Ct),Ht=Ct)},reset:function(){G=!1,Te=null,De=null,tt=null,Ye=null,bt=null,Tt=null,Ot=null,Ht=null}}}const c=new i,u=new s,h=new a,d=new WeakMap,f=new WeakMap;let m={},g={},x=new WeakMap,S=[],y=null,_=!1,b=null,M=null,T=null,R=null,C=null,N=null,B=null,A=new ke(0,0,0),P=0,z=!1,ee=null,de=null,H=null,q=null,ie=null;const le=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let j=!1,Z=0;const J=r.getParameter(r.VERSION);J.indexOf("WebGL")!==-1?(Z=parseFloat(/^WebGL (\d)/.exec(J)[1]),j=Z>=1):J.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),j=Z>=2);let te=null,ge={};const K=r.getParameter(r.SCISSOR_BOX),fe=r.getParameter(r.VIEWPORT),be=new At().fromArray(K),Oe=new At().fromArray(fe);function Ne(G,Te,De,tt){const Ye=new Uint8Array(4),bt=r.createTexture();r.bindTexture(G,bt),r.texParameteri(G,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(G,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Tt=0;Tt<De;Tt++)n&&(G===r.TEXTURE_3D||G===r.TEXTURE_2D_ARRAY)?r.texImage3D(Te,0,r.RGBA,1,1,tt,0,r.RGBA,r.UNSIGNED_BYTE,Ye):r.texImage2D(Te+Tt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Ye);return bt}const Je={};Je[r.TEXTURE_2D]=Ne(r.TEXTURE_2D,r.TEXTURE_2D,1),Je[r.TEXTURE_CUBE_MAP]=Ne(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(Je[r.TEXTURE_2D_ARRAY]=Ne(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Je[r.TEXTURE_3D]=Ne(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),c.setClear(0,0,0,1),u.setClear(1),h.setClear(0),rt(r.DEPTH_TEST),u.setFunc(Ga),Le(!1),D(Sf),rt(r.CULL_FACE),pe(Sr);function rt(G){m[G]!==!0&&(r.enable(G),m[G]=!0)}function Pe(G){m[G]!==!1&&(r.disable(G),m[G]=!1)}function Ae(G,Te){return g[G]!==Te?(r.bindFramebuffer(G,Te),g[G]=Te,n&&(G===r.DRAW_FRAMEBUFFER&&(g[r.FRAMEBUFFER]=Te),G===r.FRAMEBUFFER&&(g[r.DRAW_FRAMEBUFFER]=Te)),!0):!1}function k(G,Te){let De=S,tt=!1;if(G)if(De=x.get(Te),De===void 0&&(De=[],x.set(Te,De)),G.isWebGLMultipleRenderTargets){const Ye=G.texture;if(De.length!==Ye.length||De[0]!==r.COLOR_ATTACHMENT0){for(let bt=0,Tt=Ye.length;bt<Tt;bt++)De[bt]=r.COLOR_ATTACHMENT0+bt;De.length=Ye.length,tt=!0}}else De[0]!==r.COLOR_ATTACHMENT0&&(De[0]=r.COLOR_ATTACHMENT0,tt=!0);else De[0]!==r.BACK&&(De[0]=r.BACK,tt=!0);tt&&(t.isWebGL2?r.drawBuffers(De):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(De))}function ve(G){return y!==G?(r.useProgram(G),y=G,!0):!1}const ue={[Gr]:r.FUNC_ADD,[iv]:r.FUNC_SUBTRACT,[rv]:r.FUNC_REVERSE_SUBTRACT};if(n)ue[wf]=r.MIN,ue[Tf]=r.MAX;else{const G=e.get("EXT_blend_minmax");G!==null&&(ue[wf]=G.MIN_EXT,ue[Tf]=G.MAX_EXT)}const Ee={[sv]:r.ZERO,[ov]:r.ONE,[av]:r.SRC_COLOR,[Au]:r.SRC_ALPHA,[fv]:r.SRC_ALPHA_SATURATE,[hv]:r.DST_COLOR,[cv]:r.DST_ALPHA,[lv]:r.ONE_MINUS_SRC_COLOR,[Cu]:r.ONE_MINUS_SRC_ALPHA,[dv]:r.ONE_MINUS_DST_COLOR,[uv]:r.ONE_MINUS_DST_ALPHA,[pv]:r.CONSTANT_COLOR,[mv]:r.ONE_MINUS_CONSTANT_COLOR,[gv]:r.CONSTANT_ALPHA,[_v]:r.ONE_MINUS_CONSTANT_ALPHA};function pe(G,Te,De,tt,Ye,bt,Tt,Ot,Ht,Ct){if(G===Sr){_===!0&&(Pe(r.BLEND),_=!1);return}if(_===!1&&(rt(r.BLEND),_=!0),G!==nv){if(G!==b||Ct!==z){if((M!==Gr||C!==Gr)&&(r.blendEquation(r.FUNC_ADD),M=Gr,C=Gr),Ct)switch(G){case Ns:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Mf:r.blendFunc(r.ONE,r.ONE);break;case Ef:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case bf:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Ns:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Mf:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case Ef:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case bf:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}T=null,R=null,N=null,B=null,A.set(0,0,0),P=0,b=G,z=Ct}return}Ye=Ye||Te,bt=bt||De,Tt=Tt||tt,(Te!==M||Ye!==C)&&(r.blendEquationSeparate(ue[Te],ue[Ye]),M=Te,C=Ye),(De!==T||tt!==R||bt!==N||Tt!==B)&&(r.blendFuncSeparate(Ee[De],Ee[tt],Ee[bt],Ee[Tt]),T=De,R=tt,N=bt,B=Tt),(Ot.equals(A)===!1||Ht!==P)&&(r.blendColor(Ot.r,Ot.g,Ot.b,Ht),A.copy(Ot),P=Ht),b=G,z=!1}function Ve(G,Te){G.side===Si?Pe(r.CULL_FACE):rt(r.CULL_FACE);let De=G.side===An;Te&&(De=!De),Le(De),G.blending===Ns&&G.transparent===!1?pe(Sr):pe(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.blendColor,G.blendAlpha,G.premultipliedAlpha),u.setFunc(G.depthFunc),u.setTest(G.depthTest),u.setMask(G.depthWrite),c.setMask(G.colorWrite);const tt=G.stencilWrite;h.setTest(tt),tt&&(h.setMask(G.stencilWriteMask),h.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),h.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),Q(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?rt(r.SAMPLE_ALPHA_TO_COVERAGE):Pe(r.SAMPLE_ALPHA_TO_COVERAGE)}function Le(G){ee!==G&&(G?r.frontFace(r.CW):r.frontFace(r.CCW),ee=G)}function D(G){G!==$_?(rt(r.CULL_FACE),G!==de&&(G===Sf?r.cullFace(r.BACK):G===ev?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Pe(r.CULL_FACE),de=G}function I(G){G!==H&&(j&&r.lineWidth(G),H=G)}function Q(G,Te,De){G?(rt(r.POLYGON_OFFSET_FILL),(q!==Te||ie!==De)&&(r.polygonOffset(Te,De),q=Te,ie=De)):Pe(r.POLYGON_OFFSET_FILL)}function ye(G){G?rt(r.SCISSOR_TEST):Pe(r.SCISSOR_TEST)}function xe(G){G===void 0&&(G=r.TEXTURE0+le-1),te!==G&&(r.activeTexture(G),te=G)}function me(G,Te,De){De===void 0&&(te===null?De=r.TEXTURE0+le-1:De=te);let tt=ge[De];tt===void 0&&(tt={type:void 0,texture:void 0},ge[De]=tt),(tt.type!==G||tt.texture!==Te)&&(te!==De&&(r.activeTexture(De),te=De),r.bindTexture(G,Te||Je[G]),tt.type=G,tt.texture=Te)}function Xe(){const G=ge[te];G!==void 0&&G.type!==void 0&&(r.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function Re(){try{r.compressedTexImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Ie(){try{r.compressedTexImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function et(){try{r.texSubImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ht(){try{r.texSubImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Se(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function wt(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function gt(){try{r.texStorage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ct(){try{r.texStorage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function $e(){try{r.texImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Ge(){try{r.texImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function V(G){be.equals(G)===!1&&(r.scissor(G.x,G.y,G.z,G.w),be.copy(G))}function _e(G){Oe.equals(G)===!1&&(r.viewport(G.x,G.y,G.z,G.w),Oe.copy(G))}function Be(G,Te){let De=f.get(Te);De===void 0&&(De=new WeakMap,f.set(Te,De));let tt=De.get(G);tt===void 0&&(tt=r.getUniformBlockIndex(Te,G.name),De.set(G,tt))}function Fe(G,Te){const tt=f.get(Te).get(G);d.get(Te)!==tt&&(r.uniformBlockBinding(Te,tt,G.__bindingPointIndex),d.set(Te,tt))}function Me(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),n===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),m={},te=null,ge={},g={},x=new WeakMap,S=[],y=null,_=!1,b=null,M=null,T=null,R=null,C=null,N=null,B=null,A=new ke(0,0,0),P=0,z=!1,ee=null,de=null,H=null,q=null,ie=null,be.set(0,0,r.canvas.width,r.canvas.height),Oe.set(0,0,r.canvas.width,r.canvas.height),c.reset(),u.reset(),h.reset()}return{buffers:{color:c,depth:u,stencil:h},enable:rt,disable:Pe,bindFramebuffer:Ae,drawBuffers:k,useProgram:ve,setBlending:pe,setMaterial:Ve,setFlipSided:Le,setCullFace:D,setLineWidth:I,setPolygonOffset:Q,setScissorTest:ye,activeTexture:xe,bindTexture:me,unbindTexture:Xe,compressedTexImage2D:Re,compressedTexImage3D:Ie,texImage2D:$e,texImage3D:Ge,updateUBOMapping:Be,uniformBlockBinding:Fe,texStorage2D:gt,texStorage3D:ct,texSubImage2D:et,texSubImage3D:ht,compressedTexSubImage2D:Se,compressedTexSubImage3D:wt,scissor:V,viewport:_e,reset:Me}}function FT(r,e,t,n,i,s,a){const c=i.isWebGL2,u=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,h=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new WeakMap;let f;const m=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(D,I){return g?new OffscreenCanvas(D,I):tl("canvas")}function S(D,I,Q,ye){let xe=1;if((D.width>ye||D.height>ye)&&(xe=ye/Math.max(D.width,D.height)),xe<1||I===!0)if(typeof HTMLImageElement<"u"&&D instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&D instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&D instanceof ImageBitmap){const me=I?Lu:Math.floor,Xe=me(xe*D.width),Re=me(xe*D.height);f===void 0&&(f=x(Xe,Re));const Ie=Q?x(Xe,Re):f;return Ie.width=Xe,Ie.height=Re,Ie.getContext("2d").drawImage(D,0,0,Xe,Re),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+D.width+"x"+D.height+") to ("+Xe+"x"+Re+")."),Ie}else return"data"in D&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+D.width+"x"+D.height+")."),D;return D}function y(D){return tp(D.width)&&tp(D.height)}function _(D){return c?!1:D.wrapS!==Un||D.wrapT!==Un||D.minFilter!==en&&D.minFilter!==tn}function b(D,I){return D.generateMipmaps&&I&&D.minFilter!==en&&D.minFilter!==tn}function M(D){r.generateMipmap(D)}function T(D,I,Q,ye,xe=!1){if(c===!1)return I;if(D!==null){if(r[D]!==void 0)return r[D];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+D+"'")}let me=I;if(I===r.RED&&(Q===r.FLOAT&&(me=r.R32F),Q===r.HALF_FLOAT&&(me=r.R16F),Q===r.UNSIGNED_BYTE&&(me=r.R8)),I===r.RED_INTEGER&&(Q===r.UNSIGNED_BYTE&&(me=r.R8UI),Q===r.UNSIGNED_SHORT&&(me=r.R16UI),Q===r.UNSIGNED_INT&&(me=r.R32UI),Q===r.BYTE&&(me=r.R8I),Q===r.SHORT&&(me=r.R16I),Q===r.INT&&(me=r.R32I)),I===r.RG&&(Q===r.FLOAT&&(me=r.RG32F),Q===r.HALF_FLOAT&&(me=r.RG16F),Q===r.UNSIGNED_BYTE&&(me=r.RG8)),I===r.RGBA){const Xe=xe?Ka:Dt.getTransfer(ye);Q===r.FLOAT&&(me=r.RGBA32F),Q===r.HALF_FLOAT&&(me=r.RGBA16F),Q===r.UNSIGNED_BYTE&&(me=Xe===zt?r.SRGB8_ALPHA8:r.RGBA8),Q===r.UNSIGNED_SHORT_4_4_4_4&&(me=r.RGBA4),Q===r.UNSIGNED_SHORT_5_5_5_1&&(me=r.RGB5_A1)}return(me===r.R16F||me===r.R32F||me===r.RG16F||me===r.RG32F||me===r.RGBA16F||me===r.RGBA32F)&&e.get("EXT_color_buffer_float"),me}function R(D,I,Q){return b(D,Q)===!0||D.isFramebufferTexture&&D.minFilter!==en&&D.minFilter!==tn?Math.log2(Math.max(I.width,I.height))+1:D.mipmaps!==void 0&&D.mipmaps.length>0?D.mipmaps.length:D.isCompressedTexture&&Array.isArray(D.image)?I.mipmaps.length:1}function C(D){return D===en||D===Ru||D===za?r.NEAREST:r.LINEAR}function N(D){const I=D.target;I.removeEventListener("dispose",N),A(I),I.isVideoTexture&&d.delete(I)}function B(D){const I=D.target;I.removeEventListener("dispose",B),z(I)}function A(D){const I=n.get(D);if(I.__webglInit===void 0)return;const Q=D.source,ye=m.get(Q);if(ye){const xe=ye[I.__cacheKey];xe.usedTimes--,xe.usedTimes===0&&P(D),Object.keys(ye).length===0&&m.delete(Q)}n.remove(D)}function P(D){const I=n.get(D);r.deleteTexture(I.__webglTexture);const Q=D.source,ye=m.get(Q);delete ye[I.__cacheKey],a.memory.textures--}function z(D){const I=D.texture,Q=n.get(D),ye=n.get(I);if(ye.__webglTexture!==void 0&&(r.deleteTexture(ye.__webglTexture),a.memory.textures--),D.depthTexture&&D.depthTexture.dispose(),D.isWebGLCubeRenderTarget)for(let xe=0;xe<6;xe++){if(Array.isArray(Q.__webglFramebuffer[xe]))for(let me=0;me<Q.__webglFramebuffer[xe].length;me++)r.deleteFramebuffer(Q.__webglFramebuffer[xe][me]);else r.deleteFramebuffer(Q.__webglFramebuffer[xe]);Q.__webglDepthbuffer&&r.deleteRenderbuffer(Q.__webglDepthbuffer[xe])}else{if(Array.isArray(Q.__webglFramebuffer))for(let xe=0;xe<Q.__webglFramebuffer.length;xe++)r.deleteFramebuffer(Q.__webglFramebuffer[xe]);else r.deleteFramebuffer(Q.__webglFramebuffer);if(Q.__webglDepthbuffer&&r.deleteRenderbuffer(Q.__webglDepthbuffer),Q.__webglMultisampledFramebuffer&&r.deleteFramebuffer(Q.__webglMultisampledFramebuffer),Q.__webglColorRenderbuffer)for(let xe=0;xe<Q.__webglColorRenderbuffer.length;xe++)Q.__webglColorRenderbuffer[xe]&&r.deleteRenderbuffer(Q.__webglColorRenderbuffer[xe]);Q.__webglDepthRenderbuffer&&r.deleteRenderbuffer(Q.__webglDepthRenderbuffer)}if(D.isWebGLMultipleRenderTargets)for(let xe=0,me=I.length;xe<me;xe++){const Xe=n.get(I[xe]);Xe.__webglTexture&&(r.deleteTexture(Xe.__webglTexture),a.memory.textures--),n.remove(I[xe])}n.remove(I),n.remove(D)}let ee=0;function de(){ee=0}function H(){const D=ee;return D>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+D+" texture units while this GPU supports only "+i.maxTextures),ee+=1,D}function q(D){const I=[];return I.push(D.wrapS),I.push(D.wrapT),I.push(D.wrapR||0),I.push(D.magFilter),I.push(D.minFilter),I.push(D.anisotropy),I.push(D.internalFormat),I.push(D.format),I.push(D.type),I.push(D.generateMipmaps),I.push(D.premultiplyAlpha),I.push(D.flipY),I.push(D.unpackAlignment),I.push(D.colorSpace),I.join()}function ie(D,I){const Q=n.get(D);if(D.isVideoTexture&&Ve(D),D.isRenderTargetTexture===!1&&D.version>0&&Q.__version!==D.version){const ye=D.image;if(ye===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ye.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{be(Q,D,I);return}}t.bindTexture(r.TEXTURE_2D,Q.__webglTexture,r.TEXTURE0+I)}function le(D,I){const Q=n.get(D);if(D.version>0&&Q.__version!==D.version){be(Q,D,I);return}t.bindTexture(r.TEXTURE_2D_ARRAY,Q.__webglTexture,r.TEXTURE0+I)}function j(D,I){const Q=n.get(D);if(D.version>0&&Q.__version!==D.version){be(Q,D,I);return}t.bindTexture(r.TEXTURE_3D,Q.__webglTexture,r.TEXTURE0+I)}function Z(D,I){const Q=n.get(D);if(D.version>0&&Q.__version!==D.version){Oe(Q,D,I);return}t.bindTexture(r.TEXTURE_CUBE_MAP,Q.__webglTexture,r.TEXTURE0+I)}const J={[Xa]:r.REPEAT,[Un]:r.CLAMP_TO_EDGE,[qa]:r.MIRRORED_REPEAT},te={[en]:r.NEAREST,[Ru]:r.NEAREST_MIPMAP_NEAREST,[za]:r.NEAREST_MIPMAP_LINEAR,[tn]:r.LINEAR,[gp]:r.LINEAR_MIPMAP_NEAREST,[Zr]:r.LINEAR_MIPMAP_LINEAR},ge={[qv]:r.NEVER,[$v]:r.ALWAYS,[Yv]:r.LESS,[Tp]:r.LEQUAL,[Zv]:r.EQUAL,[Qv]:r.GEQUAL,[Jv]:r.GREATER,[Kv]:r.NOTEQUAL};function K(D,I,Q){if(Q?(r.texParameteri(D,r.TEXTURE_WRAP_S,J[I.wrapS]),r.texParameteri(D,r.TEXTURE_WRAP_T,J[I.wrapT]),(D===r.TEXTURE_3D||D===r.TEXTURE_2D_ARRAY)&&r.texParameteri(D,r.TEXTURE_WRAP_R,J[I.wrapR]),r.texParameteri(D,r.TEXTURE_MAG_FILTER,te[I.magFilter]),r.texParameteri(D,r.TEXTURE_MIN_FILTER,te[I.minFilter])):(r.texParameteri(D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(D===r.TEXTURE_3D||D===r.TEXTURE_2D_ARRAY)&&r.texParameteri(D,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(I.wrapS!==Un||I.wrapT!==Un)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(D,r.TEXTURE_MAG_FILTER,C(I.magFilter)),r.texParameteri(D,r.TEXTURE_MIN_FILTER,C(I.minFilter)),I.minFilter!==en&&I.minFilter!==tn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),I.compareFunction&&(r.texParameteri(D,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(D,r.TEXTURE_COMPARE_FUNC,ge[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ye=e.get("EXT_texture_filter_anisotropic");if(I.magFilter===en||I.minFilter!==za&&I.minFilter!==Zr||I.type===Ni&&e.has("OES_texture_float_linear")===!1||c===!1&&I.type===Go&&e.has("OES_texture_half_float_linear")===!1)return;(I.anisotropy>1||n.get(I).__currentAnisotropy)&&(r.texParameterf(D,ye.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,i.getMaxAnisotropy())),n.get(I).__currentAnisotropy=I.anisotropy)}}function fe(D,I){let Q=!1;D.__webglInit===void 0&&(D.__webglInit=!0,I.addEventListener("dispose",N));const ye=I.source;let xe=m.get(ye);xe===void 0&&(xe={},m.set(ye,xe));const me=q(I);if(me!==D.__cacheKey){xe[me]===void 0&&(xe[me]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,Q=!0),xe[me].usedTimes++;const Xe=xe[D.__cacheKey];Xe!==void 0&&(xe[D.__cacheKey].usedTimes--,Xe.usedTimes===0&&P(I)),D.__cacheKey=me,D.__webglTexture=xe[me].texture}return Q}function be(D,I,Q){let ye=r.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(ye=r.TEXTURE_2D_ARRAY),I.isData3DTexture&&(ye=r.TEXTURE_3D);const xe=fe(D,I),me=I.source;t.bindTexture(ye,D.__webglTexture,r.TEXTURE0+Q);const Xe=n.get(me);if(me.version!==Xe.__version||xe===!0){t.activeTexture(r.TEXTURE0+Q);const Re=Dt.getPrimaries(Dt.workingColorSpace),Ie=I.colorSpace===oi?null:Dt.getPrimaries(I.colorSpace),et=I.colorSpace===oi||Re===Ie?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,I.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,I.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,et);const ht=_(I)&&y(I.image)===!1;let Se=S(I.image,ht,!1,i.maxTextureSize);Se=Le(I,Se);const wt=y(Se)||c,gt=s.convert(I.format,I.colorSpace);let ct=s.convert(I.type),$e=T(I.internalFormat,gt,ct,I.colorSpace,I.isVideoTexture);K(ye,I,wt);let Ge;const V=I.mipmaps,_e=c&&I.isVideoTexture!==!0&&$e!==Ep,Be=Xe.__version===void 0||xe===!0,Fe=R(I,Se,wt);if(I.isDepthTexture)$e=r.DEPTH_COMPONENT,c?I.type===Ni?$e=r.DEPTH_COMPONENT32F:I.type===xr?$e=r.DEPTH_COMPONENT24:I.type===jr?$e=r.DEPTH24_STENCIL8:$e=r.DEPTH_COMPONENT16:I.type===Ni&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),I.format===Xr&&$e===r.DEPTH_COMPONENT&&I.type!==Bu&&I.type!==xr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),I.type=xr,ct=s.convert(I.type)),I.format===ks&&$e===r.DEPTH_COMPONENT&&($e=r.DEPTH_STENCIL,I.type!==jr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),I.type=jr,ct=s.convert(I.type))),Be&&(_e?t.texStorage2D(r.TEXTURE_2D,1,$e,Se.width,Se.height):t.texImage2D(r.TEXTURE_2D,0,$e,Se.width,Se.height,0,gt,ct,null));else if(I.isDataTexture)if(V.length>0&&wt){_e&&Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,V[0].width,V[0].height);for(let Me=0,G=V.length;Me<G;Me++)Ge=V[Me],_e?t.texSubImage2D(r.TEXTURE_2D,Me,0,0,Ge.width,Ge.height,gt,ct,Ge.data):t.texImage2D(r.TEXTURE_2D,Me,$e,Ge.width,Ge.height,0,gt,ct,Ge.data);I.generateMipmaps=!1}else _e?(Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,Se.width,Se.height),t.texSubImage2D(r.TEXTURE_2D,0,0,0,Se.width,Se.height,gt,ct,Se.data)):t.texImage2D(r.TEXTURE_2D,0,$e,Se.width,Se.height,0,gt,ct,Se.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){_e&&Be&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Fe,$e,V[0].width,V[0].height,Se.depth);for(let Me=0,G=V.length;Me<G;Me++)Ge=V[Me],I.format!==Wn?gt!==null?_e?t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Me,0,0,0,Ge.width,Ge.height,Se.depth,gt,Ge.data,0,0):t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Me,$e,Ge.width,Ge.height,Se.depth,0,Ge.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_e?t.texSubImage3D(r.TEXTURE_2D_ARRAY,Me,0,0,0,Ge.width,Ge.height,Se.depth,gt,ct,Ge.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Me,$e,Ge.width,Ge.height,Se.depth,0,gt,ct,Ge.data)}else{_e&&Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,V[0].width,V[0].height);for(let Me=0,G=V.length;Me<G;Me++)Ge=V[Me],I.format!==Wn?gt!==null?_e?t.compressedTexSubImage2D(r.TEXTURE_2D,Me,0,0,Ge.width,Ge.height,gt,Ge.data):t.compressedTexImage2D(r.TEXTURE_2D,Me,$e,Ge.width,Ge.height,0,Ge.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_e?t.texSubImage2D(r.TEXTURE_2D,Me,0,0,Ge.width,Ge.height,gt,ct,Ge.data):t.texImage2D(r.TEXTURE_2D,Me,$e,Ge.width,Ge.height,0,gt,ct,Ge.data)}else if(I.isDataArrayTexture)_e?(Be&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Fe,$e,Se.width,Se.height,Se.depth),t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Se.width,Se.height,Se.depth,gt,ct,Se.data)):t.texImage3D(r.TEXTURE_2D_ARRAY,0,$e,Se.width,Se.height,Se.depth,0,gt,ct,Se.data);else if(I.isData3DTexture)_e?(Be&&t.texStorage3D(r.TEXTURE_3D,Fe,$e,Se.width,Se.height,Se.depth),t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Se.width,Se.height,Se.depth,gt,ct,Se.data)):t.texImage3D(r.TEXTURE_3D,0,$e,Se.width,Se.height,Se.depth,0,gt,ct,Se.data);else if(I.isFramebufferTexture){if(Be)if(_e)t.texStorage2D(r.TEXTURE_2D,Fe,$e,Se.width,Se.height);else{let Me=Se.width,G=Se.height;for(let Te=0;Te<Fe;Te++)t.texImage2D(r.TEXTURE_2D,Te,$e,Me,G,0,gt,ct,null),Me>>=1,G>>=1}}else if(V.length>0&&wt){_e&&Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,V[0].width,V[0].height);for(let Me=0,G=V.length;Me<G;Me++)Ge=V[Me],_e?t.texSubImage2D(r.TEXTURE_2D,Me,0,0,gt,ct,Ge):t.texImage2D(r.TEXTURE_2D,Me,$e,gt,ct,Ge);I.generateMipmaps=!1}else _e?(Be&&t.texStorage2D(r.TEXTURE_2D,Fe,$e,Se.width,Se.height),t.texSubImage2D(r.TEXTURE_2D,0,0,0,gt,ct,Se)):t.texImage2D(r.TEXTURE_2D,0,$e,gt,ct,Se);b(I,wt)&&M(ye),Xe.__version=me.version,I.onUpdate&&I.onUpdate(I)}D.__version=I.version}function Oe(D,I,Q){if(I.image.length!==6)return;const ye=fe(D,I),xe=I.source;t.bindTexture(r.TEXTURE_CUBE_MAP,D.__webglTexture,r.TEXTURE0+Q);const me=n.get(xe);if(xe.version!==me.__version||ye===!0){t.activeTexture(r.TEXTURE0+Q);const Xe=Dt.getPrimaries(Dt.workingColorSpace),Re=I.colorSpace===oi?null:Dt.getPrimaries(I.colorSpace),Ie=I.colorSpace===oi||Xe===Re?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,I.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,I.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ie);const et=I.isCompressedTexture||I.image[0].isCompressedTexture,ht=I.image[0]&&I.image[0].isDataTexture,Se=[];for(let Me=0;Me<6;Me++)!et&&!ht?Se[Me]=S(I.image[Me],!1,!0,i.maxCubemapSize):Se[Me]=ht?I.image[Me].image:I.image[Me],Se[Me]=Le(I,Se[Me]);const wt=Se[0],gt=y(wt)||c,ct=s.convert(I.format,I.colorSpace),$e=s.convert(I.type),Ge=T(I.internalFormat,ct,$e,I.colorSpace),V=c&&I.isVideoTexture!==!0,_e=me.__version===void 0||ye===!0;let Be=R(I,wt,gt);K(r.TEXTURE_CUBE_MAP,I,gt);let Fe;if(et){V&&_e&&t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Ge,wt.width,wt.height);for(let Me=0;Me<6;Me++){Fe=Se[Me].mipmaps;for(let G=0;G<Fe.length;G++){const Te=Fe[G];I.format!==Wn?ct!==null?V?t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G,0,0,Te.width,Te.height,ct,Te.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G,Ge,Te.width,Te.height,0,Te.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G,0,0,Te.width,Te.height,ct,$e,Te.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G,Ge,Te.width,Te.height,0,ct,$e,Te.data)}}}else{Fe=I.mipmaps,V&&_e&&(Fe.length>0&&Be++,t.texStorage2D(r.TEXTURE_CUBE_MAP,Be,Ge,Se[0].width,Se[0].height));for(let Me=0;Me<6;Me++)if(ht){V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,0,0,Se[Me].width,Se[Me].height,ct,$e,Se[Me].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,Ge,Se[Me].width,Se[Me].height,0,ct,$e,Se[Me].data);for(let G=0;G<Fe.length;G++){const De=Fe[G].image[Me].image;V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G+1,0,0,De.width,De.height,ct,$e,De.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G+1,Ge,De.width,De.height,0,ct,$e,De.data)}}else{V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,0,0,ct,$e,Se[Me]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,Ge,ct,$e,Se[Me]);for(let G=0;G<Fe.length;G++){const Te=Fe[G];V?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G+1,0,0,ct,$e,Te.image[Me]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Me,G+1,Ge,ct,$e,Te.image[Me])}}}b(I,gt)&&M(r.TEXTURE_CUBE_MAP),me.__version=xe.version,I.onUpdate&&I.onUpdate(I)}D.__version=I.version}function Ne(D,I,Q,ye,xe,me){const Xe=s.convert(Q.format,Q.colorSpace),Re=s.convert(Q.type),Ie=T(Q.internalFormat,Xe,Re,Q.colorSpace);if(!n.get(I).__hasExternalTextures){const ht=Math.max(1,I.width>>me),Se=Math.max(1,I.height>>me);xe===r.TEXTURE_3D||xe===r.TEXTURE_2D_ARRAY?t.texImage3D(xe,me,Ie,ht,Se,I.depth,0,Xe,Re,null):t.texImage2D(xe,me,Ie,ht,Se,0,Xe,Re,null)}t.bindFramebuffer(r.FRAMEBUFFER,D),pe(I)?u.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ye,xe,n.get(Q).__webglTexture,0,Ee(I)):(xe===r.TEXTURE_2D||xe>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&xe<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,ye,xe,n.get(Q).__webglTexture,me),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Je(D,I,Q){if(r.bindRenderbuffer(r.RENDERBUFFER,D),I.depthBuffer&&!I.stencilBuffer){let ye=c===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(Q||pe(I)){const xe=I.depthTexture;xe&&xe.isDepthTexture&&(xe.type===Ni?ye=r.DEPTH_COMPONENT32F:xe.type===xr&&(ye=r.DEPTH_COMPONENT24));const me=Ee(I);pe(I)?u.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,me,ye,I.width,I.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,me,ye,I.width,I.height)}else r.renderbufferStorage(r.RENDERBUFFER,ye,I.width,I.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,D)}else if(I.depthBuffer&&I.stencilBuffer){const ye=Ee(I);Q&&pe(I)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,ye,r.DEPTH24_STENCIL8,I.width,I.height):pe(I)?u.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,ye,r.DEPTH24_STENCIL8,I.width,I.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,I.width,I.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,D)}else{const ye=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let xe=0;xe<ye.length;xe++){const me=ye[xe],Xe=s.convert(me.format,me.colorSpace),Re=s.convert(me.type),Ie=T(me.internalFormat,Xe,Re,me.colorSpace),et=Ee(I);Q&&pe(I)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,et,Ie,I.width,I.height):pe(I)?u.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,et,Ie,I.width,I.height):r.renderbufferStorage(r.RENDERBUFFER,Ie,I.width,I.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function rt(D,I){if(I&&I.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,D),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(I.depthTexture).__webglTexture||I.depthTexture.image.width!==I.width||I.depthTexture.image.height!==I.height)&&(I.depthTexture.image.width=I.width,I.depthTexture.image.height=I.height,I.depthTexture.needsUpdate=!0),ie(I.depthTexture,0);const ye=n.get(I.depthTexture).__webglTexture,xe=Ee(I);if(I.depthTexture.format===Xr)pe(I)?u.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,ye,0,xe):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,ye,0);else if(I.depthTexture.format===ks)pe(I)?u.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,ye,0,xe):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,ye,0);else throw new Error("Unknown depthTexture format")}function Pe(D){const I=n.get(D),Q=D.isWebGLCubeRenderTarget===!0;if(D.depthTexture&&!I.__autoAllocateDepthBuffer){if(Q)throw new Error("target.depthTexture not supported in Cube render targets");rt(I.__webglFramebuffer,D)}else if(Q){I.__webglDepthbuffer=[];for(let ye=0;ye<6;ye++)t.bindFramebuffer(r.FRAMEBUFFER,I.__webglFramebuffer[ye]),I.__webglDepthbuffer[ye]=r.createRenderbuffer(),Je(I.__webglDepthbuffer[ye],D,!1)}else t.bindFramebuffer(r.FRAMEBUFFER,I.__webglFramebuffer),I.__webglDepthbuffer=r.createRenderbuffer(),Je(I.__webglDepthbuffer,D,!1);t.bindFramebuffer(r.FRAMEBUFFER,null)}function Ae(D,I,Q){const ye=n.get(D);I!==void 0&&Ne(ye.__webglFramebuffer,D,D.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),Q!==void 0&&Pe(D)}function k(D){const I=D.texture,Q=n.get(D),ye=n.get(I);D.addEventListener("dispose",B),D.isWebGLMultipleRenderTargets!==!0&&(ye.__webglTexture===void 0&&(ye.__webglTexture=r.createTexture()),ye.__version=I.version,a.memory.textures++);const xe=D.isWebGLCubeRenderTarget===!0,me=D.isWebGLMultipleRenderTargets===!0,Xe=y(D)||c;if(xe){Q.__webglFramebuffer=[];for(let Re=0;Re<6;Re++)if(c&&I.mipmaps&&I.mipmaps.length>0){Q.__webglFramebuffer[Re]=[];for(let Ie=0;Ie<I.mipmaps.length;Ie++)Q.__webglFramebuffer[Re][Ie]=r.createFramebuffer()}else Q.__webglFramebuffer[Re]=r.createFramebuffer()}else{if(c&&I.mipmaps&&I.mipmaps.length>0){Q.__webglFramebuffer=[];for(let Re=0;Re<I.mipmaps.length;Re++)Q.__webglFramebuffer[Re]=r.createFramebuffer()}else Q.__webglFramebuffer=r.createFramebuffer();if(me)if(i.drawBuffers){const Re=D.texture;for(let Ie=0,et=Re.length;Ie<et;Ie++){const ht=n.get(Re[Ie]);ht.__webglTexture===void 0&&(ht.__webglTexture=r.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(c&&D.samples>0&&pe(D)===!1){const Re=me?I:[I];Q.__webglMultisampledFramebuffer=r.createFramebuffer(),Q.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,Q.__webglMultisampledFramebuffer);for(let Ie=0;Ie<Re.length;Ie++){const et=Re[Ie];Q.__webglColorRenderbuffer[Ie]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,Q.__webglColorRenderbuffer[Ie]);const ht=s.convert(et.format,et.colorSpace),Se=s.convert(et.type),wt=T(et.internalFormat,ht,Se,et.colorSpace,D.isXRRenderTarget===!0),gt=Ee(D);r.renderbufferStorageMultisample(r.RENDERBUFFER,gt,wt,D.width,D.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ie,r.RENDERBUFFER,Q.__webglColorRenderbuffer[Ie])}r.bindRenderbuffer(r.RENDERBUFFER,null),D.depthBuffer&&(Q.__webglDepthRenderbuffer=r.createRenderbuffer(),Je(Q.__webglDepthRenderbuffer,D,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(xe){t.bindTexture(r.TEXTURE_CUBE_MAP,ye.__webglTexture),K(r.TEXTURE_CUBE_MAP,I,Xe);for(let Re=0;Re<6;Re++)if(c&&I.mipmaps&&I.mipmaps.length>0)for(let Ie=0;Ie<I.mipmaps.length;Ie++)Ne(Q.__webglFramebuffer[Re][Ie],D,I,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Re,Ie);else Ne(Q.__webglFramebuffer[Re],D,I,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Re,0);b(I,Xe)&&M(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(me){const Re=D.texture;for(let Ie=0,et=Re.length;Ie<et;Ie++){const ht=Re[Ie],Se=n.get(ht);t.bindTexture(r.TEXTURE_2D,Se.__webglTexture),K(r.TEXTURE_2D,ht,Xe),Ne(Q.__webglFramebuffer,D,ht,r.COLOR_ATTACHMENT0+Ie,r.TEXTURE_2D,0),b(ht,Xe)&&M(r.TEXTURE_2D)}t.unbindTexture()}else{let Re=r.TEXTURE_2D;if((D.isWebGL3DRenderTarget||D.isWebGLArrayRenderTarget)&&(c?Re=D.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Re,ye.__webglTexture),K(Re,I,Xe),c&&I.mipmaps&&I.mipmaps.length>0)for(let Ie=0;Ie<I.mipmaps.length;Ie++)Ne(Q.__webglFramebuffer[Ie],D,I,r.COLOR_ATTACHMENT0,Re,Ie);else Ne(Q.__webglFramebuffer,D,I,r.COLOR_ATTACHMENT0,Re,0);b(I,Xe)&&M(Re),t.unbindTexture()}D.depthBuffer&&Pe(D)}function ve(D){const I=y(D)||c,Q=D.isWebGLMultipleRenderTargets===!0?D.texture:[D.texture];for(let ye=0,xe=Q.length;ye<xe;ye++){const me=Q[ye];if(b(me,I)){const Xe=D.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Re=n.get(me).__webglTexture;t.bindTexture(Xe,Re),M(Xe),t.unbindTexture()}}}function ue(D){if(c&&D.samples>0&&pe(D)===!1){const I=D.isWebGLMultipleRenderTargets?D.texture:[D.texture],Q=D.width,ye=D.height;let xe=r.COLOR_BUFFER_BIT;const me=[],Xe=D.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Re=n.get(D),Ie=D.isWebGLMultipleRenderTargets===!0;if(Ie)for(let et=0;et<I.length;et++)t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+et,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+et,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Re.__webglMultisampledFramebuffer),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglFramebuffer);for(let et=0;et<I.length;et++){me.push(r.COLOR_ATTACHMENT0+et),D.depthBuffer&&me.push(Xe);const ht=Re.__ignoreDepthValues!==void 0?Re.__ignoreDepthValues:!1;if(ht===!1&&(D.depthBuffer&&(xe|=r.DEPTH_BUFFER_BIT),D.stencilBuffer&&(xe|=r.STENCIL_BUFFER_BIT)),Ie&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Re.__webglColorRenderbuffer[et]),ht===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[Xe]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[Xe])),Ie){const Se=n.get(I[et]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Se,0)}r.blitFramebuffer(0,0,Q,ye,0,0,Q,ye,xe,r.NEAREST),h&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,me)}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Ie)for(let et=0;et<I.length;et++){t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+et,r.RENDERBUFFER,Re.__webglColorRenderbuffer[et]);const ht=n.get(I[et]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Re.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+et,r.TEXTURE_2D,ht,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Re.__webglMultisampledFramebuffer)}}function Ee(D){return Math.min(i.maxSamples,D.samples)}function pe(D){const I=n.get(D);return c&&D.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function Ve(D){const I=a.render.frame;d.get(D)!==I&&(d.set(D,I),D.update())}function Le(D,I){const Q=D.colorSpace,ye=D.format,xe=D.type;return D.isCompressedTexture===!0||D.isVideoTexture===!0||D.format===Pu||Q!==nr&&Q!==oi&&(Dt.getTransfer(Q)===zt?c===!1?e.has("EXT_sRGB")===!0&&ye===Wn?(D.format=Pu,D.minFilter=tn,D.generateMipmaps=!1):I=Cp.sRGBToLinear(I):(ye!==Wn||xe!==$i)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Q)),I}this.allocateTextureUnit=H,this.resetTextureUnits=de,this.setTexture2D=ie,this.setTexture2DArray=le,this.setTexture3D=j,this.setTextureCube=Z,this.rebindTextures=Ae,this.setupRenderTarget=k,this.updateRenderTargetMipmap=ve,this.updateMultisampleRenderTarget=ue,this.setupDepthRenderbuffer=Pe,this.setupFrameBufferTexture=Ne,this.useMultisampledRTT=pe}function px(r,e,t){const n=t.isWebGL2;function i(s,a=oi){let c;const u=Dt.getTransfer(a);if(s===$i)return r.UNSIGNED_BYTE;if(s===vp)return r.UNSIGNED_SHORT_4_4_4_4;if(s===xp)return r.UNSIGNED_SHORT_5_5_5_1;if(s===Nv)return r.BYTE;if(s===Dv)return r.SHORT;if(s===Bu)return r.UNSIGNED_SHORT;if(s===_p)return r.INT;if(s===xr)return r.UNSIGNED_INT;if(s===Ni)return r.FLOAT;if(s===Go)return n?r.HALF_FLOAT:(c=e.get("OES_texture_half_float"),c!==null?c.HALF_FLOAT_OES:null);if(s===Uv)return r.ALPHA;if(s===Wn)return r.RGBA;if(s===Ov)return r.LUMINANCE;if(s===Fv)return r.LUMINANCE_ALPHA;if(s===Xr)return r.DEPTH_COMPONENT;if(s===ks)return r.DEPTH_STENCIL;if(s===Pu)return c=e.get("EXT_sRGB"),c!==null?c.SRGB_ALPHA_EXT:null;if(s===zv)return r.RED;if(s===yp)return r.RED_INTEGER;if(s===Bv)return r.RG;if(s===Sp)return r.RG_INTEGER;if(s===Mp)return r.RGBA_INTEGER;if(s===vu||s===xu||s===yu||s===Su)if(u===zt)if(c=e.get("WEBGL_compressed_texture_s3tc_srgb"),c!==null){if(s===vu)return c.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===xu)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===yu)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Su)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(c=e.get("WEBGL_compressed_texture_s3tc"),c!==null){if(s===vu)return c.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===xu)return c.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===yu)return c.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Su)return c.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Cf||s===Rf||s===Pf||s===Lf)if(c=e.get("WEBGL_compressed_texture_pvrtc"),c!==null){if(s===Cf)return c.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Rf)return c.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Pf)return c.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Lf)return c.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Ep)return c=e.get("WEBGL_compressed_texture_etc1"),c!==null?c.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===If||s===Nf)if(c=e.get("WEBGL_compressed_texture_etc"),c!==null){if(s===If)return u===zt?c.COMPRESSED_SRGB8_ETC2:c.COMPRESSED_RGB8_ETC2;if(s===Nf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:c.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Df||s===Uf||s===Of||s===Ff||s===zf||s===Bf||s===kf||s===Hf||s===Vf||s===Gf||s===Wf||s===jf||s===Xf||s===qf)if(c=e.get("WEBGL_compressed_texture_astc"),c!==null){if(s===Df)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:c.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Uf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:c.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Of)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:c.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Ff)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:c.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===zf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:c.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Bf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:c.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===kf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:c.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Hf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:c.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Vf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:c.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Gf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:c.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Wf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:c.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===jf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:c.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===Xf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:c.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===qf)return u===zt?c.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:c.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Mu||s===Yf||s===Zf)if(c=e.get("EXT_texture_compression_bptc"),c!==null){if(s===Mu)return u===zt?c.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:c.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Yf)return c.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Zf)return c.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===kv||s===Jf||s===Kf||s===Qf)if(c=e.get("EXT_texture_compression_rgtc"),c!==null){if(s===Mu)return c.COMPRESSED_RED_RGTC1_EXT;if(s===Jf)return c.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Kf)return c.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Qf)return c.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===jr?n?r.UNSIGNED_INT_24_8:(c=e.get("WEBGL_depth_texture"),c!==null?c.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class mx extends jt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Bo extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const zT={type:"move"};class Vd{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Bo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Bo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Bo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const c=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){a=!0;for(const S of e.hand.values()){const y=t.getJointPose(S,n),_=this._getHandJoint(h,S);y!==null&&(_.matrix.fromArray(y.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=y.radius),_.visible=y!==null}const d=h.joints["index-finger-tip"],f=h.joints["thumb-tip"],m=d.position.distanceTo(f.position),g=.02,x=.005;h.inputState.pinching&&m>g+x?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&m<=g-x&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(zT)))}return c!==null&&(c.visible=i!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Bo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class BT extends wr{constructor(e,t){super();const n=this;let i=null,s=1,a=null,c="local-floor",u=1,h=null,d=null,f=null,m=null,g=null,x=null;const S=t.getContextAttributes();let y=null,_=null;const b=[],M=[],T=new he;let R=null;const C=new jt;C.layers.enable(1),C.viewport=new At;const N=new jt;N.layers.enable(2),N.viewport=new At;const B=[C,N],A=new mx;A.layers.enable(1),A.layers.enable(2);let P=null,z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let fe=b[K];return fe===void 0&&(fe=new Vd,b[K]=fe),fe.getTargetRaySpace()},this.getControllerGrip=function(K){let fe=b[K];return fe===void 0&&(fe=new Vd,b[K]=fe),fe.getGripSpace()},this.getHand=function(K){let fe=b[K];return fe===void 0&&(fe=new Vd,b[K]=fe),fe.getHandSpace()};function ee(K){const fe=M.indexOf(K.inputSource);if(fe===-1)return;const be=b[fe];be!==void 0&&(be.update(K.inputSource,K.frame,h||a),be.dispatchEvent({type:K.type,data:K.inputSource}))}function de(){i.removeEventListener("select",ee),i.removeEventListener("selectstart",ee),i.removeEventListener("selectend",ee),i.removeEventListener("squeeze",ee),i.removeEventListener("squeezestart",ee),i.removeEventListener("squeezeend",ee),i.removeEventListener("end",de),i.removeEventListener("inputsourceschange",H);for(let K=0;K<b.length;K++){const fe=M[K];fe!==null&&(M[K]=null,b[K].disconnect(fe))}P=null,z=null,e.setRenderTarget(y),g=null,m=null,f=null,i=null,_=null,ge.stop(),n.isPresenting=!1,e.setPixelRatio(R),e.setSize(T.width,T.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(K){s=K,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(K){c=K,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||a},this.setReferenceSpace=function(K){h=K},this.getBaseLayer=function(){return m!==null?m:g},this.getBinding=function(){return f},this.getFrame=function(){return x},this.getSession=function(){return i},this.setSession=async function(K){if(i=K,i!==null){if(y=e.getRenderTarget(),i.addEventListener("select",ee),i.addEventListener("selectstart",ee),i.addEventListener("selectend",ee),i.addEventListener("squeeze",ee),i.addEventListener("squeezestart",ee),i.addEventListener("squeezeend",ee),i.addEventListener("end",de),i.addEventListener("inputsourceschange",H),S.xrCompatible!==!0&&await t.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(T),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const fe={antialias:i.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(i,t,fe),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),_=new Ui(g.framebufferWidth,g.framebufferHeight,{format:Wn,type:$i,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil})}else{let fe=null,be=null,Oe=null;S.depth&&(Oe=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,fe=S.stencil?ks:Xr,be=S.stencil?jr:xr);const Ne={colorFormat:t.RGBA8,depthFormat:Oe,scaleFactor:s};f=new XRWebGLBinding(i,t),m=f.createProjectionLayer(Ne),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),_=new Ui(m.textureWidth,m.textureHeight,{format:Wn,type:$i,depthTexture:new Np(m.textureWidth,m.textureHeight,be,void 0,void 0,void 0,void 0,void 0,void 0,fe),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0});const Je=e.properties.get(_);Je.__ignoreDepthValues=m.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(u),h=null,a=await i.requestReferenceSpace(c),ge.setContext(i),ge.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function H(K){for(let fe=0;fe<K.removed.length;fe++){const be=K.removed[fe],Oe=M.indexOf(be);Oe>=0&&(M[Oe]=null,b[Oe].disconnect(be))}for(let fe=0;fe<K.added.length;fe++){const be=K.added[fe];let Oe=M.indexOf(be);if(Oe===-1){for(let Je=0;Je<b.length;Je++)if(Je>=M.length){M.push(be),Oe=Je;break}else if(M[Je]===null){M[Je]=be,Oe=Je;break}if(Oe===-1)break}const Ne=b[Oe];Ne&&Ne.connect(be)}}const q=new U,ie=new U;function le(K,fe,be){q.setFromMatrixPosition(fe.matrixWorld),ie.setFromMatrixPosition(be.matrixWorld);const Oe=q.distanceTo(ie),Ne=fe.projectionMatrix.elements,Je=be.projectionMatrix.elements,rt=Ne[14]/(Ne[10]-1),Pe=Ne[14]/(Ne[10]+1),Ae=(Ne[9]+1)/Ne[5],k=(Ne[9]-1)/Ne[5],ve=(Ne[8]-1)/Ne[0],ue=(Je[8]+1)/Je[0],Ee=rt*ve,pe=rt*ue,Ve=Oe/(-ve+ue),Le=Ve*-ve;fe.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(Le),K.translateZ(Ve),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();const D=rt+Ve,I=Pe+Ve,Q=Ee-Le,ye=pe+(Oe-Le),xe=Ae*Pe/I*D,me=k*Pe/I*D;K.projectionMatrix.makePerspective(Q,ye,xe,me,D,I),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}function j(K,fe){fe===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(fe.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(i===null)return;A.near=N.near=C.near=K.near,A.far=N.far=C.far=K.far,(P!==A.near||z!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),P=A.near,z=A.far);const fe=K.parent,be=A.cameras;j(A,fe);for(let Oe=0;Oe<be.length;Oe++)j(be[Oe],fe);be.length===2?le(A,C,N):A.projectionMatrix.copy(C.projectionMatrix),Z(K,A,fe)};function Z(K,fe,be){be===null?K.matrix.copy(fe.matrixWorld):(K.matrix.copy(be.matrixWorld),K.matrix.invert(),K.matrix.multiply(fe.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0),K.projectionMatrix.copy(fe.projectionMatrix),K.projectionMatrixInverse.copy(fe.projectionMatrixInverse),K.isPerspectiveCamera&&(K.fov=jo*2*Math.atan(1/K.projectionMatrix.elements[5]),K.zoom=1)}this.getCamera=function(){return A},this.getFoveation=function(){if(!(m===null&&g===null))return u},this.setFoveation=function(K){u=K,m!==null&&(m.fixedFoveation=K),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=K)};let J=null;function te(K,fe){if(d=fe.getViewerPose(h||a),x=fe,d!==null){const be=d.views;g!==null&&(e.setRenderTargetFramebuffer(_,g.framebuffer),e.setRenderTarget(_));let Oe=!1;be.length!==A.cameras.length&&(A.cameras.length=0,Oe=!0);for(let Ne=0;Ne<be.length;Ne++){const Je=be[Ne];let rt=null;if(g!==null)rt=g.getViewport(Je);else{const Ae=f.getViewSubImage(m,Je);rt=Ae.viewport,Ne===0&&(e.setRenderTargetTextures(_,Ae.colorTexture,m.ignoreDepthValues?void 0:Ae.depthStencilTexture),e.setRenderTarget(_))}let Pe=B[Ne];Pe===void 0&&(Pe=new jt,Pe.layers.enable(Ne),Pe.viewport=new At,B[Ne]=Pe),Pe.matrix.fromArray(Je.transform.matrix),Pe.matrix.decompose(Pe.position,Pe.quaternion,Pe.scale),Pe.projectionMatrix.fromArray(Je.projectionMatrix),Pe.projectionMatrixInverse.copy(Pe.projectionMatrix).invert(),Pe.viewport.set(rt.x,rt.y,rt.width,rt.height),Ne===0&&(A.matrix.copy(Pe.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),Oe===!0&&A.cameras.push(Pe)}}for(let be=0;be<b.length;be++){const Oe=M[be],Ne=b[be];Oe!==null&&Ne!==void 0&&Ne.update(Oe,fe,h||a)}J&&J(K,fe),fe.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:fe}),x=null}const ge=new lx;ge.setAnimationLoop(te),this.setAnimationLoop=function(K){J=K},this.dispose=function(){}}}function kT(r,e){function t(y,_){y.matrixAutoUpdate===!0&&y.updateMatrix(),_.value.copy(y.matrix)}function n(y,_){_.color.getRGB(y.fogColor.value,sx(r)),_.isFog?(y.fogNear.value=_.near,y.fogFar.value=_.far):_.isFogExp2&&(y.fogDensity.value=_.density)}function i(y,_,b,M,T){_.isMeshBasicMaterial||_.isMeshLambertMaterial?s(y,_):_.isMeshToonMaterial?(s(y,_),f(y,_)):_.isMeshPhongMaterial?(s(y,_),d(y,_)):_.isMeshStandardMaterial?(s(y,_),m(y,_),_.isMeshPhysicalMaterial&&g(y,_,T)):_.isMeshMatcapMaterial?(s(y,_),x(y,_)):_.isMeshDepthMaterial?s(y,_):_.isMeshDistanceMaterial?(s(y,_),S(y,_)):_.isMeshNormalMaterial?s(y,_):_.isLineBasicMaterial?(a(y,_),_.isLineDashedMaterial&&c(y,_)):_.isPointsMaterial?u(y,_,b,M):_.isSpriteMaterial?h(y,_):_.isShadowMaterial?(y.color.value.copy(_.color),y.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function s(y,_){y.opacity.value=_.opacity,_.color&&y.diffuse.value.copy(_.color),_.emissive&&y.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.bumpMap&&(y.bumpMap.value=_.bumpMap,t(_.bumpMap,y.bumpMapTransform),y.bumpScale.value=_.bumpScale,_.side===An&&(y.bumpScale.value*=-1)),_.normalMap&&(y.normalMap.value=_.normalMap,t(_.normalMap,y.normalMapTransform),y.normalScale.value.copy(_.normalScale),_.side===An&&y.normalScale.value.negate()),_.displacementMap&&(y.displacementMap.value=_.displacementMap,t(_.displacementMap,y.displacementMapTransform),y.displacementScale.value=_.displacementScale,y.displacementBias.value=_.displacementBias),_.emissiveMap&&(y.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,y.emissiveMapTransform)),_.specularMap&&(y.specularMap.value=_.specularMap,t(_.specularMap,y.specularMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest);const b=e.get(_).envMap;if(b&&(y.envMap.value=b,y.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=_.reflectivity,y.ior.value=_.ior,y.refractionRatio.value=_.refractionRatio),_.lightMap){y.lightMap.value=_.lightMap;const M=r._useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=_.lightMapIntensity*M,t(_.lightMap,y.lightMapTransform)}_.aoMap&&(y.aoMap.value=_.aoMap,y.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,y.aoMapTransform))}function a(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform))}function c(y,_){y.dashSize.value=_.dashSize,y.totalSize.value=_.dashSize+_.gapSize,y.scale.value=_.scale}function u(y,_,b,M){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.size.value=_.size*b,y.scale.value=M*.5,_.map&&(y.map.value=_.map,t(_.map,y.uvTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function h(y,_){y.diffuse.value.copy(_.color),y.opacity.value=_.opacity,y.rotation.value=_.rotation,_.map&&(y.map.value=_.map,t(_.map,y.mapTransform)),_.alphaMap&&(y.alphaMap.value=_.alphaMap,t(_.alphaMap,y.alphaMapTransform)),_.alphaTest>0&&(y.alphaTest.value=_.alphaTest)}function d(y,_){y.specular.value.copy(_.specular),y.shininess.value=Math.max(_.shininess,1e-4)}function f(y,_){_.gradientMap&&(y.gradientMap.value=_.gradientMap)}function m(y,_){y.metalness.value=_.metalness,_.metalnessMap&&(y.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,y.metalnessMapTransform)),y.roughness.value=_.roughness,_.roughnessMap&&(y.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,y.roughnessMapTransform)),e.get(_).envMap&&(y.envMapIntensity.value=_.envMapIntensity)}function g(y,_,b){y.ior.value=_.ior,_.sheen>0&&(y.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),y.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(y.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,y.sheenColorMapTransform)),_.sheenRoughnessMap&&(y.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,y.sheenRoughnessMapTransform))),_.clearcoat>0&&(y.clearcoat.value=_.clearcoat,y.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(y.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,y.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(y.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===An&&y.clearcoatNormalScale.value.negate())),_.iridescence>0&&(y.iridescence.value=_.iridescence,y.iridescenceIOR.value=_.iridescenceIOR,y.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(y.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,y.iridescenceMapTransform)),_.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),_.transmission>0&&(y.transmission.value=_.transmission,y.transmissionSamplerMap.value=b.texture,y.transmissionSamplerSize.value.set(b.width,b.height),_.transmissionMap&&(y.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,y.transmissionMapTransform)),y.thickness.value=_.thickness,_.thicknessMap&&(y.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=_.attenuationDistance,y.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(y.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(y.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=_.specularIntensity,y.specularColor.value.copy(_.specularColor),_.specularColorMap&&(y.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,y.specularColorMapTransform)),_.specularIntensityMap&&(y.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,y.specularIntensityMapTransform))}function x(y,_){_.matcap&&(y.matcap.value=_.matcap)}function S(y,_){const b=e.get(_).light;y.referencePosition.value.setFromMatrixPosition(b.matrixWorld),y.nearDistance.value=b.shadow.camera.near,y.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function HT(r,e,t,n){let i={},s={},a=[];const c=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function u(b,M){const T=M.program;n.uniformBlockBinding(b,T)}function h(b,M){let T=i[b.id];T===void 0&&(x(b),T=d(b),i[b.id]=T,b.addEventListener("dispose",y));const R=M.program;n.updateUBOMapping(b,R);const C=e.render.frame;s[b.id]!==C&&(m(b),s[b.id]=C)}function d(b){const M=f();b.__bindingPointIndex=M;const T=r.createBuffer(),R=b.__size,C=b.usage;return r.bindBuffer(r.UNIFORM_BUFFER,T),r.bufferData(r.UNIFORM_BUFFER,R,C),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,M,T),T}function f(){for(let b=0;b<c;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(b){const M=i[b.id],T=b.uniforms,R=b.__cache;r.bindBuffer(r.UNIFORM_BUFFER,M);for(let C=0,N=T.length;C<N;C++){const B=Array.isArray(T[C])?T[C]:[T[C]];for(let A=0,P=B.length;A<P;A++){const z=B[A];if(g(z,C,A,R)===!0){const ee=z.__offset,de=Array.isArray(z.value)?z.value:[z.value];let H=0;for(let q=0;q<de.length;q++){const ie=de[q],le=S(ie);typeof ie=="number"||typeof ie=="boolean"?(z.__data[0]=ie,r.bufferSubData(r.UNIFORM_BUFFER,ee+H,z.__data)):ie.isMatrix3?(z.__data[0]=ie.elements[0],z.__data[1]=ie.elements[1],z.__data[2]=ie.elements[2],z.__data[3]=0,z.__data[4]=ie.elements[3],z.__data[5]=ie.elements[4],z.__data[6]=ie.elements[5],z.__data[7]=0,z.__data[8]=ie.elements[6],z.__data[9]=ie.elements[7],z.__data[10]=ie.elements[8],z.__data[11]=0):(ie.toArray(z.__data,H),H+=le.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,ee,z.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function g(b,M,T,R){const C=b.value,N=M+"_"+T;if(R[N]===void 0)return typeof C=="number"||typeof C=="boolean"?R[N]=C:R[N]=C.clone(),!0;{const B=R[N];if(typeof C=="number"||typeof C=="boolean"){if(B!==C)return R[N]=C,!0}else if(B.equals(C)===!1)return B.copy(C),!0}return!1}function x(b){const M=b.uniforms;let T=0;const R=16;for(let N=0,B=M.length;N<B;N++){const A=Array.isArray(M[N])?M[N]:[M[N]];for(let P=0,z=A.length;P<z;P++){const ee=A[P],de=Array.isArray(ee.value)?ee.value:[ee.value];for(let H=0,q=de.length;H<q;H++){const ie=de[H],le=S(ie),j=T%R;j!==0&&R-j<le.boundary&&(T+=R-j),ee.__data=new Float32Array(le.storage/Float32Array.BYTES_PER_ELEMENT),ee.__offset=T,T+=le.storage}}}const C=T%R;return C>0&&(T+=R-C),b.__size=T,b.__cache={},this}function S(b){const M={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(M.boundary=4,M.storage=4):b.isVector2?(M.boundary=8,M.storage=8):b.isVector3||b.isColor?(M.boundary=16,M.storage=12):b.isVector4?(M.boundary=16,M.storage=16):b.isMatrix3?(M.boundary=48,M.storage=48):b.isMatrix4?(M.boundary=64,M.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),M}function y(b){const M=b.target;M.removeEventListener("dispose",y);const T=a.indexOf(M.__bindingPointIndex);a.splice(T,1),r.deleteBuffer(i[M.id]),delete i[M.id],delete s[M.id]}function _(){for(const b in i)r.deleteBuffer(i[b]);a=[],i={},s={}}return{bind:u,update:h,dispose:_}}class Op{constructor(e={}){const{canvas:t=nx(),context:n=null,depth:i=!0,stencil:s=!0,alpha:a=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let m;n!==null?m=n.getContextAttributes().alpha:m=a;const g=new Uint32Array(4),x=new Int32Array(4);let S=null,y=null;const _=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=cn,this._useLegacyLights=!1,this.toneMapping=Qi,this.toneMappingExposure=1;const M=this;let T=!1,R=0,C=0,N=null,B=-1,A=null;const P=new At,z=new At;let ee=null;const de=new ke(0);let H=0,q=t.width,ie=t.height,le=1,j=null,Z=null;const J=new At(0,0,q,ie),te=new At(0,0,q,ie);let ge=!1;const K=new ml;let fe=!1,be=!1,Oe=null;const Ne=new lt,Je=new he,rt=new U,Pe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ae(){return N===null?le:1}let k=n;function ve(O,$){for(let se=0;se<O.length;se++){const oe=O[se],re=t.getContext(oe,$);if(re!==null)return re}return null}try{const O={alpha:!0,depth:i,stencil:s,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Zo}`),t.addEventListener("webglcontextlost",Me,!1),t.addEventListener("webglcontextrestored",G,!1),t.addEventListener("webglcontextcreationerror",Te,!1),k===null){const $=["webgl2","webgl","experimental-webgl"];if(M.isWebGL1Renderer===!0&&$.shift(),k=ve($,O),k===null)throw ve($)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&k instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),k.getShaderPrecisionFormat===void 0&&(k.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(O){throw console.error("THREE.WebGLRenderer: "+O.message),O}let ue,Ee,pe,Ve,Le,D,I,Q,ye,xe,me,Xe,Re,Ie,et,ht,Se,wt,gt,ct,$e,Ge,V,_e;function Be(){ue=new t1(k),Ee=new Zw(k,ue,e),ue.init(Ee),Ge=new px(k,ue,Ee),pe=new OT(k,ue,Ee),Ve=new r1(k),Le=new bT,D=new FT(k,ue,pe,Le,Ee,Ge,Ve),I=new Kw(M),Q=new e1(M),ye=new dE(k,Ee),V=new qw(k,ue,ye,Ee),xe=new n1(k,ye,Ve,V),me=new l1(k,xe,ye,Ve),gt=new a1(k,Ee,D),ht=new Jw(Le),Xe=new ET(M,I,Q,ue,Ee,V,ht),Re=new kT(M,Le),Ie=new TT,et=new IT(ue,Ee),wt=new Xw(M,I,Q,pe,me,m,u),Se=new UT(M,me,Ee),_e=new HT(k,Ve,Ee,pe),ct=new Yw(k,ue,Ve,Ee),$e=new i1(k,ue,Ve,Ee),Ve.programs=Xe.programs,M.capabilities=Ee,M.extensions=ue,M.properties=Le,M.renderLists=Ie,M.shadowMap=Se,M.state=pe,M.info=Ve}Be();const Fe=new BT(M,k);this.xr=Fe,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const O=ue.get("WEBGL_lose_context");O&&O.loseContext()},this.forceContextRestore=function(){const O=ue.get("WEBGL_lose_context");O&&O.restoreContext()},this.getPixelRatio=function(){return le},this.setPixelRatio=function(O){O!==void 0&&(le=O,this.setSize(q,ie,!1))},this.getSize=function(O){return O.set(q,ie)},this.setSize=function(O,$,se=!0){if(Fe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}q=O,ie=$,t.width=Math.floor(O*le),t.height=Math.floor($*le),se===!0&&(t.style.width=O+"px",t.style.height=$+"px"),this.setViewport(0,0,O,$)},this.getDrawingBufferSize=function(O){return O.set(q*le,ie*le).floor()},this.setDrawingBufferSize=function(O,$,se){q=O,ie=$,le=se,t.width=Math.floor(O*se),t.height=Math.floor($*se),this.setViewport(0,0,O,$)},this.getCurrentViewport=function(O){return O.copy(P)},this.getViewport=function(O){return O.copy(J)},this.setViewport=function(O,$,se,oe){O.isVector4?J.set(O.x,O.y,O.z,O.w):J.set(O,$,se,oe),pe.viewport(P.copy(J).multiplyScalar(le).floor())},this.getScissor=function(O){return O.copy(te)},this.setScissor=function(O,$,se,oe){O.isVector4?te.set(O.x,O.y,O.z,O.w):te.set(O,$,se,oe),pe.scissor(z.copy(te).multiplyScalar(le).floor())},this.getScissorTest=function(){return ge},this.setScissorTest=function(O){pe.setScissorTest(ge=O)},this.setOpaqueSort=function(O){j=O},this.setTransparentSort=function(O){Z=O},this.getClearColor=function(O){return O.copy(wt.getClearColor())},this.setClearColor=function(){wt.setClearColor.apply(wt,arguments)},this.getClearAlpha=function(){return wt.getClearAlpha()},this.setClearAlpha=function(){wt.setClearAlpha.apply(wt,arguments)},this.clear=function(O=!0,$=!0,se=!0){let oe=0;if(O){let re=!1;if(N!==null){const He=N.texture.format;re=He===Mp||He===Sp||He===yp}if(re){const He=N.texture.type,Ke=He===$i||He===xr||He===Bu||He===jr||He===vp||He===xp,st=wt.getClearColor(),ot=wt.getClearAlpha(),dt=st.r,ut=st.g,ft=st.b;Ke?(g[0]=dt,g[1]=ut,g[2]=ft,g[3]=ot,k.clearBufferuiv(k.COLOR,0,g)):(x[0]=dt,x[1]=ut,x[2]=ft,x[3]=ot,k.clearBufferiv(k.COLOR,0,x))}else oe|=k.COLOR_BUFFER_BIT}$&&(oe|=k.DEPTH_BUFFER_BIT),se&&(oe|=k.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k.clear(oe)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Me,!1),t.removeEventListener("webglcontextrestored",G,!1),t.removeEventListener("webglcontextcreationerror",Te,!1),Ie.dispose(),et.dispose(),Le.dispose(),I.dispose(),Q.dispose(),me.dispose(),V.dispose(),_e.dispose(),Xe.dispose(),Fe.dispose(),Fe.removeEventListener("sessionstart",Ht),Fe.removeEventListener("sessionend",Ct),Oe&&(Oe.dispose(),Oe=null),yn.stop()};function Me(O){O.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function G(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const O=Ve.autoReset,$=Se.enabled,se=Se.autoUpdate,oe=Se.needsUpdate,re=Se.type;Be(),Ve.autoReset=O,Se.enabled=$,Se.autoUpdate=se,Se.needsUpdate=oe,Se.type=re}function Te(O){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",O.statusMessage)}function De(O){const $=O.target;$.removeEventListener("dispose",De),tt($)}function tt(O){Ye(O),Le.remove(O)}function Ye(O){const $=Le.get(O).programs;$!==void 0&&($.forEach(function(se){Xe.releaseProgram(se)}),O.isShaderMaterial&&Xe.releaseShaderCache(O))}this.renderBufferDirect=function(O,$,se,oe,re,He){$===null&&($=Pe);const Ke=re.isMesh&&re.matrixWorld.determinant()<0,st=dh(O,$,se,oe,re);pe.setMaterial(oe,Ke);let ot=se.index,dt=1;if(oe.wireframe===!0){if(ot=xe.getWireframeAttribute(se),ot===void 0)return;dt=2}const ut=se.drawRange,ft=se.attributes.position;let Gt=ut.start*dt,Sn=(ut.start+ut.count)*dt;He!==null&&(Gt=Math.max(Gt,He.start*dt),Sn=Math.min(Sn,(He.start+He.count)*dt)),ot!==null?(Gt=Math.max(Gt,0),Sn=Math.min(Sn,ot.count)):ft!=null&&(Gt=Math.max(Gt,0),Sn=Math.min(Sn,ft.count));const Bt=Sn-Gt;if(Bt<0||Bt===1/0)return;V.setup(re,oe,st,se,ot);let dn,at=ct;if(ot!==null&&(dn=ye.get(ot),at=$e,at.setIndex(dn)),re.isMesh)oe.wireframe===!0?(pe.setLineWidth(oe.wireframeLinewidth*Ae()),at.setMode(k.LINES)):at.setMode(k.TRIANGLES);else if(re.isLine){let We=oe.linewidth;We===void 0&&(We=1),pe.setLineWidth(We*Ae()),re.isLineSegments?at.setMode(k.LINES):re.isLineLoop?at.setMode(k.LINE_LOOP):at.setMode(k.LINE_STRIP)}else re.isPoints?at.setMode(k.POINTS):re.isSprite&&at.setMode(k.TRIANGLES);if(re.isBatchedMesh)at.renderMultiDraw(re._multiDrawStarts,re._multiDrawCounts,re._multiDrawCount);else if(re.isInstancedMesh)at.renderInstances(Gt,Bt,re.count);else if(se.isInstancedBufferGeometry){const We=se._maxInstanceCount!==void 0?se._maxInstanceCount:1/0,ui=Math.min(se.instanceCount,We);at.renderInstances(Gt,Bt,ui)}else at.render(Gt,Bt)};function bt(O,$,se){O.transparent===!0&&O.side===Si&&O.forceSinglePass===!1?(O.side=An,O.needsUpdate=!0,Ys(O,$,se),O.side=Mr,O.needsUpdate=!0,Ys(O,$,se),O.side=Si):Ys(O,$,se)}this.compile=function(O,$,se=null){se===null&&(se=O),y=et.get(se),y.init(),b.push(y),se.traverseVisible(function(re){re.isLight&&re.layers.test($.layers)&&(y.pushLight(re),re.castShadow&&y.pushShadow(re))}),O!==se&&O.traverseVisible(function(re){re.isLight&&re.layers.test($.layers)&&(y.pushLight(re),re.castShadow&&y.pushShadow(re))}),y.setupLights(M._useLegacyLights);const oe=new Set;return O.traverse(function(re){const He=re.material;if(He)if(Array.isArray(He))for(let Ke=0;Ke<He.length;Ke++){const st=He[Ke];bt(st,se,re),oe.add(st)}else bt(He,se,re),oe.add(He)}),b.pop(),y=null,oe},this.compileAsync=function(O,$,se=null){const oe=this.compile(O,$,se);return new Promise(re=>{function He(){if(oe.forEach(function(Ke){Le.get(Ke).currentProgram.isReady()&&oe.delete(Ke)}),oe.size===0){re(O);return}setTimeout(He,10)}ue.get("KHR_parallel_shader_compile")!==null?He():setTimeout(He,10)})};let Tt=null;function Ot(O){Tt&&Tt(O)}function Ht(){yn.stop()}function Ct(){yn.start()}const yn=new lx;yn.setAnimationLoop(Ot),typeof self<"u"&&yn.setContext(self),this.setAnimationLoop=function(O){Tt=O,Fe.setAnimationLoop(O),O===null?yn.stop():yn.start()},Fe.addEventListener("sessionstart",Ht),Fe.addEventListener("sessionend",Ct),this.render=function(O,$){if($!==void 0&&$.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),$.parent===null&&$.matrixWorldAutoUpdate===!0&&$.updateMatrixWorld(),Fe.enabled===!0&&Fe.isPresenting===!0&&(Fe.cameraAutoUpdate===!0&&Fe.updateCamera($),$=Fe.getCamera()),O.isScene===!0&&O.onBeforeRender(M,O,$,N),y=et.get(O,b.length),y.init(),b.push(y),Ne.multiplyMatrices($.projectionMatrix,$.matrixWorldInverse),K.setFromProjectionMatrix(Ne),be=this.localClippingEnabled,fe=ht.init(this.clippingPlanes,be),S=Ie.get(O,_.length),S.init(),_.push(S),ci(O,$,0,M.sortObjects),S.finish(),M.sortObjects===!0&&S.sort(j,Z),this.info.render.frame++,fe===!0&&ht.beginShadows();const se=y.state.shadowsArray;if(Se.render(se,O,$),fe===!0&&ht.endShadows(),this.info.autoReset===!0&&this.info.reset(),wt.render(S,O),y.setupLights(M._useLegacyLights),$.isArrayCamera){const oe=$.cameras;for(let re=0,He=oe.length;re<He;re++){const Ke=oe[re];ea(S,O,Ke,Ke.viewport)}}else ea(S,O,$);N!==null&&(D.updateMultisampleRenderTarget(N),D.updateRenderTargetMipmap(N)),O.isScene===!0&&O.onAfterRender(M,O,$),V.resetDefaultState(),B=-1,A=null,b.pop(),b.length>0?y=b[b.length-1]:y=null,_.pop(),_.length>0?S=_[_.length-1]:S=null};function ci(O,$,se,oe){if(O.visible===!1)return;if(O.layers.test($.layers)){if(O.isGroup)se=O.renderOrder;else if(O.isLOD)O.autoUpdate===!0&&O.update($);else if(O.isLight)y.pushLight(O),O.castShadow&&y.pushShadow(O);else if(O.isSprite){if(!O.frustumCulled||K.intersectsSprite(O)){oe&&rt.setFromMatrixPosition(O.matrixWorld).applyMatrix4(Ne);const Ke=me.update(O),st=O.material;st.visible&&S.push(O,Ke,st,se,rt.z,null)}}else if((O.isMesh||O.isLine||O.isPoints)&&(!O.frustumCulled||K.intersectsObject(O))){const Ke=me.update(O),st=O.material;if(oe&&(O.boundingSphere!==void 0?(O.boundingSphere===null&&O.computeBoundingSphere(),rt.copy(O.boundingSphere.center)):(Ke.boundingSphere===null&&Ke.computeBoundingSphere(),rt.copy(Ke.boundingSphere.center)),rt.applyMatrix4(O.matrixWorld).applyMatrix4(Ne)),Array.isArray(st)){const ot=Ke.groups;for(let dt=0,ut=ot.length;dt<ut;dt++){const ft=ot[dt],Gt=st[ft.materialIndex];Gt&&Gt.visible&&S.push(O,Ke,Gt,se,rt.z,ft)}}else st.visible&&S.push(O,Ke,st,se,rt.z,null)}}const He=O.children;for(let Ke=0,st=He.length;Ke<st;Ke++)ci(He[Ke],$,se,oe)}function ea(O,$,se,oe){const re=O.opaque,He=O.transmissive,Ke=O.transparent;y.setupLightsView(se),fe===!0&&ht.setGlobalState(M.clippingPlanes,se),He.length>0&&ta(re,He,$,se),oe&&pe.viewport(P.copy(oe)),re.length>0&&qs(re,$,se),He.length>0&&qs(He,$,se),Ke.length>0&&qs(Ke,$,se),pe.buffers.depth.setTest(!0),pe.buffers.depth.setMask(!0),pe.buffers.color.setMask(!0),pe.setPolygonOffset(!1)}function ta(O,$,se,oe){if((se.isScene===!0?se.overrideMaterial:null)!==null)return;const He=Ee.isWebGL2;Oe===null&&(Oe=new Ui(1,1,{generateMipmaps:!0,type:ue.has("EXT_color_buffer_half_float")?Go:$i,minFilter:Zr,samples:He?4:0})),M.getDrawingBufferSize(Je),He?Oe.setSize(Je.x,Je.y):Oe.setSize(Lu(Je.x),Lu(Je.y));const Ke=M.getRenderTarget();M.setRenderTarget(Oe),M.getClearColor(de),H=M.getClearAlpha(),H<1&&M.setClearColor(16777215,.5),M.clear();const st=M.toneMapping;M.toneMapping=Qi,qs(O,se,oe),D.updateMultisampleRenderTarget(Oe),D.updateRenderTargetMipmap(Oe);let ot=!1;for(let dt=0,ut=$.length;dt<ut;dt++){const ft=$[dt],Gt=ft.object,Sn=ft.geometry,Bt=ft.material,dn=ft.group;if(Bt.side===Si&&Gt.layers.test(oe.layers)){const at=Bt.side;Bt.side=An,Bt.needsUpdate=!0,Tr(Gt,se,oe,Sn,Bt,dn),Bt.side=at,Bt.needsUpdate=!0,ot=!0}}ot===!0&&(D.updateMultisampleRenderTarget(Oe),D.updateRenderTargetMipmap(Oe)),M.setRenderTarget(Ke),M.setClearColor(de,H),M.toneMapping=st}function qs(O,$,se){const oe=$.isScene===!0?$.overrideMaterial:null;for(let re=0,He=O.length;re<He;re++){const Ke=O[re],st=Ke.object,ot=Ke.geometry,dt=oe===null?Ke.material:oe,ut=Ke.group;st.layers.test(se.layers)&&Tr(st,$,se,ot,dt,ut)}}function Tr(O,$,se,oe,re,He){O.onBeforeRender(M,$,se,oe,re,He),O.modelViewMatrix.multiplyMatrices(se.matrixWorldInverse,O.matrixWorld),O.normalMatrix.getNormalMatrix(O.modelViewMatrix),re.onBeforeRender(M,$,se,oe,O,He),re.transparent===!0&&re.side===Si&&re.forceSinglePass===!1?(re.side=An,re.needsUpdate=!0,M.renderBufferDirect(se,$,oe,re,O,He),re.side=Mr,re.needsUpdate=!0,M.renderBufferDirect(se,$,oe,re,O,He),re.side=Si):M.renderBufferDirect(se,$,oe,re,O,He),O.onAfterRender(M,$,se,oe,re,He)}function Ys(O,$,se){$.isScene!==!0&&($=Pe);const oe=Le.get(O),re=y.state.lights,He=y.state.shadowsArray,Ke=re.state.version,st=Xe.getParameters(O,re.state,He,$,se),ot=Xe.getProgramCacheKey(st);let dt=oe.programs;oe.environment=O.isMeshStandardMaterial?$.environment:null,oe.fog=$.fog,oe.envMap=(O.isMeshStandardMaterial?Q:I).get(O.envMap||oe.environment),dt===void 0&&(O.addEventListener("dispose",De),dt=new Map,oe.programs=dt);let ut=dt.get(ot);if(ut!==void 0){if(oe.currentProgram===ut&&oe.lightsStateVersion===Ke)return wl(O,st),ut}else st.uniforms=Xe.getUniforms(O),O.onBuild(se,st,M),O.onBeforeCompile(st,M),ut=Xe.acquireProgram(st,ot),dt.set(ot,ut),oe.uniforms=st.uniforms;const ft=oe.uniforms;return(!O.isShaderMaterial&&!O.isRawShaderMaterial||O.clipping===!0)&&(ft.clippingPlanes=ht.uniform),wl(O,st),oe.needsLights=ph(O),oe.lightsStateVersion=Ke,oe.needsLights&&(ft.ambientLightColor.value=re.state.ambient,ft.lightProbe.value=re.state.probe,ft.directionalLights.value=re.state.directional,ft.directionalLightShadows.value=re.state.directionalShadow,ft.spotLights.value=re.state.spot,ft.spotLightShadows.value=re.state.spotShadow,ft.rectAreaLights.value=re.state.rectArea,ft.ltc_1.value=re.state.rectAreaLTC1,ft.ltc_2.value=re.state.rectAreaLTC2,ft.pointLights.value=re.state.point,ft.pointLightShadows.value=re.state.pointShadow,ft.hemisphereLights.value=re.state.hemi,ft.directionalShadowMap.value=re.state.directionalShadowMap,ft.directionalShadowMatrix.value=re.state.directionalShadowMatrix,ft.spotShadowMap.value=re.state.spotShadowMap,ft.spotLightMatrix.value=re.state.spotLightMatrix,ft.spotLightMap.value=re.state.spotLightMap,ft.pointShadowMap.value=re.state.pointShadowMap,ft.pointShadowMatrix.value=re.state.pointShadowMatrix),oe.currentProgram=ut,oe.uniformsList=null,ut}function bl(O){if(O.uniformsList===null){const $=O.currentProgram.getUniforms();O.uniformsList=bu.seqWithValue($.seq,O.uniforms)}return O.uniformsList}function wl(O,$){const se=Le.get(O);se.outputColorSpace=$.outputColorSpace,se.batching=$.batching,se.instancing=$.instancing,se.instancingColor=$.instancingColor,se.skinning=$.skinning,se.morphTargets=$.morphTargets,se.morphNormals=$.morphNormals,se.morphColors=$.morphColors,se.morphTargetsCount=$.morphTargetsCount,se.numClippingPlanes=$.numClippingPlanes,se.numIntersection=$.numClipIntersection,se.vertexAlphas=$.vertexAlphas,se.vertexTangents=$.vertexTangents,se.toneMapping=$.toneMapping}function dh(O,$,se,oe,re){$.isScene!==!0&&($=Pe),D.resetTextureUnits();const He=$.fog,Ke=oe.isMeshStandardMaterial?$.environment:null,st=N===null?M.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:nr,ot=(oe.isMeshStandardMaterial?Q:I).get(oe.envMap||Ke),dt=oe.vertexColors===!0&&!!se.attributes.color&&se.attributes.color.itemSize===4,ut=!!se.attributes.tangent&&(!!oe.normalMap||oe.anisotropy>0),ft=!!se.morphAttributes.position,Gt=!!se.morphAttributes.normal,Sn=!!se.morphAttributes.color;let Bt=Qi;oe.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(Bt=M.toneMapping);const dn=se.morphAttributes.position||se.morphAttributes.normal||se.morphAttributes.color,at=dn!==void 0?dn.length:0,We=Le.get(oe),ui=y.state.lights;if(fe===!0&&(be===!0||O!==A)){const Mn=O===A&&oe.id===B;ht.setState(oe,O,Mn)}let Mt=!1;oe.version===We.__version?(We.needsLights&&We.lightsStateVersion!==ui.state.version||We.outputColorSpace!==st||re.isBatchedMesh&&We.batching===!1||!re.isBatchedMesh&&We.batching===!0||re.isInstancedMesh&&We.instancing===!1||!re.isInstancedMesh&&We.instancing===!0||re.isSkinnedMesh&&We.skinning===!1||!re.isSkinnedMesh&&We.skinning===!0||re.isInstancedMesh&&We.instancingColor===!0&&re.instanceColor===null||re.isInstancedMesh&&We.instancingColor===!1&&re.instanceColor!==null||We.envMap!==ot||oe.fog===!0&&We.fog!==He||We.numClippingPlanes!==void 0&&(We.numClippingPlanes!==ht.numPlanes||We.numIntersection!==ht.numIntersection)||We.vertexAlphas!==dt||We.vertexTangents!==ut||We.morphTargets!==ft||We.morphNormals!==Gt||We.morphColors!==Sn||We.toneMapping!==Bt||Ee.isWebGL2===!0&&We.morphTargetsCount!==at)&&(Mt=!0):(Mt=!0,We.__version=oe.version);let qt=We.currentProgram;Mt===!0&&(qt=Ys(oe,$,re));let ki=!1,hi=!1,fn=!1;const Kt=qt.getUniforms(),Hi=We.uniforms;if(pe.useProgram(qt.program)&&(ki=!0,hi=!0,fn=!0),oe.id!==B&&(B=oe.id,hi=!0),ki||A!==O){Kt.setValue(k,"projectionMatrix",O.projectionMatrix),Kt.setValue(k,"viewMatrix",O.matrixWorldInverse);const Mn=Kt.map.cameraPosition;Mn!==void 0&&Mn.setValue(k,rt.setFromMatrixPosition(O.matrixWorld)),Ee.logarithmicDepthBuffer&&Kt.setValue(k,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(oe.isMeshPhongMaterial||oe.isMeshToonMaterial||oe.isMeshLambertMaterial||oe.isMeshBasicMaterial||oe.isMeshStandardMaterial||oe.isShaderMaterial)&&Kt.setValue(k,"isOrthographic",O.isOrthographicCamera===!0),A!==O&&(A=O,hi=!0,fn=!0)}if(re.isSkinnedMesh){Kt.setOptional(k,re,"bindMatrix"),Kt.setOptional(k,re,"bindMatrixInverse");const Mn=re.skeleton;Mn&&(Ee.floatVertexTextures?(Mn.boneTexture===null&&Mn.computeBoneTexture(),Kt.setValue(k,"boneTexture",Mn.boneTexture,D)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}re.isBatchedMesh&&(Kt.setOptional(k,re,"batchingTexture"),Kt.setValue(k,"batchingTexture",re._matricesTexture,D));const Zs=se.morphAttributes;if((Zs.position!==void 0||Zs.normal!==void 0||Zs.color!==void 0&&Ee.isWebGL2===!0)&&gt.update(re,se,qt),(hi||We.receiveShadow!==re.receiveShadow)&&(We.receiveShadow=re.receiveShadow,Kt.setValue(k,"receiveShadow",re.receiveShadow)),oe.isMeshGouraudMaterial&&oe.envMap!==null&&(Hi.envMap.value=ot,Hi.flipEnvMap.value=ot.isCubeTexture&&ot.isRenderTargetTexture===!1?-1:1),hi&&(Kt.setValue(k,"toneMappingExposure",M.toneMappingExposure),We.needsLights&&fh(Hi,fn),He&&oe.fog===!0&&Re.refreshFogUniforms(Hi,He),Re.refreshMaterialUniforms(Hi,oe,le,ie,Oe),bu.upload(k,bl(We),Hi,D)),oe.isShaderMaterial&&oe.uniformsNeedUpdate===!0&&(bu.upload(k,bl(We),Hi,D),oe.uniformsNeedUpdate=!1),oe.isSpriteMaterial&&Kt.setValue(k,"center",re.center),Kt.setValue(k,"modelViewMatrix",re.modelViewMatrix),Kt.setValue(k,"normalMatrix",re.normalMatrix),Kt.setValue(k,"modelMatrix",re.matrixWorld),oe.isShaderMaterial||oe.isRawShaderMaterial){const Mn=oe.uniformsGroups;for(let Js=0,$n=Mn.length;Js<$n;Js++)if(Ee.isWebGL2){const Tl=Mn[Js];_e.update(Tl,qt),_e.bind(Tl,qt)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return qt}function fh(O,$){O.ambientLightColor.needsUpdate=$,O.lightProbe.needsUpdate=$,O.directionalLights.needsUpdate=$,O.directionalLightShadows.needsUpdate=$,O.pointLights.needsUpdate=$,O.pointLightShadows.needsUpdate=$,O.spotLights.needsUpdate=$,O.spotLightShadows.needsUpdate=$,O.rectAreaLights.needsUpdate=$,O.hemisphereLights.needsUpdate=$}function ph(O){return O.isMeshLambertMaterial||O.isMeshToonMaterial||O.isMeshPhongMaterial||O.isMeshStandardMaterial||O.isShadowMaterial||O.isShaderMaterial&&O.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(O,$,se){Le.get(O.texture).__webglTexture=$,Le.get(O.depthTexture).__webglTexture=se;const oe=Le.get(O);oe.__hasExternalTextures=!0,oe.__hasExternalTextures&&(oe.__autoAllocateDepthBuffer=se===void 0,oe.__autoAllocateDepthBuffer||ue.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),oe.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(O,$){const se=Le.get(O);se.__webglFramebuffer=$,se.__useDefaultFramebuffer=$===void 0},this.setRenderTarget=function(O,$=0,se=0){N=O,R=$,C=se;let oe=!0,re=null,He=!1,Ke=!1;if(O){const ot=Le.get(O);ot.__useDefaultFramebuffer!==void 0?(pe.bindFramebuffer(k.FRAMEBUFFER,null),oe=!1):ot.__webglFramebuffer===void 0?D.setupRenderTarget(O):ot.__hasExternalTextures&&D.rebindTextures(O,Le.get(O.texture).__webglTexture,Le.get(O.depthTexture).__webglTexture);const dt=O.texture;(dt.isData3DTexture||dt.isDataArrayTexture||dt.isCompressedArrayTexture)&&(Ke=!0);const ut=Le.get(O).__webglFramebuffer;O.isWebGLCubeRenderTarget?(Array.isArray(ut[$])?re=ut[$][se]:re=ut[$],He=!0):Ee.isWebGL2&&O.samples>0&&D.useMultisampledRTT(O)===!1?re=Le.get(O).__webglMultisampledFramebuffer:Array.isArray(ut)?re=ut[se]:re=ut,P.copy(O.viewport),z.copy(O.scissor),ee=O.scissorTest}else P.copy(J).multiplyScalar(le).floor(),z.copy(te).multiplyScalar(le).floor(),ee=ge;if(pe.bindFramebuffer(k.FRAMEBUFFER,re)&&Ee.drawBuffers&&oe&&pe.drawBuffers(O,re),pe.viewport(P),pe.scissor(z),pe.setScissorTest(ee),He){const ot=Le.get(O.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+$,ot.__webglTexture,se)}else if(Ke){const ot=Le.get(O.texture),dt=$||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,ot.__webglTexture,se||0,dt)}B=-1},this.readRenderTargetPixels=function(O,$,se,oe,re,He,Ke){if(!(O&&O.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let st=Le.get(O).__webglFramebuffer;if(O.isWebGLCubeRenderTarget&&Ke!==void 0&&(st=st[Ke]),st){pe.bindFramebuffer(k.FRAMEBUFFER,st);try{const ot=O.texture,dt=ot.format,ut=ot.type;if(dt!==Wn&&Ge.convert(dt)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ft=ut===Go&&(ue.has("EXT_color_buffer_half_float")||Ee.isWebGL2&&ue.has("EXT_color_buffer_float"));if(ut!==$i&&Ge.convert(ut)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_TYPE)&&!(ut===Ni&&(Ee.isWebGL2||ue.has("OES_texture_float")||ue.has("WEBGL_color_buffer_float")))&&!ft){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}$>=0&&$<=O.width-oe&&se>=0&&se<=O.height-re&&k.readPixels($,se,oe,re,Ge.convert(dt),Ge.convert(ut),He)}finally{const ot=N!==null?Le.get(N).__webglFramebuffer:null;pe.bindFramebuffer(k.FRAMEBUFFER,ot)}}},this.copyFramebufferToTexture=function(O,$,se=0){const oe=Math.pow(2,-se),re=Math.floor($.image.width*oe),He=Math.floor($.image.height*oe);D.setTexture2D($,0),k.copyTexSubImage2D(k.TEXTURE_2D,se,0,0,O.x,O.y,re,He),pe.unbindTexture()},this.copyTextureToTexture=function(O,$,se,oe=0){const re=$.image.width,He=$.image.height,Ke=Ge.convert(se.format),st=Ge.convert(se.type);D.setTexture2D(se,0),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,se.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,se.unpackAlignment),$.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,oe,O.x,O.y,re,He,Ke,st,$.image.data):$.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,oe,O.x,O.y,$.mipmaps[0].width,$.mipmaps[0].height,Ke,$.mipmaps[0].data):k.texSubImage2D(k.TEXTURE_2D,oe,O.x,O.y,Ke,st,$.image),oe===0&&se.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),pe.unbindTexture()},this.copyTextureToTexture3D=function(O,$,se,oe,re=0){if(M.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const He=O.max.x-O.min.x+1,Ke=O.max.y-O.min.y+1,st=O.max.z-O.min.z+1,ot=Ge.convert(oe.format),dt=Ge.convert(oe.type);let ut;if(oe.isData3DTexture)D.setTexture3D(oe,0),ut=k.TEXTURE_3D;else if(oe.isDataArrayTexture||oe.isCompressedArrayTexture)D.setTexture2DArray(oe,0),ut=k.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,oe.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,oe.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,oe.unpackAlignment);const ft=k.getParameter(k.UNPACK_ROW_LENGTH),Gt=k.getParameter(k.UNPACK_IMAGE_HEIGHT),Sn=k.getParameter(k.UNPACK_SKIP_PIXELS),Bt=k.getParameter(k.UNPACK_SKIP_ROWS),dn=k.getParameter(k.UNPACK_SKIP_IMAGES),at=se.isCompressedTexture?se.mipmaps[re]:se.image;k.pixelStorei(k.UNPACK_ROW_LENGTH,at.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,at.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,O.min.x),k.pixelStorei(k.UNPACK_SKIP_ROWS,O.min.y),k.pixelStorei(k.UNPACK_SKIP_IMAGES,O.min.z),se.isDataTexture||se.isData3DTexture?k.texSubImage3D(ut,re,$.x,$.y,$.z,He,Ke,st,ot,dt,at.data):se.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),k.compressedTexSubImage3D(ut,re,$.x,$.y,$.z,He,Ke,st,ot,at.data)):k.texSubImage3D(ut,re,$.x,$.y,$.z,He,Ke,st,ot,dt,at),k.pixelStorei(k.UNPACK_ROW_LENGTH,ft),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Gt),k.pixelStorei(k.UNPACK_SKIP_PIXELS,Sn),k.pixelStorei(k.UNPACK_SKIP_ROWS,Bt),k.pixelStorei(k.UNPACK_SKIP_IMAGES,dn),re===0&&oe.generateMipmaps&&k.generateMipmap(ut),pe.unbindTexture()},this.initTexture=function(O){O.isCubeTexture?D.setTextureCube(O,0):O.isData3DTexture?D.setTexture3D(O,0):O.isDataArrayTexture||O.isCompressedArrayTexture?D.setTexture2DArray(O,0):D.setTexture2D(O,0),pe.unbindTexture()},this.resetState=function(){R=0,C=0,N=null,pe.reset(),V.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Hu?"display-p3":"srgb",t.unpackColorSpace=Dt.workingColorSpace===hl?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===cn?qr:wp}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===qr?cn:nr}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class gx extends Op{}gx.prototype.isWebGL1Renderer=!0;class Wu{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new ke(e),this.density=t}clone(){return new Wu(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class ju{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new ke(e),this.near=t,this.far=n}clone(){return new ju(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Fp extends Nt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Xu{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=el,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=li()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=li()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=li()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Hn=new U;class ai{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Hn.fromBufferAttribute(this,t),Hn.applyMatrix4(e),this.setXYZ(t,Hn.x,Hn.y,Hn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Hn.fromBufferAttribute(this,t),Hn.applyNormalMatrix(e),this.setXYZ(t,Hn.x,Hn.y,Hn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Hn.fromBufferAttribute(this,t),Hn.transformDirection(e),this.setXYZ(t,Hn.x,Hn.y,Hn.z);return this}setX(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=vt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Kn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Kn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Kn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Kn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=vt(t,this.array),n=vt(n,this.array),i=vt(i,this.array),s=vt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new Ut(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new ai(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class zp extends zn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ke(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let To;const wa=new U,Ao=new U,Co=new U,Ro=new he,Ta=new he,_x=new lt,Hc=new U,Aa=new U,Vc=new U,I0=new he,Gd=new he,N0=new he;class vx extends Nt{constructor(e=new zp){if(super(),this.isSprite=!0,this.type="Sprite",To===void 0){To=new St;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Xu(t,5);To.setIndex([0,1,2,0,2,3]),To.setAttribute("position",new ai(n,3,0,!1)),To.setAttribute("uv",new ai(n,2,3,!1))}this.geometry=To,this.material=e,this.center=new he(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ao.setFromMatrixScale(this.matrixWorld),_x.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Co.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ao.multiplyScalar(-Co.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;Gc(Hc.set(-.5,-.5,0),Co,a,Ao,i,s),Gc(Aa.set(.5,-.5,0),Co,a,Ao,i,s),Gc(Vc.set(.5,.5,0),Co,a,Ao,i,s),I0.set(0,0),Gd.set(1,0),N0.set(1,1);let c=e.ray.intersectTriangle(Hc,Aa,Vc,!1,wa);if(c===null&&(Gc(Aa.set(-.5,.5,0),Co,a,Ao,i,s),Gd.set(0,1),c=e.ray.intersectTriangle(Hc,Vc,Aa,!1,wa),c===null))return;const u=e.ray.origin.distanceTo(wa);u<e.near||u>e.far||t.push({distance:u,point:wa.clone(),uv:Jn.getInterpolation(wa,Hc,Aa,Vc,I0,Gd,N0,new he),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Gc(r,e,t,n,i,s){Ro.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Ta.x=s*Ro.x-i*Ro.y,Ta.y=i*Ro.x+s*Ro.y):Ta.copy(Ro),r.copy(e),r.x+=Ta.x,r.y+=Ta.y,r.applyMatrix4(_x)}const Wc=new U,D0=new U;class xx extends Nt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){Wc.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Wc);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Wc.setFromMatrixPosition(e.matrixWorld),D0.setFromMatrixPosition(this.matrixWorld);const n=Wc.distanceTo(D0)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let a=t[i].distance;if(t[i].object.visible&&(a-=a*t[i].hysteresis),n>=a)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const U0=new U,O0=new At,F0=new At,VT=new U,z0=new lt,jc=new U,Wd=new xn,B0=new lt,jd=new Vs;class yx extends an{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Af,this.bindMatrix=new lt,this.bindMatrixInverse=new lt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new vn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,jc),this.boundingBox.expandByPoint(jc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new xn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,jc),this.boundingSphere.expandByPoint(jc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Wd.copy(this.boundingSphere),Wd.applyMatrix4(i),e.ray.intersectsSphere(Wd)!==!1&&(B0.copy(i).invert(),jd.copy(e.ray).applyMatrix4(B0),!(this.boundingBox!==null&&jd.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,jd)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new At,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Af?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Iv?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;O0.fromBufferAttribute(i.attributes.skinIndex,e),F0.fromBufferAttribute(i.attributes.skinWeight,e),U0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=F0.getComponent(s);if(a!==0){const c=O0.getComponent(s);z0.multiplyMatrices(n.bones[c].matrixWorld,n.boneInverses[c]),t.addScaledVector(VT.copy(U0).applyMatrix4(z0),a)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}class Bp extends Nt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Fs extends nn{constructor(e=null,t=1,n=1,i,s,a,c,u,h=en,d=en,f,m){super(null,a,c,u,h,d,i,s,f,m),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const k0=new lt,GT=new lt;class qu{constructor(e=[],t=[]){this.uuid=li(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new lt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new lt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const c=e[s]?e[s].matrixWorld:GT;k0.multiplyMatrices(c,t[s]),k0.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new qu(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Fs(t,e,e,Wn,Ni);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new Bp),this.bones.push(a),this.boneInverses.push(new lt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const c=n[i];e.boneInverses.push(c.toArray())}return e}}class qo extends Ut{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Po=new lt,H0=new lt,Xc=[],V0=new vn,WT=new lt,Ca=new an,Ra=new xn;class Sx extends an{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new qo(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,WT)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new vn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Po),V0.copy(e.boundingBox).applyMatrix4(Po),this.boundingBox.union(V0)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new xn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Po),Ra.copy(e.boundingSphere).applyMatrix4(Po),this.boundingSphere.union(Ra)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ca.geometry=this.geometry,Ca.material=this.material,Ca.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ra.copy(this.boundingSphere),Ra.applyMatrix4(n),e.ray.intersectsSphere(Ra)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Po),H0.multiplyMatrices(n,Po),Ca.matrixWorld=H0,Ca.raycast(e,Xc);for(let a=0,c=Xc.length;a<c;a++){const u=Xc[a];u.instanceId=s,u.object=this,t.push(u)}Xc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new qo(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}function jT(r,e){return r.z-e.z}function XT(r,e){return e.z-r.z}class qT{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t){const n=this.pool,i=this.list;this.index>=n.length&&n.push({start:-1,count:-1,z:-1});const s=n[this.index];i.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=t}reset(){this.list.length=0,this.index=0}}const Lo="batchId",kr=new lt,G0=new lt,YT=new lt,W0=new lt,Xd=new ml,qc=new vn,ms=new xn,Pa=new U,qd=new qT,Dn=new an,Yc=[];function ZT(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let a=0;a<n;a++)e.setComponent(s+t,a,r.getComponent(s,a))}else e.array.set(r.array,t*n);e.needsUpdate=!0}class Mx extends an{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,t,n=t*2,i){super(new St,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxGeometryCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Fs(t,e,e,Wn,Ni);this._matricesTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxGeometryCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(const c in e.attributes){const u=e.getAttribute(c),{array:h,itemSize:d,normalized:f}=u,m=new h.constructor(n*d),g=new u.constructor(m,d,f);g.setUsage(u.usage),t.setAttribute(c,g)}if(e.getIndex()!==null){const c=n>65536?new Uint32Array(s):new Uint16Array(s);t.setIndex(new Ut(c,1))}const a=i>65536?new Uint32Array(n):new Uint16Array(n);t.setAttribute(Lo,new Ut(a,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(Lo))throw new Error(`BatchedMesh: Geometry cannot use attribute "${Lo}"`);const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(n===Lo)continue;if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new vn);const e=this._geometryCount,t=this.boundingBox,n=this._active;t.makeEmpty();for(let i=0;i<e;i++)n[i]!==!1&&(this.getMatrixAt(i,kr),this.getBoundingBoxAt(i,qc).applyMatrix4(kr),t.union(qc))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new xn);const e=this._geometryCount,t=this.boundingSphere,n=this._active;t.makeEmpty();for(let i=0;i<e;i++)n[i]!==!1&&(this.getMatrixAt(i,kr),this.getBoundingSphereAt(i,ms).applyMatrix4(kr),t.union(ms))}addGeometry(e,t=-1,n=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const a=this._reservedRanges,c=this._drawRanges,u=this._bounds;this._geometryCount!==0&&(s=a[a.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const h=e.getIndex(),d=h!==null;if(d&&(n===-1?i.indexCount=h.count:i.indexCount=n,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const f=this._visibility,m=this._active,g=this._matricesTexture,x=this._matricesTexture.image.data;f.push(!0),m.push(!0);const S=this._geometryCount;this._geometryCount++,YT.toArray(x,S*16),g.needsUpdate=!0,a.push(i),c.push({start:d?i.indexStart:i.vertexStart,count:-1}),u.push({boxInitialized:!1,box:new vn,sphereInitialized:!1,sphere:new xn});const y=this.geometry.getAttribute(Lo);for(let _=0;_<i.vertexCount;_++)y.setX(i.vertexStart+_,S);return y.needsUpdate=!0,this.setGeometryAt(S,e),S}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),c=this._reservedRanges[e];if(i&&a.count>c.indexCount||t.attributes.position.count>c.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const u=c.vertexStart,h=c.vertexCount;for(const g in n.attributes){if(g===Lo)continue;const x=t.getAttribute(g),S=n.getAttribute(g);ZT(x,S,u);const y=x.itemSize;for(let _=x.count,b=h;_<b;_++){const M=u+_;for(let T=0;T<y;T++)S.setComponent(M,T,0)}S.needsUpdate=!0}if(i){const g=c.indexStart;for(let x=0;x<a.count;x++)s.setX(g+x,u+a.getX(x));for(let x=a.count,S=c.indexCount;x<S;x++)s.setX(g+x,u);s.needsUpdate=!0}const d=this._bounds[e];t.boundingBox!==null?(d.box.copy(t.boundingBox),d.boxInitialized=!0):d.boxInitialized=!1,t.boundingSphere!==null?(d.sphere.copy(t.boundingSphere),d.sphereInitialized=!0):d.sphereInitialized=!1;const f=this._drawRanges[e],m=t.getAttribute("position");return f.count=i?a.count:m.count,this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._active;return e>=t.length||t[e]===!1?this:(t[e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(this._active[e]===!1)return this;const i=this._bounds[e],s=i.box,a=this.geometry;if(i.boxInitialized===!1){s.makeEmpty();const c=a.index,u=a.attributes.position,h=this._drawRanges[e];for(let d=h.start,f=h.start+h.count;d<f;d++){let m=d;c&&(m=c.getX(m)),s.expandByPoint(Pa.fromBufferAttribute(u,m))}i.boxInitialized=!0}return t.copy(s),t}getBoundingSphereAt(e,t){if(this._active[e]===!1)return this;const i=this._bounds[e],s=i.sphere,a=this.geometry;if(i.sphereInitialized===!1){s.makeEmpty(),this.getBoundingBoxAt(e,qc),qc.getCenter(s.center);const c=a.index,u=a.attributes.position,h=this._drawRanges[e];let d=0;for(let f=h.start,m=h.start+h.count;f<m;f++){let g=f;c&&(g=c.getX(g)),Pa.fromBufferAttribute(u,g),d=Math.max(d,s.center.distanceToSquared(Pa))}s.radius=Math.sqrt(d),i.sphereInitialized=!0}return t.copy(s),t}setMatrixAt(e,t){const n=this._active,i=this._matricesTexture,s=this._matricesTexture.image.data,a=this._geometryCount;return e>=a||n[e]===!1?this:(t.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._active,i=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||n[e]===!1?null:t.fromArray(i,e*16)}setVisibleAt(e,t){const n=this._visibility,i=this._active,s=this._geometryCount;return e>=s||i[e]===!1||n[e]===t?this:(n[e]=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._visibility,n=this._active,i=this._geometryCount;return e>=i||n[e]===!1?!1:t[e]}raycast(e,t){const n=this._visibility,i=this._active,s=this._drawRanges,a=this._geometryCount,c=this.matrixWorld,u=this.geometry;Dn.material=this.material,Dn.geometry.index=u.index,Dn.geometry.attributes=u.attributes,Dn.geometry.boundingBox===null&&(Dn.geometry.boundingBox=new vn),Dn.geometry.boundingSphere===null&&(Dn.geometry.boundingSphere=new xn);for(let h=0;h<a;h++){if(!n[h]||!i[h])continue;const d=s[h];Dn.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(h,Dn.matrixWorld).premultiply(c),this.getBoundingBoxAt(h,Dn.geometry.boundingBox),this.getBoundingSphereAt(h,Dn.geometry.boundingSphere),Dn.raycast(e,Yc);for(let f=0,m=Yc.length;f<m;f++){const g=Yc[f];g.object=this,g.batchId=h,t.push(g)}Yc.length=0}Dn.material=null,Dn.geometry.index=null,Dn.geometry.attributes={},Dn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),c=a===null?1:a.array.BYTES_PER_ELEMENT,u=this._visibility,h=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,m=this.perObjectFrustumCulled;m&&(W0.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Xd.setFromProjectionMatrix(W0,e.isWebGPURenderer?Wo:Di));let g=0;if(this.sortObjects){G0.copy(this.matrixWorld).invert(),Pa.setFromMatrixPosition(n.matrixWorld).applyMatrix4(G0);for(let y=0,_=u.length;y<_;y++)if(u[y]){this.getMatrixAt(y,kr),this.getBoundingSphereAt(y,ms).applyMatrix4(kr);let b=!1;if(m&&(b=!Xd.intersectsSphere(ms)),!b){const M=Pa.distanceTo(ms.center);qd.push(f[y],M)}}const x=qd.list,S=this.customSort;S===null?x.sort(s.transparent?XT:jT):S.call(this,x,n);for(let y=0,_=x.length;y<_;y++){const b=x[y];h[g]=b.start*c,d[g]=b.count,g++}qd.reset()}else for(let x=0,S=u.length;x<S;x++)if(u[x]){let y=!1;if(m&&(this.getMatrixAt(x,kr),this.getBoundingSphereAt(x,ms).applyMatrix4(kr),y=!Xd.intersectsSphere(ms)),!y){const _=f[x];h[g]=_.start*c,d[g]=_.count,g++}}this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class jn extends zn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ke(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const j0=new U,X0=new U,q0=new lt,Yd=new Vs,Zc=new xn;let Jr=class extends Nt{constructor(e=new St,t=new jn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)j0.fromBufferAttribute(t,i-1),X0.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=j0.distanceTo(X0);e.setAttribute("lineDistance",new qe(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Zc.copy(n.boundingSphere),Zc.applyMatrix4(i),Zc.radius+=s,e.ray.intersectsSphere(Zc)===!1)return;q0.copy(i).invert(),Yd.copy(e.ray).applyMatrix4(q0);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=new U,d=new U,f=new U,m=new U,g=this.isLineSegments?2:1,x=n.index,y=n.attributes.position;if(x!==null){const _=Math.max(0,a.start),b=Math.min(x.count,a.start+a.count);for(let M=_,T=b-1;M<T;M+=g){const R=x.getX(M),C=x.getX(M+1);if(h.fromBufferAttribute(y,R),d.fromBufferAttribute(y,C),Yd.distanceSqToSegment(h,d,m,f)>u)continue;m.applyMatrix4(this.matrixWorld);const B=e.ray.origin.distanceTo(m);B<e.near||B>e.far||t.push({distance:B,point:f.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,a.start),b=Math.min(y.count,a.start+a.count);for(let M=_,T=b-1;M<T;M+=g){if(h.fromBufferAttribute(y,M),d.fromBufferAttribute(y,M+1),Yd.distanceSqToSegment(h,d,m,f)>u)continue;m.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(m);C<e.near||C>e.far||t.push({distance:C,point:f.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}};const Y0=new U,Z0=new U;class ir extends Jr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Y0.fromBufferAttribute(t,i),Z0.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Y0.distanceTo(Z0);e.setAttribute("lineDistance",new qe(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Ex extends Jr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Yu extends zn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ke(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const J0=new lt,rp=new Vs,Jc=new xn,Kc=new U;let bx=class extends Nt{constructor(e=new St,t=new Yu){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Jc.copy(n.boundingSphere),Jc.applyMatrix4(i),Jc.radius+=s,e.ray.intersectsSphere(Jc)===!1)return;J0.copy(i).invert(),rp.copy(e.ray).applyMatrix4(J0);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=n.index,f=n.attributes.position;if(h!==null){const m=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let x=m,S=g;x<S;x++){const y=h.getX(x);Kc.fromBufferAttribute(f,y),K0(Kc,y,u,i,e,t,this)}}else{const m=Math.max(0,a.start),g=Math.min(f.count,a.start+a.count);for(let x=m,S=g;x<S;x++)Kc.fromBufferAttribute(f,x),K0(Kc,x,u,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}};function K0(r,e,t,n,i,s,a){const c=rp.distanceSqToPoint(r);if(c<t){const u=new U;rp.closestPointToPoint(r,u),u.applyMatrix4(n);const h=i.ray.origin.distanceTo(u);if(h<i.near||h>i.far)return;s.push({distance:h,distanceToRay:Math.sqrt(c),point:u,index:e,face:null,object:a})}}class JT extends nn{constructor(e,t,n,i,s,a,c,u,h){super(e,t,n,i,s,a,c,u,h),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:tn,this.magFilter=s!==void 0?s:tn,this.generateMipmaps=!1;const d=this;function f(){d.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class KT extends nn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=en,this.minFilter=en,this.generateMipmaps=!1,this.needsUpdate=!0}}class Zu extends nn{constructor(e,t,n,i,s,a,c,u,h,d,f,m){super(null,a,c,u,h,d,i,s,f,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class QT extends Zu{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Un}}class $T extends Zu{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Er),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class eA extends nn{constructor(e,t,n,i,s,a,c,u,h){super(e,t,n,i,s,a,c,u,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Fi{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let c=0,u=s-1,h;for(;c<=u;)if(i=Math.floor(c+(u-c)/2),h=n[i]-a,h<0)c=i+1;else if(h>0)u=i-1;else{u=i;break}if(i=u,n[i]===a)return i/(s-1);const d=n[i],m=n[i+1]-d,g=(a-d)/m;return(i+g)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),c=this.getPoint(s),u=t||(a.isVector2?new he:new U);return u.copy(c).sub(a).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new U,i=[],s=[],a=[],c=new U,u=new lt;for(let g=0;g<=e;g++){const x=g/e;i[g]=this.getTangentAt(x,new U)}s[0]=new U,a[0]=new U;let h=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=h&&(h=d,n.set(1,0,0)),f<=h&&(h=f,n.set(0,1,0)),m<=h&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],c),a[0].crossVectors(i[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),a[g]=a[g-1].clone(),c.crossVectors(i[g-1],i[g]),c.length()>Number.EPSILON){c.normalize();const x=Math.acos(Jt(i[g-1].dot(i[g]),-1,1));s[g].applyMatrix4(u.makeRotationAxis(c,x))}a[g].crossVectors(i[g],s[g])}if(t===!0){let g=Math.acos(Jt(s[0].dot(s[e]),-1,1));g/=e,i[0].dot(c.crossVectors(s[0],s[e]))>0&&(g=-g);for(let x=1;x<=e;x++)s[x].applyMatrix4(u.makeRotationAxis(i[x],g*x)),a[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Ju extends Fi{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,c=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=c,this.aRotation=u}getPoint(e,t){const n=t||new he,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const c=this.aStartAngle+e*s;let u=this.aX+this.xRadius*Math.cos(c),h=this.aY+this.yRadius*Math.sin(c);if(this.aRotation!==0){const d=Math.cos(this.aRotation),f=Math.sin(this.aRotation),m=u-this.aX,g=h-this.aY;u=m*d-g*f+this.aX,h=m*f+g*d+this.aY}return n.set(u,h)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class wx extends Ju{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function kp(){let r=0,e=0,t=0,n=0;function i(s,a,c,u){r=s,e=c,t=-3*s+3*a-2*c-u,n=2*s-2*a+c+u}return{initCatmullRom:function(s,a,c,u,h){i(a,c,h*(c-s),h*(u-a))},initNonuniformCatmullRom:function(s,a,c,u,h,d,f){let m=(a-s)/h-(c-s)/(h+d)+(c-a)/d,g=(c-a)/d-(u-a)/(d+f)+(u-c)/f;m*=d,g*=d,i(a,c,m,g)},calc:function(s){const a=s*s,c=a*s;return r+e*s+t*a+n*c}}}const Qc=new U,Zd=new kp,Jd=new kp,Kd=new kp;class Hp extends Fi{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new U){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let c=Math.floor(a),u=a-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/s)+1)*s:u===0&&c===s-1&&(c=s-2,u=1);let h,d;this.closed||c>0?h=i[(c-1)%s]:(Qc.subVectors(i[0],i[1]).add(i[0]),h=Qc);const f=i[c%s],m=i[(c+1)%s];if(this.closed||c+2<s?d=i[(c+2)%s]:(Qc.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=Qc),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let x=Math.pow(h.distanceToSquared(f),g),S=Math.pow(f.distanceToSquared(m),g),y=Math.pow(m.distanceToSquared(d),g);S<1e-4&&(S=1),x<1e-4&&(x=S),y<1e-4&&(y=S),Zd.initNonuniformCatmullRom(h.x,f.x,m.x,d.x,x,S,y),Jd.initNonuniformCatmullRom(h.y,f.y,m.y,d.y,x,S,y),Kd.initNonuniformCatmullRom(h.z,f.z,m.z,d.z,x,S,y)}else this.curveType==="catmullrom"&&(Zd.initCatmullRom(h.x,f.x,m.x,d.x,this.tension),Jd.initCatmullRom(h.y,f.y,m.y,d.y,this.tension),Kd.initCatmullRom(h.z,f.z,m.z,d.z,this.tension));return n.set(Zd.calc(u),Jd.calc(u),Kd.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new U().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Q0(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,c=r*r,u=r*c;return(2*t-2*n+s+a)*u+(-3*t+3*n-2*s-a)*c+s*r+t}function tA(r,e){const t=1-r;return t*t*e}function nA(r,e){return 2*(1-r)*r*e}function iA(r,e){return r*r*e}function Ha(r,e,t,n){return tA(r,e)+nA(r,t)+iA(r,n)}function rA(r,e){const t=1-r;return t*t*t*e}function sA(r,e){const t=1-r;return 3*t*t*r*e}function oA(r,e){return 3*(1-r)*r*r*e}function aA(r,e){return r*r*r*e}function Va(r,e,t,n,i){return rA(r,e)+sA(r,t)+oA(r,n)+aA(r,i)}class Vp extends Fi{constructor(e=new he,t=new he,n=new he,i=new he){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new he){const n=t,i=this.v0,s=this.v1,a=this.v2,c=this.v3;return n.set(Va(e,i.x,s.x,a.x,c.x),Va(e,i.y,s.y,a.y,c.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Tx extends Fi{constructor(e=new U,t=new U,n=new U,i=new U){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new U){const n=t,i=this.v0,s=this.v1,a=this.v2,c=this.v3;return n.set(Va(e,i.x,s.x,a.x,c.x),Va(e,i.y,s.y,a.y,c.y),Va(e,i.z,s.z,a.z,c.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Gp extends Fi{constructor(e=new he,t=new he){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new he){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new he){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ax extends Fi{constructor(e=new U,t=new U){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new U){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Wp extends Fi{constructor(e=new he,t=new he,n=new he){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new he){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Ha(e,i.x,s.x,a.x),Ha(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ku extends Fi{constructor(e=new U,t=new U,n=new U){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new U){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(Ha(e,i.x,s.x,a.x),Ha(e,i.y,s.y,a.y),Ha(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class jp extends Fi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new he){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),c=s-a,u=i[a===0?a:a-1],h=i[a],d=i[a>i.length-2?i.length-1:a+1],f=i[a>i.length-3?i.length-1:a+2];return n.set(Q0(c,u.x,h.x,d.x,f.x),Q0(c,u.y,h.y,d.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new he().fromArray(i))}return this}}var Nu=Object.freeze({__proto__:null,ArcCurve:wx,CatmullRomCurve3:Hp,CubicBezierCurve:Vp,CubicBezierCurve3:Tx,EllipseCurve:Ju,LineCurve:Gp,LineCurve3:Ax,QuadraticBezierCurve:Wp,QuadraticBezierCurve3:Ku,SplineCurve:jp});class Cx extends Fi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Nu[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,c=this.curves[s],u=c.getLength(),h=u===0?0:1-a/u;return c.getPointAt(h,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],c=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,u=a.getPoints(c);for(let h=0;h<u.length;h++){const d=u[h];n&&n.equals(d)||(t.push(d),n=d)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new Nu[i.type]().fromJSON(i))}return this}}class nl extends Cx{constructor(e){super(),this.type="Path",this.currentPoint=new he,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Gp(this.currentPoint.clone(),new he(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Wp(this.currentPoint.clone(),new he(e,t),new he(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const c=new Vp(this.currentPoint.clone(),new he(e,t),new he(n,i),new he(s,a));return this.curves.push(c),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new jp(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+c,t+u,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,c,u){const h=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+h,t+d,n,i,s,a,c,u),this}absellipse(e,t,n,i,s,a,c,u){const h=new Ju(e,t,n,i,s,a,c,u);if(this.curves.length>0){const f=h.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(h);const d=h.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class _l extends St{constructor(e=[new he(0,-.5),new he(.5,0),new he(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Jt(i,0,Math.PI*2);const s=[],a=[],c=[],u=[],h=[],d=1/t,f=new U,m=new he,g=new U,x=new U,S=new U;let y=0,_=0;for(let b=0;b<=e.length-1;b++)switch(b){case 0:y=e[b+1].x-e[b].x,_=e[b+1].y-e[b].y,g.x=_*1,g.y=-y,g.z=_*0,S.copy(g),g.normalize(),u.push(g.x,g.y,g.z);break;case e.length-1:u.push(S.x,S.y,S.z);break;default:y=e[b+1].x-e[b].x,_=e[b+1].y-e[b].y,g.x=_*1,g.y=-y,g.z=_*0,x.copy(g),g.x+=S.x,g.y+=S.y,g.z+=S.z,g.normalize(),u.push(g.x,g.y,g.z),S.copy(x)}for(let b=0;b<=t;b++){const M=n+b*d*i,T=Math.sin(M),R=Math.cos(M);for(let C=0;C<=e.length-1;C++){f.x=e[C].x*T,f.y=e[C].y,f.z=e[C].x*R,a.push(f.x,f.y,f.z),m.x=b/t,m.y=C/(e.length-1),c.push(m.x,m.y);const N=u[3*C+0]*T,B=u[3*C+1],A=u[3*C+0]*R;h.push(N,B,A)}}for(let b=0;b<t;b++)for(let M=0;M<e.length-1;M++){const T=M+b*e.length,R=T,C=T+e.length,N=T+e.length+1,B=T+1;s.push(R,C,B),s.push(N,B,C)}this.setIndex(s),this.setAttribute("position",new qe(a,3)),this.setAttribute("uv",new qe(c,2)),this.setAttribute("normal",new qe(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _l(e.points,e.segments,e.phiStart,e.phiLength)}}class Qu extends _l{constructor(e=1,t=1,n=4,i=8){const s=new nl;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new Qu(e.radius,e.length,e.capSegments,e.radialSegments)}}class $u extends St{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],a=[],c=[],u=[],h=new U,d=new he;a.push(0,0,0),c.push(0,0,1),u.push(.5,.5);for(let f=0,m=3;f<=t;f++,m+=3){const g=n+f/t*i;h.x=e*Math.cos(g),h.y=e*Math.sin(g),a.push(h.x,h.y,h.z),c.push(0,0,1),d.x=(a[m]/e+1)/2,d.y=(a[m+1]/e+1)/2,u.push(d.x,d.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new qe(a,3)),this.setAttribute("normal",new qe(c,3)),this.setAttribute("uv",new qe(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $u(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Qo extends St{constructor(e=1,t=1,n=1,i=32,s=1,a=!1,c=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:c,thetaLength:u};const h=this;i=Math.floor(i),s=Math.floor(s);const d=[],f=[],m=[],g=[];let x=0;const S=[],y=n/2;let _=0;b(),a===!1&&(e>0&&M(!0),t>0&&M(!1)),this.setIndex(d),this.setAttribute("position",new qe(f,3)),this.setAttribute("normal",new qe(m,3)),this.setAttribute("uv",new qe(g,2));function b(){const T=new U,R=new U;let C=0;const N=(t-e)/n;for(let B=0;B<=s;B++){const A=[],P=B/s,z=P*(t-e)+e;for(let ee=0;ee<=i;ee++){const de=ee/i,H=de*u+c,q=Math.sin(H),ie=Math.cos(H);R.x=z*q,R.y=-P*n+y,R.z=z*ie,f.push(R.x,R.y,R.z),T.set(q,N,ie).normalize(),m.push(T.x,T.y,T.z),g.push(de,1-P),A.push(x++)}S.push(A)}for(let B=0;B<i;B++)for(let A=0;A<s;A++){const P=S[A][B],z=S[A+1][B],ee=S[A+1][B+1],de=S[A][B+1];d.push(P,z,de),d.push(z,ee,de),C+=6}h.addGroup(_,C,0),_+=C}function M(T){const R=x,C=new he,N=new U;let B=0;const A=T===!0?e:t,P=T===!0?1:-1;for(let ee=1;ee<=i;ee++)f.push(0,y*P,0),m.push(0,P,0),g.push(.5,.5),x++;const z=x;for(let ee=0;ee<=i;ee++){const H=ee/i*u+c,q=Math.cos(H),ie=Math.sin(H);N.x=A*ie,N.y=y*P,N.z=A*q,f.push(N.x,N.y,N.z),m.push(0,P,0),C.x=q*.5+.5,C.y=ie*.5*P+.5,g.push(C.x,C.y),x++}for(let ee=0;ee<i;ee++){const de=R+ee,H=z+ee;T===!0?d.push(H,H+1,de):d.push(H+1,H,de),B+=3}h.addGroup(_,B,T===!0?1:2),_+=B}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class eh extends Qo{constructor(e=1,t=1,n=32,i=1,s=!1,a=0,c=Math.PI*2){super(0,e,t,n,i,s,a,c),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:c}}static fromJSON(e){return new eh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class $r extends St{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],a=[];c(i),h(n),d(),this.setAttribute("position",new qe(s,3)),this.setAttribute("normal",new qe(s.slice(),3)),this.setAttribute("uv",new qe(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function c(b){const M=new U,T=new U,R=new U;for(let C=0;C<t.length;C+=3)g(t[C+0],M),g(t[C+1],T),g(t[C+2],R),u(M,T,R,b)}function u(b,M,T,R){const C=R+1,N=[];for(let B=0;B<=C;B++){N[B]=[];const A=b.clone().lerp(T,B/C),P=M.clone().lerp(T,B/C),z=C-B;for(let ee=0;ee<=z;ee++)ee===0&&B===C?N[B][ee]=A:N[B][ee]=A.clone().lerp(P,ee/z)}for(let B=0;B<C;B++)for(let A=0;A<2*(C-B)-1;A++){const P=Math.floor(A/2);A%2===0?(m(N[B][P+1]),m(N[B+1][P]),m(N[B][P])):(m(N[B][P+1]),m(N[B+1][P+1]),m(N[B+1][P]))}}function h(b){const M=new U;for(let T=0;T<s.length;T+=3)M.x=s[T+0],M.y=s[T+1],M.z=s[T+2],M.normalize().multiplyScalar(b),s[T+0]=M.x,s[T+1]=M.y,s[T+2]=M.z}function d(){const b=new U;for(let M=0;M<s.length;M+=3){b.x=s[M+0],b.y=s[M+1],b.z=s[M+2];const T=y(b)/2/Math.PI+.5,R=_(b)/Math.PI+.5;a.push(T,1-R)}x(),f()}function f(){for(let b=0;b<a.length;b+=6){const M=a[b+0],T=a[b+2],R=a[b+4],C=Math.max(M,T,R),N=Math.min(M,T,R);C>.9&&N<.1&&(M<.2&&(a[b+0]+=1),T<.2&&(a[b+2]+=1),R<.2&&(a[b+4]+=1))}}function m(b){s.push(b.x,b.y,b.z)}function g(b,M){const T=b*3;M.x=e[T+0],M.y=e[T+1],M.z=e[T+2]}function x(){const b=new U,M=new U,T=new U,R=new U,C=new he,N=new he,B=new he;for(let A=0,P=0;A<s.length;A+=9,P+=6){b.set(s[A+0],s[A+1],s[A+2]),M.set(s[A+3],s[A+4],s[A+5]),T.set(s[A+6],s[A+7],s[A+8]),C.set(a[P+0],a[P+1]),N.set(a[P+2],a[P+3]),B.set(a[P+4],a[P+5]),R.copy(b).add(M).add(T).divideScalar(3);const z=y(R);S(C,P+0,b,z),S(N,P+2,M,z),S(B,P+4,T,z)}}function S(b,M,T,R){R<0&&b.x===1&&(a[M]=b.x-1),T.x===0&&T.z===0&&(a[M]=R/2/Math.PI+.5)}function y(b){return Math.atan2(b.z,-b.x)}function _(b){return Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $r(e.vertices,e.indices,e.radius,e.details)}}class th extends $r{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[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];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new th(e.radius,e.detail)}}const $c=new U,eu=new U,Qd=new U,tu=new Jn;class Rx extends St{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(Us*t),a=e.getIndex(),c=e.getAttribute("position"),u=a?a.count:c.count,h=[0,0,0],d=["a","b","c"],f=new Array(3),m={},g=[];for(let x=0;x<u;x+=3){a?(h[0]=a.getX(x),h[1]=a.getX(x+1),h[2]=a.getX(x+2)):(h[0]=x,h[1]=x+1,h[2]=x+2);const{a:S,b:y,c:_}=tu;if(S.fromBufferAttribute(c,h[0]),y.fromBufferAttribute(c,h[1]),_.fromBufferAttribute(c,h[2]),tu.getNormal(Qd),f[0]=`${Math.round(S.x*i)},${Math.round(S.y*i)},${Math.round(S.z*i)}`,f[1]=`${Math.round(y.x*i)},${Math.round(y.y*i)},${Math.round(y.z*i)}`,f[2]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let b=0;b<3;b++){const M=(b+1)%3,T=f[b],R=f[M],C=tu[d[b]],N=tu[d[M]],B=`${T}_${R}`,A=`${R}_${T}`;A in m&&m[A]?(Qd.dot(m[A].normal)<=s&&(g.push(C.x,C.y,C.z),g.push(N.x,N.y,N.z)),m[A]=null):B in m||(m[B]={index0:h[b],index1:h[M],normal:Qd.clone()})}}for(const x in m)if(m[x]){const{index0:S,index1:y}=m[x];$c.fromBufferAttribute(c,S),eu.fromBufferAttribute(c,y),g.push($c.x,$c.y,$c.z),g.push(eu.x,eu.y,eu.z)}this.setAttribute("position",new qe(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class zs extends nl{constructor(e){super(e),this.uuid=li(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new nl().fromJSON(i))}return this}}const lA={triangulate:function(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=Px(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let c,u,h,d,f,m,g;if(n&&(s=fA(r,e,s,t)),r.length>80*t){c=h=r[0],u=d=r[1];for(let x=t;x<i;x+=t)f=r[x],m=r[x+1],f<c&&(c=f),m<u&&(u=m),f>h&&(h=f),m>d&&(d=m);g=Math.max(h-c,d-u),g=g!==0?32767/g:0}return il(s,a,t,c,u,g,0),a}};function Px(r,e,t,n,i){let s,a;if(i===bA(r,e,t,n)>0)for(s=e;s<t;s+=n)a=$0(s,r[s],r[s+1],a);else for(s=t-n;s>=e;s-=n)a=$0(s,r[s],r[s+1],a);return a&&nh(a,a.next)&&(sl(a),a=a.next),a}function Hs(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(nh(t,t.next)||Xt(t.prev,t,t.next)===0)){if(sl(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function il(r,e,t,n,i,s,a){if(!r)return;!a&&s&&vA(r,n,i,s);let c=r,u,h;for(;r.prev!==r.next;){if(u=r.prev,h=r.next,s?uA(r,n,i,s):cA(r)){e.push(u.i/t|0),e.push(r.i/t|0),e.push(h.i/t|0),sl(r),r=h.next,c=h.next;continue}if(r=h,r===c){a?a===1?(r=hA(Hs(r),e,t),il(r,e,t,n,i,s,2)):a===2&&dA(r,e,t,n,i,s):il(Hs(r),e,t,n,i,s,1);break}}}function cA(r){const e=r.prev,t=r,n=r.next;if(Xt(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,c=e.y,u=t.y,h=n.y,d=i<s?i<a?i:a:s<a?s:a,f=c<u?c<h?c:h:u<h?u:h,m=i>s?i>a?i:a:s>a?s:a,g=c>u?c>h?c:h:u>h?u:h;let x=n.next;for(;x!==e;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=g&&ko(i,c,s,u,a,h,x.x,x.y)&&Xt(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function uA(r,e,t,n){const i=r.prev,s=r,a=r.next;if(Xt(i,s,a)>=0)return!1;const c=i.x,u=s.x,h=a.x,d=i.y,f=s.y,m=a.y,g=c<u?c<h?c:h:u<h?u:h,x=d<f?d<m?d:m:f<m?f:m,S=c>u?c>h?c:h:u>h?u:h,y=d>f?d>m?d:m:f>m?f:m,_=sp(g,x,e,t,n),b=sp(S,y,e,t,n);let M=r.prevZ,T=r.nextZ;for(;M&&M.z>=_&&T&&T.z<=b;){if(M.x>=g&&M.x<=S&&M.y>=x&&M.y<=y&&M!==i&&M!==a&&ko(c,d,u,f,h,m,M.x,M.y)&&Xt(M.prev,M,M.next)>=0||(M=M.prevZ,T.x>=g&&T.x<=S&&T.y>=x&&T.y<=y&&T!==i&&T!==a&&ko(c,d,u,f,h,m,T.x,T.y)&&Xt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;M&&M.z>=_;){if(M.x>=g&&M.x<=S&&M.y>=x&&M.y<=y&&M!==i&&M!==a&&ko(c,d,u,f,h,m,M.x,M.y)&&Xt(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;T&&T.z<=b;){if(T.x>=g&&T.x<=S&&T.y>=x&&T.y<=y&&T!==i&&T!==a&&ko(c,d,u,f,h,m,T.x,T.y)&&Xt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function hA(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!nh(i,s)&&Lx(i,n,n.next,s)&&rl(i,s)&&rl(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),sl(n),sl(n.next),n=r=s),n=n.next}while(n!==r);return Hs(n)}function dA(r,e,t,n,i,s){let a=r;do{let c=a.next.next;for(;c!==a.prev;){if(a.i!==c.i&&SA(a,c)){let u=Ix(a,c);a=Hs(a,a.next),u=Hs(u,u.next),il(a,e,t,n,i,s,0),il(u,e,t,n,i,s,0);return}c=c.next}a=a.next}while(a!==r)}function fA(r,e,t,n){const i=[];let s,a,c,u,h;for(s=0,a=e.length;s<a;s++)c=e[s]*n,u=s<a-1?e[s+1]*n:r.length,h=Px(r,c,u,n,!1),h===h.next&&(h.steiner=!0),i.push(yA(h));for(i.sort(pA),s=0;s<i.length;s++)t=mA(i[s],t);return t}function pA(r,e){return r.x-e.x}function mA(r,e){const t=gA(r,e);if(!t)return e;const n=Ix(t,r);return Hs(n,n.next),Hs(t,t.next)}function gA(r,e){let t=e,n=-1/0,i;const s=r.x,a=r.y;do{if(a<=t.y&&a>=t.next.y&&t.next.y!==t.y){const m=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(m<=s&&m>n&&(n=m,i=t.x<t.next.x?t:t.next,m===s))return i}t=t.next}while(t!==e);if(!i)return null;const c=i,u=i.x,h=i.y;let d=1/0,f;t=i;do s>=t.x&&t.x>=u&&s!==t.x&&ko(a<h?s:n,a,u,h,a<h?n:s,a,t.x,t.y)&&(f=Math.abs(a-t.y)/(s-t.x),rl(t,r)&&(f<d||f===d&&(t.x>i.x||t.x===i.x&&_A(i,t)))&&(i=t,d=f)),t=t.next;while(t!==c);return i}function _A(r,e){return Xt(r.prev,r,e.prev)<0&&Xt(e.next,r,r.next)<0}function vA(r,e,t,n){let i=r;do i.z===0&&(i.z=sp(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,xA(i)}function xA(r){let e,t,n,i,s,a,c,u,h=1;do{for(t=r,r=null,s=null,a=0;t;){for(a++,n=t,c=0,e=0;e<h&&(c++,n=n.nextZ,!!n);e++);for(u=h;c>0||u>0&&n;)c!==0&&(u===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,c--):(i=n,n=n.nextZ,u--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,h*=2}while(a>1);return r}function sp(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function yA(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function ko(r,e,t,n,i,s,a,c){return(i-a)*(e-c)>=(r-a)*(s-c)&&(r-a)*(n-c)>=(t-a)*(e-c)&&(t-a)*(s-c)>=(i-a)*(n-c)}function SA(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!MA(r,e)&&(rl(r,e)&&rl(e,r)&&EA(r,e)&&(Xt(r.prev,r,e.prev)||Xt(r,e.prev,e))||nh(r,e)&&Xt(r.prev,r,r.next)>0&&Xt(e.prev,e,e.next)>0)}function Xt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function nh(r,e){return r.x===e.x&&r.y===e.y}function Lx(r,e,t,n){const i=iu(Xt(r,e,t)),s=iu(Xt(r,e,n)),a=iu(Xt(t,n,r)),c=iu(Xt(t,n,e));return!!(i!==s&&a!==c||i===0&&nu(r,t,e)||s===0&&nu(r,n,e)||a===0&&nu(t,r,n)||c===0&&nu(t,e,n))}function nu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function iu(r){return r>0?1:r<0?-1:0}function MA(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Lx(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function rl(r,e){return Xt(r.prev,r,r.next)<0?Xt(r,e,r.next)>=0&&Xt(r,r.prev,e)>=0:Xt(r,e,r.prev)<0||Xt(r,r.next,e)<0}function EA(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Ix(r,e){const t=new op(r.i,r.x,r.y),n=new op(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function $0(r,e,t,n){const i=new op(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function sl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function op(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function bA(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class tr{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return tr.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];e_(e),t_(n,e);let a=e.length;t.forEach(e_);for(let u=0;u<t.length;u++)i.push(a),a+=t[u].length,t_(n,t[u]);const c=lA.triangulate(n,i);for(let u=0;u<c.length;u+=3)s.push(c.slice(u,u+3));return s}}function e_(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function t_(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class ih extends St{constructor(e=new zs([new he(.5,.5),new he(-.5,.5),new he(-.5,-.5),new he(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let c=0,u=e.length;c<u;c++){const h=e[c];a(h)}this.setAttribute("position",new qe(i,3)),this.setAttribute("uv",new qe(s,2)),this.computeVertexNormals();function a(c){const u=[],h=t.curveSegments!==void 0?t.curveSegments:12,d=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1;let m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,x=t.bevelSize!==void 0?t.bevelSize:g-.1,S=t.bevelOffset!==void 0?t.bevelOffset:0,y=t.bevelSegments!==void 0?t.bevelSegments:3;const _=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:wA;let M,T=!1,R,C,N,B;_&&(M=_.getSpacedPoints(d),T=!0,m=!1,R=_.computeFrenetFrames(d,!1),C=new U,N=new U,B=new U),m||(y=0,g=0,x=0,S=0);const A=c.extractPoints(h);let P=A.shape;const z=A.holes;if(!tr.isClockWise(P)){P=P.reverse();for(let k=0,ve=z.length;k<ve;k++){const ue=z[k];tr.isClockWise(ue)&&(z[k]=ue.reverse())}}const de=tr.triangulateShape(P,z),H=P;for(let k=0,ve=z.length;k<ve;k++){const ue=z[k];P=P.concat(ue)}function q(k,ve,ue){return ve||console.error("THREE.ExtrudeGeometry: vec does not exist"),k.clone().addScaledVector(ve,ue)}const ie=P.length,le=de.length;function j(k,ve,ue){let Ee,pe,Ve;const Le=k.x-ve.x,D=k.y-ve.y,I=ue.x-k.x,Q=ue.y-k.y,ye=Le*Le+D*D,xe=Le*Q-D*I;if(Math.abs(xe)>Number.EPSILON){const me=Math.sqrt(ye),Xe=Math.sqrt(I*I+Q*Q),Re=ve.x-D/me,Ie=ve.y+Le/me,et=ue.x-Q/Xe,ht=ue.y+I/Xe,Se=((et-Re)*Q-(ht-Ie)*I)/(Le*Q-D*I);Ee=Re+Le*Se-k.x,pe=Ie+D*Se-k.y;const wt=Ee*Ee+pe*pe;if(wt<=2)return new he(Ee,pe);Ve=Math.sqrt(wt/2)}else{let me=!1;Le>Number.EPSILON?I>Number.EPSILON&&(me=!0):Le<-Number.EPSILON?I<-Number.EPSILON&&(me=!0):Math.sign(D)===Math.sign(Q)&&(me=!0),me?(Ee=-D,pe=Le,Ve=Math.sqrt(ye)):(Ee=Le,pe=D,Ve=Math.sqrt(ye/2))}return new he(Ee/Ve,pe/Ve)}const Z=[];for(let k=0,ve=H.length,ue=ve-1,Ee=k+1;k<ve;k++,ue++,Ee++)ue===ve&&(ue=0),Ee===ve&&(Ee=0),Z[k]=j(H[k],H[ue],H[Ee]);const J=[];let te,ge=Z.concat();for(let k=0,ve=z.length;k<ve;k++){const ue=z[k];te=[];for(let Ee=0,pe=ue.length,Ve=pe-1,Le=Ee+1;Ee<pe;Ee++,Ve++,Le++)Ve===pe&&(Ve=0),Le===pe&&(Le=0),te[Ee]=j(ue[Ee],ue[Ve],ue[Le]);J.push(te),ge=ge.concat(te)}for(let k=0;k<y;k++){const ve=k/y,ue=g*Math.cos(ve*Math.PI/2),Ee=x*Math.sin(ve*Math.PI/2)+S;for(let pe=0,Ve=H.length;pe<Ve;pe++){const Le=q(H[pe],Z[pe],Ee);Ne(Le.x,Le.y,-ue)}for(let pe=0,Ve=z.length;pe<Ve;pe++){const Le=z[pe];te=J[pe];for(let D=0,I=Le.length;D<I;D++){const Q=q(Le[D],te[D],Ee);Ne(Q.x,Q.y,-ue)}}}const K=x+S;for(let k=0;k<ie;k++){const ve=m?q(P[k],ge[k],K):P[k];T?(N.copy(R.normals[0]).multiplyScalar(ve.x),C.copy(R.binormals[0]).multiplyScalar(ve.y),B.copy(M[0]).add(N).add(C),Ne(B.x,B.y,B.z)):Ne(ve.x,ve.y,0)}for(let k=1;k<=d;k++)for(let ve=0;ve<ie;ve++){const ue=m?q(P[ve],ge[ve],K):P[ve];T?(N.copy(R.normals[k]).multiplyScalar(ue.x),C.copy(R.binormals[k]).multiplyScalar(ue.y),B.copy(M[k]).add(N).add(C),Ne(B.x,B.y,B.z)):Ne(ue.x,ue.y,f/d*k)}for(let k=y-1;k>=0;k--){const ve=k/y,ue=g*Math.cos(ve*Math.PI/2),Ee=x*Math.sin(ve*Math.PI/2)+S;for(let pe=0,Ve=H.length;pe<Ve;pe++){const Le=q(H[pe],Z[pe],Ee);Ne(Le.x,Le.y,f+ue)}for(let pe=0,Ve=z.length;pe<Ve;pe++){const Le=z[pe];te=J[pe];for(let D=0,I=Le.length;D<I;D++){const Q=q(Le[D],te[D],Ee);T?Ne(Q.x,Q.y+M[d-1].y,M[d-1].x+ue):Ne(Q.x,Q.y,f+ue)}}}fe(),be();function fe(){const k=i.length/3;if(m){let ve=0,ue=ie*ve;for(let Ee=0;Ee<le;Ee++){const pe=de[Ee];Je(pe[2]+ue,pe[1]+ue,pe[0]+ue)}ve=d+y*2,ue=ie*ve;for(let Ee=0;Ee<le;Ee++){const pe=de[Ee];Je(pe[0]+ue,pe[1]+ue,pe[2]+ue)}}else{for(let ve=0;ve<le;ve++){const ue=de[ve];Je(ue[2],ue[1],ue[0])}for(let ve=0;ve<le;ve++){const ue=de[ve];Je(ue[0]+ie*d,ue[1]+ie*d,ue[2]+ie*d)}}n.addGroup(k,i.length/3-k,0)}function be(){const k=i.length/3;let ve=0;Oe(H,ve),ve+=H.length;for(let ue=0,Ee=z.length;ue<Ee;ue++){const pe=z[ue];Oe(pe,ve),ve+=pe.length}n.addGroup(k,i.length/3-k,1)}function Oe(k,ve){let ue=k.length;for(;--ue>=0;){const Ee=ue;let pe=ue-1;pe<0&&(pe=k.length-1);for(let Ve=0,Le=d+y*2;Ve<Le;Ve++){const D=ie*Ve,I=ie*(Ve+1),Q=ve+Ee+D,ye=ve+pe+D,xe=ve+pe+I,me=ve+Ee+I;rt(Q,ye,xe,me)}}}function Ne(k,ve,ue){u.push(k),u.push(ve),u.push(ue)}function Je(k,ve,ue){Pe(k),Pe(ve),Pe(ue);const Ee=i.length/3,pe=b.generateTopUV(n,i,Ee-3,Ee-2,Ee-1);Ae(pe[0]),Ae(pe[1]),Ae(pe[2])}function rt(k,ve,ue,Ee){Pe(k),Pe(ve),Pe(Ee),Pe(ve),Pe(ue),Pe(Ee);const pe=i.length/3,Ve=b.generateSideWallUV(n,i,pe-6,pe-3,pe-2,pe-1);Ae(Ve[0]),Ae(Ve[1]),Ae(Ve[3]),Ae(Ve[1]),Ae(Ve[2]),Ae(Ve[3])}function Pe(k){i.push(u[k*3+0]),i.push(u[k*3+1]),i.push(u[k*3+2])}function Ae(k){s.push(k.x),s.push(k.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return TA(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,a=e.shapes.length;s<a;s++){const c=t[e.shapes[s]];n.push(c)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new Nu[i.type]().fromJSON(i)),new ih(n,e.options)}}const wA={generateTopUV:function(r,e,t,n,i){const s=e[t*3],a=e[t*3+1],c=e[n*3],u=e[n*3+1],h=e[i*3],d=e[i*3+1];return[new he(s,a),new he(c,u),new he(h,d)]},generateSideWallUV:function(r,e,t,n,i,s){const a=e[t*3],c=e[t*3+1],u=e[t*3+2],h=e[n*3],d=e[n*3+1],f=e[n*3+2],m=e[i*3],g=e[i*3+1],x=e[i*3+2],S=e[s*3],y=e[s*3+1],_=e[s*3+2];return Math.abs(c-d)<Math.abs(a-h)?[new he(a,1-u),new he(h,1-f),new he(m,1-x),new he(S,1-_)]:[new he(c,1-u),new he(d,1-f),new he(g,1-x),new he(y,1-_)]}};function TA(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class rh extends $r{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[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];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rh(e.radius,e.detail)}}class vl extends $r{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new vl(e.radius,e.detail)}}class sh extends St{constructor(e=.5,t=1,n=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const c=[],u=[],h=[],d=[];let f=e;const m=(t-e)/i,g=new U,x=new he;for(let S=0;S<=i;S++){for(let y=0;y<=n;y++){const _=s+y/n*a;g.x=f*Math.cos(_),g.y=f*Math.sin(_),u.push(g.x,g.y,g.z),h.push(0,0,1),x.x=(g.x/t+1)/2,x.y=(g.y/t+1)/2,d.push(x.x,x.y)}f+=m}for(let S=0;S<i;S++){const y=S*(n+1);for(let _=0;_<n;_++){const b=_+y,M=b,T=b+n+1,R=b+n+2,C=b+1;c.push(M,T,C),c.push(T,R,C)}}this.setIndex(c),this.setAttribute("position",new qe(u,3)),this.setAttribute("normal",new qe(h,3)),this.setAttribute("uv",new qe(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sh(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class oh extends St{constructor(e=new zs([new he(0,.5),new he(-.5,-.5),new he(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let c=0,u=0;if(Array.isArray(e)===!1)h(e);else for(let d=0;d<e.length;d++)h(e[d]),this.addGroup(c,u,d),c+=u,u=0;this.setIndex(n),this.setAttribute("position",new qe(i,3)),this.setAttribute("normal",new qe(s,3)),this.setAttribute("uv",new qe(a,2));function h(d){const f=i.length/3,m=d.extractPoints(t);let g=m.shape;const x=m.holes;tr.isClockWise(g)===!1&&(g=g.reverse());for(let y=0,_=x.length;y<_;y++){const b=x[y];tr.isClockWise(b)===!0&&(x[y]=b.reverse())}const S=tr.triangulateShape(g,x);for(let y=0,_=x.length;y<_;y++){const b=x[y];g=g.concat(b)}for(let y=0,_=g.length;y<_;y++){const b=g[y];i.push(b.x,b.y,0),s.push(0,0,1),a.push(b.x,b.y)}for(let y=0,_=S.length;y<_;y++){const b=S[y],M=b[0]+f,T=b[1]+f,R=b[2]+f;n.push(M,T,R),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return AA(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new oh(n,e.curveSegments)}}function AA(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class xl extends St{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:c},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(a+c,Math.PI);let h=0;const d=[],f=new U,m=new U,g=[],x=[],S=[],y=[];for(let _=0;_<=n;_++){const b=[],M=_/n;let T=0;_===0&&a===0?T=.5/t:_===n&&u===Math.PI&&(T=-.5/t);for(let R=0;R<=t;R++){const C=R/t;f.x=-e*Math.cos(i+C*s)*Math.sin(a+M*c),f.y=e*Math.cos(a+M*c),f.z=e*Math.sin(i+C*s)*Math.sin(a+M*c),x.push(f.x,f.y,f.z),m.copy(f).normalize(),S.push(m.x,m.y,m.z),y.push(C+T,1-M),b.push(h++)}d.push(b)}for(let _=0;_<n;_++)for(let b=0;b<t;b++){const M=d[_][b+1],T=d[_][b],R=d[_+1][b],C=d[_+1][b+1];(_!==0||a>0)&&g.push(M,T,C),(_!==n-1||u<Math.PI)&&g.push(T,R,C)}this.setIndex(g),this.setAttribute("position",new qe(x,3)),this.setAttribute("normal",new qe(S,3)),this.setAttribute("uv",new qe(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class ah extends $r{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ah(e.radius,e.detail)}}class lh extends St{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],c=[],u=[],h=[],d=new U,f=new U,m=new U;for(let g=0;g<=n;g++)for(let x=0;x<=i;x++){const S=x/i*s,y=g/n*Math.PI*2;f.x=(e+t*Math.cos(y))*Math.cos(S),f.y=(e+t*Math.cos(y))*Math.sin(S),f.z=t*Math.sin(y),c.push(f.x,f.y,f.z),d.x=e*Math.cos(S),d.y=e*Math.sin(S),m.subVectors(f,d).normalize(),u.push(m.x,m.y,m.z),h.push(x/i),h.push(g/n)}for(let g=1;g<=n;g++)for(let x=1;x<=i;x++){const S=(i+1)*g+x-1,y=(i+1)*(g-1)+x-1,_=(i+1)*(g-1)+x,b=(i+1)*g+x;a.push(S,y,b),a.push(y,_,b)}this.setIndex(a),this.setAttribute("position",new qe(c,3)),this.setAttribute("normal",new qe(u,3)),this.setAttribute("uv",new qe(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class ch extends St{constructor(e=1,t=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const c=[],u=[],h=[],d=[],f=new U,m=new U,g=new U,x=new U,S=new U,y=new U,_=new U;for(let M=0;M<=n;++M){const T=M/n*s*Math.PI*2;b(T,s,a,e,g),b(T+.01,s,a,e,x),y.subVectors(x,g),_.addVectors(x,g),S.crossVectors(y,_),_.crossVectors(S,y),S.normalize(),_.normalize();for(let R=0;R<=i;++R){const C=R/i*Math.PI*2,N=-t*Math.cos(C),B=t*Math.sin(C);f.x=g.x+(N*_.x+B*S.x),f.y=g.y+(N*_.y+B*S.y),f.z=g.z+(N*_.z+B*S.z),u.push(f.x,f.y,f.z),m.subVectors(f,g).normalize(),h.push(m.x,m.y,m.z),d.push(M/n),d.push(R/i)}}for(let M=1;M<=n;M++)for(let T=1;T<=i;T++){const R=(i+1)*(M-1)+(T-1),C=(i+1)*M+(T-1),N=(i+1)*M+T,B=(i+1)*(M-1)+T;c.push(R,C,B),c.push(C,N,B)}this.setIndex(c),this.setAttribute("position",new qe(u,3)),this.setAttribute("normal",new qe(h,3)),this.setAttribute("uv",new qe(d,2));function b(M,T,R,C,N){const B=Math.cos(M),A=Math.sin(M),P=R/T*M,z=Math.cos(P);N.x=C*(2+z)*.5*B,N.y=C*(2+z)*A*.5,N.z=C*Math.sin(P)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ch(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class uh extends St{constructor(e=new Ku(new U(-1,-1,0),new U(-1,1,0),new U(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const c=new U,u=new U,h=new he;let d=new U;const f=[],m=[],g=[],x=[];S(),this.setIndex(x),this.setAttribute("position",new qe(f,3)),this.setAttribute("normal",new qe(m,3)),this.setAttribute("uv",new qe(g,2));function S(){for(let M=0;M<t;M++)y(M);y(s===!1?t:0),b(),_()}function y(M){d=e.getPointAt(M/t,d);const T=a.normals[M],R=a.binormals[M];for(let C=0;C<=i;C++){const N=C/i*Math.PI*2,B=Math.sin(N),A=-Math.cos(N);u.x=A*T.x+B*R.x,u.y=A*T.y+B*R.y,u.z=A*T.z+B*R.z,u.normalize(),m.push(u.x,u.y,u.z),c.x=d.x+n*u.x,c.y=d.y+n*u.y,c.z=d.z+n*u.z,f.push(c.x,c.y,c.z)}}function _(){for(let M=1;M<=t;M++)for(let T=1;T<=i;T++){const R=(i+1)*(M-1)+(T-1),C=(i+1)*M+(T-1),N=(i+1)*M+T,B=(i+1)*(M-1)+T;x.push(R,C,B),x.push(C,N,B)}}function b(){for(let M=0;M<=t;M++)for(let T=0;T<=i;T++)h.x=M/t,h.y=T/i,g.push(h.x,h.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new uh(new Nu[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Xp extends St{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new U,s=new U;if(e.index!==null){const a=e.attributes.position,c=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:c.count,materialIndex:0}]);for(let h=0,d=u.length;h<d;++h){const f=u[h],m=f.start,g=f.count;for(let x=m,S=m+g;x<S;x+=3)for(let y=0;y<3;y++){const _=c.getX(x+y),b=c.getX(x+(y+1)%3);i.fromBufferAttribute(a,_),s.fromBufferAttribute(a,b),n_(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let c=0,u=a.count/3;c<u;c++)for(let h=0;h<3;h++){const d=3*c+h,f=3*c+(h+1)%3;i.fromBufferAttribute(a,d),s.fromBufferAttribute(a,f),n_(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new qe(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function n_(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var i_=Object.freeze({__proto__:null,BoxGeometry:Gs,CapsuleGeometry:Qu,CircleGeometry:$u,ConeGeometry:eh,CylinderGeometry:Qo,DodecahedronGeometry:th,EdgesGeometry:Rx,ExtrudeGeometry:ih,IcosahedronGeometry:rh,LatheGeometry:_l,OctahedronGeometry:vl,PlaneGeometry:gl,PolyhedronGeometry:$r,RingGeometry:sh,ShapeGeometry:oh,SphereGeometry:xl,TetrahedronGeometry:ah,TorusGeometry:lh,TorusKnotGeometry:ch,TubeGeometry:uh,WireframeGeometry:Xp});class Nx extends zn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ke(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class Dx extends Oi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class qp extends zn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ke(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 ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ux extends qp{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new he(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Jt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ke(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ke(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ke(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Ox extends zn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ke(16777215),this.specular=new ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ul,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Fx extends zn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ke(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class zx extends zn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Bx extends zn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ul,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class kx extends zn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ke(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kr,this.normalScale=new he(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Hx extends jn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Ps(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Vx(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Gx(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function ap(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const c=t[s]*e;for(let u=0;u!==e;++u)i[a++]=r[c+u]}return i}function Yp(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}function CA(r,e,t,n,i=30){const s=r.clone();s.name=e;const a=[];for(let u=0;u<s.tracks.length;++u){const h=s.tracks[u],d=h.getValueSize(),f=[],m=[];for(let g=0;g<h.times.length;++g){const x=h.times[g]*i;if(!(x<t||x>=n)){f.push(h.times[g]);for(let S=0;S<d;++S)m.push(h.values[g*d+S])}}f.length!==0&&(h.times=Ps(f,h.times.constructor),h.values=Ps(m,h.values.constructor),a.push(h))}s.tracks=a;let c=1/0;for(let u=0;u<s.tracks.length;++u)c>s.tracks[u].times[0]&&(c=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*c);return s.resetDuration(),s}function RA(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let a=0;a<i;++a){const c=t.tracks[a],u=c.ValueTypeName;if(u==="bool"||u==="string")continue;const h=r.tracks.find(function(_){return _.name===c.name&&_.ValueTypeName===u});if(h===void 0)continue;let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);let m=0;const g=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=g/3);const x=c.times.length-1;let S;if(s<=c.times[0]){const _=d,b=f-d;S=c.values.slice(_,b)}else if(s>=c.times[x]){const _=x*f+d,b=_+f-d;S=c.values.slice(_,b)}else{const _=c.createInterpolant(),b=d,M=f-d;_.evaluate(s),S=_.resultBuffer.slice(b,M)}u==="quaternion"&&new On().fromArray(S).normalize().conjugate().toArray(S);const y=h.times.length;for(let _=0;_<y;++_){const b=_*g+m;if(u==="quaternion")On.multiplyQuaternionsFlat(h.values,b,S,0,h.values,b);else{const M=g-m*2;for(let T=0;T<M;++T)h.values[b+T]-=S[T]}}}return r.blendMode=bp,r}const PA={convertArray:Ps,isTypedArray:Vx,getKeyframeOrder:Gx,sortedArray:ap,flattenJSON:Yp,subclip:CA,makeClipAdditive:RA};class yl{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let c=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const c=t[1];e<c&&(n=2,s=c);for(let u=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const c=n+a>>>1;e<t[c]?a=c:n=c+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Wx extends yl{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:As,endingEnd:As}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,c=i[s],u=i[a];if(c===void 0)switch(this.getSettings_().endingStart){case Cs:s=e,c=2*t-n;break;case Ja:s=i.length-2,c=t+i[s]-i[s+1];break;default:s=e,c=n}if(u===void 0)switch(this.getSettings_().endingEnd){case Cs:a=e,u=2*n-t;break;case Ja:a=1,u=n+i[1]-i[0];break;default:a=e-1,u=t}const h=(n-t)*.5,d=this.valueSize;this._weightPrev=h/(t-c),this._weightNext=h/(u-n),this._offsetPrev=s*d,this._offsetNext=a*d}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=this._offsetPrev,f=this._offsetNext,m=this._weightPrev,g=this._weightNext,x=(n-t)/(i-t),S=x*x,y=S*x,_=-m*y+2*m*S-m*x,b=(1+m)*y+(-1.5-2*m)*S+(-.5+m)*x+1,M=(-1-g)*y+(1.5+g)*S+.5*x,T=g*y-g*S;for(let R=0;R!==c;++R)s[R]=_*a[d+R]+b*a[h+R]+M*a[u+R]+T*a[f+R];return s}}class Zp extends yl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=(n-t)/(i-t),f=1-d;for(let m=0;m!==c;++m)s[m]=a[h+m]*f+a[u+m]*d;return s}}class jx extends yl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class zi{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ps(t,this.TimeBufferType),this.values=Ps(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Ps(e.times,Array),values:Ps(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new jx(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Zp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Wx(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ya:t=this.InterpolantFactoryMethodDiscrete;break;case Za:t=this.InterpolantFactoryMethodLinear;break;case Eu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ya;case this.InterpolantFactoryMethodLinear:return Za;case this.InterpolantFactoryMethodSmooth:return Eu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const c=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*c,a*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let c=0;c!==s;c++){const u=n[c];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,c,u),e=!1;break}if(a!==null&&a>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,c,u,a),e=!1;break}a=u}if(i!==void 0&&Vx(i))for(let c=0,u=i.length;c!==u;++c){const h=i[c];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,c,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Eu,s=e.length-1;let a=1;for(let c=1;c<s;++c){let u=!1;const h=e[c],d=e[c+1];if(h!==d&&(c!==1||h!==e[0]))if(i)u=!0;else{const f=c*n,m=f-n,g=f+n;for(let x=0;x!==n;++x){const S=t[f+x];if(S!==t[m+x]||S!==t[g+x]){u=!0;break}}}if(u){if(c!==a){e[a]=e[c];const f=c*n,m=a*n;for(let g=0;g!==n;++g)t[m+g]=t[f+g]}++a}}if(s>0){e[a]=e[s];for(let c=s*n,u=a*n,h=0;h!==n;++h)t[u+h]=t[c+h];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}zi.prototype.TimeBufferType=Float32Array;zi.prototype.ValueBufferType=Float32Array;zi.prototype.DefaultInterpolation=Za;class Ws extends zi{}Ws.prototype.ValueTypeName="bool";Ws.prototype.ValueBufferType=Array;Ws.prototype.DefaultInterpolation=Ya;Ws.prototype.InterpolantFactoryMethodLinear=void 0;Ws.prototype.InterpolantFactoryMethodSmooth=void 0;class Jp extends zi{}Jp.prototype.ValueTypeName="color";class ol extends zi{}ol.prototype.ValueTypeName="number";class Xx extends yl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,c=this.valueSize,u=(n-t)/(i-t);let h=e*c;for(let d=h+c;h!==d;h+=4)On.slerpFlat(s,0,a,h-c,a,h,u);return s}}class $o extends zi{InterpolantFactoryMethodLinear(e){return new Xx(this.times,this.values,this.getValueSize(),e)}}$o.prototype.ValueTypeName="quaternion";$o.prototype.DefaultInterpolation=Za;$o.prototype.InterpolantFactoryMethodSmooth=void 0;class js extends zi{}js.prototype.ValueTypeName="string";js.prototype.ValueBufferType=Array;js.prototype.DefaultInterpolation=Ya;js.prototype.InterpolantFactoryMethodLinear=void 0;js.prototype.InterpolantFactoryMethodSmooth=void 0;class al extends zi{}al.prototype.ValueTypeName="vector";class ll{constructor(e,t=-1,n,i=ku){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=li(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,c=n.length;a!==c;++a)t.push(IA(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(zi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let c=0;c<s;c++){let u=[],h=[];u.push((c+s-1)%s,c,(c+1)%s),h.push(0,1,0);const d=Gx(u);u=ap(u,1,d),h=ap(h,1,d),!i&&u[0]===0&&(u.push(s),h.push(h[0])),a.push(new ol(".morphTargetInfluences["+t[c].name+"]",u,h).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let c=0,u=e.length;c<u;c++){const h=e[c],d=h.name.match(s);if(d&&d.length>1){const f=d[1];let m=i[f];m||(i[f]=m=[]),m.push(h)}}const a=[];for(const c in i)a.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(f,m,g,x,S){if(g.length!==0){const y=[],_=[];Yp(g,y,_,x),y.length!==0&&S.push(new f(m,y,_))}},i=[],s=e.name||"default",a=e.fps||30,c=e.blendMode;let u=e.length||-1;const h=e.hierarchy||[];for(let f=0;f<h.length;f++){const m=h[f].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const g={};let x;for(x=0;x<m.length;x++)if(m[x].morphTargets)for(let S=0;S<m[x].morphTargets.length;S++)g[m[x].morphTargets[S]]=-1;for(const S in g){const y=[],_=[];for(let b=0;b!==m[x].morphTargets.length;++b){const M=m[x];y.push(M.time),_.push(M.morphTarget===S?1:0)}i.push(new ol(".morphTargetInfluence["+S+"]",y,_))}u=g.length*a}else{const g=".bones["+t[f].name+"]";n(al,g+".position",m,"pos",i),n($o,g+".quaternion",m,"rot",i),n(al,g+".scale",m,"scl",i)}}return i.length===0?null:new this(s,u,i,c)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function LA(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ol;case"vector":case"vector2":case"vector3":case"vector4":return al;case"color":return Jp;case"quaternion":return $o;case"bool":case"boolean":return Ws;case"string":return js}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function IA(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=LA(r.type);if(r.times===void 0){const t=[],n=[];Yp(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const yr={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Kp{constructor(e,t,n){const i=this;let s=!1,a=0,c=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(d){c++,s===!1&&i.onStart!==void 0&&i.onStart(d,a,c),s=!0},this.itemEnd=function(d){a++,i.onProgress!==void 0&&i.onProgress(d,a,c),a===c&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return u?u(d):d},this.setURLModifier=function(d){return u=d,this},this.addHandler=function(d,f){return h.push(d,f),this},this.removeHandler=function(d){const f=h.indexOf(d);return f!==-1&&h.splice(f,2),this},this.getHandler=function(d){for(let f=0,m=h.length;f<m;f+=2){const g=h[f],x=h[f+1];if(g.global&&(g.lastIndex=0),g.test(d))return x}return null}}}const qx=new Kp;class Qn{constructor(e){this.manager=e!==void 0?e:qx,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Qn.DEFAULT_MATERIAL_NAME="__DEFAULT";const mr={};class NA extends Error{constructor(e,t){super(e),this.response=t}}class br extends Qn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=yr.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(mr[e]!==void 0){mr[e].push({onLoad:t,onProgress:n,onError:i});return}mr[e]=[],mr[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),c=this.mimeType,u=this.responseType;fetch(a).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const d=mr[e],f=h.body.getReader(),m=h.headers.get("Content-Length")||h.headers.get("X-File-Size"),g=m?parseInt(m):0,x=g!==0;let S=0;const y=new ReadableStream({start(_){b();function b(){f.read().then(({done:M,value:T})=>{if(M)_.close();else{S+=T.byteLength;const R=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:g});for(let C=0,N=d.length;C<N;C++){const B=d[C];B.onProgress&&B.onProgress(R)}_.enqueue(T),b()}})}}});return new Response(y)}else throw new NA(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(u){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(d=>new DOMParser().parseFromString(d,c));case"json":return h.json();default:if(c===void 0)return h.text();{const f=/charset="?([^;"\s]*)"?/i.exec(c),m=f&&f[1]?f[1].toLowerCase():void 0,g=new TextDecoder(m);return h.arrayBuffer().then(x=>g.decode(x))}}}).then(h=>{yr.add(e,h);const d=mr[e];delete mr[e];for(let f=0,m=d.length;f<m;f++){const g=d[f];g.onLoad&&g.onLoad(h)}}).catch(h=>{const d=mr[e];if(d===void 0)throw this.manager.itemError(e),h;delete mr[e];for(let f=0,m=d.length;f<m;f++){const g=d[f];g.onError&&g.onError(h)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class DA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new br(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=ll.parse(e[n]);t.push(i)}return t}}class UA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=[],c=new Zu,u=new br(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(s.withCredentials);let h=0;function d(f){u.load(e[f],function(m){const g=s.parse(m,!0);a[f]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},h+=1,h===6&&(g.mipmapCount===1&&(c.minFilter=tn),c.image=a,c.format=g.format,c.needsUpdate=!0,t&&t(c))},n,i)}if(Array.isArray(e))for(let f=0,m=e.length;f<m;++f)d(f);else u.load(e,function(f){const m=s.parse(f,!0);if(m.isCubemap){const g=m.mipmaps.length/m.mipmapCount;for(let x=0;x<g;x++){a[x]={mipmaps:[]};for(let S=0;S<m.mipmapCount;S++)a[x].mipmaps.push(m.mipmaps[x*m.mipmapCount+S]),a[x].format=m.format,a[x].width=m.width,a[x].height=m.height}c.image=a}else c.image.width=m.width,c.image.height=m.height,c.mipmaps=m.mipmaps;m.mipmapCount===1&&(c.minFilter=tn),c.format=m.format,c.needsUpdate=!0,t&&t(c)},n,i);return c}}class cl extends Qn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=yr.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const c=tl("img");function u(){d(),yr.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(f){d(),i&&i(f),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){c.removeEventListener("load",u,!1),c.removeEventListener("error",h,!1)}return c.addEventListener("load",u,!1),c.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(c.crossOrigin=this.crossOrigin),s.manager.itemStart(e),c.src=e,c}}class OA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=new pl;s.colorSpace=cn;const a=new cl(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let c=0;function u(h){a.load(e[h],function(d){s.images[h]=d,c++,c===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let h=0;h<e.length;++h)u(h);return s}}class FA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Fs,c=new br(this.manager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(s.withCredentials),c.load(e,function(u){let h;try{h=s.parse(u)}catch(d){if(i!==void 0)i(d);else{console.error(d);return}}h.image!==void 0?a.image=h.image:h.data!==void 0&&(a.image.width=h.width,a.image.height=h.height,a.image.data=h.data),a.wrapS=h.wrapS!==void 0?h.wrapS:Un,a.wrapT=h.wrapT!==void 0?h.wrapT:Un,a.magFilter=h.magFilter!==void 0?h.magFilter:tn,a.minFilter=h.minFilter!==void 0?h.minFilter:tn,a.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0?a.colorSpace=h.colorSpace:h.encoding!==void 0&&(a.encoding=h.encoding),h.flipY!==void 0&&(a.flipY=h.flipY),h.format!==void 0&&(a.format=h.format),h.type!==void 0&&(a.type=h.type),h.mipmaps!==void 0&&(a.mipmaps=h.mipmaps,a.minFilter=Zr),h.mipmapCount===1&&(a.minFilter=tn),h.generateMipmaps!==void 0&&(a.generateMipmaps=h.generateMipmaps),a.needsUpdate=!0,t&&t(a,h)},n,i),a}}class zA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=new nn,a=new cl(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(c){s.image=c,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class es extends Nt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ke(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class Yx extends es{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ke(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const $d=new lt,r_=new U,s_=new U;class Qp{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new he(512,512),this.map=null,this.mapPass=null,this.matrix=new lt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ml,this._frameExtents=new he(1,1),this._viewportCount=1,this._viewports=[new At(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;r_.setFromMatrixPosition(e.matrixWorld),t.position.copy(r_),s_.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(s_),t.updateMatrixWorld(),$d.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix($d),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply($d)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class BA extends Qp{constructor(){super(new jt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=jo*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Zx extends es{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.target=new Nt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new BA}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const o_=new lt,La=new U,ef=new U;class kA extends Qp{constructor(){super(new jt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new he(4,2),this._viewportCount=6,this._viewports=[new At(2,1,1,1),new At(0,1,1,1),new At(3,1,1,1),new At(1,1,1,1),new At(3,0,1,1),new At(1,0,1,1)],this._cubeDirections=[new U(1,0,0),new U(-1,0,0),new U(0,0,1),new U(0,0,-1),new U(0,1,0),new U(0,-1,0)],this._cubeUps=[new U(0,1,0),new U(0,1,0),new U(0,1,0),new U(0,1,0),new U(0,0,1),new U(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),La.setFromMatrixPosition(e.matrixWorld),n.position.copy(La),ef.copy(n.position),ef.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(ef),n.updateMatrixWorld(),i.makeTranslation(-La.x,-La.y,-La.z),o_.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o_)}}class Jx extends es{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new kA}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class HA extends Qp{constructor(){super(new er(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Kx extends es{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.target=new Nt,this.shadow=new HA}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Qx extends es{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class $x extends es{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class ey{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new U)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class ty extends es{constructor(e=new ey,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class hh extends Qn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,a=new br(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=hh.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new ke().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new ke().setHex(a.value);break;case"v2":i.uniforms[s].value=new he().fromArray(a.value);break;case"v3":i.uniforms[s].value=new U().fromArray(a.value);break;case"v4":i.uniforms[s].value=new At().fromArray(a.value);break;case"m3":i.uniforms[s].value=new yt().fromArray(a.value);break;case"m4":i.uniforms[s].value=new lt().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new he().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new he().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:Nx,SpriteMaterial:zp,RawShaderMaterial:Dx,ShaderMaterial:Oi,PointsMaterial:Yu,MeshPhysicalMaterial:Ux,MeshStandardMaterial:qp,MeshPhongMaterial:Ox,MeshToonMaterial:Fx,MeshNormalMaterial:zx,MeshLambertMaterial:Bx,MeshDepthMaterial:Dp,MeshDistanceMaterial:Up,MeshBasicMaterial:Qr,MeshMatcapMaterial:kx,LineDashedMaterial:Hx,LineBasicMaterial:jn,Material:zn};return new t[e]}}class lp{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class $p extends St{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class ny extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new br(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(g,x){if(t[x]!==void 0)return t[x];const y=g.interleavedBuffers[x],_=s(g,y.buffer),b=Oo(y.type,_),M=new Xu(b,y.stride);return M.uuid=y.uuid,t[x]=M,M}function s(g,x){if(n[x]!==void 0)return n[x];const y=g.arrayBuffers[x],_=new Uint32Array(y).buffer;return n[x]=_,_}const a=e.isInstancedBufferGeometry?new $p:new St,c=e.data.index;if(c!==void 0){const g=Oo(c.type,c.array);a.setIndex(new Ut(g,1))}const u=e.data.attributes;for(const g in u){const x=u[g];let S;if(x.isInterleavedBufferAttribute){const y=i(e.data,x.data);S=new ai(y,x.itemSize,x.offset,x.normalized)}else{const y=Oo(x.type,x.array),_=x.isInstancedBufferAttribute?qo:Ut;S=new _(y,x.itemSize,x.normalized)}x.name!==void 0&&(S.name=x.name),x.usage!==void 0&&S.setUsage(x.usage),a.setAttribute(g,S)}const h=e.data.morphAttributes;if(h)for(const g in h){const x=h[g],S=[];for(let y=0,_=x.length;y<_;y++){const b=x[y];let M;if(b.isInterleavedBufferAttribute){const T=i(e.data,b.data);M=new ai(T,b.itemSize,b.offset,b.normalized)}else{const T=Oo(b.type,b.array);M=new Ut(T,b.itemSize,b.normalized)}b.name!==void 0&&(M.name=b.name),S.push(M)}a.morphAttributes[g]=S}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const f=e.data.groups||e.data.drawcalls||e.data.offsets;if(f!==void 0)for(let g=0,x=f.length;g!==x;++g){const S=f[g];a.addGroup(S.start,S.count,S.materialIndex)}const m=e.data.boundingSphere;if(m!==void 0){const g=new U;m.center!==void 0&&g.fromArray(m.center),a.boundingSphere=new xn(g,m.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class VA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?lp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const c=new br(this.manager);c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(u){let h=null;try{h=JSON.parse(u)}catch(f){i!==void 0&&i(f),console.error("THREE:ObjectLoader: Can't parse "+e+".",f.message);return}const d=h.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?lp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new br(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t),c=JSON.parse(a),u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(c)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){t!==void 0&&t(h)}),c=this.parseTextures(e.textures,a),u=this.parseMaterials(e.materials,c),h=this.parseObject(e.object,s,u,c,n),d=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,d),t!==void 0){let f=!1;for(const m in a)if(a[m].data instanceof HTMLImageElement){f=!0;break}f===!1&&t(h)}return h}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),c=this.parseMaterials(e.materials,a),u=this.parseObject(e.object,i,c,a,t),h=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,h),u}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new zs().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const c=new qu().fromJSON(e[s],i);n[c.uuid]=c}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new ny;for(let s=0,a=e.length;s<a;s++){let c;const u=e[s];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":c=i.parse(u);break;default:u.type in i_?c=i_[u.type].fromJSON(u,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${u.type}"`)}c.uuid=u.uuid,u.name!==void 0&&(c.name=u.name),u.userData!==void 0&&(c.userData=u.userData),n[u.uuid]=c}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new hh;s.setTextures(t);for(let a=0,c=e.length;a<c;a++){const u=e[a];n[u.uuid]===void 0&&(n[u.uuid]=s.parse(u)),i[u.uuid]=n[u.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=ll.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function a(u){return n.manager.itemStart(u),s.load(u,function(){n.manager.itemEnd(u)},void 0,function(){n.manager.itemError(u),n.manager.itemEnd(u)})}function c(u){if(typeof u=="string"){const h=u,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return a(d)}else return u.data?{data:Oo(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new Kp(t);s=new cl(u),s.setCrossOrigin(this.crossOrigin);for(let h=0,d=e.length;h<d;h++){const f=e[h],m=f.url;if(Array.isArray(m)){const g=[];for(let x=0,S=m.length;x<S;x++){const y=m[x],_=c(y);_!==null&&(_ instanceof HTMLImageElement?g.push(_):g.push(new Fs(_.data,_.width,_.height)))}i[f.uuid]=new Rs(g)}else{const g=c(f.url);i[f.uuid]=new Rs(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(a){if(typeof a=="string"){const c=a,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:t.resourcePath+c;return await i.loadAsync(u)}else return a.data?{data:Oo(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new cl(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,c=e.length;a<c;a++){const u=e[a],h=u.url;if(Array.isArray(h)){const d=[];for(let f=0,m=h.length;f<m;f++){const g=h[f],x=await s(g);x!==null&&(x instanceof HTMLImageElement?d.push(x):d.push(new Fs(x.data,x.width,x.height)))}n[u.uuid]=new Rs(d)}else{const d=await s(u.url);n[u.uuid]=new Rs(d)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const c=e[s];c.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',c.uuid),t[c.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",c.image);const u=t[c.image],h=u.data;let d;Array.isArray(h)?(d=new pl,h.length===6&&(d.needsUpdate=!0)):(h&&h.data?d=new Fs:d=new nn,h&&(d.needsUpdate=!0)),d.source=u,d.uuid=c.uuid,c.name!==void 0&&(d.name=c.name),c.mapping!==void 0&&(d.mapping=n(c.mapping,GA)),c.channel!==void 0&&(d.channel=c.channel),c.offset!==void 0&&d.offset.fromArray(c.offset),c.repeat!==void 0&&d.repeat.fromArray(c.repeat),c.center!==void 0&&d.center.fromArray(c.center),c.rotation!==void 0&&(d.rotation=c.rotation),c.wrap!==void 0&&(d.wrapS=n(c.wrap[0],a_),d.wrapT=n(c.wrap[1],a_)),c.format!==void 0&&(d.format=c.format),c.internalFormat!==void 0&&(d.internalFormat=c.internalFormat),c.type!==void 0&&(d.type=c.type),c.colorSpace!==void 0&&(d.colorSpace=c.colorSpace),c.encoding!==void 0&&(d.encoding=c.encoding),c.minFilter!==void 0&&(d.minFilter=n(c.minFilter,l_)),c.magFilter!==void 0&&(d.magFilter=n(c.magFilter,l_)),c.anisotropy!==void 0&&(d.anisotropy=c.anisotropy),c.flipY!==void 0&&(d.flipY=c.flipY),c.generateMipmaps!==void 0&&(d.generateMipmaps=c.generateMipmaps),c.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=c.premultiplyAlpha),c.unpackAlignment!==void 0&&(d.unpackAlignment=c.unpackAlignment),c.compareFunction!==void 0&&(d.compareFunction=c.compareFunction),c.userData!==void 0&&(d.userData=c.userData),i[c.uuid]=d}return i}parseObject(e,t,n,i,s){let a;function c(m){return t[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",m),t[m]}function u(m){if(m!==void 0){if(Array.isArray(m)){const g=[];for(let x=0,S=m.length;x<S;x++){const y=m[x];n[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",y),g.push(n[y])}return g}return n[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),n[m]}}function h(m){return i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",m),i[m]}let d,f;switch(e.type){case"Scene":a=new Fp,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new ke(e.background):a.background=h(e.background)),e.environment!==void 0&&(a.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new ju(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Wu(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":a=new jt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new er(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new Qx(e.color,e.intensity);break;case"DirectionalLight":a=new Kx(e.color,e.intensity);break;case"PointLight":a=new Jx(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new $x(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Zx(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new Yx(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new ty().fromJSON(e);break;case"SkinnedMesh":d=c(e.geometry),f=u(e.material),a=new yx(d,f),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":d=c(e.geometry),f=u(e.material),a=new an(d,f);break;case"InstancedMesh":d=c(e.geometry),f=u(e.material);const m=e.count,g=e.instanceMatrix,x=e.instanceColor;a=new Sx(d,f,m),a.instanceMatrix=new qo(new Float32Array(g.array),16),x!==void 0&&(a.instanceColor=new qo(new Float32Array(x.array),x.itemSize));break;case"BatchedMesh":d=c(e.geometry),f=u(e.material),a=new Mx(e.maxGeometryCount,e.maxVertexCount,e.maxIndexCount,f),a.geometry=d,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._visibility=e.visibility,a._active=e.active,a._bounds=e.bounds.map(S=>{const y=new vn;y.min.fromArray(S.boxMin),y.max.fromArray(S.boxMax);const _=new xn;return _.radius=S.sphereRadius,_.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:y,sphereInitialized:S.sphereInitialized,sphere:_}}),a._maxGeometryCount=e.maxGeometryCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._geometryCount=e.geometryCount,a._matricesTexture=h(e.matricesTexture.uuid);break;case"LOD":a=new xx;break;case"Line":a=new Jr(c(e.geometry),u(e.material));break;case"LineLoop":a=new Ex(c(e.geometry),u(e.material));break;case"LineSegments":a=new ir(c(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new bx(c(e.geometry),u(e.material));break;case"Sprite":a=new vx(u(e.material));break;case"Group":a=new Bo;break;case"Bone":a=new Bp;break;default:a=new Nt}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let g=0;g<m.length;g++)a.add(this.parseObject(m[g],t,n,i,s))}if(e.animations!==void 0){const m=e.animations;for(let g=0;g<m.length;g++){const x=m[g];a.animations.push(s[x])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const m=e.levels;for(let g=0;g<m.length;g++){const x=m[g],S=a.getObjectByProperty("uuid",x.object);S!==void 0&&a.addLevel(S,x.distance,x.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}}const GA={UVMapping:zu,CubeReflectionMapping:Er,CubeRefractionMapping:Yr,EquirectangularReflectionMapping:Wa,EquirectangularRefractionMapping:ja,CubeUVReflectionMapping:Jo},a_={RepeatWrapping:Xa,ClampToEdgeWrapping:Un,MirroredRepeatWrapping:qa},l_={NearestFilter:en,NearestMipmapNearestFilter:Ru,NearestMipmapLinearFilter:za,LinearFilter:tn,LinearMipmapNearestFilter:gp,LinearMipmapLinearFilter:Zr};class WA extends Qn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=yr.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(h=>{t&&t(h),s.manager.itemEnd(e)}).catch(h=>{i&&i(h)});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader;const u=fetch(e,c).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return yr.add(e,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){i&&i(h),yr.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});yr.add(e,u),s.manager.itemStart(e)}}let ru;class em{static getContext(){return ru===void 0&&(ru=new(window.AudioContext||window.webkitAudioContext)),ru}static setContext(e){ru=e}}class jA extends Qn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new br(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(u){try{const h=u.slice(0);em.getContext().decodeAudioData(h,function(f){t(f)}).catch(c)}catch(h){c(h)}},n,i);function c(u){i?i(u):console.error(u),s.manager.itemError(e)}}}const c_=new lt,u_=new lt,gs=new lt;class XA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new jt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new jt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,gs.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(Us*t.fov*.5)/t.zoom;let c,u;u_.elements[12]=-i,c_.elements[12]=i,c=-a*t.aspect+s,u=a*t.aspect+s,gs.elements[0]=2*t.near/(u-c),gs.elements[8]=(u+c)/(u-c),this.cameraL.projectionMatrix.copy(gs),c=-a*t.aspect-s,u=a*t.aspect-s,gs.elements[0]=2*t.near/(u-c),gs.elements[8]=(u+c)/(u-c),this.cameraR.projectionMatrix.copy(gs)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(u_),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(c_)}}class tm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=h_(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=h_();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function h_(){return(typeof performance>"u"?Date:performance).now()}const _s=new U,d_=new On,qA=new U,vs=new U;class YA extends Nt{constructor(){super(),this.type="AudioListener",this.context=em.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new tm}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(_s,d_,qA),vs.set(0,0,-1).applyQuaternion(d_),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(_s.x,i),t.positionY.linearRampToValueAtTime(_s.y,i),t.positionZ.linearRampToValueAtTime(_s.z,i),t.forwardX.linearRampToValueAtTime(vs.x,i),t.forwardY.linearRampToValueAtTime(vs.y,i),t.forwardZ.linearRampToValueAtTime(vs.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(_s.x,_s.y,_s.z),t.setOrientation(vs.x,vs.y,vs.z,n.x,n.y,n.z)}}class iy extends Nt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const xs=new U,f_=new On,ZA=new U,ys=new U;class JA extends iy{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(xs,f_,ZA),ys.set(0,0,1).applyQuaternion(f_);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(xs.x,n),t.positionY.linearRampToValueAtTime(xs.y,n),t.positionZ.linearRampToValueAtTime(xs.z,n),t.orientationX.linearRampToValueAtTime(ys.x,n),t.orientationY.linearRampToValueAtTime(ys.y,n),t.orientationZ.linearRampToValueAtTime(ys.z,n)}else t.setPosition(xs.x,xs.y,xs.z),t.setOrientation(ys.x,ys.y,ys.z)}}class KA{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class ry{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let c=0;c!==i;++c)n[s+c]=n[c];a=t}else{a+=t;const c=t/a;this._mixBufferRegion(n,s,0,c,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let u=t,h=t+t;u!==h;++u)if(n[u]!==n[u+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){On.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;On.multiplyQuaternionsFlat(e,a,e,t,e,n),On.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let c=0;c!==s;++c){const u=t+c;e[u]=e[u]*a+e[n+c]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const c=t+a;e[c]=e[c]+e[n+a]*i}}}const nm="\\[\\]\\.:\\/",QA=new RegExp("["+nm+"]","g"),im="[^"+nm+"]",$A="[^"+nm.replace("\\.","")+"]",eC=/((?:WC+[\/:])*)/.source.replace("WC",im),tC=/(WCOD+)?/.source.replace("WCOD",$A),nC=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",im),iC=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",im),rC=new RegExp("^"+eC+tC+nC+iC+"$"),sC=["material","materials","bones","map"];class oC{constructor(e,t,n){const i=n||Rt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Rt{constructor(e,t,n){this.path=t,this.parsedPath=n||Rt.parseTrackName(t),this.node=Rt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Rt.Composite(e,t,n):new Rt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(QA,"")}static parseTrackName(e){const t=rC.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);sC.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const c=s[a];if(c.name===t||c.uuid===t)return c;const u=n(c.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=Rt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===h){h=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const a=e[i];if(a===void 0){const h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?c=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}u=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(u=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Rt.Composite=oC;Rt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Rt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Rt.prototype.GetterByBindingType=[Rt.prototype._getValue_direct,Rt.prototype._getValue_array,Rt.prototype._getValue_arrayElement,Rt.prototype._getValue_toArray];Rt.prototype.SetterByBindingTypeAndVersioning=[[Rt.prototype._setValue_direct,Rt.prototype._setValue_direct_setNeedsUpdate,Rt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Rt.prototype._setValue_array,Rt.prototype._setValue_array_setNeedsUpdate,Rt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Rt.prototype._setValue_arrayElement,Rt.prototype._setValue_arrayElement_setNeedsUpdate,Rt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Rt.prototype._setValue_fromArray,Rt.prototype._setValue_fromArray_setNeedsUpdate,Rt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class aC{constructor(){this.isAnimationObjectGroup=!0,this.uuid=li(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let c,u=e.length,h=this.nCachedObjects_;for(let d=0,f=arguments.length;d!==f;++d){const m=arguments[d],g=m.uuid;let x=t[g];if(x===void 0){x=u++,t[g]=x,e.push(m);for(let S=0,y=a;S!==y;++S)s[S].push(new Rt(m,n[S],i[S]))}else if(x<h){c=e[x];const S=--h,y=e[S];t[y.uuid]=x,e[x]=y,t[g]=S,e[S]=m;for(let _=0,b=a;_!==b;++_){const M=s[_],T=M[S];let R=M[x];M[x]=T,R===void 0&&(R=new Rt(m,n[_],i[_])),M[S]=R}}else e[x]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=h}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let a=0,c=arguments.length;a!==c;++a){const u=arguments[a],h=u.uuid,d=t[h];if(d!==void 0&&d>=s){const f=s++,m=e[f];t[m.uuid]=d,e[d]=m,t[h]=f,e[f]=u;for(let g=0,x=i;g!==x;++g){const S=n[g],y=S[f],_=S[d];S[d]=y,S[f]=_}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=e.length;for(let c=0,u=arguments.length;c!==u;++c){const h=arguments[c],d=h.uuid,f=t[d];if(f!==void 0)if(delete t[d],f<s){const m=--s,g=e[m],x=--a,S=e[x];t[g.uuid]=f,e[f]=g,t[S.uuid]=m,e[m]=S,e.pop();for(let y=0,_=i;y!==_;++y){const b=n[y],M=b[m],T=b[x];b[f]=M,b[m]=T,b.pop()}}else{const m=--a,g=e[m];m>0&&(t[g.uuid]=f),e[f]=g,e.pop();for(let x=0,S=i;x!==S;++x){const y=n[x];y[f]=y[m],y.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,c=this._parsedPaths,u=this._objects,h=u.length,d=this.nCachedObjects_,f=new Array(h);i=s.length,n[e]=i,a.push(e),c.push(t),s.push(f);for(let m=d,g=u.length;m!==g;++m){const x=u[m];f[m]=new Rt(x,e,t)}return f}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,c=a.length-1,u=a[c],h=e[c];t[h]=n,a[n]=u,a.pop(),s[n]=s[c],s.pop(),i[n]=i[c],i.pop()}}}class sy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,c=new Array(a),u={endingStart:As,endingEnd:As};for(let h=0;h!==a;++h){const d=s[h].createInterpolant(null);c[h]=d,d.settings=u}this._interpolantSettings=u,this._interpolants=c,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Vv,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,a=s/i,c=i/s;e.warp(1,a,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const u=c.parameterPositions,h=c.sampleValues;return u[0]=s,u[1]=s+n,h[0]=e/a,h[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const u=(e-s)*n;u<0||n===0?t=0:(this._startTime=null,t=n*u)}t*=this._updateTimeScale(e);const a=this._updateTime(t),c=this._updateWeight(e);if(c>0){const u=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case bp:for(let d=0,f=u.length;d!==f;++d)u[d].evaluate(a),h[d].accumulateAdditive(c);break;case ku:default:for(let d=0,f=u.length;d!==f;++d)u[d].evaluate(a),h[d].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===Gv;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===Hv){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,s+=Math.abs(c);const u=this.repetitions-s;if(u<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(u===1){const h=e<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Cs,i.endingEnd=Cs):(e?i.endingStart=this.zeroSlopeAtStart?Cs:As:i.endingStart=Ja,t?i.endingEnd=this.zeroSlopeAtEnd?Cs:As:i.endingEnd=Ja)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const c=a.parameterPositions,u=a.sampleValues;return c[0]=s,u[0]=t,c[1]=s+e,u[1]=n,this}}const lC=new Float32Array(1);class cC extends wr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,c=e._interpolants,u=n.uuid,h=this._bindingsByRootAndName;let d=h[u];d===void 0&&(d={},h[u]=d);for(let f=0;f!==s;++f){const m=i[f],g=m.name;let x=d[g];if(x!==void 0)++x.referenceCount,a[f]=x;else{if(x=a[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,u,g));continue}const S=t&&t._propertyBindings[f].binding.parsedPath;x=new ry(Rt.create(n,g,S),m.ValueTypeName,m.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,u,g),a[f]=x}c[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const c=a.knownActions;e._byClipCacheIndex=c.length,c.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,c=a[s],u=c.knownActions,h=u[u.length-1],d=e._byClipCacheIndex;h._byClipCacheIndex=d,u[d]=h,u.pop(),e._byClipCacheIndex=null;const f=c.actionByRoot,m=(e._localRoot||this._root).uuid;delete f[m],u.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,c=a[i],u=t[t.length-1],h=e._cacheIndex;u._cacheIndex=h,t[h]=u,t.pop(),delete c[s],Object.keys(c).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Zp(new Float32Array(2),new Float32Array(2),1,lC),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?ll.findByName(i,e):e;const c=a!==null?a.uuid:e,u=this._actionsByClip[c];let h=null;if(n===void 0&&(a!==null?n=a.blendMode:n=ku),u!==void 0){const f=u.actionByRoot[s];if(f!==void 0&&f.blendMode===n)return f;h=u.knownActions[0],a===null&&(a=h._clip)}if(a===null)return null;const d=new sy(this,a,t,n);return this._bindAction(d,h),this._addInactiveAction(d,c,s),d}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?ll.findByName(n,e):e,a=s?s.uuid:e,c=this._actionsByClip[a];return c!==void 0&&c.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,s,a);const c=this._bindings,u=this._nActiveBindings;for(let h=0;h!==u;++h)c[h].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let c=0,u=a.length;c!==u;++c){const h=a[c];this._deactivateAction(h);const d=h._cacheIndex,f=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,f._cacheIndex=d,t[d]=f,t.pop(),this._removeInactiveBindingsForAction(h)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const c=n[a].actionByRoot,u=c[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const c=s[a];c.restoreOriginalState(),this._removeInactiveBinding(c)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class rm{constructor(e){this.value=e}clone(){return new rm(this.value.clone===void 0?this.value:this.value.clone())}}let uC=0;class hC extends wr{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:uC++}),this.name="",this.usage=el,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class Du extends Xu{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class dC{constructor(e,t,n,i,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class oy{constructor(e,t,n=0,i=1/0){this.ray=new Vs(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Os,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return cp(e,this,n,t),n.sort(p_),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)cp(e[i],this,n,t);return n.sort(p_),n}}function p_(r,e){return r.distance-e.distance}function cp(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){const i=r.children;for(let s=0,a=i.length;s<a;s++)cp(i[s],e,t,!0)}}class up{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Jt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class fC{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const m_=new he;class pC{constructor(e=new he(1/0,1/0),t=new he(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=m_.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,m_).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const g_=new U,su=new U;class ay{constructor(e=new U,t=new U){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){g_.subVectors(e,this.start),su.subVectors(this.end,this.start);const n=su.dot(su);let s=su.dot(g_)/n;return t&&(s=Jt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const __=new U;class mC extends Nt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new St,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,c=1,u=32;a<u;a++,c++){const h=a/u*Math.PI*2,d=c/u*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(d),Math.sin(d),1)}n.setAttribute("position",new qe(i,3));const s=new jn({fog:!1,toneMapped:!1});this.cone=new ir(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),__.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(__),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Hr=new U,ou=new lt,tf=new lt;class gC extends ir{constructor(e){const t=ly(e),n=new St,i=[],s=[],a=new ke(0,0,1),c=new ke(0,1,0);for(let h=0;h<t.length;h++){const d=t[h];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(a.r,a.g,a.b),s.push(c.r,c.g,c.b))}n.setAttribute("position",new qe(i,3)),n.setAttribute("color",new qe(s,3));const u=new jn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,u),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");tf.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const c=t[s];c.parent&&c.parent.isBone&&(ou.multiplyMatrices(tf,c.matrixWorld),Hr.setFromMatrixPosition(ou),i.setXYZ(a,Hr.x,Hr.y,Hr.z),ou.multiplyMatrices(tf,c.parent.matrixWorld),Hr.setFromMatrixPosition(ou),i.setXYZ(a+1,Hr.x,Hr.y,Hr.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function ly(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,ly(r.children[t]));return e}class _C extends an{constructor(e,t,n){const i=new xl(t,4,2),s=new Qr({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const vC=new U,v_=new ke,x_=new ke;class xC extends Nt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new vl(t);i.rotateY(Math.PI*.5),this.material=new Qr({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new Ut(a,3)),this.add(new an(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");v_.copy(this.light.color),x_.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?v_:x_;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(vC.setFromMatrixPosition(this.light.matrixWorld).negate())}}class yC extends ir{constructor(e=10,t=10,n=4473924,i=8947848){n=new ke(n),i=new ke(i);const s=t/2,a=e/t,c=e/2,u=[],h=[];for(let m=0,g=0,x=-c;m<=t;m++,x+=a){u.push(-c,0,x,c,0,x),u.push(x,0,-c,x,0,c);const S=m===s?n:i;S.toArray(h,g),g+=3,S.toArray(h,g),g+=3,S.toArray(h,g),g+=3,S.toArray(h,g),g+=3}const d=new St;d.setAttribute("position",new qe(u,3)),d.setAttribute("color",new qe(h,3));const f=new jn({vertexColors:!0,toneMapped:!1});super(d,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class SC extends ir{constructor(e=10,t=16,n=8,i=64,s=4473924,a=8947848){s=new ke(s),a=new ke(a);const c=[],u=[];if(t>1)for(let f=0;f<t;f++){const m=f/t*(Math.PI*2),g=Math.sin(m)*e,x=Math.cos(m)*e;c.push(0,0,0),c.push(g,0,x);const S=f&1?s:a;u.push(S.r,S.g,S.b),u.push(S.r,S.g,S.b)}for(let f=0;f<n;f++){const m=f&1?s:a,g=e-e/n*f;for(let x=0;x<i;x++){let S=x/i*(Math.PI*2),y=Math.sin(S)*g,_=Math.cos(S)*g;c.push(y,0,_),u.push(m.r,m.g,m.b),S=(x+1)/i*(Math.PI*2),y=Math.sin(S)*g,_=Math.cos(S)*g,c.push(y,0,_),u.push(m.r,m.g,m.b)}}const h=new St;h.setAttribute("position",new qe(c,3)),h.setAttribute("color",new qe(u,3));const d=new jn({vertexColors:!0,toneMapped:!1});super(h,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const y_=new U,au=new U,S_=new U;class MC extends Nt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new St;i.setAttribute("position",new qe([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new jn({fog:!1,toneMapped:!1});this.lightPlane=new Jr(i,s),this.add(this.lightPlane),i=new St,i.setAttribute("position",new qe([0,0,0,0,0,1],3)),this.targetLine=new Jr(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),y_.setFromMatrixPosition(this.light.matrixWorld),au.setFromMatrixPosition(this.light.target.matrixWorld),S_.subVectors(au,y_),this.lightPlane.lookAt(au),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(au),this.targetLine.scale.z=S_.length()}}const lu=new U,Zt=new fl;class EC extends ir{constructor(e){const t=new St,n=new jn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4");function c(x,S){u(x),u(S)}function u(x){i.push(0,0,0),s.push(0,0,0),a[x]===void 0&&(a[x]=[]),a[x].push(i.length/3-1)}t.setAttribute("position",new qe(i,3)),t.setAttribute("color",new qe(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const h=new ke(16755200),d=new ke(16711680),f=new ke(43775),m=new ke(16777215),g=new ke(3355443);this.setColors(h,d,f,m,g)}setColors(e,t,n,i,s){const c=this.geometry.getAttribute("color");c.setXYZ(0,e.r,e.g,e.b),c.setXYZ(1,e.r,e.g,e.b),c.setXYZ(2,e.r,e.g,e.b),c.setXYZ(3,e.r,e.g,e.b),c.setXYZ(4,e.r,e.g,e.b),c.setXYZ(5,e.r,e.g,e.b),c.setXYZ(6,e.r,e.g,e.b),c.setXYZ(7,e.r,e.g,e.b),c.setXYZ(8,e.r,e.g,e.b),c.setXYZ(9,e.r,e.g,e.b),c.setXYZ(10,e.r,e.g,e.b),c.setXYZ(11,e.r,e.g,e.b),c.setXYZ(12,e.r,e.g,e.b),c.setXYZ(13,e.r,e.g,e.b),c.setXYZ(14,e.r,e.g,e.b),c.setXYZ(15,e.r,e.g,e.b),c.setXYZ(16,e.r,e.g,e.b),c.setXYZ(17,e.r,e.g,e.b),c.setXYZ(18,e.r,e.g,e.b),c.setXYZ(19,e.r,e.g,e.b),c.setXYZ(20,e.r,e.g,e.b),c.setXYZ(21,e.r,e.g,e.b),c.setXYZ(22,e.r,e.g,e.b),c.setXYZ(23,e.r,e.g,e.b),c.setXYZ(24,t.r,t.g,t.b),c.setXYZ(25,t.r,t.g,t.b),c.setXYZ(26,t.r,t.g,t.b),c.setXYZ(27,t.r,t.g,t.b),c.setXYZ(28,t.r,t.g,t.b),c.setXYZ(29,t.r,t.g,t.b),c.setXYZ(30,t.r,t.g,t.b),c.setXYZ(31,t.r,t.g,t.b),c.setXYZ(32,n.r,n.g,n.b),c.setXYZ(33,n.r,n.g,n.b),c.setXYZ(34,n.r,n.g,n.b),c.setXYZ(35,n.r,n.g,n.b),c.setXYZ(36,n.r,n.g,n.b),c.setXYZ(37,n.r,n.g,n.b),c.setXYZ(38,i.r,i.g,i.b),c.setXYZ(39,i.r,i.g,i.b),c.setXYZ(40,s.r,s.g,s.b),c.setXYZ(41,s.r,s.g,s.b),c.setXYZ(42,s.r,s.g,s.b),c.setXYZ(43,s.r,s.g,s.b),c.setXYZ(44,s.r,s.g,s.b),c.setXYZ(45,s.r,s.g,s.b),c.setXYZ(46,s.r,s.g,s.b),c.setXYZ(47,s.r,s.g,s.b),c.setXYZ(48,s.r,s.g,s.b),c.setXYZ(49,s.r,s.g,s.b),c.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;Zt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),$t("c",t,e,Zt,0,0,-1),$t("t",t,e,Zt,0,0,1),$t("n1",t,e,Zt,-n,-i,-1),$t("n2",t,e,Zt,n,-i,-1),$t("n3",t,e,Zt,-n,i,-1),$t("n4",t,e,Zt,n,i,-1),$t("f1",t,e,Zt,-n,-i,1),$t("f2",t,e,Zt,n,-i,1),$t("f3",t,e,Zt,-n,i,1),$t("f4",t,e,Zt,n,i,1),$t("u1",t,e,Zt,n*.7,i*1.1,-1),$t("u2",t,e,Zt,-n*.7,i*1.1,-1),$t("u3",t,e,Zt,0,i*2,-1),$t("cf1",t,e,Zt,-n,0,1),$t("cf2",t,e,Zt,n,0,1),$t("cf3",t,e,Zt,0,-i,1),$t("cf4",t,e,Zt,0,i,1),$t("cn1",t,e,Zt,-n,0,-1),$t("cn2",t,e,Zt,n,0,-1),$t("cn3",t,e,Zt,0,-i,-1),$t("cn4",t,e,Zt,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function $t(r,e,t,n,i,s,a){lu.set(i,s,a).unproject(n);const c=e[r];if(c!==void 0){const u=t.getAttribute("position");for(let h=0,d=c.length;h<d;h++)u.setXYZ(c[h],lu.x,lu.y,lu.z)}}const cu=new vn;class bC extends ir{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new St;s.setIndex(new Ut(n,1)),s.setAttribute("position",new Ut(i,3)),super(s,new jn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&cu.setFromObject(this.object),cu.isEmpty())return;const t=cu.min,n=cu.max,i=this.geometry.attributes.position,s=i.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class wC extends ir{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new St;s.setIndex(new Ut(n,1)),s.setAttribute("position",new qe(i,3)),super(s,new jn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class TC extends Jr{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new St;a.setAttribute("position",new qe(s,3)),a.computeBoundingSphere(),super(a,new jn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],u=new St;u.setAttribute("position",new qe(c,3)),u.computeBoundingSphere(),this.add(new an(u,new Qr({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const M_=new U;let uu,nf;class AC extends Nt{constructor(e=new U(0,0,1),t=new U(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",uu===void 0&&(uu=new St,uu.setAttribute("position",new qe([0,0,0,0,1,0],3)),nf=new Qo(0,.5,1,5,1),nf.translate(0,-.5,0)),this.position.copy(t),this.line=new Jr(uu,new jn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new an(nf,new Qr({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{M_.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(M_,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class CC extends ir{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new St;i.setAttribute("position",new qe(t,3)),i.setAttribute("color",new qe(n,3));const s=new jn({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new ke,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class RC{constructor(){this.type="ShapePath",this.color=new ke,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new nl,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,a){return this.currentPath.bezierCurveTo(e,t,n,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(_){const b=[];for(let M=0,T=_.length;M<T;M++){const R=_[M],C=new zs;C.curves=R.curves,b.push(C)}return b}function n(_,b){const M=b.length;let T=!1;for(let R=M-1,C=0;C<M;R=C++){let N=b[R],B=b[C],A=B.x-N.x,P=B.y-N.y;if(Math.abs(P)>Number.EPSILON){if(P<0&&(N=b[C],A=-A,B=b[R],P=-P),_.y<N.y||_.y>B.y)continue;if(_.y===N.y){if(_.x===N.x)return!0}else{const z=P*(_.x-N.x)-A*(_.y-N.y);if(z===0)return!0;if(z<0)continue;T=!T}}else{if(_.y!==N.y)continue;if(B.x<=_.x&&_.x<=N.x||N.x<=_.x&&_.x<=B.x)return!0}}return T}const i=tr.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,c,u;const h=[];if(s.length===1)return c=s[0],u=new zs,u.curves=c.curves,h.push(u),h;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],m=[];let g=[],x=0,S;m[x]=void 0,g[x]=[];for(let _=0,b=s.length;_<b;_++)c=s[_],S=c.getPoints(),a=i(S),a=e?!a:a,a?(!d&&m[x]&&x++,m[x]={s:new zs,p:S},m[x].s.curves=c.curves,d&&x++,g[x]=[]):g[x].push({h:c,p:S[0]});if(!m[0])return t(s);if(m.length>1){let _=!1,b=0;for(let M=0,T=m.length;M<T;M++)f[M]=[];for(let M=0,T=m.length;M<T;M++){const R=g[M];for(let C=0;C<R.length;C++){const N=R[C];let B=!0;for(let A=0;A<m.length;A++)n(N.p,m[A].p)&&(M!==A&&b++,B?(B=!1,f[A].push(N)):_=!0);B&&f[M].push(N)}}b>0&&_===!1&&(g=f)}let y;for(let _=0,b=m.length;_<b;_++){u=m[_].s,h.push(u),y=g[_];for(let M=0,T=y.length;M<T;M++)u.holes.push(y[M].h)}return h}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Zo}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Zo);const PC=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Fu,AddEquation:Gr,AddOperation:Tv,AdditiveAnimationBlendMode:bp,AdditiveBlending:Mf,AgXToneMapping:Lv,AlphaFormat:Uv,AlwaysCompare:$v,AlwaysDepth:xv,AlwaysStencilFunc:$f,AmbientLight:Qx,AnimationAction:sy,AnimationClip:ll,AnimationLoader:DA,AnimationMixer:cC,AnimationObjectGroup:aC,AnimationUtils:PA,ArcCurve:wx,ArrayCamera:mx,ArrowHelper:AC,AttachedBindMode:Af,Audio:iy,AudioAnalyser:KA,AudioContext:em,AudioListener:YA,AudioLoader:jA,AxesHelper:CC,BackSide:An,BasicDepthPacking:Wv,BasicShadowMap:tv,BatchedMesh:Mx,Bone:Bp,BooleanKeyframeTrack:Ws,Box2:pC,Box3:vn,Box3Helper:wC,BoxGeometry:Gs,BoxHelper:bC,BufferAttribute:Ut,BufferGeometry:St,BufferGeometryLoader:ny,ByteType:Nv,Cache:yr,Camera:fl,CameraHelper:EC,CanvasTexture:eA,CapsuleGeometry:Qu,CatmullRomCurve3:Hp,CineonToneMapping:Rv,CircleGeometry:$u,ClampToEdgeWrapping:Un,Clock:tm,Color:ke,ColorKeyframeTrack:Jp,ColorManagement:Dt,CompressedArrayTexture:QT,CompressedCubeTexture:$T,CompressedTexture:Zu,CompressedTextureLoader:UA,ConeGeometry:eh,ConstantAlphaFactor:gv,ConstantColorFactor:pv,CubeCamera:ox,CubeReflectionMapping:Er,CubeRefractionMapping:Yr,CubeTexture:pl,CubeTextureLoader:OA,CubeUVReflectionMapping:Jo,CubicBezierCurve:Vp,CubicBezierCurve3:Tx,CubicInterpolant:Wx,CullFaceBack:Sf,CullFaceFront:ev,CullFaceFrontBack:GS,CullFaceNone:$_,Curve:Fi,CurvePath:Cx,CustomBlending:nv,CustomToneMapping:Pv,CylinderGeometry:Qo,Cylindrical:fC,Data3DTexture:Rp,DataArrayTexture:Vu,DataTexture:Fs,DataTextureLoader:FA,DataUtils:KM,DecrementStencilOp:tM,DecrementWrapStencilOp:iM,DefaultLoadingManager:qx,DepthFormat:Xr,DepthStencilFormat:ks,DepthTexture:Np,DetachedBindMode:Iv,DirectionalLight:Kx,DirectionalLightHelper:MC,DiscreteInterpolant:jx,DisplayP3ColorSpace:Hu,DodecahedronGeometry:th,DoubleSide:Si,DstAlphaFactor:cv,DstColorFactor:hv,DynamicCopyUsage:_M,DynamicDrawUsage:Ds,DynamicReadUsage:pM,EdgesGeometry:Rx,EllipseCurve:Ju,EqualCompare:Zv,EqualDepth:Sv,EqualStencilFunc:aM,EquirectangularReflectionMapping:Wa,EquirectangularRefractionMapping:ja,Euler:dl,EventDispatcher:wr,ExtrudeGeometry:ih,FileLoader:br,Float16BufferAttribute:iE,Float32BufferAttribute:qe,Float64BufferAttribute:rE,FloatType:Ni,Fog:ju,FogExp2:Wu,FramebufferTexture:KT,FrontSide:Mr,Frustum:ml,GLBufferAttribute:dC,GLSL1:xM,GLSL3:ep,GreaterCompare:Jv,GreaterDepth:Ev,GreaterEqualCompare:Qv,GreaterEqualDepth:Mv,GreaterEqualStencilFunc:hM,GreaterStencilFunc:cM,GridHelper:yC,Group:Bo,HalfFloatType:Go,HemisphereLight:Yx,HemisphereLightHelper:xC,IcosahedronGeometry:rh,ImageBitmapLoader:WA,ImageLoader:cl,ImageUtils:Cp,IncrementStencilOp:eM,IncrementWrapStencilOp:nM,InstancedBufferAttribute:qo,InstancedBufferGeometry:$p,InstancedInterleavedBuffer:Du,InstancedMesh:Sx,Int16BufferAttribute:tE,Int32BufferAttribute:nE,Int8BufferAttribute:QM,IntType:_p,InterleavedBuffer:Xu,InterleavedBufferAttribute:ai,Interpolant:yl,InterpolateDiscrete:Ya,InterpolateLinear:Za,InterpolateSmooth:Eu,InvertStencilOp:rM,KeepStencilOp:bs,KeyframeTrack:zi,LOD:xx,LatheGeometry:_l,Layers:Os,LessCompare:Yv,LessDepth:yv,LessEqualCompare:Tp,LessEqualDepth:Ga,LessEqualStencilFunc:lM,LessStencilFunc:oM,Light:es,LightProbe:ty,Line:Jr,Line3:ay,LineBasicMaterial:jn,LineCurve:Gp,LineCurve3:Ax,LineDashedMaterial:Hx,LineLoop:Ex,LineSegments:ir,LinearDisplayP3ColorSpace:hl,LinearEncoding:wp,LinearFilter:tn,LinearInterpolant:Zp,LinearMipMapLinearFilter:YS,LinearMipMapNearestFilter:qS,LinearMipmapLinearFilter:Zr,LinearMipmapNearestFilter:gp,LinearSRGBColorSpace:nr,LinearToneMapping:Av,LinearTransfer:Ka,Loader:Qn,LoaderUtils:lp,LoadingManager:Kp,LoopOnce:Hv,LoopPingPong:Gv,LoopRepeat:Vv,LuminanceAlphaFormat:Fv,LuminanceFormat:Ov,MOUSE:Ms,Material:zn,MaterialLoader:hh,MathUtils:ex,Matrix3:yt,Matrix4:lt,MaxEquation:Tf,Mesh:an,MeshBasicMaterial:Qr,MeshDepthMaterial:Dp,MeshDistanceMaterial:Up,MeshLambertMaterial:Bx,MeshMatcapMaterial:kx,MeshNormalMaterial:zx,MeshPhongMaterial:Ox,MeshPhysicalMaterial:Ux,MeshStandardMaterial:qp,MeshToonMaterial:Fx,MinEquation:wf,MirroredRepeatWrapping:qa,MixOperation:wv,MultiplyBlending:bf,MultiplyOperation:ul,NearestFilter:en,NearestMipMapLinearFilter:XS,NearestMipMapNearestFilter:jS,NearestMipmapLinearFilter:za,NearestMipmapNearestFilter:Ru,NeverCompare:qv,NeverDepth:vv,NeverStencilFunc:sM,NoBlending:Sr,NoColorSpace:oi,NoToneMapping:Qi,NormalAnimationBlendMode:ku,NormalBlending:Ns,NotEqualCompare:Kv,NotEqualDepth:bv,NotEqualStencilFunc:uM,NumberKeyframeTrack:ol,Object3D:Nt,ObjectLoader:VA,ObjectSpaceNormalMap:Xv,OctahedronGeometry:vl,OneFactor:ov,OneMinusConstantAlphaFactor:_v,OneMinusConstantColorFactor:mv,OneMinusDstAlphaFactor:uv,OneMinusDstColorFactor:dv,OneMinusSrcAlphaFactor:Cu,OneMinusSrcColorFactor:lv,OrthographicCamera:er,P3Primaries:$a,PCFShadowMap:Ou,PCFSoftShadowMap:Fa,PMREMGenerator:np,Path:nl,PerspectiveCamera:jt,Plane:_r,PlaneGeometry:gl,PlaneHelper:TC,PointLight:Jx,PointLightHelper:_C,Points:bx,PointsMaterial:Yu,PolarGridHelper:SC,PolyhedronGeometry:$r,PositionalAudio:JA,PropertyBinding:Rt,PropertyMixer:ry,QuadraticBezierCurve:Wp,QuadraticBezierCurve3:Ku,Quaternion:On,QuaternionKeyframeTrack:$o,QuaternionLinearInterpolant:Xx,RED_GREEN_RGTC2_Format:Kf,RED_RGTC1_Format:kv,REVISION:Zo,RGBADepthPacking:jv,RGBAFormat:Wn,RGBAIntegerFormat:Mp,RGBA_ASTC_10x10_Format:jf,RGBA_ASTC_10x5_Format:Vf,RGBA_ASTC_10x6_Format:Gf,RGBA_ASTC_10x8_Format:Wf,RGBA_ASTC_12x10_Format:Xf,RGBA_ASTC_12x12_Format:qf,RGBA_ASTC_4x4_Format:Df,RGBA_ASTC_5x4_Format:Uf,RGBA_ASTC_5x5_Format:Of,RGBA_ASTC_6x5_Format:Ff,RGBA_ASTC_6x6_Format:zf,RGBA_ASTC_8x5_Format:Bf,RGBA_ASTC_8x6_Format:kf,RGBA_ASTC_8x8_Format:Hf,RGBA_BPTC_Format:Mu,RGBA_ETC2_EAC_Format:Nf,RGBA_PVRTC_2BPPV1_Format:Lf,RGBA_PVRTC_4BPPV1_Format:Pf,RGBA_S3TC_DXT1_Format:xu,RGBA_S3TC_DXT3_Format:yu,RGBA_S3TC_DXT5_Format:Su,RGB_BPTC_SIGNED_Format:Yf,RGB_BPTC_UNSIGNED_Format:Zf,RGB_ETC1_Format:Ep,RGB_ETC2_Format:If,RGB_PVRTC_2BPPV1_Format:Rf,RGB_PVRTC_4BPPV1_Format:Cf,RGB_S3TC_DXT1_Format:vu,RGFormat:Bv,RGIntegerFormat:Sp,RawShaderMaterial:Dx,Ray:Vs,Raycaster:oy,Rec709Primaries:Qa,RectAreaLight:$x,RedFormat:zv,RedIntegerFormat:yp,ReinhardToneMapping:Cv,RenderTarget:ix,RepeatWrapping:Xa,ReplaceStencilOp:$S,ReverseSubtractEquation:rv,RingGeometry:sh,SIGNED_RED_GREEN_RGTC2_Format:Qf,SIGNED_RED_RGTC1_Format:Jf,SRGBColorSpace:cn,SRGBTransfer:zt,Scene:Fp,ShaderChunk:_t,ShaderLib:Li,ShaderMaterial:Oi,ShadowMaterial:Nx,Shape:zs,ShapeGeometry:oh,ShapePath:RC,ShapeUtils:tr,ShortType:Dv,Skeleton:qu,SkeletonHelper:gC,SkinnedMesh:yx,Source:Rs,Sphere:xn,SphereGeometry:xl,Spherical:up,SphericalHarmonics3:ey,SplineCurve:jp,SpotLight:Zx,SpotLightHelper:mC,Sprite:vx,SpriteMaterial:zp,SrcAlphaFactor:Au,SrcAlphaSaturateFactor:fv,SrcColorFactor:av,StaticCopyUsage:gM,StaticDrawUsage:el,StaticReadUsage:fM,StereoCamera:XA,StreamCopyUsage:vM,StreamDrawUsage:dM,StreamReadUsage:mM,StringKeyframeTrack:js,SubtractEquation:iv,SubtractiveBlending:Ef,TOUCH:Es,TangentSpaceNormalMap:Kr,TetrahedronGeometry:ah,Texture:nn,TextureLoader:zA,TorusGeometry:lh,TorusKnotGeometry:ch,Triangle:Jn,TriangleFanDrawMode:KS,TriangleStripDrawMode:JS,TrianglesDrawMode:ZS,TubeGeometry:uh,TwoPassDoubleSide:WS,UVMapping:zu,Uint16BufferAttribute:Pp,Uint32BufferAttribute:Lp,Uint8BufferAttribute:$M,Uint8ClampedBufferAttribute:eE,Uniform:rm,UniformsGroup:hC,UniformsLib:Ce,UniformsUtils:Iu,UnsignedByteType:$i,UnsignedInt248Type:jr,UnsignedIntType:xr,UnsignedShort4444Type:vp,UnsignedShort5551Type:xp,UnsignedShortType:Bu,VSMShadowMap:Ri,Vector2:he,Vector3:U,Vector4:At,VectorKeyframeTrack:al,VideoTexture:JT,WebGL1Renderer:gx,WebGL3DRenderTarget:BM,WebGLArrayRenderTarget:zM,WebGLCoordinateSystem:Di,WebGLCubeRenderTarget:ax,WebGLMultipleRenderTargets:kM,WebGLRenderTarget:Ui,WebGLRenderer:Op,WebGLUtils:px,WebGPUCoordinateSystem:Wo,WireframeGeometry:Xp,WrapAroundEnding:Ja,ZeroCurvatureEnding:As,ZeroFactor:sv,ZeroSlopeEnding:Cs,ZeroStencilOp:QS,_SRGBAFormat:Pu,createCanvasElement:nx,sRGBEncoding:qr},Symbol.toStringTag,{value:"Module"}));var cy={exports:{}},Xs={};/**
3688
3688
  * @license React
3689
3689
  * react-reconciler-constants.production.min.js
3690
3690
  *
@@ -3692,7 +3692,7 @@ void main() {
3692
3692
  *
3693
3693
  * This source code is licensed under the MIT license found in the
3694
3694
  * LICENSE file in the root directory of this source tree.
3695
- */Xs.ConcurrentRoot=1;Xs.ContinuousEventPriority=4;Xs.DefaultEventPriority=16;Xs.DiscreteEventPriority=1;Xs.IdleEventPriority=536870912;Xs.LegacyRoot=0;cy.exports=Xs;var Ho=cy.exports;function LC(r){let e;const t=new Set,n=(h,d)=>{const f=typeof h=="function"?h(e):h;if(f!==e){const m=e;e=d?f:Object.assign({},e,f),t.forEach(g=>g(e,m))}},i=()=>e,s=(h,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=d(e);function g(){const x=d(e);if(!f(m,x)){const S=m;h(m=x,S)}}return t.add(g),()=>t.delete(g)},u={setState:n,getState:i,subscribe:(h,d,f)=>d||f?s(h,d,f):(t.add(h),()=>t.delete(h)),destroy:()=>t.clear()};return e=r(n,i,u),u}const IC=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),b_=IC?W.useEffect:W.useLayoutEffect;function NC(r){const e=typeof r=="function"?LC(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=W.useReducer(y=>y+1,0),a=e.getState(),c=W.useRef(a),u=W.useRef(n),h=W.useRef(i),d=W.useRef(!1),f=W.useRef();f.current===void 0&&(f.current=n(a));let m,g=!1;(c.current!==a||u.current!==n||h.current!==i||d.current)&&(m=n(a),g=!i(f.current,m)),b_(()=>{g&&(f.current=m),c.current=a,u.current=n,h.current=i,d.current=!1});const x=W.useRef(a);b_(()=>{const y=()=>{try{const b=e.getState(),M=u.current(b);h.current(f.current,M)||(c.current=b,f.current=M,s())}catch{d.current=!0,s()}},_=e.subscribe(y);return e.getState()!==x.current&&y(),_},[]);const S=g?m:f.current;return W.useDebugValue(S),S};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}var uy={exports:{}},hy={exports:{}},dy={};/**
3695
+ */Xs.ConcurrentRoot=1;Xs.ContinuousEventPriority=4;Xs.DefaultEventPriority=16;Xs.DiscreteEventPriority=1;Xs.IdleEventPriority=536870912;Xs.LegacyRoot=0;cy.exports=Xs;var Ho=cy.exports;function LC(r){let e;const t=new Set,n=(h,d)=>{const f=typeof h=="function"?h(e):h;if(f!==e){const m=e;e=d?f:Object.assign({},e,f),t.forEach(g=>g(e,m))}},i=()=>e,s=(h,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=d(e);function g(){const x=d(e);if(!f(m,x)){const S=m;h(m=x,S)}}return t.add(g),()=>t.delete(g)},u={setState:n,getState:i,subscribe:(h,d,f)=>d||f?s(h,d,f):(t.add(h),()=>t.delete(h)),destroy:()=>t.clear()};return e=r(n,i,u),u}const IC=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),E_=IC?W.useEffect:W.useLayoutEffect;function NC(r){const e=typeof r=="function"?LC(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=W.useReducer(y=>y+1,0),a=e.getState(),c=W.useRef(a),u=W.useRef(n),h=W.useRef(i),d=W.useRef(!1),f=W.useRef();f.current===void 0&&(f.current=n(a));let m,g=!1;(c.current!==a||u.current!==n||h.current!==i||d.current)&&(m=n(a),g=!i(f.current,m)),E_(()=>{g&&(f.current=m),c.current=a,u.current=n,h.current=i,d.current=!1});const x=W.useRef(a);E_(()=>{const y=()=>{try{const b=e.getState(),M=u.current(b);h.current(f.current,M)||(c.current=b,f.current=M,s())}catch{d.current=!0,s()}},_=e.subscribe(y);return e.getState()!==x.current&&y(),_},[]);const S=g?m:f.current;return W.useDebugValue(S),S};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}var uy={exports:{}},hy={exports:{}},dy={};/**
3696
3696
  * @license React
3697
3697
  * scheduler.production.min.js
3698
3698
  *
@@ -3700,7 +3700,7 @@ void main() {
3700
3700
  *
3701
3701
  * This source code is licensed under the MIT license found in the
3702
3702
  * LICENSE file in the root directory of this source tree.
3703
- */(function(r){function e(j,Z){var J=j.length;j.push(Z);e:for(;0<J;){var te=J-1>>>1,ge=j[te];if(0<i(ge,Z))j[te]=Z,j[J]=ge,J=te;else break e}}function t(j){return j.length===0?null:j[0]}function n(j){if(j.length===0)return null;var Z=j[0],J=j.pop();if(J!==Z){j[0]=J;e:for(var te=0,ge=j.length,K=ge>>>1;te<K;){var fe=2*(te+1)-1,be=j[fe],Oe=fe+1,Ne=j[Oe];if(0>i(be,J))Oe<ge&&0>i(Ne,be)?(j[te]=Ne,j[Oe]=J,te=Oe):(j[te]=be,j[fe]=J,te=fe);else if(Oe<ge&&0>i(Ne,J))j[te]=Ne,j[Oe]=J,te=Oe;else break e}}return Z}function i(j,Z){var J=j.sortIndex-Z.sortIndex;return J!==0?J:j.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var a=Date,c=a.now();r.unstable_now=function(){return a.now()-c}}var u=[],h=[],d=1,f=null,m=3,g=!1,x=!1,S=!1,y=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(j){for(var Z=t(h);Z!==null;){if(Z.callback===null)n(h);else if(Z.startTime<=j)n(h),Z.sortIndex=Z.expirationTime,e(u,Z);else break;Z=t(h)}}function T(j){if(S=!1,M(j),!x)if(t(u)!==null)x=!0,ie(R);else{var Z=t(h);Z!==null&&le(T,Z.startTime-j)}}function R(j,Z){x=!1,S&&(S=!1,_(B),B=-1),g=!0;var J=m;try{for(M(Z),f=t(u);f!==null&&(!(f.expirationTime>Z)||j&&!z());){var te=f.callback;if(typeof te=="function"){f.callback=null,m=f.priorityLevel;var ge=te(f.expirationTime<=Z);Z=r.unstable_now(),typeof ge=="function"?f.callback=ge:f===t(u)&&n(u),M(Z)}else n(u);f=t(u)}if(f!==null)var K=!0;else{var fe=t(h);fe!==null&&le(T,fe.startTime-Z),K=!1}return K}finally{f=null,m=J,g=!1}}var C=!1,N=null,B=-1,A=5,P=-1;function z(){return!(r.unstable_now()-P<A)}function ee(){if(N!==null){var j=r.unstable_now();P=j;var Z=!0;try{Z=N(!0,j)}finally{Z?de():(C=!1,N=null)}}else C=!1}var de;if(typeof b=="function")de=function(){b(ee)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,q=H.port2;H.port1.onmessage=ee,de=function(){q.postMessage(null)}}else de=function(){y(ee,0)};function ie(j){N=j,C||(C=!0,de())}function le(j,Z){B=y(function(){j(r.unstable_now())},Z)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(j){j.callback=null},r.unstable_continueExecution=function(){x||g||(x=!0,ie(R))},r.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<j?Math.floor(1e3/j):5},r.unstable_getCurrentPriorityLevel=function(){return m},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(j){switch(m){case 1:case 2:case 3:var Z=3;break;default:Z=m}var J=m;m=Z;try{return j()}finally{m=J}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(j,Z){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var J=m;m=j;try{return Z()}finally{m=J}},r.unstable_scheduleCallback=function(j,Z,J){var te=r.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?te+J:te):J=te,j){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=J+ge,j={id:d++,callback:Z,priorityLevel:j,startTime:J,expirationTime:ge,sortIndex:-1},J>te?(j.sortIndex=J,e(h,j),t(u)===null&&j===t(h)&&(S?(_(B),B=-1):S=!0,le(T,J-te))):(j.sortIndex=ge,e(u,j),x||g||(x=!0,ie(R))),j},r.unstable_shouldYield=z,r.unstable_wrapCallback=function(j){var Z=m;return function(){var J=m;m=Z;try{return j.apply(this,arguments)}finally{m=J}}}})(dy);hy.exports=dy;var dp=hy.exports;/**
3703
+ */(function(r){function e(j,Z){var J=j.length;j.push(Z);e:for(;0<J;){var te=J-1>>>1,ge=j[te];if(0<i(ge,Z))j[te]=Z,j[J]=ge,J=te;else break e}}function t(j){return j.length===0?null:j[0]}function n(j){if(j.length===0)return null;var Z=j[0],J=j.pop();if(J!==Z){j[0]=J;e:for(var te=0,ge=j.length,K=ge>>>1;te<K;){var fe=2*(te+1)-1,be=j[fe],Oe=fe+1,Ne=j[Oe];if(0>i(be,J))Oe<ge&&0>i(Ne,be)?(j[te]=Ne,j[Oe]=J,te=Oe):(j[te]=be,j[fe]=J,te=fe);else if(Oe<ge&&0>i(Ne,J))j[te]=Ne,j[Oe]=J,te=Oe;else break e}}return Z}function i(j,Z){var J=j.sortIndex-Z.sortIndex;return J!==0?J:j.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var a=Date,c=a.now();r.unstable_now=function(){return a.now()-c}}var u=[],h=[],d=1,f=null,m=3,g=!1,x=!1,S=!1,y=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(j){for(var Z=t(h);Z!==null;){if(Z.callback===null)n(h);else if(Z.startTime<=j)n(h),Z.sortIndex=Z.expirationTime,e(u,Z);else break;Z=t(h)}}function T(j){if(S=!1,M(j),!x)if(t(u)!==null)x=!0,ie(R);else{var Z=t(h);Z!==null&&le(T,Z.startTime-j)}}function R(j,Z){x=!1,S&&(S=!1,_(B),B=-1),g=!0;var J=m;try{for(M(Z),f=t(u);f!==null&&(!(f.expirationTime>Z)||j&&!z());){var te=f.callback;if(typeof te=="function"){f.callback=null,m=f.priorityLevel;var ge=te(f.expirationTime<=Z);Z=r.unstable_now(),typeof ge=="function"?f.callback=ge:f===t(u)&&n(u),M(Z)}else n(u);f=t(u)}if(f!==null)var K=!0;else{var fe=t(h);fe!==null&&le(T,fe.startTime-Z),K=!1}return K}finally{f=null,m=J,g=!1}}var C=!1,N=null,B=-1,A=5,P=-1;function z(){return!(r.unstable_now()-P<A)}function ee(){if(N!==null){var j=r.unstable_now();P=j;var Z=!0;try{Z=N(!0,j)}finally{Z?de():(C=!1,N=null)}}else C=!1}var de;if(typeof b=="function")de=function(){b(ee)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,q=H.port2;H.port1.onmessage=ee,de=function(){q.postMessage(null)}}else de=function(){y(ee,0)};function ie(j){N=j,C||(C=!0,de())}function le(j,Z){B=y(function(){j(r.unstable_now())},Z)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(j){j.callback=null},r.unstable_continueExecution=function(){x||g||(x=!0,ie(R))},r.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<j?Math.floor(1e3/j):5},r.unstable_getCurrentPriorityLevel=function(){return m},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(j){switch(m){case 1:case 2:case 3:var Z=3;break;default:Z=m}var J=m;m=Z;try{return j()}finally{m=J}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(j,Z){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var J=m;m=j;try{return Z()}finally{m=J}},r.unstable_scheduleCallback=function(j,Z,J){var te=r.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?te+J:te):J=te,j){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=J+ge,j={id:d++,callback:Z,priorityLevel:j,startTime:J,expirationTime:ge,sortIndex:-1},J>te?(j.sortIndex=J,e(h,j),t(u)===null&&j===t(h)&&(S?(_(B),B=-1):S=!0,le(T,J-te))):(j.sortIndex=ge,e(u,j),x||g||(x=!0,ie(R))),j},r.unstable_shouldYield=z,r.unstable_wrapCallback=function(j){var Z=m;return function(){var J=m;m=Z;try{return j.apply(this,arguments)}finally{m=J}}}})(dy);hy.exports=dy;var hp=hy.exports;/**
3704
3704
  * @license React
3705
3705
  * react-reconciler.production.min.js
3706
3706
  *
@@ -3708,17 +3708,17 @@ void main() {
3708
3708
  *
3709
3709
  * This source code is licensed under the MIT license found in the
3710
3710
  * LICENSE file in the root directory of this source tree.
3711
- */var DC=function(e){var t={},n=W,i=dp,s=Object.assign;function a(o){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+o,p=1;p<arguments.length;p++)l+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=Symbol.for("react.element"),h=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),x=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),R=Symbol.iterator;function C(o){return o===null||typeof o!="object"?null:(o=R&&o[R]||o["@@iterator"],typeof o=="function"?o:null)}function N(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case d:return"Fragment";case h:return"Portal";case m:return"Profiler";case f:return"StrictMode";case y:return"Suspense";case _:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case x:return(o.displayName||"Context")+".Consumer";case g:return(o._context.displayName||"Context")+".Provider";case S:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case b:return l=o.displayName||null,l!==null?l:N(o.type)||"Memo";case M:l=o._payload,o=o._init;try{return N(o(l))}catch{}}return null}function B(o){var l=o.type;switch(o.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=l.render,o=o.displayName||o.name||"",l.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return N(l);case 8:return l===f?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function A(o){var l=o,p=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,l.flags&4098&&(p=l.return),o=l.return;while(o)}return l.tag===3?p:null}function P(o){if(A(o)!==o)throw Error(a(188))}function z(o){var l=o.alternate;if(!l){if(l=A(o),l===null)throw Error(a(188));return l!==o?null:o}for(var p=o,v=l;;){var E=p.return;if(E===null)break;var w=E.alternate;if(w===null){if(v=E.return,v!==null){p=v;continue}break}if(E.child===w.child){for(w=E.child;w;){if(w===p)return P(E),o;if(w===v)return P(E),l;w=w.sibling}throw Error(a(188))}if(p.return!==v.return)p=E,v=w;else{for(var F=!1,X=E.child;X;){if(X===p){F=!0,p=E,v=w;break}if(X===v){F=!0,v=E,p=w;break}X=X.sibling}if(!F){for(X=w.child;X;){if(X===p){F=!0,p=w,v=E;break}if(X===v){F=!0,v=w,p=E;break}X=X.sibling}if(!F)throw Error(a(189))}}if(p.alternate!==v)throw Error(a(190))}if(p.tag!==3)throw Error(a(188));return p.stateNode.current===p?o:l}function ee(o){return o=z(o),o!==null?de(o):null}function de(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var l=de(o);if(l!==null)return l;o=o.sibling}return null}function H(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){if(o.tag!==4){var l=H(o);if(l!==null)return l}o=o.sibling}return null}var q=Array.isArray,ie=e.getPublicInstance,le=e.getRootHostContext,j=e.getChildHostContext,Z=e.prepareForCommit,J=e.resetAfterCommit,te=e.createInstance,ge=e.appendInitialChild,K=e.finalizeInitialChildren,fe=e.prepareUpdate,be=e.shouldSetTextContent,Oe=e.createTextInstance,Ne=e.scheduleTimeout,Je=e.cancelTimeout,rt=e.noTimeout,Pe=e.isPrimaryRenderer,Ae=e.supportsMutation,k=e.supportsPersistence,ve=e.supportsHydration,ue=e.getInstanceFromNode,Ee=e.preparePortalMount,pe=e.getCurrentEventPriority,Ve=e.detachDeletedInstance,Le=e.supportsMicrotasks,D=e.scheduleMicrotask,I=e.supportsTestSelectors,Q=e.findFiberRoot,ye=e.getBoundingRect,xe=e.getTextContent,me=e.isHiddenSubtree,Xe=e.matchAccessibilityRole,Re=e.setFocusIfFocusable,Ie=e.setupIntersectionObserver,et=e.appendChild,ht=e.appendChildToContainer,Se=e.commitTextUpdate,wt=e.commitMount,gt=e.commitUpdate,ct=e.insertBefore,$e=e.insertInContainerBefore,Ge=e.removeChild,V=e.removeChildFromContainer,_e=e.resetTextContent,Be=e.hideInstance,Fe=e.hideTextInstance,Me=e.unhideInstance,G=e.unhideTextInstance,Te=e.clearContainer,De=e.cloneInstance,tt=e.createContainerChildSet,Ye=e.appendChildToContainerChildSet,bt=e.finalizeContainerChildren,Tt=e.replaceContainerChildren,Ot=e.cloneHiddenInstance,Ht=e.cloneHiddenTextInstance,Ct=e.canHydrateInstance,yn=e.canHydrateTextInstance,ci=e.canHydrateSuspenseInstance,ea=e.isSuspenseInstancePending,ta=e.isSuspenseInstanceFallback,qs=e.registerSuspenseInstanceRetry,Tr=e.getNextHydratableSibling,Ys=e.getFirstHydratableChild,bl=e.getFirstHydratableChildWithinContainer,wl=e.getFirstHydratableChildWithinSuspenseInstance,dh=e.hydrateInstance,fh=e.hydrateTextInstance,ph=e.hydrateSuspenseInstance,O=e.getNextHydratableInstanceAfterSuspenseInstance,$=e.commitHydratedContainer,se=e.commitHydratedSuspenseInstance,oe=e.clearSuspenseBoundary,re=e.clearSuspenseBoundaryFromContainer,He=e.shouldDeleteUnhydratedTailInstances,Ke=e.didNotMatchHydratedContainerTextInstance,st=e.didNotMatchHydratedTextInstance,ot;function dt(o){if(ot===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);ot=l&&l[1]||""}return`
3711
+ */var DC=function(e){var t={},n=W,i=hp,s=Object.assign;function a(o){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+o,p=1;p<arguments.length;p++)l+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=Symbol.for("react.element"),h=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),x=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),R=Symbol.iterator;function C(o){return o===null||typeof o!="object"?null:(o=R&&o[R]||o["@@iterator"],typeof o=="function"?o:null)}function N(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case d:return"Fragment";case h:return"Portal";case m:return"Profiler";case f:return"StrictMode";case y:return"Suspense";case _:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case x:return(o.displayName||"Context")+".Consumer";case g:return(o._context.displayName||"Context")+".Provider";case S:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case b:return l=o.displayName||null,l!==null?l:N(o.type)||"Memo";case M:l=o._payload,o=o._init;try{return N(o(l))}catch{}}return null}function B(o){var l=o.type;switch(o.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=l.render,o=o.displayName||o.name||"",l.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return N(l);case 8:return l===f?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function A(o){var l=o,p=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,l.flags&4098&&(p=l.return),o=l.return;while(o)}return l.tag===3?p:null}function P(o){if(A(o)!==o)throw Error(a(188))}function z(o){var l=o.alternate;if(!l){if(l=A(o),l===null)throw Error(a(188));return l!==o?null:o}for(var p=o,v=l;;){var E=p.return;if(E===null)break;var w=E.alternate;if(w===null){if(v=E.return,v!==null){p=v;continue}break}if(E.child===w.child){for(w=E.child;w;){if(w===p)return P(E),o;if(w===v)return P(E),l;w=w.sibling}throw Error(a(188))}if(p.return!==v.return)p=E,v=w;else{for(var F=!1,X=E.child;X;){if(X===p){F=!0,p=E,v=w;break}if(X===v){F=!0,v=E,p=w;break}X=X.sibling}if(!F){for(X=w.child;X;){if(X===p){F=!0,p=w,v=E;break}if(X===v){F=!0,v=w,p=E;break}X=X.sibling}if(!F)throw Error(a(189))}}if(p.alternate!==v)throw Error(a(190))}if(p.tag!==3)throw Error(a(188));return p.stateNode.current===p?o:l}function ee(o){return o=z(o),o!==null?de(o):null}function de(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var l=de(o);if(l!==null)return l;o=o.sibling}return null}function H(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){if(o.tag!==4){var l=H(o);if(l!==null)return l}o=o.sibling}return null}var q=Array.isArray,ie=e.getPublicInstance,le=e.getRootHostContext,j=e.getChildHostContext,Z=e.prepareForCommit,J=e.resetAfterCommit,te=e.createInstance,ge=e.appendInitialChild,K=e.finalizeInitialChildren,fe=e.prepareUpdate,be=e.shouldSetTextContent,Oe=e.createTextInstance,Ne=e.scheduleTimeout,Je=e.cancelTimeout,rt=e.noTimeout,Pe=e.isPrimaryRenderer,Ae=e.supportsMutation,k=e.supportsPersistence,ve=e.supportsHydration,ue=e.getInstanceFromNode,Ee=e.preparePortalMount,pe=e.getCurrentEventPriority,Ve=e.detachDeletedInstance,Le=e.supportsMicrotasks,D=e.scheduleMicrotask,I=e.supportsTestSelectors,Q=e.findFiberRoot,ye=e.getBoundingRect,xe=e.getTextContent,me=e.isHiddenSubtree,Xe=e.matchAccessibilityRole,Re=e.setFocusIfFocusable,Ie=e.setupIntersectionObserver,et=e.appendChild,ht=e.appendChildToContainer,Se=e.commitTextUpdate,wt=e.commitMount,gt=e.commitUpdate,ct=e.insertBefore,$e=e.insertInContainerBefore,Ge=e.removeChild,V=e.removeChildFromContainer,_e=e.resetTextContent,Be=e.hideInstance,Fe=e.hideTextInstance,Me=e.unhideInstance,G=e.unhideTextInstance,Te=e.clearContainer,De=e.cloneInstance,tt=e.createContainerChildSet,Ye=e.appendChildToContainerChildSet,bt=e.finalizeContainerChildren,Tt=e.replaceContainerChildren,Ot=e.cloneHiddenInstance,Ht=e.cloneHiddenTextInstance,Ct=e.canHydrateInstance,yn=e.canHydrateTextInstance,ci=e.canHydrateSuspenseInstance,ea=e.isSuspenseInstancePending,ta=e.isSuspenseInstanceFallback,qs=e.registerSuspenseInstanceRetry,Tr=e.getNextHydratableSibling,Ys=e.getFirstHydratableChild,bl=e.getFirstHydratableChildWithinContainer,wl=e.getFirstHydratableChildWithinSuspenseInstance,dh=e.hydrateInstance,fh=e.hydrateTextInstance,ph=e.hydrateSuspenseInstance,O=e.getNextHydratableInstanceAfterSuspenseInstance,$=e.commitHydratedContainer,se=e.commitHydratedSuspenseInstance,oe=e.clearSuspenseBoundary,re=e.clearSuspenseBoundaryFromContainer,He=e.shouldDeleteUnhydratedTailInstances,Ke=e.didNotMatchHydratedContainerTextInstance,st=e.didNotMatchHydratedTextInstance,ot;function dt(o){if(ot===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);ot=l&&l[1]||""}return`
3712
3712
  `+ot+o}var ut=!1;function ft(o,l){if(!o||ut)return"";ut=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(we){var v=we}Reflect.construct(o,[],l)}else{try{l.call()}catch(we){v=we}o.call(l.prototype)}else{try{throw Error()}catch(we){v=we}o()}}catch(we){if(we&&v&&typeof we.stack=="string"){for(var E=we.stack.split(`
3713
3713
  `),w=v.stack.split(`
3714
3714
  `),F=E.length-1,X=w.length-1;1<=F&&0<=X&&E[F]!==w[X];)X--;for(;1<=F&&0<=X;F--,X--)if(E[F]!==w[X]){if(F!==1||X!==1)do if(F--,X--,0>X||E[F]!==w[X]){var ce=`
3715
- `+E[F].replace(" at new "," at ");return o.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",o.displayName)),ce}while(1<=F&&0<=X);break}}}finally{ut=!1,Error.prepareStackTrace=p}return(o=o?o.displayName||o.name:"")?dt(o):""}var Gt=Object.prototype.hasOwnProperty,Sn=[],Bt=-1;function dn(o){return{current:o}}function at(o){0>Bt||(o.current=Sn[Bt],Sn[Bt]=null,Bt--)}function We(o,l){Bt++,Sn[Bt]=o.current,o.current=l}var ui={},Mt=dn(ui),qt=dn(!1),ki=ui;function hi(o,l){var p=o.type.contextTypes;if(!p)return ui;var v=o.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===l)return v.__reactInternalMemoizedMaskedChildContext;var E={},w;for(w in p)E[w]=l[w];return v&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=l,o.__reactInternalMemoizedMaskedChildContext=E),E}function fn(o){return o=o.childContextTypes,o!=null}function Kt(){at(qt),at(Mt)}function Hi(o,l,p){if(Mt.current!==ui)throw Error(a(168));We(Mt,l),We(qt,p)}function Zs(o,l,p){var v=o.stateNode;if(l=l.childContextTypes,typeof v.getChildContext!="function")return p;v=v.getChildContext();for(var E in v)if(!(E in l))throw Error(a(108,B(o)||"Unknown",E));return s({},p,v)}function Mn(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||ui,ki=Mt.current,We(Mt,o),We(qt,qt.current),!0}function Js(o,l,p){var v=o.stateNode;if(!v)throw Error(a(169));p?(o=Zs(o,l,ki),v.__reactInternalMemoizedMergedChildContext=o,at(qt),at(Mt),We(Mt,o)):at(qt),We(qt,p)}var $n=Math.clz32?Math.clz32:By,Tl=Math.log,zy=Math.LN2;function By(o){return o>>>=0,o===0?32:31-(Tl(o)/zy|0)|0}var Al=64,Cl=4194304;function na(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Rl(o,l){var p=o.pendingLanes;if(p===0)return 0;var v=0,E=o.suspendedLanes,w=o.pingedLanes,F=p&268435455;if(F!==0){var X=F&~E;X!==0?v=na(X):(w&=F,w!==0&&(v=na(w)))}else F=p&~E,F!==0?v=na(F):w!==0&&(v=na(w));if(v===0)return 0;if(l!==0&&l!==v&&!(l&E)&&(E=v&-v,w=l&-l,E>=w||E===16&&(w&4194240)!==0))return l;if(v&4&&(v|=p&16),l=o.entangledLanes,l!==0)for(o=o.entanglements,l&=v;0<l;)p=31-$n(l),E=1<<p,v|=o[p],l&=~E;return v}function ky(o,l){switch(o){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Hy(o,l){for(var p=o.suspendedLanes,v=o.pingedLanes,E=o.expirationTimes,w=o.pendingLanes;0<w;){var F=31-$n(w),X=1<<F,ce=E[F];ce===-1?(!(X&p)||X&v)&&(E[F]=ky(X,l)):ce<=l&&(o.expiredLanes|=X),w&=~X}}function mh(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function gh(o){for(var l=[],p=0;31>p;p++)l.push(o);return l}function ia(o,l,p){o.pendingLanes|=l,l!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,l=31-$n(l),o[l]=p}function Vy(o,l){var p=o.pendingLanes&~l;o.pendingLanes=l,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=l,o.mutableReadLanes&=l,o.entangledLanes&=l,l=o.entanglements;var v=o.eventTimes;for(o=o.expirationTimes;0<p;){var E=31-$n(p),w=1<<E;l[E]=0,v[E]=-1,o[E]=-1,p&=~w}}function _h(o,l){var p=o.entangledLanes|=l;for(o=o.entanglements;p;){var v=31-$n(p),E=1<<v;E&l|o[v]&l&&(o[v]|=l),p&=~E}}var Pt=0;function mm(o){return o&=-o,1<o?4<o?o&268435455?16:536870912:4:1}var vh=i.unstable_scheduleCallback,gm=i.unstable_cancelCallback,Gy=i.unstable_shouldYield,Wy=i.unstable_requestPaint,pn=i.unstable_now,xh=i.unstable_ImmediatePriority,jy=i.unstable_UserBlockingPriority,yh=i.unstable_NormalPriority,Xy=i.unstable_IdlePriority,Pl=null,Vi=null;function qy(o){if(Vi&&typeof Vi.onCommitFiberRoot=="function")try{Vi.onCommitFiberRoot(Pl,o,void 0,(o.current.flags&128)===128)}catch{}}function Yy(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var Gi=typeof Object.is=="function"?Object.is:Yy,rr=null,Ll=!1,Sh=!1;function _m(o){rr===null?rr=[o]:rr.push(o)}function Zy(o){Ll=!0,_m(o)}function Wi(){if(!Sh&&rr!==null){Sh=!0;var o=0,l=Pt;try{var p=rr;for(Pt=1;o<p.length;o++){var v=p[o];do v=v(!0);while(v!==null)}rr=null,Ll=!1}catch(E){throw rr!==null&&(rr=rr.slice(o+1)),vh(xh,Wi),E}finally{Pt=l,Sh=!1}}return null}var Jy=c.ReactCurrentBatchConfig;function Il(o,l){if(Gi(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var p=Object.keys(o),v=Object.keys(l);if(p.length!==v.length)return!1;for(v=0;v<p.length;v++){var E=p[v];if(!Gt.call(l,E)||!Gi(o[E],l[E]))return!1}return!0}function Ky(o){switch(o.tag){case 5:return dt(o.type);case 16:return dt("Lazy");case 13:return dt("Suspense");case 19:return dt("SuspenseList");case 0:case 2:case 15:return o=ft(o.type,!1),o;case 11:return o=ft(o.type.render,!1),o;case 1:return o=ft(o.type,!0),o;default:return""}}function bi(o,l){if(o&&o.defaultProps){l=s({},l),o=o.defaultProps;for(var p in o)l[p]===void 0&&(l[p]=o[p]);return l}return l}var Nl=dn(null),Dl=null,Ks=null,Mh=null;function Eh(){Mh=Ks=Dl=null}function vm(o,l,p){Pe?(We(Nl,l._currentValue),l._currentValue=p):(We(Nl,l._currentValue2),l._currentValue2=p)}function bh(o){var l=Nl.current;at(Nl),Pe?o._currentValue=l:o._currentValue2=l}function wh(o,l,p){for(;o!==null;){var v=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,v!==null&&(v.childLanes|=l)):v!==null&&(v.childLanes&l)!==l&&(v.childLanes|=l),o===p)break;o=o.return}}function Qs(o,l){Dl=o,Mh=Ks=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&l&&(ni=!0),o.firstContext=null)}function di(o){var l=Pe?o._currentValue:o._currentValue2;if(Mh!==o)if(o={context:o,memoizedValue:l,next:null},Ks===null){if(Dl===null)throw Error(a(308));Ks=o,Dl.dependencies={lanes:0,firstContext:o}}else Ks=Ks.next=o;return l}var ji=null,Ar=!1;function Th(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xm(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function sr(o,l){return{eventTime:o,lane:l,tag:0,payload:null,callback:null,next:null}}function Cr(o,l){var p=o.updateQueue;p!==null&&(p=p.shared,rn!==null&&o.mode&1&&!(Et&2)?(o=p.interleaved,o===null?(l.next=l,ji===null?ji=[p]:ji.push(p)):(l.next=o.next,o.next=l),p.interleaved=l):(o=p.pending,o===null?l.next=l:(l.next=o.next,o.next=l),p.pending=l))}function Ul(o,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194240)!==0)){var v=l.lanes;v&=o.pendingLanes,p|=v,l.lanes=p,_h(o,p)}}function ym(o,l){var p=o.updateQueue,v=o.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var E=null,w=null;if(p=p.firstBaseUpdate,p!==null){do{var F={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};w===null?E=w=F:w=w.next=F,p=p.next}while(p!==null);w===null?E=w=l:w=w.next=l}else E=w=l;p={baseState:v.baseState,firstBaseUpdate:E,lastBaseUpdate:w,shared:v.shared,effects:v.effects},o.updateQueue=p;return}o=p.lastBaseUpdate,o===null?p.firstBaseUpdate=l:o.next=l,p.lastBaseUpdate=l}function Ol(o,l,p,v){var E=o.updateQueue;Ar=!1;var w=E.firstBaseUpdate,F=E.lastBaseUpdate,X=E.shared.pending;if(X!==null){E.shared.pending=null;var ce=X,we=ce.next;ce.next=null,F===null?w=we:F.next=we,F=ce;var je=o.alternate;je!==null&&(je=je.updateQueue,X=je.lastBaseUpdate,X!==F&&(X===null?je.firstBaseUpdate=we:X.next=we,je.lastBaseUpdate=ce))}if(w!==null){var pt=E.baseState;F=0,je=we=ce=null,X=w;do{var nt=X.lane,Ft=X.eventTime;if((v&nt)===nt){je!==null&&(je=je.next={eventTime:Ft,lane:0,tag:X.tag,payload:X.payload,callback:X.callback,next:null});e:{var Qe=o,Ln=X;switch(nt=l,Ft=p,Ln.tag){case 1:if(Qe=Ln.payload,typeof Qe=="function"){pt=Qe.call(Ft,pt,nt);break e}pt=Qe;break e;case 3:Qe.flags=Qe.flags&-65537|128;case 0:if(Qe=Ln.payload,nt=typeof Qe=="function"?Qe.call(Ft,pt,nt):Qe,nt==null)break e;pt=s({},pt,nt);break e;case 2:Ar=!0}}X.callback!==null&&X.lane!==0&&(o.flags|=64,nt=E.effects,nt===null?E.effects=[X]:nt.push(X))}else Ft={eventTime:Ft,lane:nt,tag:X.tag,payload:X.payload,callback:X.callback,next:null},je===null?(we=je=Ft,ce=pt):je=je.next=Ft,F|=nt;if(X=X.next,X===null){if(X=E.shared.pending,X===null)break;nt=X,X=nt.next,nt.next=null,E.lastBaseUpdate=nt,E.shared.pending=null}}while(!0);if(je===null&&(ce=pt),E.baseState=ce,E.firstBaseUpdate=we,E.lastBaseUpdate=je,l=E.shared.interleaved,l!==null){E=l;do F|=E.lane,E=E.next;while(E!==l)}else w===null&&(E.shared.lanes=0);ao|=F,o.lanes=F,o.memoizedState=pt}}function Sm(o,l,p){if(o=l.effects,l.effects=null,o!==null)for(l=0;l<o.length;l++){var v=o[l],E=v.callback;if(E!==null){if(v.callback=null,v=p,typeof E!="function")throw Error(a(191,E));E.call(v)}}}var Mm=new n.Component().refs;function Ah(o,l,p,v){l=o.memoizedState,p=p(v,l),p=p==null?l:s({},l,p),o.memoizedState=p,o.lanes===0&&(o.updateQueue.baseState=p)}var Fl={isMounted:function(o){return(o=o._reactInternals)?A(o)===o:!1},enqueueSetState:function(o,l,p){o=o._reactInternals;var v=kn(),E=Lr(o),w=sr(v,E);w.payload=l,p!=null&&(w.callback=p),Cr(o,w),l=_i(o,E,v),l!==null&&Ul(l,o,E)},enqueueReplaceState:function(o,l,p){o=o._reactInternals;var v=kn(),E=Lr(o),w=sr(v,E);w.tag=1,w.payload=l,p!=null&&(w.callback=p),Cr(o,w),l=_i(o,E,v),l!==null&&Ul(l,o,E)},enqueueForceUpdate:function(o,l){o=o._reactInternals;var p=kn(),v=Lr(o),E=sr(p,v);E.tag=2,l!=null&&(E.callback=l),Cr(o,E),l=_i(o,v,p),l!==null&&Ul(l,o,v)}};function Em(o,l,p,v,E,w,F){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(v,w,F):l.prototype&&l.prototype.isPureReactComponent?!Il(p,v)||!Il(E,w):!0}function bm(o,l,p){var v=!1,E=ui,w=l.contextType;return typeof w=="object"&&w!==null?w=di(w):(E=fn(l)?ki:Mt.current,v=l.contextTypes,w=(v=v!=null)?hi(o,E):ui),l=new l(p,w),o.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Fl,o.stateNode=l,l._reactInternals=o,v&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=E,o.__reactInternalMemoizedMaskedChildContext=w),l}function wm(o,l,p,v){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,v),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,v),l.state!==o&&Fl.enqueueReplaceState(l,l.state,null)}function Ch(o,l,p,v){var E=o.stateNode;E.props=p,E.state=o.memoizedState,E.refs=Mm,Th(o);var w=l.contextType;typeof w=="object"&&w!==null?E.context=di(w):(w=fn(l)?ki:Mt.current,E.context=hi(o,w)),E.state=o.memoizedState,w=l.getDerivedStateFromProps,typeof w=="function"&&(Ah(o,l,w,p),E.state=o.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(l=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),l!==E.state&&Fl.enqueueReplaceState(E,E.state,null),Ol(o,p,E,v),E.state=o.memoizedState),typeof E.componentDidMount=="function"&&(o.flags|=4194308)}var $s=[],eo=0,zl=null,Bl=0,fi=[],pi=0,ts=null,or=1,ar="";function ns(o,l){$s[eo++]=Bl,$s[eo++]=zl,zl=o,Bl=l}function Tm(o,l,p){fi[pi++]=or,fi[pi++]=ar,fi[pi++]=ts,ts=o;var v=or;o=ar;var E=32-$n(v)-1;v&=~(1<<E),p+=1;var w=32-$n(l)+E;if(30<w){var F=E-E%5;w=(v&(1<<F)-1).toString(32),v>>=F,E-=F,or=1<<32-$n(l)+E|p<<E|v,ar=w+o}else or=1<<w|p<<E|v,ar=o}function Rh(o){o.return!==null&&(ns(o,1),Tm(o,1,0))}function Ph(o){for(;o===zl;)zl=$s[--eo],$s[eo]=null,Bl=$s[--eo],$s[eo]=null;for(;o===ts;)ts=fi[--pi],fi[pi]=null,ar=fi[--pi],fi[pi]=null,or=fi[--pi],fi[pi]=null}var ei=null,ti=null,Vt=!1,ra=!1,wi=null;function Am(o,l){var p=vi(5,null,null,0);p.elementType="DELETED",p.stateNode=l,p.return=o,l=o.deletions,l===null?(o.deletions=[p],o.flags|=16):l.push(p)}function Cm(o,l){switch(o.tag){case 5:return l=Ct(l,o.type,o.pendingProps),l!==null?(o.stateNode=l,ei=o,ti=Ys(l),!0):!1;case 6:return l=yn(l,o.pendingProps),l!==null?(o.stateNode=l,ei=o,ti=null,!0):!1;case 13:if(l=ci(l),l!==null){var p=ts!==null?{id:or,overflow:ar}:null;return o.memoizedState={dehydrated:l,treeContext:p,retryLane:1073741824},p=vi(18,null,null,0),p.stateNode=l,p.return=o,o.child=p,ei=o,ti=null,!0}return!1;default:return!1}}function Lh(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Ih(o){if(Vt){var l=ti;if(l){var p=l;if(!Cm(o,l)){if(Lh(o))throw Error(a(418));l=Tr(p);var v=ei;l&&Cm(o,l)?Am(v,p):(o.flags=o.flags&-4097|2,Vt=!1,ei=o)}}else{if(Lh(o))throw Error(a(418));o.flags=o.flags&-4097|2,Vt=!1,ei=o}}}function Rm(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;ei=o}function sa(o){if(!ve||o!==ei)return!1;if(!Vt)return Rm(o),Vt=!0,!1;if(o.tag!==3&&(o.tag!==5||He(o.type)&&!be(o.type,o.memoizedProps))){var l=ti;if(l){if(Lh(o)){for(o=ti;o;)o=Tr(o);throw Error(a(418))}for(;l;)Am(o,l),l=Tr(l)}}if(Rm(o),o.tag===13){if(!ve)throw Error(a(316));if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));ti=O(o)}else ti=ei?Tr(o.stateNode):null;return!0}function to(){ve&&(ti=ei=null,ra=Vt=!1)}function Nh(o){wi===null?wi=[o]:wi.push(o)}function oa(o,l,p){if(o=p.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(a(309));var v=p.stateNode}if(!v)throw Error(a(147,o));var E=v,w=""+o;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===w?l.ref:(l=function(F){var X=E.refs;X===Mm&&(X=E.refs={}),F===null?delete X[w]:X[w]=F},l._stringRef=w,l)}if(typeof o!="string")throw Error(a(284));if(!p._owner)throw Error(a(290,o))}return o}function kl(o,l){throw o=Object.prototype.toString.call(l),Error(a(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o))}function Pm(o){var l=o._init;return l(o._payload)}function Lm(o){function l(ne,Y){if(o){var ae=ne.deletions;ae===null?(ne.deletions=[Y],ne.flags|=16):ae.push(Y)}}function p(ne,Y){if(!o)return null;for(;Y!==null;)l(ne,Y),Y=Y.sibling;return null}function v(ne,Y){for(ne=new Map;Y!==null;)Y.key!==null?ne.set(Y.key,Y):ne.set(Y.index,Y),Y=Y.sibling;return ne}function E(ne,Y){return ne=Nr(ne,Y),ne.index=0,ne.sibling=null,ne}function w(ne,Y,ae){return ne.index=ae,o?(ae=ne.alternate,ae!==null?(ae=ae.index,ae<Y?(ne.flags|=2,Y):ae):(ne.flags|=2,Y)):(ne.flags|=1048576,Y)}function F(ne){return o&&ne.alternate===null&&(ne.flags|=2),ne}function X(ne,Y,ae,ze){return Y===null||Y.tag!==6?(Y=gd(ae,ne.mode,ze),Y.return=ne,Y):(Y=E(Y,ae),Y.return=ne,Y)}function ce(ne,Y,ae,ze){var Ze=ae.type;return Ze===d?je(ne,Y,ae.props.children,ze,ae.key):Y!==null&&(Y.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===M&&Pm(Ze)===Y.type)?(ze=E(Y,ae.props),ze.ref=oa(ne,Y,ae),ze.return=ne,ze):(ze=_c(ae.type,ae.key,ae.props,null,ne.mode,ze),ze.ref=oa(ne,Y,ae),ze.return=ne,ze)}function we(ne,Y,ae,ze){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ae.containerInfo||Y.stateNode.implementation!==ae.implementation?(Y=_d(ae,ne.mode,ze),Y.return=ne,Y):(Y=E(Y,ae.children||[]),Y.return=ne,Y)}function je(ne,Y,ae,ze,Ze){return Y===null||Y.tag!==7?(Y=cs(ae,ne.mode,ze,Ze),Y.return=ne,Y):(Y=E(Y,ae),Y.return=ne,Y)}function pt(ne,Y,ae){if(typeof Y=="string"&&Y!==""||typeof Y=="number")return Y=gd(""+Y,ne.mode,ae),Y.return=ne,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case u:return ae=_c(Y.type,Y.key,Y.props,null,ne.mode,ae),ae.ref=oa(ne,null,Y),ae.return=ne,ae;case h:return Y=_d(Y,ne.mode,ae),Y.return=ne,Y;case M:var ze=Y._init;return pt(ne,ze(Y._payload),ae)}if(q(Y)||C(Y))return Y=cs(Y,ne.mode,ae,null),Y.return=ne,Y;kl(ne,Y)}return null}function nt(ne,Y,ae,ze){var Ze=Y!==null?Y.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number")return Ze!==null?null:X(ne,Y,""+ae,ze);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case u:return ae.key===Ze?ce(ne,Y,ae,ze):null;case h:return ae.key===Ze?we(ne,Y,ae,ze):null;case M:return Ze=ae._init,nt(ne,Y,Ze(ae._payload),ze)}if(q(ae)||C(ae))return Ze!==null?null:je(ne,Y,ae,ze,null);kl(ne,ae)}return null}function Ft(ne,Y,ae,ze,Ze){if(typeof ze=="string"&&ze!==""||typeof ze=="number")return ne=ne.get(ae)||null,X(Y,ne,""+ze,Ze);if(typeof ze=="object"&&ze!==null){switch(ze.$$typeof){case u:return ne=ne.get(ze.key===null?ae:ze.key)||null,ce(Y,ne,ze,Ze);case h:return ne=ne.get(ze.key===null?ae:ze.key)||null,we(Y,ne,ze,Ze);case M:var xt=ze._init;return Ft(ne,Y,ae,xt(ze._payload),Ze)}if(q(ze)||C(ze))return ne=ne.get(ae)||null,je(Y,ne,ze,Ze,null);kl(Y,ze)}return null}function Qe(ne,Y,ae,ze){for(var Ze=null,xt=null,mt=Y,Lt=Y=0,gn=null;mt!==null&&Lt<ae.length;Lt++){mt.index>Lt?(gn=mt,mt=null):gn=mt.sibling;var It=nt(ne,mt,ae[Lt],ze);if(It===null){mt===null&&(mt=gn);break}o&&mt&&It.alternate===null&&l(ne,mt),Y=w(It,Y,Lt),xt===null?Ze=It:xt.sibling=It,xt=It,mt=gn}if(Lt===ae.length)return p(ne,mt),Vt&&ns(ne,Lt),Ze;if(mt===null){for(;Lt<ae.length;Lt++)mt=pt(ne,ae[Lt],ze),mt!==null&&(Y=w(mt,Y,Lt),xt===null?Ze=mt:xt.sibling=mt,xt=mt);return Vt&&ns(ne,Lt),Ze}for(mt=v(ne,mt);Lt<ae.length;Lt++)gn=Ft(mt,ne,Lt,ae[Lt],ze),gn!==null&&(o&&gn.alternate!==null&&mt.delete(gn.key===null?Lt:gn.key),Y=w(gn,Y,Lt),xt===null?Ze=gn:xt.sibling=gn,xt=gn);return o&&mt.forEach(function(Dr){return l(ne,Dr)}),Vt&&ns(ne,Lt),Ze}function Ln(ne,Y,ae,ze){var Ze=C(ae);if(typeof Ze!="function")throw Error(a(150));if(ae=Ze.call(ae),ae==null)throw Error(a(151));for(var xt=Ze=null,mt=Y,Lt=Y=0,gn=null,It=ae.next();mt!==null&&!It.done;Lt++,It=ae.next()){mt.index>Lt?(gn=mt,mt=null):gn=mt.sibling;var Dr=nt(ne,mt,It.value,ze);if(Dr===null){mt===null&&(mt=gn);break}o&&mt&&Dr.alternate===null&&l(ne,mt),Y=w(Dr,Y,Lt),xt===null?Ze=Dr:xt.sibling=Dr,xt=Dr,mt=gn}if(It.done)return p(ne,mt),Vt&&ns(ne,Lt),Ze;if(mt===null){for(;!It.done;Lt++,It=ae.next())It=pt(ne,It.value,ze),It!==null&&(Y=w(It,Y,Lt),xt===null?Ze=It:xt.sibling=It,xt=It);return Vt&&ns(ne,Lt),Ze}for(mt=v(ne,mt);!It.done;Lt++,It=ae.next())It=Ft(mt,ne,Lt,It.value,ze),It!==null&&(o&&It.alternate!==null&&mt.delete(It.key===null?Lt:It.key),Y=w(It,Y,Lt),xt===null?Ze=It:xt.sibling=It,xt=It);return o&&mt.forEach(function(AS){return l(ne,AS)}),Vt&&ns(ne,Lt),Ze}function xi(ne,Y,ae,ze){if(typeof ae=="object"&&ae!==null&&ae.type===d&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case u:e:{for(var Ze=ae.key,xt=Y;xt!==null;){if(xt.key===Ze){if(Ze=ae.type,Ze===d){if(xt.tag===7){p(ne,xt.sibling),Y=E(xt,ae.props.children),Y.return=ne,ne=Y;break e}}else if(xt.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===M&&Pm(Ze)===xt.type){p(ne,xt.sibling),Y=E(xt,ae.props),Y.ref=oa(ne,xt,ae),Y.return=ne,ne=Y;break e}p(ne,xt);break}else l(ne,xt);xt=xt.sibling}ae.type===d?(Y=cs(ae.props.children,ne.mode,ze,ae.key),Y.return=ne,ne=Y):(ze=_c(ae.type,ae.key,ae.props,null,ne.mode,ze),ze.ref=oa(ne,Y,ae),ze.return=ne,ne=ze)}return F(ne);case h:e:{for(xt=ae.key;Y!==null;){if(Y.key===xt)if(Y.tag===4&&Y.stateNode.containerInfo===ae.containerInfo&&Y.stateNode.implementation===ae.implementation){p(ne,Y.sibling),Y=E(Y,ae.children||[]),Y.return=ne,ne=Y;break e}else{p(ne,Y);break}else l(ne,Y);Y=Y.sibling}Y=_d(ae,ne.mode,ze),Y.return=ne,ne=Y}return F(ne);case M:return xt=ae._init,xi(ne,Y,xt(ae._payload),ze)}if(q(ae))return Qe(ne,Y,ae,ze);if(C(ae))return Ln(ne,Y,ae,ze);kl(ne,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,Y!==null&&Y.tag===6?(p(ne,Y.sibling),Y=E(Y,ae),Y.return=ne,ne=Y):(p(ne,Y),Y=gd(ae,ne.mode,ze),Y.return=ne,ne=Y),F(ne)):p(ne,Y)}return xi}var no=Lm(!0),Im=Lm(!1),aa={},mi=dn(aa),la=dn(aa),io=dn(aa);function Xi(o){if(o===aa)throw Error(a(174));return o}function Dh(o,l){We(io,l),We(la,o),We(mi,aa),o=le(l),at(mi),We(mi,o)}function ro(){at(mi),at(la),at(io)}function Nm(o){var l=Xi(io.current),p=Xi(mi.current);l=j(p,o.type,l),p!==l&&(We(la,o),We(mi,l))}function Uh(o){la.current===o&&(at(mi),at(la))}var Wt=dn(0);function Hl(o){for(var l=o;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||ea(p)||ta(p)))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if(l.flags&128)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Oh=[];function Fh(){for(var o=0;o<Oh.length;o++){var l=Oh[o];Pe?l._workInProgressVersionPrimary=null:l._workInProgressVersionSecondary=null}Oh.length=0}var Vl=c.ReactCurrentDispatcher,gi=c.ReactCurrentBatchConfig,so=0,Yt=null,Cn=null,mn=null,Gl=!1,ca=!1,ua=0,Qy=0;function Rn(){throw Error(a(321))}function zh(o,l){if(l===null)return!1;for(var p=0;p<l.length&&p<o.length;p++)if(!Gi(o[p],l[p]))return!1;return!0}function Bh(o,l,p,v,E,w){if(so=w,Yt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Vl.current=o===null||o.memoizedState===null?nS:iS,o=p(v,E),ca){w=0;do{if(ca=!1,ua=0,25<=w)throw Error(a(301));w+=1,mn=Cn=null,l.updateQueue=null,Vl.current=rS,o=p(v,E)}while(ca)}if(Vl.current=Yl,l=Cn!==null&&Cn.next!==null,so=0,mn=Cn=Yt=null,Gl=!1,l)throw Error(a(300));return o}function kh(){var o=ua!==0;return ua=0,o}function lr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?Yt.memoizedState=mn=o:mn=mn.next=o,mn}function qi(){if(Cn===null){var o=Yt.alternate;o=o!==null?o.memoizedState:null}else o=Cn.next;var l=mn===null?Yt.memoizedState:mn.next;if(l!==null)mn=l,Cn=o;else{if(o===null)throw Error(a(310));Cn=o,o={memoizedState:Cn.memoizedState,baseState:Cn.baseState,baseQueue:Cn.baseQueue,queue:Cn.queue,next:null},mn===null?Yt.memoizedState=mn=o:mn=mn.next=o}return mn}function is(o,l){return typeof l=="function"?l(o):l}function Wl(o){var l=qi(),p=l.queue;if(p===null)throw Error(a(311));p.lastRenderedReducer=o;var v=Cn,E=v.baseQueue,w=p.pending;if(w!==null){if(E!==null){var F=E.next;E.next=w.next,w.next=F}v.baseQueue=E=w,p.pending=null}if(E!==null){w=E.next,v=v.baseState;var X=F=null,ce=null,we=w;do{var je=we.lane;if((so&je)===je)ce!==null&&(ce=ce.next={lane:0,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null}),v=we.hasEagerState?we.eagerState:o(v,we.action);else{var pt={lane:je,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};ce===null?(X=ce=pt,F=v):ce=ce.next=pt,Yt.lanes|=je,ao|=je}we=we.next}while(we!==null&&we!==w);ce===null?F=v:ce.next=X,Gi(v,l.memoizedState)||(ni=!0),l.memoizedState=v,l.baseState=F,l.baseQueue=ce,p.lastRenderedState=v}if(o=p.interleaved,o!==null){E=o;do w=E.lane,Yt.lanes|=w,ao|=w,E=E.next;while(E!==o)}else E===null&&(p.lanes=0);return[l.memoizedState,p.dispatch]}function jl(o){var l=qi(),p=l.queue;if(p===null)throw Error(a(311));p.lastRenderedReducer=o;var v=p.dispatch,E=p.pending,w=l.memoizedState;if(E!==null){p.pending=null;var F=E=E.next;do w=o(w,F.action),F=F.next;while(F!==E);Gi(w,l.memoizedState)||(ni=!0),l.memoizedState=w,l.baseQueue===null&&(l.baseState=w),p.lastRenderedState=w}return[w,v]}function Dm(){}function Um(o,l){var p=Yt,v=qi(),E=l(),w=!Gi(v.memoizedState,E);if(w&&(v.memoizedState=E,ni=!0),v=v.queue,da(zm.bind(null,p,v,o),[o]),v.getSnapshot!==l||w||mn!==null&&mn.memoizedState.tag&1){if(p.flags|=2048,ha(9,Fm.bind(null,p,v,E,l),void 0,null),rn===null)throw Error(a(349));so&30||Om(p,l,E)}return E}function Om(o,l,p){o.flags|=16384,o={getSnapshot:l,value:p},l=Yt.updateQueue,l===null?(l={lastEffect:null,stores:null},Yt.updateQueue=l,l.stores=[o]):(p=l.stores,p===null?l.stores=[o]:p.push(o))}function Fm(o,l,p,v){l.value=p,l.getSnapshot=v,Bm(l)&&_i(o,1,-1)}function zm(o,l,p){return p(function(){Bm(l)&&_i(o,1,-1)})}function Bm(o){var l=o.getSnapshot;o=o.value;try{var p=l();return!Gi(o,p)}catch{return!0}}function Hh(o){var l=lr();return typeof o=="function"&&(o=o()),l.memoizedState=l.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:is,lastRenderedState:o},l.queue=o,o=o.dispatch=tS.bind(null,Yt,o),[l.memoizedState,o]}function ha(o,l,p,v){return o={tag:o,create:l,destroy:p,deps:v,next:null},l=Yt.updateQueue,l===null?(l={lastEffect:null,stores:null},Yt.updateQueue=l,l.lastEffect=o.next=o):(p=l.lastEffect,p===null?l.lastEffect=o.next=o:(v=p.next,p.next=o,o.next=v,l.lastEffect=o)),o}function km(){return qi().memoizedState}function Xl(o,l,p,v){var E=lr();Yt.flags|=o,E.memoizedState=ha(1|l,p,void 0,v===void 0?null:v)}function ql(o,l,p,v){var E=qi();v=v===void 0?null:v;var w=void 0;if(Cn!==null){var F=Cn.memoizedState;if(w=F.destroy,v!==null&&zh(v,F.deps)){E.memoizedState=ha(l,p,w,v);return}}Yt.flags|=o,E.memoizedState=ha(1|l,p,w,v)}function Vh(o,l){return Xl(8390656,8,o,l)}function da(o,l){return ql(2048,8,o,l)}function Hm(o,l){return ql(4,2,o,l)}function Vm(o,l){return ql(4,4,o,l)}function Gm(o,l){if(typeof l=="function")return o=o(),l(o),function(){l(null)};if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function Wm(o,l,p){return p=p!=null?p.concat([o]):null,ql(4,4,Gm.bind(null,l,o),p)}function Gh(){}function jm(o,l){var p=qi();l=l===void 0?null:l;var v=p.memoizedState;return v!==null&&l!==null&&zh(l,v[1])?v[0]:(p.memoizedState=[o,l],o)}function Xm(o,l){var p=qi();l=l===void 0?null:l;var v=p.memoizedState;return v!==null&&l!==null&&zh(l,v[1])?v[0]:(o=o(),p.memoizedState=[o,l],o)}function $y(o,l){var p=Pt;Pt=p!==0&&4>p?p:4,o(!0);var v=gi.transition;gi.transition={};try{o(!1),l()}finally{Pt=p,gi.transition=v}}function qm(){return qi().memoizedState}function eS(o,l,p){var v=Lr(o);p={lane:v,action:p,hasEagerState:!1,eagerState:null,next:null},Ym(o)?Zm(l,p):(Jm(o,l,p),p=kn(),o=_i(o,v,p),o!==null&&Km(o,l,v))}function tS(o,l,p){var v=Lr(o),E={lane:v,action:p,hasEagerState:!1,eagerState:null,next:null};if(Ym(o))Zm(l,E);else{Jm(o,l,E);var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var F=l.lastRenderedState,X=w(F,p);if(E.hasEagerState=!0,E.eagerState=X,Gi(X,F))return}catch{}finally{}p=kn(),o=_i(o,v,p),o!==null&&Km(o,l,v)}}function Ym(o){var l=o.alternate;return o===Yt||l!==null&&l===Yt}function Zm(o,l){ca=Gl=!0;var p=o.pending;p===null?l.next=l:(l.next=p.next,p.next=l),o.pending=l}function Jm(o,l,p){rn!==null&&o.mode&1&&!(Et&2)?(o=l.interleaved,o===null?(p.next=p,ji===null?ji=[l]:ji.push(l)):(p.next=o.next,o.next=p),l.interleaved=p):(o=l.pending,o===null?p.next=p:(p.next=o.next,o.next=p),l.pending=p)}function Km(o,l,p){if(p&4194240){var v=l.lanes;v&=o.pendingLanes,p|=v,l.lanes=p,_h(o,p)}}var Yl={readContext:di,useCallback:Rn,useContext:Rn,useEffect:Rn,useImperativeHandle:Rn,useInsertionEffect:Rn,useLayoutEffect:Rn,useMemo:Rn,useReducer:Rn,useRef:Rn,useState:Rn,useDebugValue:Rn,useDeferredValue:Rn,useTransition:Rn,useMutableSource:Rn,useSyncExternalStore:Rn,useId:Rn,unstable_isNewReconciler:!1},nS={readContext:di,useCallback:function(o,l){return lr().memoizedState=[o,l===void 0?null:l],o},useContext:di,useEffect:Vh,useImperativeHandle:function(o,l,p){return p=p!=null?p.concat([o]):null,Xl(4194308,4,Gm.bind(null,l,o),p)},useLayoutEffect:function(o,l){return Xl(4194308,4,o,l)},useInsertionEffect:function(o,l){return Xl(4,2,o,l)},useMemo:function(o,l){var p=lr();return l=l===void 0?null:l,o=o(),p.memoizedState=[o,l],o},useReducer:function(o,l,p){var v=lr();return l=p!==void 0?p(l):l,v.memoizedState=v.baseState=l,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:l},v.queue=o,o=o.dispatch=eS.bind(null,Yt,o),[v.memoizedState,o]},useRef:function(o){var l=lr();return o={current:o},l.memoizedState=o},useState:Hh,useDebugValue:Gh,useDeferredValue:function(o){var l=Hh(o),p=l[0],v=l[1];return Vh(function(){var E=gi.transition;gi.transition={};try{v(o)}finally{gi.transition=E}},[o]),p},useTransition:function(){var o=Hh(!1),l=o[0];return o=$y.bind(null,o[1]),lr().memoizedState=o,[l,o]},useMutableSource:function(){},useSyncExternalStore:function(o,l,p){var v=Yt,E=lr();if(Vt){if(p===void 0)throw Error(a(407));p=p()}else{if(p=l(),rn===null)throw Error(a(349));so&30||Om(v,l,p)}E.memoizedState=p;var w={value:p,getSnapshot:l};return E.queue=w,Vh(zm.bind(null,v,w,o),[o]),v.flags|=2048,ha(9,Fm.bind(null,v,w,p,l),void 0,null),p},useId:function(){var o=lr(),l=rn.identifierPrefix;if(Vt){var p=ar,v=or;p=(v&~(1<<32-$n(v)-1)).toString(32)+p,l=":"+l+"R"+p,p=ua++,0<p&&(l+="H"+p.toString(32)),l+=":"}else p=Qy++,l=":"+l+"r"+p.toString(32)+":";return o.memoizedState=l},unstable_isNewReconciler:!1},iS={readContext:di,useCallback:jm,useContext:di,useEffect:da,useImperativeHandle:Wm,useInsertionEffect:Hm,useLayoutEffect:Vm,useMemo:Xm,useReducer:Wl,useRef:km,useState:function(){return Wl(is)},useDebugValue:Gh,useDeferredValue:function(o){var l=Wl(is),p=l[0],v=l[1];return da(function(){var E=gi.transition;gi.transition={};try{v(o)}finally{gi.transition=E}},[o]),p},useTransition:function(){var o=Wl(is)[0],l=qi().memoizedState;return[o,l]},useMutableSource:Dm,useSyncExternalStore:Um,useId:qm,unstable_isNewReconciler:!1},rS={readContext:di,useCallback:jm,useContext:di,useEffect:da,useImperativeHandle:Wm,useInsertionEffect:Hm,useLayoutEffect:Vm,useMemo:Xm,useReducer:jl,useRef:km,useState:function(){return jl(is)},useDebugValue:Gh,useDeferredValue:function(o){var l=jl(is),p=l[0],v=l[1];return da(function(){var E=gi.transition;gi.transition={};try{v(o)}finally{gi.transition=E}},[o]),p},useTransition:function(){var o=jl(is)[0],l=qi().memoizedState;return[o,l]},useMutableSource:Dm,useSyncExternalStore:Um,useId:qm,unstable_isNewReconciler:!1};function Wh(o,l){try{var p="",v=l;do p+=Ky(v),v=v.return;while(v);var E=p}catch(w){E=`
3715
+ `+E[F].replace(" at new "," at ");return o.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",o.displayName)),ce}while(1<=F&&0<=X);break}}}finally{ut=!1,Error.prepareStackTrace=p}return(o=o?o.displayName||o.name:"")?dt(o):""}var Gt=Object.prototype.hasOwnProperty,Sn=[],Bt=-1;function dn(o){return{current:o}}function at(o){0>Bt||(o.current=Sn[Bt],Sn[Bt]=null,Bt--)}function We(o,l){Bt++,Sn[Bt]=o.current,o.current=l}var ui={},Mt=dn(ui),qt=dn(!1),ki=ui;function hi(o,l){var p=o.type.contextTypes;if(!p)return ui;var v=o.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===l)return v.__reactInternalMemoizedMaskedChildContext;var E={},w;for(w in p)E[w]=l[w];return v&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=l,o.__reactInternalMemoizedMaskedChildContext=E),E}function fn(o){return o=o.childContextTypes,o!=null}function Kt(){at(qt),at(Mt)}function Hi(o,l,p){if(Mt.current!==ui)throw Error(a(168));We(Mt,l),We(qt,p)}function Zs(o,l,p){var v=o.stateNode;if(l=l.childContextTypes,typeof v.getChildContext!="function")return p;v=v.getChildContext();for(var E in v)if(!(E in l))throw Error(a(108,B(o)||"Unknown",E));return s({},p,v)}function Mn(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||ui,ki=Mt.current,We(Mt,o),We(qt,qt.current),!0}function Js(o,l,p){var v=o.stateNode;if(!v)throw Error(a(169));p?(o=Zs(o,l,ki),v.__reactInternalMemoizedMergedChildContext=o,at(qt),at(Mt),We(Mt,o)):at(qt),We(qt,p)}var $n=Math.clz32?Math.clz32:By,Tl=Math.log,zy=Math.LN2;function By(o){return o>>>=0,o===0?32:31-(Tl(o)/zy|0)|0}var Al=64,Cl=4194304;function na(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Rl(o,l){var p=o.pendingLanes;if(p===0)return 0;var v=0,E=o.suspendedLanes,w=o.pingedLanes,F=p&268435455;if(F!==0){var X=F&~E;X!==0?v=na(X):(w&=F,w!==0&&(v=na(w)))}else F=p&~E,F!==0?v=na(F):w!==0&&(v=na(w));if(v===0)return 0;if(l!==0&&l!==v&&!(l&E)&&(E=v&-v,w=l&-l,E>=w||E===16&&(w&4194240)!==0))return l;if(v&4&&(v|=p&16),l=o.entangledLanes,l!==0)for(o=o.entanglements,l&=v;0<l;)p=31-$n(l),E=1<<p,v|=o[p],l&=~E;return v}function ky(o,l){switch(o){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Hy(o,l){for(var p=o.suspendedLanes,v=o.pingedLanes,E=o.expirationTimes,w=o.pendingLanes;0<w;){var F=31-$n(w),X=1<<F,ce=E[F];ce===-1?(!(X&p)||X&v)&&(E[F]=ky(X,l)):ce<=l&&(o.expiredLanes|=X),w&=~X}}function mh(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function gh(o){for(var l=[],p=0;31>p;p++)l.push(o);return l}function ia(o,l,p){o.pendingLanes|=l,l!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,l=31-$n(l),o[l]=p}function Vy(o,l){var p=o.pendingLanes&~l;o.pendingLanes=l,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=l,o.mutableReadLanes&=l,o.entangledLanes&=l,l=o.entanglements;var v=o.eventTimes;for(o=o.expirationTimes;0<p;){var E=31-$n(p),w=1<<E;l[E]=0,v[E]=-1,o[E]=-1,p&=~w}}function _h(o,l){var p=o.entangledLanes|=l;for(o=o.entanglements;p;){var v=31-$n(p),E=1<<v;E&l|o[v]&l&&(o[v]|=l),p&=~E}}var Pt=0;function pm(o){return o&=-o,1<o?4<o?o&268435455?16:536870912:4:1}var vh=i.unstable_scheduleCallback,mm=i.unstable_cancelCallback,Gy=i.unstable_shouldYield,Wy=i.unstable_requestPaint,pn=i.unstable_now,xh=i.unstable_ImmediatePriority,jy=i.unstable_UserBlockingPriority,yh=i.unstable_NormalPriority,Xy=i.unstable_IdlePriority,Pl=null,Vi=null;function qy(o){if(Vi&&typeof Vi.onCommitFiberRoot=="function")try{Vi.onCommitFiberRoot(Pl,o,void 0,(o.current.flags&128)===128)}catch{}}function Yy(o,l){return o===l&&(o!==0||1/o===1/l)||o!==o&&l!==l}var Gi=typeof Object.is=="function"?Object.is:Yy,rr=null,Ll=!1,Sh=!1;function gm(o){rr===null?rr=[o]:rr.push(o)}function Zy(o){Ll=!0,gm(o)}function Wi(){if(!Sh&&rr!==null){Sh=!0;var o=0,l=Pt;try{var p=rr;for(Pt=1;o<p.length;o++){var v=p[o];do v=v(!0);while(v!==null)}rr=null,Ll=!1}catch(E){throw rr!==null&&(rr=rr.slice(o+1)),vh(xh,Wi),E}finally{Pt=l,Sh=!1}}return null}var Jy=c.ReactCurrentBatchConfig;function Il(o,l){if(Gi(o,l))return!0;if(typeof o!="object"||o===null||typeof l!="object"||l===null)return!1;var p=Object.keys(o),v=Object.keys(l);if(p.length!==v.length)return!1;for(v=0;v<p.length;v++){var E=p[v];if(!Gt.call(l,E)||!Gi(o[E],l[E]))return!1}return!0}function Ky(o){switch(o.tag){case 5:return dt(o.type);case 16:return dt("Lazy");case 13:return dt("Suspense");case 19:return dt("SuspenseList");case 0:case 2:case 15:return o=ft(o.type,!1),o;case 11:return o=ft(o.type.render,!1),o;case 1:return o=ft(o.type,!0),o;default:return""}}function bi(o,l){if(o&&o.defaultProps){l=s({},l),o=o.defaultProps;for(var p in o)l[p]===void 0&&(l[p]=o[p]);return l}return l}var Nl=dn(null),Dl=null,Ks=null,Mh=null;function Eh(){Mh=Ks=Dl=null}function _m(o,l,p){Pe?(We(Nl,l._currentValue),l._currentValue=p):(We(Nl,l._currentValue2),l._currentValue2=p)}function bh(o){var l=Nl.current;at(Nl),Pe?o._currentValue=l:o._currentValue2=l}function wh(o,l,p){for(;o!==null;){var v=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,v!==null&&(v.childLanes|=l)):v!==null&&(v.childLanes&l)!==l&&(v.childLanes|=l),o===p)break;o=o.return}}function Qs(o,l){Dl=o,Mh=Ks=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&l&&(ni=!0),o.firstContext=null)}function di(o){var l=Pe?o._currentValue:o._currentValue2;if(Mh!==o)if(o={context:o,memoizedValue:l,next:null},Ks===null){if(Dl===null)throw Error(a(308));Ks=o,Dl.dependencies={lanes:0,firstContext:o}}else Ks=Ks.next=o;return l}var ji=null,Ar=!1;function Th(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vm(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function sr(o,l){return{eventTime:o,lane:l,tag:0,payload:null,callback:null,next:null}}function Cr(o,l){var p=o.updateQueue;p!==null&&(p=p.shared,rn!==null&&o.mode&1&&!(Et&2)?(o=p.interleaved,o===null?(l.next=l,ji===null?ji=[p]:ji.push(p)):(l.next=o.next,o.next=l),p.interleaved=l):(o=p.pending,o===null?l.next=l:(l.next=o.next,o.next=l),p.pending=l))}function Ul(o,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194240)!==0)){var v=l.lanes;v&=o.pendingLanes,p|=v,l.lanes=p,_h(o,p)}}function xm(o,l){var p=o.updateQueue,v=o.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var E=null,w=null;if(p=p.firstBaseUpdate,p!==null){do{var F={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};w===null?E=w=F:w=w.next=F,p=p.next}while(p!==null);w===null?E=w=l:w=w.next=l}else E=w=l;p={baseState:v.baseState,firstBaseUpdate:E,lastBaseUpdate:w,shared:v.shared,effects:v.effects},o.updateQueue=p;return}o=p.lastBaseUpdate,o===null?p.firstBaseUpdate=l:o.next=l,p.lastBaseUpdate=l}function Ol(o,l,p,v){var E=o.updateQueue;Ar=!1;var w=E.firstBaseUpdate,F=E.lastBaseUpdate,X=E.shared.pending;if(X!==null){E.shared.pending=null;var ce=X,we=ce.next;ce.next=null,F===null?w=we:F.next=we,F=ce;var je=o.alternate;je!==null&&(je=je.updateQueue,X=je.lastBaseUpdate,X!==F&&(X===null?je.firstBaseUpdate=we:X.next=we,je.lastBaseUpdate=ce))}if(w!==null){var pt=E.baseState;F=0,je=we=ce=null,X=w;do{var nt=X.lane,Ft=X.eventTime;if((v&nt)===nt){je!==null&&(je=je.next={eventTime:Ft,lane:0,tag:X.tag,payload:X.payload,callback:X.callback,next:null});e:{var Qe=o,Ln=X;switch(nt=l,Ft=p,Ln.tag){case 1:if(Qe=Ln.payload,typeof Qe=="function"){pt=Qe.call(Ft,pt,nt);break e}pt=Qe;break e;case 3:Qe.flags=Qe.flags&-65537|128;case 0:if(Qe=Ln.payload,nt=typeof Qe=="function"?Qe.call(Ft,pt,nt):Qe,nt==null)break e;pt=s({},pt,nt);break e;case 2:Ar=!0}}X.callback!==null&&X.lane!==0&&(o.flags|=64,nt=E.effects,nt===null?E.effects=[X]:nt.push(X))}else Ft={eventTime:Ft,lane:nt,tag:X.tag,payload:X.payload,callback:X.callback,next:null},je===null?(we=je=Ft,ce=pt):je=je.next=Ft,F|=nt;if(X=X.next,X===null){if(X=E.shared.pending,X===null)break;nt=X,X=nt.next,nt.next=null,E.lastBaseUpdate=nt,E.shared.pending=null}}while(!0);if(je===null&&(ce=pt),E.baseState=ce,E.firstBaseUpdate=we,E.lastBaseUpdate=je,l=E.shared.interleaved,l!==null){E=l;do F|=E.lane,E=E.next;while(E!==l)}else w===null&&(E.shared.lanes=0);ao|=F,o.lanes=F,o.memoizedState=pt}}function ym(o,l,p){if(o=l.effects,l.effects=null,o!==null)for(l=0;l<o.length;l++){var v=o[l],E=v.callback;if(E!==null){if(v.callback=null,v=p,typeof E!="function")throw Error(a(191,E));E.call(v)}}}var Sm=new n.Component().refs;function Ah(o,l,p,v){l=o.memoizedState,p=p(v,l),p=p==null?l:s({},l,p),o.memoizedState=p,o.lanes===0&&(o.updateQueue.baseState=p)}var Fl={isMounted:function(o){return(o=o._reactInternals)?A(o)===o:!1},enqueueSetState:function(o,l,p){o=o._reactInternals;var v=kn(),E=Lr(o),w=sr(v,E);w.payload=l,p!=null&&(w.callback=p),Cr(o,w),l=_i(o,E,v),l!==null&&Ul(l,o,E)},enqueueReplaceState:function(o,l,p){o=o._reactInternals;var v=kn(),E=Lr(o),w=sr(v,E);w.tag=1,w.payload=l,p!=null&&(w.callback=p),Cr(o,w),l=_i(o,E,v),l!==null&&Ul(l,o,E)},enqueueForceUpdate:function(o,l){o=o._reactInternals;var p=kn(),v=Lr(o),E=sr(p,v);E.tag=2,l!=null&&(E.callback=l),Cr(o,E),l=_i(o,v,p),l!==null&&Ul(l,o,v)}};function Mm(o,l,p,v,E,w,F){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(v,w,F):l.prototype&&l.prototype.isPureReactComponent?!Il(p,v)||!Il(E,w):!0}function Em(o,l,p){var v=!1,E=ui,w=l.contextType;return typeof w=="object"&&w!==null?w=di(w):(E=fn(l)?ki:Mt.current,v=l.contextTypes,w=(v=v!=null)?hi(o,E):ui),l=new l(p,w),o.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Fl,o.stateNode=l,l._reactInternals=o,v&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=E,o.__reactInternalMemoizedMaskedChildContext=w),l}function bm(o,l,p,v){o=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,v),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,v),l.state!==o&&Fl.enqueueReplaceState(l,l.state,null)}function Ch(o,l,p,v){var E=o.stateNode;E.props=p,E.state=o.memoizedState,E.refs=Sm,Th(o);var w=l.contextType;typeof w=="object"&&w!==null?E.context=di(w):(w=fn(l)?ki:Mt.current,E.context=hi(o,w)),E.state=o.memoizedState,w=l.getDerivedStateFromProps,typeof w=="function"&&(Ah(o,l,w,p),E.state=o.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(l=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),l!==E.state&&Fl.enqueueReplaceState(E,E.state,null),Ol(o,p,E,v),E.state=o.memoizedState),typeof E.componentDidMount=="function"&&(o.flags|=4194308)}var $s=[],eo=0,zl=null,Bl=0,fi=[],pi=0,ts=null,or=1,ar="";function ns(o,l){$s[eo++]=Bl,$s[eo++]=zl,zl=o,Bl=l}function wm(o,l,p){fi[pi++]=or,fi[pi++]=ar,fi[pi++]=ts,ts=o;var v=or;o=ar;var E=32-$n(v)-1;v&=~(1<<E),p+=1;var w=32-$n(l)+E;if(30<w){var F=E-E%5;w=(v&(1<<F)-1).toString(32),v>>=F,E-=F,or=1<<32-$n(l)+E|p<<E|v,ar=w+o}else or=1<<w|p<<E|v,ar=o}function Rh(o){o.return!==null&&(ns(o,1),wm(o,1,0))}function Ph(o){for(;o===zl;)zl=$s[--eo],$s[eo]=null,Bl=$s[--eo],$s[eo]=null;for(;o===ts;)ts=fi[--pi],fi[pi]=null,ar=fi[--pi],fi[pi]=null,or=fi[--pi],fi[pi]=null}var ei=null,ti=null,Vt=!1,ra=!1,wi=null;function Tm(o,l){var p=vi(5,null,null,0);p.elementType="DELETED",p.stateNode=l,p.return=o,l=o.deletions,l===null?(o.deletions=[p],o.flags|=16):l.push(p)}function Am(o,l){switch(o.tag){case 5:return l=Ct(l,o.type,o.pendingProps),l!==null?(o.stateNode=l,ei=o,ti=Ys(l),!0):!1;case 6:return l=yn(l,o.pendingProps),l!==null?(o.stateNode=l,ei=o,ti=null,!0):!1;case 13:if(l=ci(l),l!==null){var p=ts!==null?{id:or,overflow:ar}:null;return o.memoizedState={dehydrated:l,treeContext:p,retryLane:1073741824},p=vi(18,null,null,0),p.stateNode=l,p.return=o,o.child=p,ei=o,ti=null,!0}return!1;default:return!1}}function Lh(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Ih(o){if(Vt){var l=ti;if(l){var p=l;if(!Am(o,l)){if(Lh(o))throw Error(a(418));l=Tr(p);var v=ei;l&&Am(o,l)?Tm(v,p):(o.flags=o.flags&-4097|2,Vt=!1,ei=o)}}else{if(Lh(o))throw Error(a(418));o.flags=o.flags&-4097|2,Vt=!1,ei=o}}}function Cm(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;ei=o}function sa(o){if(!ve||o!==ei)return!1;if(!Vt)return Cm(o),Vt=!0,!1;if(o.tag!==3&&(o.tag!==5||He(o.type)&&!be(o.type,o.memoizedProps))){var l=ti;if(l){if(Lh(o)){for(o=ti;o;)o=Tr(o);throw Error(a(418))}for(;l;)Tm(o,l),l=Tr(l)}}if(Cm(o),o.tag===13){if(!ve)throw Error(a(316));if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));ti=O(o)}else ti=ei?Tr(o.stateNode):null;return!0}function to(){ve&&(ti=ei=null,ra=Vt=!1)}function Nh(o){wi===null?wi=[o]:wi.push(o)}function oa(o,l,p){if(o=p.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(a(309));var v=p.stateNode}if(!v)throw Error(a(147,o));var E=v,w=""+o;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===w?l.ref:(l=function(F){var X=E.refs;X===Sm&&(X=E.refs={}),F===null?delete X[w]:X[w]=F},l._stringRef=w,l)}if(typeof o!="string")throw Error(a(284));if(!p._owner)throw Error(a(290,o))}return o}function kl(o,l){throw o=Object.prototype.toString.call(l),Error(a(31,o==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":o))}function Rm(o){var l=o._init;return l(o._payload)}function Pm(o){function l(ne,Y){if(o){var ae=ne.deletions;ae===null?(ne.deletions=[Y],ne.flags|=16):ae.push(Y)}}function p(ne,Y){if(!o)return null;for(;Y!==null;)l(ne,Y),Y=Y.sibling;return null}function v(ne,Y){for(ne=new Map;Y!==null;)Y.key!==null?ne.set(Y.key,Y):ne.set(Y.index,Y),Y=Y.sibling;return ne}function E(ne,Y){return ne=Nr(ne,Y),ne.index=0,ne.sibling=null,ne}function w(ne,Y,ae){return ne.index=ae,o?(ae=ne.alternate,ae!==null?(ae=ae.index,ae<Y?(ne.flags|=2,Y):ae):(ne.flags|=2,Y)):(ne.flags|=1048576,Y)}function F(ne){return o&&ne.alternate===null&&(ne.flags|=2),ne}function X(ne,Y,ae,ze){return Y===null||Y.tag!==6?(Y=gd(ae,ne.mode,ze),Y.return=ne,Y):(Y=E(Y,ae),Y.return=ne,Y)}function ce(ne,Y,ae,ze){var Ze=ae.type;return Ze===d?je(ne,Y,ae.props.children,ze,ae.key):Y!==null&&(Y.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===M&&Rm(Ze)===Y.type)?(ze=E(Y,ae.props),ze.ref=oa(ne,Y,ae),ze.return=ne,ze):(ze=_c(ae.type,ae.key,ae.props,null,ne.mode,ze),ze.ref=oa(ne,Y,ae),ze.return=ne,ze)}function we(ne,Y,ae,ze){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ae.containerInfo||Y.stateNode.implementation!==ae.implementation?(Y=_d(ae,ne.mode,ze),Y.return=ne,Y):(Y=E(Y,ae.children||[]),Y.return=ne,Y)}function je(ne,Y,ae,ze,Ze){return Y===null||Y.tag!==7?(Y=cs(ae,ne.mode,ze,Ze),Y.return=ne,Y):(Y=E(Y,ae),Y.return=ne,Y)}function pt(ne,Y,ae){if(typeof Y=="string"&&Y!==""||typeof Y=="number")return Y=gd(""+Y,ne.mode,ae),Y.return=ne,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case u:return ae=_c(Y.type,Y.key,Y.props,null,ne.mode,ae),ae.ref=oa(ne,null,Y),ae.return=ne,ae;case h:return Y=_d(Y,ne.mode,ae),Y.return=ne,Y;case M:var ze=Y._init;return pt(ne,ze(Y._payload),ae)}if(q(Y)||C(Y))return Y=cs(Y,ne.mode,ae,null),Y.return=ne,Y;kl(ne,Y)}return null}function nt(ne,Y,ae,ze){var Ze=Y!==null?Y.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number")return Ze!==null?null:X(ne,Y,""+ae,ze);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case u:return ae.key===Ze?ce(ne,Y,ae,ze):null;case h:return ae.key===Ze?we(ne,Y,ae,ze):null;case M:return Ze=ae._init,nt(ne,Y,Ze(ae._payload),ze)}if(q(ae)||C(ae))return Ze!==null?null:je(ne,Y,ae,ze,null);kl(ne,ae)}return null}function Ft(ne,Y,ae,ze,Ze){if(typeof ze=="string"&&ze!==""||typeof ze=="number")return ne=ne.get(ae)||null,X(Y,ne,""+ze,Ze);if(typeof ze=="object"&&ze!==null){switch(ze.$$typeof){case u:return ne=ne.get(ze.key===null?ae:ze.key)||null,ce(Y,ne,ze,Ze);case h:return ne=ne.get(ze.key===null?ae:ze.key)||null,we(Y,ne,ze,Ze);case M:var xt=ze._init;return Ft(ne,Y,ae,xt(ze._payload),Ze)}if(q(ze)||C(ze))return ne=ne.get(ae)||null,je(Y,ne,ze,Ze,null);kl(Y,ze)}return null}function Qe(ne,Y,ae,ze){for(var Ze=null,xt=null,mt=Y,Lt=Y=0,gn=null;mt!==null&&Lt<ae.length;Lt++){mt.index>Lt?(gn=mt,mt=null):gn=mt.sibling;var It=nt(ne,mt,ae[Lt],ze);if(It===null){mt===null&&(mt=gn);break}o&&mt&&It.alternate===null&&l(ne,mt),Y=w(It,Y,Lt),xt===null?Ze=It:xt.sibling=It,xt=It,mt=gn}if(Lt===ae.length)return p(ne,mt),Vt&&ns(ne,Lt),Ze;if(mt===null){for(;Lt<ae.length;Lt++)mt=pt(ne,ae[Lt],ze),mt!==null&&(Y=w(mt,Y,Lt),xt===null?Ze=mt:xt.sibling=mt,xt=mt);return Vt&&ns(ne,Lt),Ze}for(mt=v(ne,mt);Lt<ae.length;Lt++)gn=Ft(mt,ne,Lt,ae[Lt],ze),gn!==null&&(o&&gn.alternate!==null&&mt.delete(gn.key===null?Lt:gn.key),Y=w(gn,Y,Lt),xt===null?Ze=gn:xt.sibling=gn,xt=gn);return o&&mt.forEach(function(Dr){return l(ne,Dr)}),Vt&&ns(ne,Lt),Ze}function Ln(ne,Y,ae,ze){var Ze=C(ae);if(typeof Ze!="function")throw Error(a(150));if(ae=Ze.call(ae),ae==null)throw Error(a(151));for(var xt=Ze=null,mt=Y,Lt=Y=0,gn=null,It=ae.next();mt!==null&&!It.done;Lt++,It=ae.next()){mt.index>Lt?(gn=mt,mt=null):gn=mt.sibling;var Dr=nt(ne,mt,It.value,ze);if(Dr===null){mt===null&&(mt=gn);break}o&&mt&&Dr.alternate===null&&l(ne,mt),Y=w(Dr,Y,Lt),xt===null?Ze=Dr:xt.sibling=Dr,xt=Dr,mt=gn}if(It.done)return p(ne,mt),Vt&&ns(ne,Lt),Ze;if(mt===null){for(;!It.done;Lt++,It=ae.next())It=pt(ne,It.value,ze),It!==null&&(Y=w(It,Y,Lt),xt===null?Ze=It:xt.sibling=It,xt=It);return Vt&&ns(ne,Lt),Ze}for(mt=v(ne,mt);!It.done;Lt++,It=ae.next())It=Ft(mt,ne,Lt,It.value,ze),It!==null&&(o&&It.alternate!==null&&mt.delete(It.key===null?Lt:It.key),Y=w(It,Y,Lt),xt===null?Ze=It:xt.sibling=It,xt=It);return o&&mt.forEach(function(AS){return l(ne,AS)}),Vt&&ns(ne,Lt),Ze}function xi(ne,Y,ae,ze){if(typeof ae=="object"&&ae!==null&&ae.type===d&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case u:e:{for(var Ze=ae.key,xt=Y;xt!==null;){if(xt.key===Ze){if(Ze=ae.type,Ze===d){if(xt.tag===7){p(ne,xt.sibling),Y=E(xt,ae.props.children),Y.return=ne,ne=Y;break e}}else if(xt.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===M&&Rm(Ze)===xt.type){p(ne,xt.sibling),Y=E(xt,ae.props),Y.ref=oa(ne,xt,ae),Y.return=ne,ne=Y;break e}p(ne,xt);break}else l(ne,xt);xt=xt.sibling}ae.type===d?(Y=cs(ae.props.children,ne.mode,ze,ae.key),Y.return=ne,ne=Y):(ze=_c(ae.type,ae.key,ae.props,null,ne.mode,ze),ze.ref=oa(ne,Y,ae),ze.return=ne,ne=ze)}return F(ne);case h:e:{for(xt=ae.key;Y!==null;){if(Y.key===xt)if(Y.tag===4&&Y.stateNode.containerInfo===ae.containerInfo&&Y.stateNode.implementation===ae.implementation){p(ne,Y.sibling),Y=E(Y,ae.children||[]),Y.return=ne,ne=Y;break e}else{p(ne,Y);break}else l(ne,Y);Y=Y.sibling}Y=_d(ae,ne.mode,ze),Y.return=ne,ne=Y}return F(ne);case M:return xt=ae._init,xi(ne,Y,xt(ae._payload),ze)}if(q(ae))return Qe(ne,Y,ae,ze);if(C(ae))return Ln(ne,Y,ae,ze);kl(ne,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,Y!==null&&Y.tag===6?(p(ne,Y.sibling),Y=E(Y,ae),Y.return=ne,ne=Y):(p(ne,Y),Y=gd(ae,ne.mode,ze),Y.return=ne,ne=Y),F(ne)):p(ne,Y)}return xi}var no=Pm(!0),Lm=Pm(!1),aa={},mi=dn(aa),la=dn(aa),io=dn(aa);function Xi(o){if(o===aa)throw Error(a(174));return o}function Dh(o,l){We(io,l),We(la,o),We(mi,aa),o=le(l),at(mi),We(mi,o)}function ro(){at(mi),at(la),at(io)}function Im(o){var l=Xi(io.current),p=Xi(mi.current);l=j(p,o.type,l),p!==l&&(We(la,o),We(mi,l))}function Uh(o){la.current===o&&(at(mi),at(la))}var Wt=dn(0);function Hl(o){for(var l=o;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||ea(p)||ta(p)))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if(l.flags&128)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Oh=[];function Fh(){for(var o=0;o<Oh.length;o++){var l=Oh[o];Pe?l._workInProgressVersionPrimary=null:l._workInProgressVersionSecondary=null}Oh.length=0}var Vl=c.ReactCurrentDispatcher,gi=c.ReactCurrentBatchConfig,so=0,Yt=null,Cn=null,mn=null,Gl=!1,ca=!1,ua=0,Qy=0;function Rn(){throw Error(a(321))}function zh(o,l){if(l===null)return!1;for(var p=0;p<l.length&&p<o.length;p++)if(!Gi(o[p],l[p]))return!1;return!0}function Bh(o,l,p,v,E,w){if(so=w,Yt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Vl.current=o===null||o.memoizedState===null?nS:iS,o=p(v,E),ca){w=0;do{if(ca=!1,ua=0,25<=w)throw Error(a(301));w+=1,mn=Cn=null,l.updateQueue=null,Vl.current=rS,o=p(v,E)}while(ca)}if(Vl.current=Yl,l=Cn!==null&&Cn.next!==null,so=0,mn=Cn=Yt=null,Gl=!1,l)throw Error(a(300));return o}function kh(){var o=ua!==0;return ua=0,o}function lr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mn===null?Yt.memoizedState=mn=o:mn=mn.next=o,mn}function qi(){if(Cn===null){var o=Yt.alternate;o=o!==null?o.memoizedState:null}else o=Cn.next;var l=mn===null?Yt.memoizedState:mn.next;if(l!==null)mn=l,Cn=o;else{if(o===null)throw Error(a(310));Cn=o,o={memoizedState:Cn.memoizedState,baseState:Cn.baseState,baseQueue:Cn.baseQueue,queue:Cn.queue,next:null},mn===null?Yt.memoizedState=mn=o:mn=mn.next=o}return mn}function is(o,l){return typeof l=="function"?l(o):l}function Wl(o){var l=qi(),p=l.queue;if(p===null)throw Error(a(311));p.lastRenderedReducer=o;var v=Cn,E=v.baseQueue,w=p.pending;if(w!==null){if(E!==null){var F=E.next;E.next=w.next,w.next=F}v.baseQueue=E=w,p.pending=null}if(E!==null){w=E.next,v=v.baseState;var X=F=null,ce=null,we=w;do{var je=we.lane;if((so&je)===je)ce!==null&&(ce=ce.next={lane:0,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null}),v=we.hasEagerState?we.eagerState:o(v,we.action);else{var pt={lane:je,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null};ce===null?(X=ce=pt,F=v):ce=ce.next=pt,Yt.lanes|=je,ao|=je}we=we.next}while(we!==null&&we!==w);ce===null?F=v:ce.next=X,Gi(v,l.memoizedState)||(ni=!0),l.memoizedState=v,l.baseState=F,l.baseQueue=ce,p.lastRenderedState=v}if(o=p.interleaved,o!==null){E=o;do w=E.lane,Yt.lanes|=w,ao|=w,E=E.next;while(E!==o)}else E===null&&(p.lanes=0);return[l.memoizedState,p.dispatch]}function jl(o){var l=qi(),p=l.queue;if(p===null)throw Error(a(311));p.lastRenderedReducer=o;var v=p.dispatch,E=p.pending,w=l.memoizedState;if(E!==null){p.pending=null;var F=E=E.next;do w=o(w,F.action),F=F.next;while(F!==E);Gi(w,l.memoizedState)||(ni=!0),l.memoizedState=w,l.baseQueue===null&&(l.baseState=w),p.lastRenderedState=w}return[w,v]}function Nm(){}function Dm(o,l){var p=Yt,v=qi(),E=l(),w=!Gi(v.memoizedState,E);if(w&&(v.memoizedState=E,ni=!0),v=v.queue,da(Fm.bind(null,p,v,o),[o]),v.getSnapshot!==l||w||mn!==null&&mn.memoizedState.tag&1){if(p.flags|=2048,ha(9,Om.bind(null,p,v,E,l),void 0,null),rn===null)throw Error(a(349));so&30||Um(p,l,E)}return E}function Um(o,l,p){o.flags|=16384,o={getSnapshot:l,value:p},l=Yt.updateQueue,l===null?(l={lastEffect:null,stores:null},Yt.updateQueue=l,l.stores=[o]):(p=l.stores,p===null?l.stores=[o]:p.push(o))}function Om(o,l,p,v){l.value=p,l.getSnapshot=v,zm(l)&&_i(o,1,-1)}function Fm(o,l,p){return p(function(){zm(l)&&_i(o,1,-1)})}function zm(o){var l=o.getSnapshot;o=o.value;try{var p=l();return!Gi(o,p)}catch{return!0}}function Hh(o){var l=lr();return typeof o=="function"&&(o=o()),l.memoizedState=l.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:is,lastRenderedState:o},l.queue=o,o=o.dispatch=tS.bind(null,Yt,o),[l.memoizedState,o]}function ha(o,l,p,v){return o={tag:o,create:l,destroy:p,deps:v,next:null},l=Yt.updateQueue,l===null?(l={lastEffect:null,stores:null},Yt.updateQueue=l,l.lastEffect=o.next=o):(p=l.lastEffect,p===null?l.lastEffect=o.next=o:(v=p.next,p.next=o,o.next=v,l.lastEffect=o)),o}function Bm(){return qi().memoizedState}function Xl(o,l,p,v){var E=lr();Yt.flags|=o,E.memoizedState=ha(1|l,p,void 0,v===void 0?null:v)}function ql(o,l,p,v){var E=qi();v=v===void 0?null:v;var w=void 0;if(Cn!==null){var F=Cn.memoizedState;if(w=F.destroy,v!==null&&zh(v,F.deps)){E.memoizedState=ha(l,p,w,v);return}}Yt.flags|=o,E.memoizedState=ha(1|l,p,w,v)}function Vh(o,l){return Xl(8390656,8,o,l)}function da(o,l){return ql(2048,8,o,l)}function km(o,l){return ql(4,2,o,l)}function Hm(o,l){return ql(4,4,o,l)}function Vm(o,l){if(typeof l=="function")return o=o(),l(o),function(){l(null)};if(l!=null)return o=o(),l.current=o,function(){l.current=null}}function Gm(o,l,p){return p=p!=null?p.concat([o]):null,ql(4,4,Vm.bind(null,l,o),p)}function Gh(){}function Wm(o,l){var p=qi();l=l===void 0?null:l;var v=p.memoizedState;return v!==null&&l!==null&&zh(l,v[1])?v[0]:(p.memoizedState=[o,l],o)}function jm(o,l){var p=qi();l=l===void 0?null:l;var v=p.memoizedState;return v!==null&&l!==null&&zh(l,v[1])?v[0]:(o=o(),p.memoizedState=[o,l],o)}function $y(o,l){var p=Pt;Pt=p!==0&&4>p?p:4,o(!0);var v=gi.transition;gi.transition={};try{o(!1),l()}finally{Pt=p,gi.transition=v}}function Xm(){return qi().memoizedState}function eS(o,l,p){var v=Lr(o);p={lane:v,action:p,hasEagerState:!1,eagerState:null,next:null},qm(o)?Ym(l,p):(Zm(o,l,p),p=kn(),o=_i(o,v,p),o!==null&&Jm(o,l,v))}function tS(o,l,p){var v=Lr(o),E={lane:v,action:p,hasEagerState:!1,eagerState:null,next:null};if(qm(o))Ym(l,E);else{Zm(o,l,E);var w=o.alternate;if(o.lanes===0&&(w===null||w.lanes===0)&&(w=l.lastRenderedReducer,w!==null))try{var F=l.lastRenderedState,X=w(F,p);if(E.hasEagerState=!0,E.eagerState=X,Gi(X,F))return}catch{}finally{}p=kn(),o=_i(o,v,p),o!==null&&Jm(o,l,v)}}function qm(o){var l=o.alternate;return o===Yt||l!==null&&l===Yt}function Ym(o,l){ca=Gl=!0;var p=o.pending;p===null?l.next=l:(l.next=p.next,p.next=l),o.pending=l}function Zm(o,l,p){rn!==null&&o.mode&1&&!(Et&2)?(o=l.interleaved,o===null?(p.next=p,ji===null?ji=[l]:ji.push(l)):(p.next=o.next,o.next=p),l.interleaved=p):(o=l.pending,o===null?p.next=p:(p.next=o.next,o.next=p),l.pending=p)}function Jm(o,l,p){if(p&4194240){var v=l.lanes;v&=o.pendingLanes,p|=v,l.lanes=p,_h(o,p)}}var Yl={readContext:di,useCallback:Rn,useContext:Rn,useEffect:Rn,useImperativeHandle:Rn,useInsertionEffect:Rn,useLayoutEffect:Rn,useMemo:Rn,useReducer:Rn,useRef:Rn,useState:Rn,useDebugValue:Rn,useDeferredValue:Rn,useTransition:Rn,useMutableSource:Rn,useSyncExternalStore:Rn,useId:Rn,unstable_isNewReconciler:!1},nS={readContext:di,useCallback:function(o,l){return lr().memoizedState=[o,l===void 0?null:l],o},useContext:di,useEffect:Vh,useImperativeHandle:function(o,l,p){return p=p!=null?p.concat([o]):null,Xl(4194308,4,Vm.bind(null,l,o),p)},useLayoutEffect:function(o,l){return Xl(4194308,4,o,l)},useInsertionEffect:function(o,l){return Xl(4,2,o,l)},useMemo:function(o,l){var p=lr();return l=l===void 0?null:l,o=o(),p.memoizedState=[o,l],o},useReducer:function(o,l,p){var v=lr();return l=p!==void 0?p(l):l,v.memoizedState=v.baseState=l,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:l},v.queue=o,o=o.dispatch=eS.bind(null,Yt,o),[v.memoizedState,o]},useRef:function(o){var l=lr();return o={current:o},l.memoizedState=o},useState:Hh,useDebugValue:Gh,useDeferredValue:function(o){var l=Hh(o),p=l[0],v=l[1];return Vh(function(){var E=gi.transition;gi.transition={};try{v(o)}finally{gi.transition=E}},[o]),p},useTransition:function(){var o=Hh(!1),l=o[0];return o=$y.bind(null,o[1]),lr().memoizedState=o,[l,o]},useMutableSource:function(){},useSyncExternalStore:function(o,l,p){var v=Yt,E=lr();if(Vt){if(p===void 0)throw Error(a(407));p=p()}else{if(p=l(),rn===null)throw Error(a(349));so&30||Um(v,l,p)}E.memoizedState=p;var w={value:p,getSnapshot:l};return E.queue=w,Vh(Fm.bind(null,v,w,o),[o]),v.flags|=2048,ha(9,Om.bind(null,v,w,p,l),void 0,null),p},useId:function(){var o=lr(),l=rn.identifierPrefix;if(Vt){var p=ar,v=or;p=(v&~(1<<32-$n(v)-1)).toString(32)+p,l=":"+l+"R"+p,p=ua++,0<p&&(l+="H"+p.toString(32)),l+=":"}else p=Qy++,l=":"+l+"r"+p.toString(32)+":";return o.memoizedState=l},unstable_isNewReconciler:!1},iS={readContext:di,useCallback:Wm,useContext:di,useEffect:da,useImperativeHandle:Gm,useInsertionEffect:km,useLayoutEffect:Hm,useMemo:jm,useReducer:Wl,useRef:Bm,useState:function(){return Wl(is)},useDebugValue:Gh,useDeferredValue:function(o){var l=Wl(is),p=l[0],v=l[1];return da(function(){var E=gi.transition;gi.transition={};try{v(o)}finally{gi.transition=E}},[o]),p},useTransition:function(){var o=Wl(is)[0],l=qi().memoizedState;return[o,l]},useMutableSource:Nm,useSyncExternalStore:Dm,useId:Xm,unstable_isNewReconciler:!1},rS={readContext:di,useCallback:Wm,useContext:di,useEffect:da,useImperativeHandle:Gm,useInsertionEffect:km,useLayoutEffect:Hm,useMemo:jm,useReducer:jl,useRef:Bm,useState:function(){return jl(is)},useDebugValue:Gh,useDeferredValue:function(o){var l=jl(is),p=l[0],v=l[1];return da(function(){var E=gi.transition;gi.transition={};try{v(o)}finally{gi.transition=E}},[o]),p},useTransition:function(){var o=jl(is)[0],l=qi().memoizedState;return[o,l]},useMutableSource:Nm,useSyncExternalStore:Dm,useId:Xm,unstable_isNewReconciler:!1};function Wh(o,l){try{var p="",v=l;do p+=Ky(v),v=v.return;while(v);var E=p}catch(w){E=`
3716
3716
  Error generating stack: `+w.message+`
3717
- `+w.stack}return{value:o,source:l,stack:E}}function jh(o,l){try{console.error(l.value)}catch(p){setTimeout(function(){throw p})}}var sS=typeof WeakMap=="function"?WeakMap:Map;function Qm(o,l,p){p=sr(-1,p),p.tag=3,p.payload={element:null};var v=l.value;return p.callback=function(){uc||(uc=!0,cd=v),jh(o,l)},p}function $m(o,l,p){p=sr(-1,p),p.tag=3;var v=o.type.getDerivedStateFromError;if(typeof v=="function"){var E=l.value;p.payload=function(){return v(E)},p.callback=function(){jh(o,l)}}var w=o.stateNode;return w!==null&&typeof w.componentDidCatch=="function"&&(p.callback=function(){jh(o,l),typeof v!="function"&&(Rr===null?Rr=new Set([this]):Rr.add(this));var F=l.stack;this.componentDidCatch(l.value,{componentStack:F!==null?F:""})}),p}function eg(o,l,p){var v=o.pingCache;if(v===null){v=o.pingCache=new sS;var E=new Set;v.set(l,E)}else E=v.get(l),E===void 0&&(E=new Set,v.set(l,E));E.has(p)||(E.add(p),o=xS.bind(null,o,l,p),l.then(o,o))}function tg(o){do{var l;if((l=o.tag===13)&&(l=o.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return o;o=o.return}while(o!==null);return null}function ng(o,l,p,v,E){return o.mode&1?(o.flags|=65536,o.lanes=E,o):(o===l?o.flags|=65536:(o.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(l=sr(-1,1),l.tag=2,Cr(p,l))),p.lanes|=1),o)}function Yi(o){o.flags|=4}function ig(o,l){if(o!==null&&o.child===l.child)return!0;if(l.flags&16)return!1;for(o=l.child;o!==null;){if(o.flags&12854||o.subtreeFlags&12854)return!1;o=o.sibling}return!0}var fa,pa,Zl,Jl;if(Ae)fa=function(o,l){for(var p=l.child;p!==null;){if(p.tag===5||p.tag===6)ge(o,p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===l)break;for(;p.sibling===null;){if(p.return===null||p.return===l)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},pa=function(){},Zl=function(o,l,p,v,E){if(o=o.memoizedProps,o!==v){var w=l.stateNode,F=Xi(mi.current);p=fe(w,p,o,v,E,F),(l.updateQueue=p)&&Yi(l)}},Jl=function(o,l,p,v){p!==v&&Yi(l)};else if(k){fa=function(o,l,p,v){for(var E=l.child;E!==null;){if(E.tag===5){var w=E.stateNode;p&&v&&(w=Ot(w,E.type,E.memoizedProps,E)),ge(o,w)}else if(E.tag===6)w=E.stateNode,p&&v&&(w=Ht(w,E.memoizedProps,E)),ge(o,w);else if(E.tag!==4){if(E.tag===22&&E.memoizedState!==null)w=E.child,w!==null&&(w.return=E),fa(o,E,!0,!0);else if(E.child!==null){E.child.return=E,E=E.child;continue}}if(E===l)break;for(;E.sibling===null;){if(E.return===null||E.return===l)return;E=E.return}E.sibling.return=E.return,E=E.sibling}};var rg=function(o,l,p,v){for(var E=l.child;E!==null;){if(E.tag===5){var w=E.stateNode;p&&v&&(w=Ot(w,E.type,E.memoizedProps,E)),Ye(o,w)}else if(E.tag===6)w=E.stateNode,p&&v&&(w=Ht(w,E.memoizedProps,E)),Ye(o,w);else if(E.tag!==4){if(E.tag===22&&E.memoizedState!==null)w=E.child,w!==null&&(w.return=E),rg(o,E,!0,!0);else if(E.child!==null){E.child.return=E,E=E.child;continue}}if(E===l)break;for(;E.sibling===null;){if(E.return===null||E.return===l)return;E=E.return}E.sibling.return=E.return,E=E.sibling}};pa=function(o,l){var p=l.stateNode;if(!ig(o,l)){o=p.containerInfo;var v=tt(o);rg(v,l,!1,!1),p.pendingChildren=v,Yi(l),bt(o,v)}},Zl=function(o,l,p,v,E){var w=o.stateNode,F=o.memoizedProps;if((o=ig(o,l))&&F===v)l.stateNode=w;else{var X=l.stateNode,ce=Xi(mi.current),we=null;F!==v&&(we=fe(X,p,F,v,E,ce)),o&&we===null?l.stateNode=w:(w=De(w,we,p,F,v,l,o,X),K(w,p,v,E,ce)&&Yi(l),l.stateNode=w,o?Yi(l):fa(w,l,!1,!1))}},Jl=function(o,l,p,v){p!==v?(o=Xi(io.current),p=Xi(mi.current),l.stateNode=Oe(v,o,p,l),Yi(l)):l.stateNode=o.stateNode}}else pa=function(){},Zl=function(){},Jl=function(){};function ma(o,l){if(!Vt)switch(o.tailMode){case"hidden":l=o.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?o.tail=null:p.sibling=null;break;case"collapsed":p=o.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:v.sibling=null}}function Pn(o){var l=o.alternate!==null&&o.alternate.child===o.child,p=0,v=0;if(l)for(var E=o.child;E!==null;)p|=E.lanes|E.childLanes,v|=E.subtreeFlags&14680064,v|=E.flags&14680064,E.return=o,E=E.sibling;else for(E=o.child;E!==null;)p|=E.lanes|E.childLanes,v|=E.subtreeFlags,v|=E.flags,E.return=o,E=E.sibling;return o.subtreeFlags|=v,o.childLanes=p,l}function oS(o,l,p){var v=l.pendingProps;switch(Ph(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pn(l),null;case 1:return fn(l.type)&&Kt(),Pn(l),null;case 3:return v=l.stateNode,ro(),at(qt),at(Mt),Fh(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(o===null||o.child===null)&&(sa(l)?Yi(l):o===null||o.memoizedState.isDehydrated&&!(l.flags&256)||(l.flags|=1024,wi!==null&&(dd(wi),wi=null))),pa(o,l),Pn(l),null;case 5:Uh(l),p=Xi(io.current);var E=l.type;if(o!==null&&l.stateNode!=null)Zl(o,l,E,v,p),o.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!v){if(l.stateNode===null)throw Error(a(166));return Pn(l),null}if(o=Xi(mi.current),sa(l)){if(!ve)throw Error(a(175));o=dh(l.stateNode,l.type,l.memoizedProps,p,o,l,!ra),l.updateQueue=o,o!==null&&Yi(l)}else{var w=te(E,v,p,o,l);fa(w,l,!1,!1),l.stateNode=w,K(w,E,v,p,o)&&Yi(l)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Pn(l),null;case 6:if(o&&l.stateNode!=null)Jl(o,l,o.memoizedProps,v);else{if(typeof v!="string"&&l.stateNode===null)throw Error(a(166));if(o=Xi(io.current),p=Xi(mi.current),sa(l)){if(!ve)throw Error(a(176));if(o=l.stateNode,v=l.memoizedProps,(p=fh(o,v,l,!ra))&&(E=ei,E!==null))switch(w=(E.mode&1)!==0,E.tag){case 3:Ke(E.stateNode.containerInfo,o,v,w);break;case 5:st(E.type,E.memoizedProps,E.stateNode,o,v,w)}p&&Yi(l)}else l.stateNode=Oe(v,o,p,l)}return Pn(l),null;case 13:if(at(Wt),v=l.memoizedState,Vt&&ti!==null&&l.mode&1&&!(l.flags&128)){for(o=ti;o;)o=Tr(o);return to(),l.flags|=98560,l}if(v!==null&&v.dehydrated!==null){if(v=sa(l),o===null){if(!v)throw Error(a(318));if(!ve)throw Error(a(344));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));ph(o,l)}else to(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;return Pn(l),null}return wi!==null&&(dd(wi),wi=null),l.flags&128?(l.lanes=p,l):(v=v!==null,p=!1,o===null?sa(l):p=o.memoizedState!==null,v&&!p&&(l.child.flags|=8192,l.mode&1&&(o===null||Wt.current&1?ln===0&&(ln=3):pd())),l.updateQueue!==null&&(l.flags|=4),Pn(l),null);case 4:return ro(),pa(o,l),o===null&&Ee(l.stateNode.containerInfo),Pn(l),null;case 10:return bh(l.type._context),Pn(l),null;case 17:return fn(l.type)&&Kt(),Pn(l),null;case 19:if(at(Wt),E=l.memoizedState,E===null)return Pn(l),null;if(v=(l.flags&128)!==0,w=E.rendering,w===null)if(v)ma(E,!1);else{if(ln!==0||o!==null&&o.flags&128)for(o=l.child;o!==null;){if(w=Hl(o),w!==null){for(l.flags|=128,ma(E,!1),o=w.updateQueue,o!==null&&(l.updateQueue=o,l.flags|=4),l.subtreeFlags=0,o=p,v=l.child;v!==null;)p=v,E=o,p.flags&=14680066,w=p.alternate,w===null?(p.childLanes=0,p.lanes=E,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=w.childLanes,p.lanes=w.lanes,p.child=w.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=w.memoizedProps,p.memoizedState=w.memoizedState,p.updateQueue=w.updateQueue,p.type=w.type,E=w.dependencies,p.dependencies=E===null?null:{lanes:E.lanes,firstContext:E.firstContext}),v=v.sibling;return We(Wt,Wt.current&1|2),l.child}o=o.sibling}E.tail!==null&&pn()>ld&&(l.flags|=128,v=!0,ma(E,!1),l.lanes=4194304)}else{if(!v)if(o=Hl(w),o!==null){if(l.flags|=128,v=!0,o=o.updateQueue,o!==null&&(l.updateQueue=o,l.flags|=4),ma(E,!0),E.tail===null&&E.tailMode==="hidden"&&!w.alternate&&!Vt)return Pn(l),null}else 2*pn()-E.renderingStartTime>ld&&p!==1073741824&&(l.flags|=128,v=!0,ma(E,!1),l.lanes=4194304);E.isBackwards?(w.sibling=l.child,l.child=w):(o=E.last,o!==null?o.sibling=w:l.child=w,E.last=w)}return E.tail!==null?(l=E.tail,E.rendering=l,E.tail=l.sibling,E.renderingStartTime=pn(),l.sibling=null,o=Wt.current,We(Wt,v?o&1|2:o&1),l):(Pn(l),null);case 22:case 23:return fd(),v=l.memoizedState!==null,o!==null&&o.memoizedState!==null!==v&&(l.flags|=8192),v&&l.mode&1?ii&1073741824&&(Pn(l),Ae&&l.subtreeFlags&6&&(l.flags|=8192)):Pn(l),null;case 24:return null;case 25:return null}throw Error(a(156,l.tag))}var aS=c.ReactCurrentOwner,ni=!1;function Bn(o,l,p,v){l.child=o===null?Im(l,null,p,v):no(l,o.child,p,v)}function sg(o,l,p,v,E){p=p.render;var w=l.ref;return Qs(l,E),v=Bh(o,l,p,v,w,E),p=kh(),o!==null&&!ni?(l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~E,cr(o,l,E)):(Vt&&p&&Rh(l),l.flags|=1,Bn(o,l,v,E),l.child)}function og(o,l,p,v,E){if(o===null){var w=p.type;return typeof w=="function"&&!md(w)&&w.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(l.tag=15,l.type=w,ag(o,l,w,v,E)):(o=_c(p.type,null,v,l,l.mode,E),o.ref=l.ref,o.return=l,l.child=o)}if(w=o.child,!(o.lanes&E)){var F=w.memoizedProps;if(p=p.compare,p=p!==null?p:Il,p(F,v)&&o.ref===l.ref)return cr(o,l,E)}return l.flags|=1,o=Nr(w,v),o.ref=l.ref,o.return=l,l.child=o}function ag(o,l,p,v,E){if(o!==null&&Il(o.memoizedProps,v)&&o.ref===l.ref)if(ni=!1,(o.lanes&E)!==0)o.flags&131072&&(ni=!0);else return l.lanes=o.lanes,cr(o,l,E);return Xh(o,l,p,v,E)}function lg(o,l,p){var v=l.pendingProps,E=v.children,w=o!==null?o.memoizedState:null;if(v.mode==="hidden")if(!(l.mode&1))l.memoizedState={baseLanes:0,cachePool:null},We(oo,ii),ii|=p;else if(p&1073741824)l.memoizedState={baseLanes:0,cachePool:null},v=w!==null?w.baseLanes:p,We(oo,ii),ii|=v;else return o=w!==null?w.baseLanes|p:p,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:o,cachePool:null},l.updateQueue=null,We(oo,ii),ii|=o,null;else w!==null?(v=w.baseLanes|p,l.memoizedState=null):v=p,We(oo,ii),ii|=v;return Bn(o,l,E,p),l.child}function cg(o,l){var p=l.ref;(o===null&&p!==null||o!==null&&o.ref!==p)&&(l.flags|=512,l.flags|=2097152)}function Xh(o,l,p,v,E){var w=fn(p)?ki:Mt.current;return w=hi(l,w),Qs(l,E),p=Bh(o,l,p,v,w,E),v=kh(),o!==null&&!ni?(l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~E,cr(o,l,E)):(Vt&&v&&Rh(l),l.flags|=1,Bn(o,l,p,E),l.child)}function ug(o,l,p,v,E){if(fn(p)){var w=!0;Mn(l)}else w=!1;if(Qs(l,E),l.stateNode===null)o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),bm(l,p,v),Ch(l,p,v,E),v=!0;else if(o===null){var F=l.stateNode,X=l.memoizedProps;F.props=X;var ce=F.context,we=p.contextType;typeof we=="object"&&we!==null?we=di(we):(we=fn(p)?ki:Mt.current,we=hi(l,we));var je=p.getDerivedStateFromProps,pt=typeof je=="function"||typeof F.getSnapshotBeforeUpdate=="function";pt||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(X!==v||ce!==we)&&wm(l,F,v,we),Ar=!1;var nt=l.memoizedState;F.state=nt,Ol(l,v,F,E),ce=l.memoizedState,X!==v||nt!==ce||qt.current||Ar?(typeof je=="function"&&(Ah(l,p,je,v),ce=l.memoizedState),(X=Ar||Em(l,p,X,v,nt,ce,we))?(pt||typeof F.UNSAFE_componentWillMount!="function"&&typeof F.componentWillMount!="function"||(typeof F.componentWillMount=="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount=="function"&&F.UNSAFE_componentWillMount()),typeof F.componentDidMount=="function"&&(l.flags|=4194308)):(typeof F.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=v,l.memoizedState=ce),F.props=v,F.state=ce,F.context=we,v=X):(typeof F.componentDidMount=="function"&&(l.flags|=4194308),v=!1)}else{F=l.stateNode,xm(o,l),X=l.memoizedProps,we=l.type===l.elementType?X:bi(l.type,X),F.props=we,pt=l.pendingProps,nt=F.context,ce=p.contextType,typeof ce=="object"&&ce!==null?ce=di(ce):(ce=fn(p)?ki:Mt.current,ce=hi(l,ce));var Ft=p.getDerivedStateFromProps;(je=typeof Ft=="function"||typeof F.getSnapshotBeforeUpdate=="function")||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(X!==pt||nt!==ce)&&wm(l,F,v,ce),Ar=!1,nt=l.memoizedState,F.state=nt,Ol(l,v,F,E);var Qe=l.memoizedState;X!==pt||nt!==Qe||qt.current||Ar?(typeof Ft=="function"&&(Ah(l,p,Ft,v),Qe=l.memoizedState),(we=Ar||Em(l,p,we,v,nt,Qe,ce)||!1)?(je||typeof F.UNSAFE_componentWillUpdate!="function"&&typeof F.componentWillUpdate!="function"||(typeof F.componentWillUpdate=="function"&&F.componentWillUpdate(v,Qe,ce),typeof F.UNSAFE_componentWillUpdate=="function"&&F.UNSAFE_componentWillUpdate(v,Qe,ce)),typeof F.componentDidUpdate=="function"&&(l.flags|=4),typeof F.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof F.componentDidUpdate!="function"||X===o.memoizedProps&&nt===o.memoizedState||(l.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||X===o.memoizedProps&&nt===o.memoizedState||(l.flags|=1024),l.memoizedProps=v,l.memoizedState=Qe),F.props=v,F.state=Qe,F.context=ce,v=we):(typeof F.componentDidUpdate!="function"||X===o.memoizedProps&&nt===o.memoizedState||(l.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||X===o.memoizedProps&&nt===o.memoizedState||(l.flags|=1024),v=!1)}return qh(o,l,p,v,w,E)}function qh(o,l,p,v,E,w){cg(o,l);var F=(l.flags&128)!==0;if(!v&&!F)return E&&Js(l,p,!1),cr(o,l,w);v=l.stateNode,aS.current=l;var X=F&&typeof p.getDerivedStateFromError!="function"?null:v.render();return l.flags|=1,o!==null&&F?(l.child=no(l,o.child,null,w),l.child=no(l,null,X,w)):Bn(o,l,X,w),l.memoizedState=v.state,E&&Js(l,p,!0),l.child}function hg(o){var l=o.stateNode;l.pendingContext?Hi(o,l.pendingContext,l.pendingContext!==l.context):l.context&&Hi(o,l.context,!1),Dh(o,l.containerInfo)}function dg(o,l,p,v,E){return to(),Nh(E),l.flags|=256,Bn(o,l,p,v),l.child}var Kl={dehydrated:null,treeContext:null,retryLane:0};function Ql(o){return{baseLanes:o,cachePool:null}}function fg(o,l,p){var v=l.pendingProps,E=Wt.current,w=!1,F=(l.flags&128)!==0,X;if((X=F)||(X=o!==null&&o.memoizedState===null?!1:(E&2)!==0),X?(w=!0,l.flags&=-129):(o===null||o.memoizedState!==null)&&(E|=1),We(Wt,E&1),o===null)return Ih(l),o=l.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?(l.mode&1?ta(o)?l.lanes=8:l.lanes=1073741824:l.lanes=1,null):(E=v.children,o=v.fallback,w?(v=l.mode,w=l.child,E={mode:"hidden",children:E},!(v&1)&&w!==null?(w.childLanes=0,w.pendingProps=E):w=vc(E,v,0,null),o=cs(o,v,p,null),w.return=l,o.return=l,w.sibling=o,l.child=w,l.child.memoizedState=Ql(p),l.memoizedState=Kl,o):Yh(l,E));if(E=o.memoizedState,E!==null){if(X=E.dehydrated,X!==null){if(F)return l.flags&256?(l.flags&=-257,$l(o,l,p,Error(a(422)))):l.memoizedState!==null?(l.child=o.child,l.flags|=128,null):(w=v.fallback,E=l.mode,v=vc({mode:"visible",children:v.children},E,0,null),w=cs(w,E,p,null),w.flags|=2,v.return=l,w.return=l,v.sibling=w,l.child=v,l.mode&1&&no(l,o.child,null,p),l.child.memoizedState=Ql(p),l.memoizedState=Kl,w);if(!(l.mode&1))l=$l(o,l,p,null);else if(ta(X))l=$l(o,l,p,Error(a(419)));else if(v=(p&o.childLanes)!==0,ni||v){if(v=rn,v!==null){switch(p&-p){case 4:w=2;break;case 16:w=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:w=32;break;case 536870912:w=268435456;break;default:w=0}v=w&(v.suspendedLanes|p)?0:w,v!==0&&v!==E.retryLane&&(E.retryLane=v,_i(o,v,-1))}pd(),l=$l(o,l,p,Error(a(421)))}else ea(X)?(l.flags|=128,l.child=o.child,l=yS.bind(null,o),qs(X,l),l=null):(p=E.treeContext,ve&&(ti=wl(X),ei=l,Vt=!0,wi=null,ra=!1,p!==null&&(fi[pi++]=or,fi[pi++]=ar,fi[pi++]=ts,or=p.id,ar=p.overflow,ts=l)),l=Yh(l,l.pendingProps.children),l.flags|=4096);return l}return w?(v=mg(o,l,v.children,v.fallback,p),w=l.child,E=o.child.memoizedState,w.memoizedState=E===null?Ql(p):{baseLanes:E.baseLanes|p,cachePool:null},w.childLanes=o.childLanes&~p,l.memoizedState=Kl,v):(p=pg(o,l,v.children,p),l.memoizedState=null,p)}return w?(v=mg(o,l,v.children,v.fallback,p),w=l.child,E=o.child.memoizedState,w.memoizedState=E===null?Ql(p):{baseLanes:E.baseLanes|p,cachePool:null},w.childLanes=o.childLanes&~p,l.memoizedState=Kl,v):(p=pg(o,l,v.children,p),l.memoizedState=null,p)}function Yh(o,l){return l=vc({mode:"visible",children:l},o.mode,0,null),l.return=o,o.child=l}function pg(o,l,p,v){var E=o.child;return o=E.sibling,p=Nr(E,{mode:"visible",children:p}),!(l.mode&1)&&(p.lanes=v),p.return=l,p.sibling=null,o!==null&&(v=l.deletions,v===null?(l.deletions=[o],l.flags|=16):v.push(o)),l.child=p}function mg(o,l,p,v,E){var w=l.mode;o=o.child;var F=o.sibling,X={mode:"hidden",children:p};return!(w&1)&&l.child!==o?(p=l.child,p.childLanes=0,p.pendingProps=X,l.deletions=null):(p=Nr(o,X),p.subtreeFlags=o.subtreeFlags&14680064),F!==null?v=Nr(F,v):(v=cs(v,w,E,null),v.flags|=2),v.return=l,p.return=l,p.sibling=v,l.child=p,v}function $l(o,l,p,v){return v!==null&&Nh(v),no(l,o.child,null,p),o=Yh(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function gg(o,l,p){o.lanes|=l;var v=o.alternate;v!==null&&(v.lanes|=l),wh(o.return,l,p)}function Zh(o,l,p,v,E){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:v,tail:p,tailMode:E}:(w.isBackwards=l,w.rendering=null,w.renderingStartTime=0,w.last=v,w.tail=p,w.tailMode=E)}function _g(o,l,p){var v=l.pendingProps,E=v.revealOrder,w=v.tail;if(Bn(o,l,v.children,p),v=Wt.current,v&2)v=v&1|2,l.flags|=128;else{if(o!==null&&o.flags&128)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&gg(o,p,l);else if(o.tag===19)gg(o,p,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}v&=1}if(We(Wt,v),!(l.mode&1))l.memoizedState=null;else switch(E){case"forwards":for(p=l.child,E=null;p!==null;)o=p.alternate,o!==null&&Hl(o)===null&&(E=p),p=p.sibling;p=E,p===null?(E=l.child,l.child=null):(E=p.sibling,p.sibling=null),Zh(l,!1,E,p,w);break;case"backwards":for(p=null,E=l.child,l.child=null;E!==null;){if(o=E.alternate,o!==null&&Hl(o)===null){l.child=E;break}o=E.sibling,E.sibling=p,p=E,E=o}Zh(l,!0,p,null,w);break;case"together":Zh(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function cr(o,l,p){if(o!==null&&(l.dependencies=o.dependencies),ao|=l.lanes,!(p&l.childLanes))return null;if(o!==null&&l.child!==o.child)throw Error(a(153));if(l.child!==null){for(o=l.child,p=Nr(o,o.pendingProps),l.child=p,p.return=l;o.sibling!==null;)o=o.sibling,p=p.sibling=Nr(o,o.pendingProps),p.return=l;p.sibling=null}return l.child}function lS(o,l,p){switch(l.tag){case 3:hg(l),to();break;case 5:Nm(l);break;case 1:fn(l.type)&&Mn(l);break;case 4:Dh(l,l.stateNode.containerInfo);break;case 10:vm(l,l.type._context,l.memoizedProps.value);break;case 13:var v=l.memoizedState;if(v!==null)return v.dehydrated!==null?(We(Wt,Wt.current&1),l.flags|=128,null):p&l.child.childLanes?fg(o,l,p):(We(Wt,Wt.current&1),o=cr(o,l,p),o!==null?o.sibling:null);We(Wt,Wt.current&1);break;case 19:if(v=(p&l.childLanes)!==0,o.flags&128){if(v)return _g(o,l,p);l.flags|=128}var E=l.memoizedState;if(E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),We(Wt,Wt.current),v)break;return null;case 22:case 23:return l.lanes=0,lg(o,l,p)}return cr(o,l,p)}function cS(o,l){switch(Ph(l),l.tag){case 1:return fn(l.type)&&Kt(),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return ro(),at(qt),at(Mt),Fh(),o=l.flags,o&65536&&!(o&128)?(l.flags=o&-65537|128,l):null;case 5:return Uh(l),null;case 13:if(at(Wt),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(a(340));to()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return at(Wt),null;case 4:return ro(),null;case 10:return bh(l.type._context),null;case 22:case 23:return fd(),null;case 24:return null;default:return null}}var ec=!1,rs=!1,uS=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function tc(o,l){var p=o.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(v){Yn(o,l,v)}else p.current=null}function Jh(o,l,p){try{p()}catch(v){Yn(o,l,v)}}var vg=!1;function hS(o,l){for(Z(o.containerInfo),Ue=l;Ue!==null;)if(o=Ue,l=o.child,(o.subtreeFlags&1028)!==0&&l!==null)l.return=o,Ue=l;else for(;Ue!==null;){o=Ue;try{var p=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var v=p.memoizedProps,E=p.memoizedState,w=o.stateNode,F=w.getSnapshotBeforeUpdate(o.elementType===o.type?v:bi(o.type,v),E);w.__reactInternalSnapshotBeforeUpdate=F}break;case 3:Ae&&Te(o.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(X){Yn(o,o.return,X)}if(l=o.sibling,l!==null){l.return=o.return,Ue=l;break}Ue=o.return}return p=vg,vg=!1,p}function ss(o,l,p){var v=l.updateQueue;if(v=v!==null?v.lastEffect:null,v!==null){var E=v=v.next;do{if((E.tag&o)===o){var w=E.destroy;E.destroy=void 0,w!==void 0&&Jh(l,p,w)}E=E.next}while(E!==v)}}function ga(o,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var p=l=l.next;do{if((p.tag&o)===o){var v=p.create;p.destroy=v()}p=p.next}while(p!==l)}}function Kh(o){var l=o.ref;if(l!==null){var p=o.stateNode;switch(o.tag){case 5:o=ie(p);break;default:o=p}typeof l=="function"?l(o):l.current=o}}function xg(o,l,p){if(Vi&&typeof Vi.onCommitFiberUnmount=="function")try{Vi.onCommitFiberUnmount(Pl,l)}catch{}switch(l.tag){case 0:case 11:case 14:case 15:if(o=l.updateQueue,o!==null&&(o=o.lastEffect,o!==null)){var v=o=o.next;do{var E=v,w=E.destroy;E=E.tag,w!==void 0&&(E&2||E&4)&&Jh(l,p,w),v=v.next}while(v!==o)}break;case 1:if(tc(l,p),o=l.stateNode,typeof o.componentWillUnmount=="function")try{o.props=l.memoizedProps,o.state=l.memoizedState,o.componentWillUnmount()}catch(F){Yn(l,p,F)}break;case 5:tc(l,p);break;case 4:Ae?wg(o,l,p):k&&k&&(l=l.stateNode.containerInfo,p=tt(l),Tt(l,p))}}function yg(o,l,p){for(var v=l;;)if(xg(o,v,p),v.child===null||Ae&&v.tag===4){if(v===l)break;for(;v.sibling===null;){if(v.return===null||v.return===l)return;v=v.return}v.sibling.return=v.return,v=v.sibling}else v.child.return=v,v=v.child}function Sg(o){var l=o.alternate;l!==null&&(o.alternate=null,Sg(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&Ve(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Mg(o){return o.tag===5||o.tag===3||o.tag===4}function Eg(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Mg(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function bg(o){if(Ae){e:{for(var l=o.return;l!==null;){if(Mg(l))break e;l=l.return}throw Error(a(160))}var p=l;switch(p.tag){case 5:l=p.stateNode,p.flags&32&&(_e(l),p.flags&=-33),p=Eg(o),$h(o,p,l);break;case 3:case 4:l=p.stateNode.containerInfo,p=Eg(o),Qh(o,p,l);break;default:throw Error(a(161))}}}function Qh(o,l,p){var v=o.tag;if(v===5||v===6)o=o.stateNode,l?$e(p,o,l):ht(p,o);else if(v!==4&&(o=o.child,o!==null))for(Qh(o,l,p),o=o.sibling;o!==null;)Qh(o,l,p),o=o.sibling}function $h(o,l,p){var v=o.tag;if(v===5||v===6)o=o.stateNode,l?ct(p,o,l):et(p,o);else if(v!==4&&(o=o.child,o!==null))for($h(o,l,p),o=o.sibling;o!==null;)$h(o,l,p),o=o.sibling}function wg(o,l,p){for(var v=l,E=!1,w,F;;){if(!E){E=v.return;e:for(;;){if(E===null)throw Error(a(160));switch(w=E.stateNode,E.tag){case 5:F=!1;break e;case 3:w=w.containerInfo,F=!0;break e;case 4:w=w.containerInfo,F=!0;break e}E=E.return}E=!0}if(v.tag===5||v.tag===6)yg(o,v,p),F?V(w,v.stateNode):Ge(w,v.stateNode);else if(v.tag===18)F?re(w,v.stateNode):oe(w,v.stateNode);else if(v.tag===4){if(v.child!==null){w=v.stateNode.containerInfo,F=!0,v.child.return=v,v=v.child;continue}}else if(xg(o,v,p),v.child!==null){v.child.return=v,v=v.child;continue}if(v===l)break;for(;v.sibling===null;){if(v.return===null||v.return===l)return;v=v.return,v.tag===4&&(E=!1)}v.sibling.return=v.return,v=v.sibling}}function ed(o,l){if(Ae){switch(l.tag){case 0:case 11:case 14:case 15:ss(3,l,l.return),ga(3,l),ss(5,l,l.return);return;case 1:return;case 5:var p=l.stateNode;if(p!=null){var v=l.memoizedProps;o=o!==null?o.memoizedProps:v;var E=l.type,w=l.updateQueue;l.updateQueue=null,w!==null&&gt(p,w,E,o,v,l)}return;case 6:if(l.stateNode===null)throw Error(a(162));p=l.memoizedProps,Se(l.stateNode,o!==null?o.memoizedProps:p,p);return;case 3:ve&&o!==null&&o.memoizedState.isDehydrated&&$(l.stateNode.containerInfo);return;case 12:return;case 13:nc(l);return;case 19:nc(l);return;case 17:return}throw Error(a(163))}switch(l.tag){case 0:case 11:case 14:case 15:ss(3,l,l.return),ga(3,l),ss(5,l,l.return);return;case 12:return;case 13:nc(l);return;case 19:nc(l);return;case 3:ve&&o!==null&&o.memoizedState.isDehydrated&&$(l.stateNode.containerInfo);break;case 22:case 23:return}e:if(k){switch(l.tag){case 1:case 5:case 6:break e;case 3:case 4:l=l.stateNode,Tt(l.containerInfo,l.pendingChildren);break e}throw Error(a(163))}}function nc(o){var l=o.updateQueue;if(l!==null){o.updateQueue=null;var p=o.stateNode;p===null&&(p=o.stateNode=new uS),l.forEach(function(v){var E=SS.bind(null,o,v);p.has(v)||(p.add(v),v.then(E,E))})}}function dS(o,l){for(Ue=l;Ue!==null;){l=Ue;var p=l.deletions;if(p!==null)for(var v=0;v<p.length;v++){var E=p[v];try{var w=o;Ae?wg(w,E,l):yg(w,E,l);var F=E.alternate;F!==null&&(F.return=null),E.return=null}catch(Ze){Yn(E,l,Ze)}}if(p=l.child,l.subtreeFlags&12854&&p!==null)p.return=l,Ue=p;else for(;Ue!==null;){l=Ue;try{var X=l.flags;if(X&32&&Ae&&_e(l.stateNode),X&512){var ce=l.alternate;if(ce!==null){var we=ce.ref;we!==null&&(typeof we=="function"?we(null):we.current=null)}}if(X&8192)switch(l.tag){case 13:if(l.memoizedState!==null){var je=l.alternate;(je===null||je.memoizedState===null)&&(ad=pn())}break;case 22:var pt=l.memoizedState!==null,nt=l.alternate,Ft=nt!==null&&nt.memoizedState!==null;if(p=l,Ae){e:if(v=p,E=pt,w=null,Ae)for(var Qe=v;;){if(Qe.tag===5){if(w===null){w=Qe;var Ln=Qe.stateNode;E?Be(Ln):Me(Qe.stateNode,Qe.memoizedProps)}}else if(Qe.tag===6){if(w===null){var xi=Qe.stateNode;E?Fe(xi):G(xi,Qe.memoizedProps)}}else if((Qe.tag!==22&&Qe.tag!==23||Qe.memoizedState===null||Qe===v)&&Qe.child!==null){Qe.child.return=Qe,Qe=Qe.child;continue}if(Qe===v)break;for(;Qe.sibling===null;){if(Qe.return===null||Qe.return===v)break e;w===Qe&&(w=null),Qe=Qe.return}w===Qe&&(w=null),Qe.sibling.return=Qe.return,Qe=Qe.sibling}}if(pt&&!Ft&&p.mode&1){Ue=p;for(var ne=p.child;ne!==null;){for(p=Ue=ne;Ue!==null;){v=Ue;var Y=v.child;switch(v.tag){case 0:case 11:case 14:case 15:ss(4,v,v.return);break;case 1:tc(v,v.return);var ae=v.stateNode;if(typeof ae.componentWillUnmount=="function"){var ze=v.return;try{ae.props=v.memoizedProps,ae.state=v.memoizedState,ae.componentWillUnmount()}catch(Ze){Yn(v,ze,Ze)}}break;case 5:tc(v,v.return);break;case 22:if(v.memoizedState!==null){Cg(p);continue}}Y!==null?(Y.return=v,Ue=Y):Cg(p)}ne=ne.sibling}}}switch(X&4102){case 2:bg(l),l.flags&=-3;break;case 6:bg(l),l.flags&=-3,ed(l.alternate,l);break;case 4096:l.flags&=-4097;break;case 4100:l.flags&=-4097,ed(l.alternate,l);break;case 4:ed(l.alternate,l)}}catch(Ze){Yn(l,l.return,Ze)}if(p=l.sibling,p!==null){p.return=l.return,Ue=p;break}Ue=l.return}}}function fS(o,l,p){Ue=o,Tg(o)}function Tg(o,l,p){for(var v=(o.mode&1)!==0;Ue!==null;){var E=Ue,w=E.child;if(E.tag===22&&v){var F=E.memoizedState!==null||ec;if(!F){var X=E.alternate,ce=X!==null&&X.memoizedState!==null||rs;X=ec;var we=rs;if(ec=F,(rs=ce)&&!we)for(Ue=E;Ue!==null;)F=Ue,ce=F.child,F.tag===22&&F.memoizedState!==null?Rg(E):ce!==null?(ce.return=F,Ue=ce):Rg(E);for(;w!==null;)Ue=w,Tg(w),w=w.sibling;Ue=E,ec=X,rs=we}Ag(o)}else E.subtreeFlags&8772&&w!==null?(w.return=E,Ue=w):Ag(o)}}function Ag(o){for(;Ue!==null;){var l=Ue;if(l.flags&8772){var p=l.alternate;try{if(l.flags&8772)switch(l.tag){case 0:case 11:case 15:rs||ga(5,l);break;case 1:var v=l.stateNode;if(l.flags&4&&!rs)if(p===null)v.componentDidMount();else{var E=l.elementType===l.type?p.memoizedProps:bi(l.type,p.memoizedProps);v.componentDidUpdate(E,p.memoizedState,v.__reactInternalSnapshotBeforeUpdate)}var w=l.updateQueue;w!==null&&Sm(l,w,v);break;case 3:var F=l.updateQueue;if(F!==null){if(p=null,l.child!==null)switch(l.child.tag){case 5:p=ie(l.child.stateNode);break;case 1:p=l.child.stateNode}Sm(l,F,p)}break;case 5:var X=l.stateNode;p===null&&l.flags&4&&wt(X,l.type,l.memoizedProps,l);break;case 6:break;case 4:break;case 12:break;case 13:if(ve&&l.memoizedState===null){var ce=l.alternate;if(ce!==null){var we=ce.memoizedState;if(we!==null){var je=we.dehydrated;je!==null&&se(je)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(a(163))}rs||l.flags&512&&Kh(l)}catch(pt){Yn(l,l.return,pt)}}if(l===o){Ue=null;break}if(p=l.sibling,p!==null){p.return=l.return,Ue=p;break}Ue=l.return}}function Cg(o){for(;Ue!==null;){var l=Ue;if(l===o){Ue=null;break}var p=l.sibling;if(p!==null){p.return=l.return,Ue=p;break}Ue=l.return}}function Rg(o){for(;Ue!==null;){var l=Ue;try{switch(l.tag){case 0:case 11:case 15:var p=l.return;try{ga(4,l)}catch(ce){Yn(l,p,ce)}break;case 1:var v=l.stateNode;if(typeof v.componentDidMount=="function"){var E=l.return;try{v.componentDidMount()}catch(ce){Yn(l,E,ce)}}var w=l.return;try{Kh(l)}catch(ce){Yn(l,w,ce)}break;case 5:var F=l.return;try{Kh(l)}catch(ce){Yn(l,F,ce)}}}catch(ce){Yn(l,l.return,ce)}if(l===o){Ue=null;break}var X=l.sibling;if(X!==null){X.return=l.return,Ue=X;break}Ue=l.return}}var ic=0,rc=1,sc=2,oc=3,ac=4;if(typeof Symbol=="function"&&Symbol.for){var _a=Symbol.for;ic=_a("selector.component"),rc=_a("selector.has_pseudo_class"),sc=_a("selector.role"),oc=_a("selector.test_id"),ac=_a("selector.text")}function td(o){var l=ue(o);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(a(364));return l}if(o=Q(o),o===null)throw Error(a(362));return o.stateNode.current}function nd(o,l){switch(l.$$typeof){case ic:if(o.type===l.value)return!0;break;case rc:e:{l=l.value,o=[o,0];for(var p=0;p<o.length;){var v=o[p++],E=o[p++],w=l[E];if(v.tag!==5||!me(v)){for(;w!=null&&nd(v,w);)E++,w=l[E];if(E===l.length){l=!0;break e}else for(v=v.child;v!==null;)o.push(v,E),v=v.sibling}}l=!1}return l;case sc:if(o.tag===5&&Xe(o.stateNode,l.value))return!0;break;case ac:if((o.tag===5||o.tag===6)&&(o=xe(o),o!==null&&0<=o.indexOf(l.value)))return!0;break;case oc:if(o.tag===5&&(o=o.memoizedProps["data-testname"],typeof o=="string"&&o.toLowerCase()===l.value.toLowerCase()))return!0;break;default:throw Error(a(365))}return!1}function id(o){switch(o.$$typeof){case ic:return"<"+(N(o.value)||"Unknown")+">";case rc:return":has("+(id(o)||"")+")";case sc:return'[role="'+o.value+'"]';case ac:return'"'+o.value+'"';case oc:return'[data-testname="'+o.value+'"]';default:throw Error(a(365))}}function Pg(o,l){var p=[];o=[o,0];for(var v=0;v<o.length;){var E=o[v++],w=o[v++],F=l[w];if(E.tag!==5||!me(E)){for(;F!=null&&nd(E,F);)w++,F=l[w];if(w===l.length)p.push(E);else for(E=E.child;E!==null;)o.push(E,w),E=E.sibling}}return p}function rd(o,l){if(!I)throw Error(a(363));o=td(o),o=Pg(o,l),l=[],o=Array.from(o);for(var p=0;p<o.length;){var v=o[p++];if(v.tag===5)me(v)||l.push(v.stateNode);else for(v=v.child;v!==null;)o.push(v),v=v.sibling}return l}var pS=Math.ceil,lc=c.ReactCurrentDispatcher,sd=c.ReactCurrentOwner,Qt=c.ReactCurrentBatchConfig,Et=0,rn=null,sn=null,En=0,ii=0,oo=dn(0),ln=0,va=null,ao=0,cc=0,od=0,xa=null,Xn=null,ad=0,ld=1/0;function lo(){ld=pn()+500}var uc=!1,cd=null,Rr=null,hc=!1,Pr=null,dc=0,ya=0,ud=null,fc=-1,pc=0;function kn(){return Et&6?pn():fc!==-1?fc:fc=pn()}function Lr(o){return o.mode&1?Et&2&&En!==0?En&-En:Jy.transition!==null?(pc===0&&(o=Al,Al<<=1,!(Al&4194240)&&(Al=64),pc=o),pc):(o=Pt,o!==0?o:pe()):1}function _i(o,l,p){if(50<ya)throw ya=0,ud=null,Error(a(185));var v=mc(o,l);return v===null?null:(ia(v,l,p),(!(Et&2)||v!==rn)&&(v===rn&&(!(Et&2)&&(cc|=l),ln===4&&Ir(v,En)),qn(v,p),l===1&&Et===0&&!(o.mode&1)&&(lo(),Ll&&Wi())),v)}function mc(o,l){o.lanes|=l;var p=o.alternate;for(p!==null&&(p.lanes|=l),p=o,o=o.return;o!==null;)o.childLanes|=l,p=o.alternate,p!==null&&(p.childLanes|=l),p=o,o=o.return;return p.tag===3?p.stateNode:null}function qn(o,l){var p=o.callbackNode;Hy(o,l);var v=Rl(o,o===rn?En:0);if(v===0)p!==null&&gm(p),o.callbackNode=null,o.callbackPriority=0;else if(l=v&-v,o.callbackPriority!==l){if(p!=null&&gm(p),l===1)o.tag===0?Zy(Ig.bind(null,o)):_m(Ig.bind(null,o)),Le?D(function(){Et===0&&Wi()}):vh(xh,Wi),p=null;else{switch(mm(v)){case 1:p=xh;break;case 4:p=jy;break;case 16:p=yh;break;case 536870912:p=Xy;break;default:p=yh}p=Hg(p,Lg.bind(null,o))}o.callbackPriority=l,o.callbackNode=p}}function Lg(o,l){if(fc=-1,pc=0,Et&6)throw Error(a(327));var p=o.callbackNode;if(ls()&&o.callbackNode!==p)return null;var v=Rl(o,o===rn?En:0);if(v===0)return null;if(v&30||v&o.expiredLanes||l)l=gc(o,v);else{l=v;var E=Et;Et|=2;var w=Ug();(rn!==o||En!==l)&&(lo(),os(o,l));do try{_S();break}catch(X){Dg(o,X)}while(!0);Eh(),lc.current=w,Et=E,sn!==null?l=0:(rn=null,En=0,l=ln)}if(l!==0){if(l===2&&(E=mh(o),E!==0&&(v=E,l=hd(o,E))),l===1)throw p=va,os(o,0),Ir(o,v),qn(o,pn()),p;if(l===6)Ir(o,v);else{if(E=o.current.alternate,!(v&30)&&!mS(E)&&(l=gc(o,v),l===2&&(w=mh(o),w!==0&&(v=w,l=hd(o,w))),l===1))throw p=va,os(o,0),Ir(o,v),qn(o,pn()),p;switch(o.finishedWork=E,o.finishedLanes=v,l){case 0:case 1:throw Error(a(345));case 2:as(o,Xn);break;case 3:if(Ir(o,v),(v&130023424)===v&&(l=ad+500-pn(),10<l)){if(Rl(o,0)!==0)break;if(E=o.suspendedLanes,(E&v)!==v){kn(),o.pingedLanes|=o.suspendedLanes&E;break}o.timeoutHandle=Ne(as.bind(null,o,Xn),l);break}as(o,Xn);break;case 4:if(Ir(o,v),(v&4194240)===v)break;for(l=o.eventTimes,E=-1;0<v;){var F=31-$n(v);w=1<<F,F=l[F],F>E&&(E=F),v&=~w}if(v=E,v=pn()-v,v=(120>v?120:480>v?480:1080>v?1080:1920>v?1920:3e3>v?3e3:4320>v?4320:1960*pS(v/1960))-v,10<v){o.timeoutHandle=Ne(as.bind(null,o,Xn),v);break}as(o,Xn);break;case 5:as(o,Xn);break;default:throw Error(a(329))}}}return qn(o,pn()),o.callbackNode===p?Lg.bind(null,o):null}function hd(o,l){var p=xa;return o.current.memoizedState.isDehydrated&&(os(o,l).flags|=256),o=gc(o,l),o!==2&&(l=Xn,Xn=p,l!==null&&dd(l)),o}function dd(o){Xn===null?Xn=o:Xn.push.apply(Xn,o)}function mS(o){for(var l=o;;){if(l.flags&16384){var p=l.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var v=0;v<p.length;v++){var E=p[v],w=E.getSnapshot;E=E.value;try{if(!Gi(w(),E))return!1}catch{return!1}}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ir(o,l){for(l&=~od,l&=~cc,o.suspendedLanes|=l,o.pingedLanes&=~l,o=o.expirationTimes;0<l;){var p=31-$n(l),v=1<<p;o[p]=-1,l&=~v}}function Ig(o){if(Et&6)throw Error(a(327));ls();var l=Rl(o,0);if(!(l&1))return qn(o,pn()),null;var p=gc(o,l);if(o.tag!==0&&p===2){var v=mh(o);v!==0&&(l=v,p=hd(o,v))}if(p===1)throw p=va,os(o,0),Ir(o,l),qn(o,pn()),p;if(p===6)throw Error(a(345));return o.finishedWork=o.current.alternate,o.finishedLanes=l,as(o,Xn),qn(o,pn()),null}function Ng(o){Pr!==null&&Pr.tag===0&&!(Et&6)&&ls();var l=Et;Et|=1;var p=Qt.transition,v=Pt;try{if(Qt.transition=null,Pt=1,o)return o()}finally{Pt=v,Qt.transition=p,Et=l,!(Et&6)&&Wi()}}function fd(){ii=oo.current,at(oo)}function os(o,l){o.finishedWork=null,o.finishedLanes=0;var p=o.timeoutHandle;if(p!==rt&&(o.timeoutHandle=rt,Je(p)),sn!==null)for(p=sn.return;p!==null;){var v=p;switch(Ph(v),v.tag){case 1:v=v.type.childContextTypes,v!=null&&Kt();break;case 3:ro(),at(qt),at(Mt),Fh();break;case 5:Uh(v);break;case 4:ro();break;case 13:at(Wt);break;case 19:at(Wt);break;case 10:bh(v.type._context);break;case 22:case 23:fd()}p=p.return}if(rn=o,sn=o=Nr(o.current,null),En=ii=l,ln=0,va=null,od=cc=ao=0,Xn=xa=null,ji!==null){for(l=0;l<ji.length;l++)if(p=ji[l],v=p.interleaved,v!==null){p.interleaved=null;var E=v.next,w=p.pending;if(w!==null){var F=w.next;w.next=E,v.next=F}p.pending=v}ji=null}return o}function Dg(o,l){do{var p=sn;try{if(Eh(),Vl.current=Yl,Gl){for(var v=Yt.memoizedState;v!==null;){var E=v.queue;E!==null&&(E.pending=null),v=v.next}Gl=!1}if(so=0,mn=Cn=Yt=null,ca=!1,ua=0,sd.current=null,p===null||p.return===null){ln=1,va=l,sn=null;break}e:{var w=o,F=p.return,X=p,ce=l;if(l=En,X.flags|=32768,ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var we=ce,je=X,pt=je.tag;if(!(je.mode&1)&&(pt===0||pt===11||pt===15)){var nt=je.alternate;nt?(je.updateQueue=nt.updateQueue,je.memoizedState=nt.memoizedState,je.lanes=nt.lanes):(je.updateQueue=null,je.memoizedState=null)}var Ft=tg(F);if(Ft!==null){Ft.flags&=-257,ng(Ft,F,X,w,l),Ft.mode&1&&eg(w,we,l),l=Ft,ce=we;var Qe=l.updateQueue;if(Qe===null){var Ln=new Set;Ln.add(ce),l.updateQueue=Ln}else Qe.add(ce);break e}else{if(!(l&1)){eg(w,we,l),pd();break e}ce=Error(a(426))}}else if(Vt&&X.mode&1){var xi=tg(F);if(xi!==null){!(xi.flags&65536)&&(xi.flags|=256),ng(xi,F,X,w,l),Nh(ce);break e}}w=ce,ln!==4&&(ln=2),xa===null?xa=[w]:xa.push(w),ce=Wh(ce,X),X=F;do{switch(X.tag){case 3:X.flags|=65536,l&=-l,X.lanes|=l;var ne=Qm(X,ce,l);ym(X,ne);break e;case 1:w=ce;var Y=X.type,ae=X.stateNode;if(!(X.flags&128)&&(typeof Y.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&(Rr===null||!Rr.has(ae)))){X.flags|=65536,l&=-l,X.lanes|=l;var ze=$m(X,w,l);ym(X,ze);break e}}X=X.return}while(X!==null)}Fg(p)}catch(Ze){l=Ze,sn===p&&p!==null&&(sn=p=p.return);continue}break}while(!0)}function Ug(){var o=lc.current;return lc.current=Yl,o===null?Yl:o}function pd(){(ln===0||ln===3||ln===2)&&(ln=4),rn===null||!(ao&268435455)&&!(cc&268435455)||Ir(rn,En)}function gc(o,l){var p=Et;Et|=2;var v=Ug();rn===o&&En===l||os(o,l);do try{gS();break}catch(E){Dg(o,E)}while(!0);if(Eh(),Et=p,lc.current=v,sn!==null)throw Error(a(261));return rn=null,En=0,ln}function gS(){for(;sn!==null;)Og(sn)}function _S(){for(;sn!==null&&!Gy();)Og(sn)}function Og(o){var l=kg(o.alternate,o,ii);o.memoizedProps=o.pendingProps,l===null?Fg(o):sn=l,sd.current=null}function Fg(o){var l=o;do{var p=l.alternate;if(o=l.return,l.flags&32768){if(p=cS(p,l),p!==null){p.flags&=32767,sn=p;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{ln=6,sn=null;return}}else if(p=oS(p,l,ii),p!==null){sn=p;return}if(l=l.sibling,l!==null){sn=l;return}sn=l=o}while(l!==null);ln===0&&(ln=5)}function as(o,l){var p=Pt,v=Qt.transition;try{Qt.transition=null,Pt=1,vS(o,l,p)}finally{Qt.transition=v,Pt=p}return null}function vS(o,l,p){do ls();while(Pr!==null);if(Et&6)throw Error(a(327));var v=o.finishedWork,E=o.finishedLanes;if(v===null)return null;if(o.finishedWork=null,o.finishedLanes=0,v===o.current)throw Error(a(177));o.callbackNode=null,o.callbackPriority=0;var w=v.lanes|v.childLanes;if(Vy(o,w),o===rn&&(sn=rn=null,En=0),!(v.subtreeFlags&2064)&&!(v.flags&2064)||hc||(hc=!0,Hg(yh,function(){return ls(),null})),w=(v.flags&15990)!==0,v.subtreeFlags&15990||w){w=Qt.transition,Qt.transition=null;var F=Pt;Pt=1;var X=Et;Et|=4,sd.current=null,hS(o,v),dS(o,v),J(o.containerInfo),o.current=v,fS(v),Wy(),Et=X,Pt=F,Qt.transition=w}else o.current=v;if(hc&&(hc=!1,Pr=o,dc=E),w=o.pendingLanes,w===0&&(Rr=null),qy(v.stateNode),qn(o,pn()),l!==null)for(p=o.onRecoverableError,v=0;v<l.length;v++)p(l[v]);if(uc)throw uc=!1,o=cd,cd=null,o;return dc&1&&o.tag!==0&&ls(),w=o.pendingLanes,w&1?o===ud?ya++:(ya=0,ud=o):ya=0,Wi(),null}function ls(){if(Pr!==null){var o=mm(dc),l=Qt.transition,p=Pt;try{if(Qt.transition=null,Pt=16>o?16:o,Pr===null)var v=!1;else{if(o=Pr,Pr=null,dc=0,Et&6)throw Error(a(331));var E=Et;for(Et|=4,Ue=o.current;Ue!==null;){var w=Ue,F=w.child;if(Ue.flags&16){var X=w.deletions;if(X!==null){for(var ce=0;ce<X.length;ce++){var we=X[ce];for(Ue=we;Ue!==null;){var je=Ue;switch(je.tag){case 0:case 11:case 15:ss(8,je,w)}var pt=je.child;if(pt!==null)pt.return=je,Ue=pt;else for(;Ue!==null;){je=Ue;var nt=je.sibling,Ft=je.return;if(Sg(je),je===we){Ue=null;break}if(nt!==null){nt.return=Ft,Ue=nt;break}Ue=Ft}}}var Qe=w.alternate;if(Qe!==null){var Ln=Qe.child;if(Ln!==null){Qe.child=null;do{var xi=Ln.sibling;Ln.sibling=null,Ln=xi}while(Ln!==null)}}Ue=w}}if(w.subtreeFlags&2064&&F!==null)F.return=w,Ue=F;else e:for(;Ue!==null;){if(w=Ue,w.flags&2048)switch(w.tag){case 0:case 11:case 15:ss(9,w,w.return)}var ne=w.sibling;if(ne!==null){ne.return=w.return,Ue=ne;break e}Ue=w.return}}var Y=o.current;for(Ue=Y;Ue!==null;){F=Ue;var ae=F.child;if(F.subtreeFlags&2064&&ae!==null)ae.return=F,Ue=ae;else e:for(F=Y;Ue!==null;){if(X=Ue,X.flags&2048)try{switch(X.tag){case 0:case 11:case 15:ga(9,X)}}catch(Ze){Yn(X,X.return,Ze)}if(X===F){Ue=null;break e}var ze=X.sibling;if(ze!==null){ze.return=X.return,Ue=ze;break e}Ue=X.return}}if(Et=E,Wi(),Vi&&typeof Vi.onPostCommitFiberRoot=="function")try{Vi.onPostCommitFiberRoot(Pl,o)}catch{}v=!0}return v}finally{Pt=p,Qt.transition=l}}return!1}function zg(o,l,p){l=Wh(p,l),l=Qm(o,l,1),Cr(o,l),l=kn(),o=mc(o,1),o!==null&&(ia(o,1,l),qn(o,l))}function Yn(o,l,p){if(o.tag===3)zg(o,o,p);else for(;l!==null;){if(l.tag===3){zg(l,o,p);break}else if(l.tag===1){var v=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Rr===null||!Rr.has(v))){o=Wh(p,o),o=$m(l,o,1),Cr(l,o),o=kn(),l=mc(l,1),l!==null&&(ia(l,1,o),qn(l,o));break}}l=l.return}}function xS(o,l,p){var v=o.pingCache;v!==null&&v.delete(l),l=kn(),o.pingedLanes|=o.suspendedLanes&p,rn===o&&(En&p)===p&&(ln===4||ln===3&&(En&130023424)===En&&500>pn()-ad?os(o,0):od|=p),qn(o,l)}function Bg(o,l){l===0&&(o.mode&1?(l=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):l=1);var p=kn();o=mc(o,l),o!==null&&(ia(o,l,p),qn(o,p))}function yS(o){var l=o.memoizedState,p=0;l!==null&&(p=l.retryLane),Bg(o,p)}function SS(o,l){var p=0;switch(o.tag){case 13:var v=o.stateNode,E=o.memoizedState;E!==null&&(p=E.retryLane);break;case 19:v=o.stateNode;break;default:throw Error(a(314))}v!==null&&v.delete(l),Bg(o,p)}var kg;kg=function(o,l,p){if(o!==null)if(o.memoizedProps!==l.pendingProps||qt.current)ni=!0;else{if(!(o.lanes&p)&&!(l.flags&128))return ni=!1,lS(o,l,p);ni=!!(o.flags&131072)}else ni=!1,Vt&&l.flags&1048576&&Tm(l,Bl,l.index);switch(l.lanes=0,l.tag){case 2:var v=l.type;o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),o=l.pendingProps;var E=hi(l,Mt.current);Qs(l,p),E=Bh(null,l,v,o,E,p);var w=kh();return l.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,fn(v)?(w=!0,Mn(l)):w=!1,l.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,Th(l),E.updater=Fl,l.stateNode=E,E._reactInternals=l,Ch(l,v,o,p),l=qh(null,l,v,!0,w,p)):(l.tag=0,Vt&&w&&Rh(l),Bn(null,l,E,p),l=l.child),l;case 16:v=l.elementType;e:{switch(o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),o=l.pendingProps,E=v._init,v=E(v._payload),l.type=v,E=l.tag=ES(v),o=bi(v,o),E){case 0:l=Xh(null,l,v,o,p);break e;case 1:l=ug(null,l,v,o,p);break e;case 11:l=sg(null,l,v,o,p);break e;case 14:l=og(null,l,v,bi(v.type,o),p);break e}throw Error(a(306,v,""))}return l;case 0:return v=l.type,E=l.pendingProps,E=l.elementType===v?E:bi(v,E),Xh(o,l,v,E,p);case 1:return v=l.type,E=l.pendingProps,E=l.elementType===v?E:bi(v,E),ug(o,l,v,E,p);case 3:e:{if(hg(l),o===null)throw Error(a(387));v=l.pendingProps,w=l.memoizedState,E=w.element,xm(o,l),Ol(l,v,null,p);var F=l.memoizedState;if(v=F.element,ve&&w.isDehydrated)if(w={element:v,isDehydrated:!1,cache:F.cache,transitions:F.transitions},l.updateQueue.baseState=w,l.memoizedState=w,l.flags&256){E=Error(a(423)),l=dg(o,l,v,p,E);break e}else if(v!==E){E=Error(a(424)),l=dg(o,l,v,p,E);break e}else for(ve&&(ti=bl(l.stateNode.containerInfo),ei=l,Vt=!0,wi=null,ra=!1),p=Im(l,null,v,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(to(),v===E){l=cr(o,l,p);break e}Bn(o,l,v,p)}l=l.child}return l;case 5:return Nm(l),o===null&&Ih(l),v=l.type,E=l.pendingProps,w=o!==null?o.memoizedProps:null,F=E.children,be(v,E)?F=null:w!==null&&be(v,w)&&(l.flags|=32),cg(o,l),Bn(o,l,F,p),l.child;case 6:return o===null&&Ih(l),null;case 13:return fg(o,l,p);case 4:return Dh(l,l.stateNode.containerInfo),v=l.pendingProps,o===null?l.child=no(l,null,v,p):Bn(o,l,v,p),l.child;case 11:return v=l.type,E=l.pendingProps,E=l.elementType===v?E:bi(v,E),sg(o,l,v,E,p);case 7:return Bn(o,l,l.pendingProps,p),l.child;case 8:return Bn(o,l,l.pendingProps.children,p),l.child;case 12:return Bn(o,l,l.pendingProps.children,p),l.child;case 10:e:{if(v=l.type._context,E=l.pendingProps,w=l.memoizedProps,F=E.value,vm(l,v,F),w!==null)if(Gi(w.value,F)){if(w.children===E.children&&!qt.current){l=cr(o,l,p);break e}}else for(w=l.child,w!==null&&(w.return=l);w!==null;){var X=w.dependencies;if(X!==null){F=w.child;for(var ce=X.firstContext;ce!==null;){if(ce.context===v){if(w.tag===1){ce=sr(-1,p&-p),ce.tag=2;var we=w.updateQueue;if(we!==null){we=we.shared;var je=we.pending;je===null?ce.next=ce:(ce.next=je.next,je.next=ce),we.pending=ce}}w.lanes|=p,ce=w.alternate,ce!==null&&(ce.lanes|=p),wh(w.return,p,l),X.lanes|=p;break}ce=ce.next}}else if(w.tag===10)F=w.type===l.type?null:w.child;else if(w.tag===18){if(F=w.return,F===null)throw Error(a(341));F.lanes|=p,X=F.alternate,X!==null&&(X.lanes|=p),wh(F,p,l),F=w.sibling}else F=w.child;if(F!==null)F.return=w;else for(F=w;F!==null;){if(F===l){F=null;break}if(w=F.sibling,w!==null){w.return=F.return,F=w;break}F=F.return}w=F}Bn(o,l,E.children,p),l=l.child}return l;case 9:return E=l.type,v=l.pendingProps.children,Qs(l,p),E=di(E),v=v(E),l.flags|=1,Bn(o,l,v,p),l.child;case 14:return v=l.type,E=bi(v,l.pendingProps),E=bi(v.type,E),og(o,l,v,E,p);case 15:return ag(o,l,l.type,l.pendingProps,p);case 17:return v=l.type,E=l.pendingProps,E=l.elementType===v?E:bi(v,E),o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),l.tag=1,fn(v)?(o=!0,Mn(l)):o=!1,Qs(l,p),bm(l,v,E),Ch(l,v,E,p),qh(null,l,v,!0,o,p);case 19:return _g(o,l,p);case 22:return lg(o,l,p)}throw Error(a(156,l.tag))};function Hg(o,l){return vh(o,l)}function MS(o,l,p,v){this.tag=o,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vi(o,l,p,v){return new MS(o,l,p,v)}function md(o){return o=o.prototype,!(!o||!o.isReactComponent)}function ES(o){if(typeof o=="function")return md(o)?1:0;if(o!=null){if(o=o.$$typeof,o===S)return 11;if(o===b)return 14}return 2}function Nr(o,l){var p=o.alternate;return p===null?(p=vi(o.tag,l,o.key,o.mode),p.elementType=o.elementType,p.type=o.type,p.stateNode=o.stateNode,p.alternate=o,o.alternate=p):(p.pendingProps=l,p.type=o.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=o.flags&14680064,p.childLanes=o.childLanes,p.lanes=o.lanes,p.child=o.child,p.memoizedProps=o.memoizedProps,p.memoizedState=o.memoizedState,p.updateQueue=o.updateQueue,l=o.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=o.sibling,p.index=o.index,p.ref=o.ref,p}function _c(o,l,p,v,E,w){var F=2;if(v=o,typeof o=="function")md(o)&&(F=1);else if(typeof o=="string")F=5;else e:switch(o){case d:return cs(p.children,E,w,l);case f:F=8,E|=8;break;case m:return o=vi(12,p,l,E|2),o.elementType=m,o.lanes=w,o;case y:return o=vi(13,p,l,E),o.elementType=y,o.lanes=w,o;case _:return o=vi(19,p,l,E),o.elementType=_,o.lanes=w,o;case T:return vc(p,E,w,l);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case g:F=10;break e;case x:F=9;break e;case S:F=11;break e;case b:F=14;break e;case M:F=16,v=null;break e}throw Error(a(130,o==null?o:typeof o,""))}return l=vi(F,p,l,E),l.elementType=o,l.type=v,l.lanes=w,l}function cs(o,l,p,v){return o=vi(7,o,v,l),o.lanes=p,o}function vc(o,l,p,v){return o=vi(22,o,v,l),o.elementType=T,o.lanes=p,o.stateNode={},o}function gd(o,l,p){return o=vi(6,o,null,l),o.lanes=p,o}function _d(o,l,p){return l=vi(4,o.children!==null?o.children:[],o.key,l),l.lanes=p,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}function bS(o,l,p,v,E){this.tag=l,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=rt,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gh(0),this.expirationTimes=gh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gh(0),this.identifierPrefix=v,this.onRecoverableError=E,ve&&(this.mutableSourceEagerHydrationData=null)}function Vg(o,l,p,v,E,w,F,X,ce){return o=new bS(o,l,p,X,ce),l===1?(l=1,w===!0&&(l|=8)):l=0,w=vi(3,null,null,l),o.current=w,w.stateNode=o,w.memoizedState={element:v,isDehydrated:p,cache:null,transitions:null},Th(w),o}function Gg(o){if(!o)return ui;o=o._reactInternals;e:{if(A(o)!==o||o.tag!==1)throw Error(a(170));var l=o;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(fn(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(a(171))}if(o.tag===1){var p=o.type;if(fn(p))return Zs(o,p,l)}return l}function Wg(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(a(188)):(o=Object.keys(o).join(","),Error(a(268,o)));return o=ee(l),o===null?null:o.stateNode}function jg(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var p=o.retryLane;o.retryLane=p!==0&&p<l?p:l}}function vd(o,l){jg(o,l),(o=o.alternate)&&jg(o,l)}function wS(o){return o=ee(o),o===null?null:o.stateNode}function TS(){return null}return t.attemptContinuousHydration=function(o){if(o.tag===13){var l=kn();_i(o,134217728,l),vd(o,134217728)}},t.attemptHydrationAtCurrentPriority=function(o){if(o.tag===13){var l=kn(),p=Lr(o);_i(o,p,l),vd(o,p)}},t.attemptSynchronousHydration=function(o){switch(o.tag){case 3:var l=o.stateNode;if(l.current.memoizedState.isDehydrated){var p=na(l.pendingLanes);p!==0&&(_h(l,p|1),qn(l,pn()),!(Et&6)&&(lo(),Wi()))}break;case 13:var v=kn();Ng(function(){return _i(o,1,v)}),vd(o,1)}},t.batchedUpdates=function(o,l){var p=Et;Et|=1;try{return o(l)}finally{Et=p,Et===0&&(lo(),Ll&&Wi())}},t.createComponentSelector=function(o){return{$$typeof:ic,value:o}},t.createContainer=function(o,l,p,v,E,w,F){return Vg(o,l,!1,null,p,v,E,w,F)},t.createHasPseudoClassSelector=function(o){return{$$typeof:rc,value:o}},t.createHydrationContainer=function(o,l,p,v,E,w,F,X,ce){return o=Vg(p,v,!0,o,E,w,F,X,ce),o.context=Gg(null),p=o.current,v=kn(),E=Lr(p),w=sr(v,E),w.callback=l??null,Cr(p,w),o.current.lanes=E,ia(o,E,v),qn(o,v),o},t.createPortal=function(o,l,p){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:v==null?null:""+v,children:o,containerInfo:l,implementation:p}},t.createRoleSelector=function(o){return{$$typeof:sc,value:o}},t.createTestNameSelector=function(o){return{$$typeof:oc,value:o}},t.createTextSelector=function(o){return{$$typeof:ac,value:o}},t.deferredUpdates=function(o){var l=Pt,p=Qt.transition;try{return Qt.transition=null,Pt=16,o()}finally{Pt=l,Qt.transition=p}},t.discreteUpdates=function(o,l,p,v,E){var w=Pt,F=Qt.transition;try{return Qt.transition=null,Pt=1,o(l,p,v,E)}finally{Pt=w,Qt.transition=F,Et===0&&lo()}},t.findAllNodes=rd,t.findBoundingRects=function(o,l){if(!I)throw Error(a(363));l=rd(o,l),o=[];for(var p=0;p<l.length;p++)o.push(ye(l[p]));for(l=o.length-1;0<l;l--){p=o[l];for(var v=p.x,E=v+p.width,w=p.y,F=w+p.height,X=l-1;0<=X;X--)if(l!==X){var ce=o[X],we=ce.x,je=we+ce.width,pt=ce.y,nt=pt+ce.height;if(v>=we&&w>=pt&&E<=je&&F<=nt){o.splice(l,1);break}else if(v!==we||p.width!==ce.width||nt<w||pt>F){if(!(w!==pt||p.height!==ce.height||je<v||we>E)){we>v&&(ce.width+=we-v,ce.x=v),je<E&&(ce.width=E-we),o.splice(l,1);break}}else{pt>w&&(ce.height+=pt-w,ce.y=w),nt<F&&(ce.height=F-pt),o.splice(l,1);break}}}return o},t.findHostInstance=Wg,t.findHostInstanceWithNoPortals=function(o){return o=z(o),o=o!==null?H(o):null,o===null?null:o.stateNode},t.findHostInstanceWithWarning=function(o){return Wg(o)},t.flushControlled=function(o){var l=Et;Et|=1;var p=Qt.transition,v=Pt;try{Qt.transition=null,Pt=1,o()}finally{Pt=v,Qt.transition=p,Et=l,Et===0&&(lo(),Wi())}},t.flushPassiveEffects=ls,t.flushSync=Ng,t.focusWithin=function(o,l){if(!I)throw Error(a(363));for(o=td(o),l=Pg(o,l),l=Array.from(l),o=0;o<l.length;){var p=l[o++];if(!me(p)){if(p.tag===5&&Re(p.stateNode))return!0;for(p=p.child;p!==null;)l.push(p),p=p.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Pt},t.getFindAllNodesFailureDescription=function(o,l){if(!I)throw Error(a(363));var p=0,v=[];o=[td(o),0];for(var E=0;E<o.length;){var w=o[E++],F=o[E++],X=l[F];if((w.tag!==5||!me(w))&&(nd(w,X)&&(v.push(id(X)),F++,F>p&&(p=F)),F<l.length))for(w=w.child;w!==null;)o.push(w,F),w=w.sibling}if(p<l.length){for(o=[];p<l.length;p++)o.push(id(l[p]));return`findAllNodes was able to match part of the selector:
3717
+ `+w.stack}return{value:o,source:l,stack:E}}function jh(o,l){try{console.error(l.value)}catch(p){setTimeout(function(){throw p})}}var sS=typeof WeakMap=="function"?WeakMap:Map;function Km(o,l,p){p=sr(-1,p),p.tag=3,p.payload={element:null};var v=l.value;return p.callback=function(){uc||(uc=!0,cd=v),jh(o,l)},p}function Qm(o,l,p){p=sr(-1,p),p.tag=3;var v=o.type.getDerivedStateFromError;if(typeof v=="function"){var E=l.value;p.payload=function(){return v(E)},p.callback=function(){jh(o,l)}}var w=o.stateNode;return w!==null&&typeof w.componentDidCatch=="function"&&(p.callback=function(){jh(o,l),typeof v!="function"&&(Rr===null?Rr=new Set([this]):Rr.add(this));var F=l.stack;this.componentDidCatch(l.value,{componentStack:F!==null?F:""})}),p}function $m(o,l,p){var v=o.pingCache;if(v===null){v=o.pingCache=new sS;var E=new Set;v.set(l,E)}else E=v.get(l),E===void 0&&(E=new Set,v.set(l,E));E.has(p)||(E.add(p),o=xS.bind(null,o,l,p),l.then(o,o))}function eg(o){do{var l;if((l=o.tag===13)&&(l=o.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return o;o=o.return}while(o!==null);return null}function tg(o,l,p,v,E){return o.mode&1?(o.flags|=65536,o.lanes=E,o):(o===l?o.flags|=65536:(o.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(l=sr(-1,1),l.tag=2,Cr(p,l))),p.lanes|=1),o)}function Yi(o){o.flags|=4}function ng(o,l){if(o!==null&&o.child===l.child)return!0;if(l.flags&16)return!1;for(o=l.child;o!==null;){if(o.flags&12854||o.subtreeFlags&12854)return!1;o=o.sibling}return!0}var fa,pa,Zl,Jl;if(Ae)fa=function(o,l){for(var p=l.child;p!==null;){if(p.tag===5||p.tag===6)ge(o,p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===l)break;for(;p.sibling===null;){if(p.return===null||p.return===l)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},pa=function(){},Zl=function(o,l,p,v,E){if(o=o.memoizedProps,o!==v){var w=l.stateNode,F=Xi(mi.current);p=fe(w,p,o,v,E,F),(l.updateQueue=p)&&Yi(l)}},Jl=function(o,l,p,v){p!==v&&Yi(l)};else if(k){fa=function(o,l,p,v){for(var E=l.child;E!==null;){if(E.tag===5){var w=E.stateNode;p&&v&&(w=Ot(w,E.type,E.memoizedProps,E)),ge(o,w)}else if(E.tag===6)w=E.stateNode,p&&v&&(w=Ht(w,E.memoizedProps,E)),ge(o,w);else if(E.tag!==4){if(E.tag===22&&E.memoizedState!==null)w=E.child,w!==null&&(w.return=E),fa(o,E,!0,!0);else if(E.child!==null){E.child.return=E,E=E.child;continue}}if(E===l)break;for(;E.sibling===null;){if(E.return===null||E.return===l)return;E=E.return}E.sibling.return=E.return,E=E.sibling}};var ig=function(o,l,p,v){for(var E=l.child;E!==null;){if(E.tag===5){var w=E.stateNode;p&&v&&(w=Ot(w,E.type,E.memoizedProps,E)),Ye(o,w)}else if(E.tag===6)w=E.stateNode,p&&v&&(w=Ht(w,E.memoizedProps,E)),Ye(o,w);else if(E.tag!==4){if(E.tag===22&&E.memoizedState!==null)w=E.child,w!==null&&(w.return=E),ig(o,E,!0,!0);else if(E.child!==null){E.child.return=E,E=E.child;continue}}if(E===l)break;for(;E.sibling===null;){if(E.return===null||E.return===l)return;E=E.return}E.sibling.return=E.return,E=E.sibling}};pa=function(o,l){var p=l.stateNode;if(!ng(o,l)){o=p.containerInfo;var v=tt(o);ig(v,l,!1,!1),p.pendingChildren=v,Yi(l),bt(o,v)}},Zl=function(o,l,p,v,E){var w=o.stateNode,F=o.memoizedProps;if((o=ng(o,l))&&F===v)l.stateNode=w;else{var X=l.stateNode,ce=Xi(mi.current),we=null;F!==v&&(we=fe(X,p,F,v,E,ce)),o&&we===null?l.stateNode=w:(w=De(w,we,p,F,v,l,o,X),K(w,p,v,E,ce)&&Yi(l),l.stateNode=w,o?Yi(l):fa(w,l,!1,!1))}},Jl=function(o,l,p,v){p!==v?(o=Xi(io.current),p=Xi(mi.current),l.stateNode=Oe(v,o,p,l),Yi(l)):l.stateNode=o.stateNode}}else pa=function(){},Zl=function(){},Jl=function(){};function ma(o,l){if(!Vt)switch(o.tailMode){case"hidden":l=o.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?o.tail=null:p.sibling=null;break;case"collapsed":p=o.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?l||o.tail===null?o.tail=null:o.tail.sibling=null:v.sibling=null}}function Pn(o){var l=o.alternate!==null&&o.alternate.child===o.child,p=0,v=0;if(l)for(var E=o.child;E!==null;)p|=E.lanes|E.childLanes,v|=E.subtreeFlags&14680064,v|=E.flags&14680064,E.return=o,E=E.sibling;else for(E=o.child;E!==null;)p|=E.lanes|E.childLanes,v|=E.subtreeFlags,v|=E.flags,E.return=o,E=E.sibling;return o.subtreeFlags|=v,o.childLanes=p,l}function oS(o,l,p){var v=l.pendingProps;switch(Ph(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pn(l),null;case 1:return fn(l.type)&&Kt(),Pn(l),null;case 3:return v=l.stateNode,ro(),at(qt),at(Mt),Fh(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(o===null||o.child===null)&&(sa(l)?Yi(l):o===null||o.memoizedState.isDehydrated&&!(l.flags&256)||(l.flags|=1024,wi!==null&&(dd(wi),wi=null))),pa(o,l),Pn(l),null;case 5:Uh(l),p=Xi(io.current);var E=l.type;if(o!==null&&l.stateNode!=null)Zl(o,l,E,v,p),o.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!v){if(l.stateNode===null)throw Error(a(166));return Pn(l),null}if(o=Xi(mi.current),sa(l)){if(!ve)throw Error(a(175));o=dh(l.stateNode,l.type,l.memoizedProps,p,o,l,!ra),l.updateQueue=o,o!==null&&Yi(l)}else{var w=te(E,v,p,o,l);fa(w,l,!1,!1),l.stateNode=w,K(w,E,v,p,o)&&Yi(l)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Pn(l),null;case 6:if(o&&l.stateNode!=null)Jl(o,l,o.memoizedProps,v);else{if(typeof v!="string"&&l.stateNode===null)throw Error(a(166));if(o=Xi(io.current),p=Xi(mi.current),sa(l)){if(!ve)throw Error(a(176));if(o=l.stateNode,v=l.memoizedProps,(p=fh(o,v,l,!ra))&&(E=ei,E!==null))switch(w=(E.mode&1)!==0,E.tag){case 3:Ke(E.stateNode.containerInfo,o,v,w);break;case 5:st(E.type,E.memoizedProps,E.stateNode,o,v,w)}p&&Yi(l)}else l.stateNode=Oe(v,o,p,l)}return Pn(l),null;case 13:if(at(Wt),v=l.memoizedState,Vt&&ti!==null&&l.mode&1&&!(l.flags&128)){for(o=ti;o;)o=Tr(o);return to(),l.flags|=98560,l}if(v!==null&&v.dehydrated!==null){if(v=sa(l),o===null){if(!v)throw Error(a(318));if(!ve)throw Error(a(344));if(o=l.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(a(317));ph(o,l)}else to(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;return Pn(l),null}return wi!==null&&(dd(wi),wi=null),l.flags&128?(l.lanes=p,l):(v=v!==null,p=!1,o===null?sa(l):p=o.memoizedState!==null,v&&!p&&(l.child.flags|=8192,l.mode&1&&(o===null||Wt.current&1?ln===0&&(ln=3):pd())),l.updateQueue!==null&&(l.flags|=4),Pn(l),null);case 4:return ro(),pa(o,l),o===null&&Ee(l.stateNode.containerInfo),Pn(l),null;case 10:return bh(l.type._context),Pn(l),null;case 17:return fn(l.type)&&Kt(),Pn(l),null;case 19:if(at(Wt),E=l.memoizedState,E===null)return Pn(l),null;if(v=(l.flags&128)!==0,w=E.rendering,w===null)if(v)ma(E,!1);else{if(ln!==0||o!==null&&o.flags&128)for(o=l.child;o!==null;){if(w=Hl(o),w!==null){for(l.flags|=128,ma(E,!1),o=w.updateQueue,o!==null&&(l.updateQueue=o,l.flags|=4),l.subtreeFlags=0,o=p,v=l.child;v!==null;)p=v,E=o,p.flags&=14680066,w=p.alternate,w===null?(p.childLanes=0,p.lanes=E,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=w.childLanes,p.lanes=w.lanes,p.child=w.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=w.memoizedProps,p.memoizedState=w.memoizedState,p.updateQueue=w.updateQueue,p.type=w.type,E=w.dependencies,p.dependencies=E===null?null:{lanes:E.lanes,firstContext:E.firstContext}),v=v.sibling;return We(Wt,Wt.current&1|2),l.child}o=o.sibling}E.tail!==null&&pn()>ld&&(l.flags|=128,v=!0,ma(E,!1),l.lanes=4194304)}else{if(!v)if(o=Hl(w),o!==null){if(l.flags|=128,v=!0,o=o.updateQueue,o!==null&&(l.updateQueue=o,l.flags|=4),ma(E,!0),E.tail===null&&E.tailMode==="hidden"&&!w.alternate&&!Vt)return Pn(l),null}else 2*pn()-E.renderingStartTime>ld&&p!==1073741824&&(l.flags|=128,v=!0,ma(E,!1),l.lanes=4194304);E.isBackwards?(w.sibling=l.child,l.child=w):(o=E.last,o!==null?o.sibling=w:l.child=w,E.last=w)}return E.tail!==null?(l=E.tail,E.rendering=l,E.tail=l.sibling,E.renderingStartTime=pn(),l.sibling=null,o=Wt.current,We(Wt,v?o&1|2:o&1),l):(Pn(l),null);case 22:case 23:return fd(),v=l.memoizedState!==null,o!==null&&o.memoizedState!==null!==v&&(l.flags|=8192),v&&l.mode&1?ii&1073741824&&(Pn(l),Ae&&l.subtreeFlags&6&&(l.flags|=8192)):Pn(l),null;case 24:return null;case 25:return null}throw Error(a(156,l.tag))}var aS=c.ReactCurrentOwner,ni=!1;function Bn(o,l,p,v){l.child=o===null?Lm(l,null,p,v):no(l,o.child,p,v)}function rg(o,l,p,v,E){p=p.render;var w=l.ref;return Qs(l,E),v=Bh(o,l,p,v,w,E),p=kh(),o!==null&&!ni?(l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~E,cr(o,l,E)):(Vt&&p&&Rh(l),l.flags|=1,Bn(o,l,v,E),l.child)}function sg(o,l,p,v,E){if(o===null){var w=p.type;return typeof w=="function"&&!md(w)&&w.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(l.tag=15,l.type=w,og(o,l,w,v,E)):(o=_c(p.type,null,v,l,l.mode,E),o.ref=l.ref,o.return=l,l.child=o)}if(w=o.child,!(o.lanes&E)){var F=w.memoizedProps;if(p=p.compare,p=p!==null?p:Il,p(F,v)&&o.ref===l.ref)return cr(o,l,E)}return l.flags|=1,o=Nr(w,v),o.ref=l.ref,o.return=l,l.child=o}function og(o,l,p,v,E){if(o!==null&&Il(o.memoizedProps,v)&&o.ref===l.ref)if(ni=!1,(o.lanes&E)!==0)o.flags&131072&&(ni=!0);else return l.lanes=o.lanes,cr(o,l,E);return Xh(o,l,p,v,E)}function ag(o,l,p){var v=l.pendingProps,E=v.children,w=o!==null?o.memoizedState:null;if(v.mode==="hidden")if(!(l.mode&1))l.memoizedState={baseLanes:0,cachePool:null},We(oo,ii),ii|=p;else if(p&1073741824)l.memoizedState={baseLanes:0,cachePool:null},v=w!==null?w.baseLanes:p,We(oo,ii),ii|=v;else return o=w!==null?w.baseLanes|p:p,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:o,cachePool:null},l.updateQueue=null,We(oo,ii),ii|=o,null;else w!==null?(v=w.baseLanes|p,l.memoizedState=null):v=p,We(oo,ii),ii|=v;return Bn(o,l,E,p),l.child}function lg(o,l){var p=l.ref;(o===null&&p!==null||o!==null&&o.ref!==p)&&(l.flags|=512,l.flags|=2097152)}function Xh(o,l,p,v,E){var w=fn(p)?ki:Mt.current;return w=hi(l,w),Qs(l,E),p=Bh(o,l,p,v,w,E),v=kh(),o!==null&&!ni?(l.updateQueue=o.updateQueue,l.flags&=-2053,o.lanes&=~E,cr(o,l,E)):(Vt&&v&&Rh(l),l.flags|=1,Bn(o,l,p,E),l.child)}function cg(o,l,p,v,E){if(fn(p)){var w=!0;Mn(l)}else w=!1;if(Qs(l,E),l.stateNode===null)o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),Em(l,p,v),Ch(l,p,v,E),v=!0;else if(o===null){var F=l.stateNode,X=l.memoizedProps;F.props=X;var ce=F.context,we=p.contextType;typeof we=="object"&&we!==null?we=di(we):(we=fn(p)?ki:Mt.current,we=hi(l,we));var je=p.getDerivedStateFromProps,pt=typeof je=="function"||typeof F.getSnapshotBeforeUpdate=="function";pt||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(X!==v||ce!==we)&&bm(l,F,v,we),Ar=!1;var nt=l.memoizedState;F.state=nt,Ol(l,v,F,E),ce=l.memoizedState,X!==v||nt!==ce||qt.current||Ar?(typeof je=="function"&&(Ah(l,p,je,v),ce=l.memoizedState),(X=Ar||Mm(l,p,X,v,nt,ce,we))?(pt||typeof F.UNSAFE_componentWillMount!="function"&&typeof F.componentWillMount!="function"||(typeof F.componentWillMount=="function"&&F.componentWillMount(),typeof F.UNSAFE_componentWillMount=="function"&&F.UNSAFE_componentWillMount()),typeof F.componentDidMount=="function"&&(l.flags|=4194308)):(typeof F.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=v,l.memoizedState=ce),F.props=v,F.state=ce,F.context=we,v=X):(typeof F.componentDidMount=="function"&&(l.flags|=4194308),v=!1)}else{F=l.stateNode,vm(o,l),X=l.memoizedProps,we=l.type===l.elementType?X:bi(l.type,X),F.props=we,pt=l.pendingProps,nt=F.context,ce=p.contextType,typeof ce=="object"&&ce!==null?ce=di(ce):(ce=fn(p)?ki:Mt.current,ce=hi(l,ce));var Ft=p.getDerivedStateFromProps;(je=typeof Ft=="function"||typeof F.getSnapshotBeforeUpdate=="function")||typeof F.UNSAFE_componentWillReceiveProps!="function"&&typeof F.componentWillReceiveProps!="function"||(X!==pt||nt!==ce)&&bm(l,F,v,ce),Ar=!1,nt=l.memoizedState,F.state=nt,Ol(l,v,F,E);var Qe=l.memoizedState;X!==pt||nt!==Qe||qt.current||Ar?(typeof Ft=="function"&&(Ah(l,p,Ft,v),Qe=l.memoizedState),(we=Ar||Mm(l,p,we,v,nt,Qe,ce)||!1)?(je||typeof F.UNSAFE_componentWillUpdate!="function"&&typeof F.componentWillUpdate!="function"||(typeof F.componentWillUpdate=="function"&&F.componentWillUpdate(v,Qe,ce),typeof F.UNSAFE_componentWillUpdate=="function"&&F.UNSAFE_componentWillUpdate(v,Qe,ce)),typeof F.componentDidUpdate=="function"&&(l.flags|=4),typeof F.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof F.componentDidUpdate!="function"||X===o.memoizedProps&&nt===o.memoizedState||(l.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||X===o.memoizedProps&&nt===o.memoizedState||(l.flags|=1024),l.memoizedProps=v,l.memoizedState=Qe),F.props=v,F.state=Qe,F.context=ce,v=we):(typeof F.componentDidUpdate!="function"||X===o.memoizedProps&&nt===o.memoizedState||(l.flags|=4),typeof F.getSnapshotBeforeUpdate!="function"||X===o.memoizedProps&&nt===o.memoizedState||(l.flags|=1024),v=!1)}return qh(o,l,p,v,w,E)}function qh(o,l,p,v,E,w){lg(o,l);var F=(l.flags&128)!==0;if(!v&&!F)return E&&Js(l,p,!1),cr(o,l,w);v=l.stateNode,aS.current=l;var X=F&&typeof p.getDerivedStateFromError!="function"?null:v.render();return l.flags|=1,o!==null&&F?(l.child=no(l,o.child,null,w),l.child=no(l,null,X,w)):Bn(o,l,X,w),l.memoizedState=v.state,E&&Js(l,p,!0),l.child}function ug(o){var l=o.stateNode;l.pendingContext?Hi(o,l.pendingContext,l.pendingContext!==l.context):l.context&&Hi(o,l.context,!1),Dh(o,l.containerInfo)}function hg(o,l,p,v,E){return to(),Nh(E),l.flags|=256,Bn(o,l,p,v),l.child}var Kl={dehydrated:null,treeContext:null,retryLane:0};function Ql(o){return{baseLanes:o,cachePool:null}}function dg(o,l,p){var v=l.pendingProps,E=Wt.current,w=!1,F=(l.flags&128)!==0,X;if((X=F)||(X=o!==null&&o.memoizedState===null?!1:(E&2)!==0),X?(w=!0,l.flags&=-129):(o===null||o.memoizedState!==null)&&(E|=1),We(Wt,E&1),o===null)return Ih(l),o=l.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?(l.mode&1?ta(o)?l.lanes=8:l.lanes=1073741824:l.lanes=1,null):(E=v.children,o=v.fallback,w?(v=l.mode,w=l.child,E={mode:"hidden",children:E},!(v&1)&&w!==null?(w.childLanes=0,w.pendingProps=E):w=vc(E,v,0,null),o=cs(o,v,p,null),w.return=l,o.return=l,w.sibling=o,l.child=w,l.child.memoizedState=Ql(p),l.memoizedState=Kl,o):Yh(l,E));if(E=o.memoizedState,E!==null){if(X=E.dehydrated,X!==null){if(F)return l.flags&256?(l.flags&=-257,$l(o,l,p,Error(a(422)))):l.memoizedState!==null?(l.child=o.child,l.flags|=128,null):(w=v.fallback,E=l.mode,v=vc({mode:"visible",children:v.children},E,0,null),w=cs(w,E,p,null),w.flags|=2,v.return=l,w.return=l,v.sibling=w,l.child=v,l.mode&1&&no(l,o.child,null,p),l.child.memoizedState=Ql(p),l.memoizedState=Kl,w);if(!(l.mode&1))l=$l(o,l,p,null);else if(ta(X))l=$l(o,l,p,Error(a(419)));else if(v=(p&o.childLanes)!==0,ni||v){if(v=rn,v!==null){switch(p&-p){case 4:w=2;break;case 16:w=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:w=32;break;case 536870912:w=268435456;break;default:w=0}v=w&(v.suspendedLanes|p)?0:w,v!==0&&v!==E.retryLane&&(E.retryLane=v,_i(o,v,-1))}pd(),l=$l(o,l,p,Error(a(421)))}else ea(X)?(l.flags|=128,l.child=o.child,l=yS.bind(null,o),qs(X,l),l=null):(p=E.treeContext,ve&&(ti=wl(X),ei=l,Vt=!0,wi=null,ra=!1,p!==null&&(fi[pi++]=or,fi[pi++]=ar,fi[pi++]=ts,or=p.id,ar=p.overflow,ts=l)),l=Yh(l,l.pendingProps.children),l.flags|=4096);return l}return w?(v=pg(o,l,v.children,v.fallback,p),w=l.child,E=o.child.memoizedState,w.memoizedState=E===null?Ql(p):{baseLanes:E.baseLanes|p,cachePool:null},w.childLanes=o.childLanes&~p,l.memoizedState=Kl,v):(p=fg(o,l,v.children,p),l.memoizedState=null,p)}return w?(v=pg(o,l,v.children,v.fallback,p),w=l.child,E=o.child.memoizedState,w.memoizedState=E===null?Ql(p):{baseLanes:E.baseLanes|p,cachePool:null},w.childLanes=o.childLanes&~p,l.memoizedState=Kl,v):(p=fg(o,l,v.children,p),l.memoizedState=null,p)}function Yh(o,l){return l=vc({mode:"visible",children:l},o.mode,0,null),l.return=o,o.child=l}function fg(o,l,p,v){var E=o.child;return o=E.sibling,p=Nr(E,{mode:"visible",children:p}),!(l.mode&1)&&(p.lanes=v),p.return=l,p.sibling=null,o!==null&&(v=l.deletions,v===null?(l.deletions=[o],l.flags|=16):v.push(o)),l.child=p}function pg(o,l,p,v,E){var w=l.mode;o=o.child;var F=o.sibling,X={mode:"hidden",children:p};return!(w&1)&&l.child!==o?(p=l.child,p.childLanes=0,p.pendingProps=X,l.deletions=null):(p=Nr(o,X),p.subtreeFlags=o.subtreeFlags&14680064),F!==null?v=Nr(F,v):(v=cs(v,w,E,null),v.flags|=2),v.return=l,p.return=l,p.sibling=v,l.child=p,v}function $l(o,l,p,v){return v!==null&&Nh(v),no(l,o.child,null,p),o=Yh(l,l.pendingProps.children),o.flags|=2,l.memoizedState=null,o}function mg(o,l,p){o.lanes|=l;var v=o.alternate;v!==null&&(v.lanes|=l),wh(o.return,l,p)}function Zh(o,l,p,v,E){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:v,tail:p,tailMode:E}:(w.isBackwards=l,w.rendering=null,w.renderingStartTime=0,w.last=v,w.tail=p,w.tailMode=E)}function gg(o,l,p){var v=l.pendingProps,E=v.revealOrder,w=v.tail;if(Bn(o,l,v.children,p),v=Wt.current,v&2)v=v&1|2,l.flags|=128;else{if(o!==null&&o.flags&128)e:for(o=l.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&mg(o,p,l);else if(o.tag===19)mg(o,p,l);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===l)break e;for(;o.sibling===null;){if(o.return===null||o.return===l)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}v&=1}if(We(Wt,v),!(l.mode&1))l.memoizedState=null;else switch(E){case"forwards":for(p=l.child,E=null;p!==null;)o=p.alternate,o!==null&&Hl(o)===null&&(E=p),p=p.sibling;p=E,p===null?(E=l.child,l.child=null):(E=p.sibling,p.sibling=null),Zh(l,!1,E,p,w);break;case"backwards":for(p=null,E=l.child,l.child=null;E!==null;){if(o=E.alternate,o!==null&&Hl(o)===null){l.child=E;break}o=E.sibling,E.sibling=p,p=E,E=o}Zh(l,!0,p,null,w);break;case"together":Zh(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function cr(o,l,p){if(o!==null&&(l.dependencies=o.dependencies),ao|=l.lanes,!(p&l.childLanes))return null;if(o!==null&&l.child!==o.child)throw Error(a(153));if(l.child!==null){for(o=l.child,p=Nr(o,o.pendingProps),l.child=p,p.return=l;o.sibling!==null;)o=o.sibling,p=p.sibling=Nr(o,o.pendingProps),p.return=l;p.sibling=null}return l.child}function lS(o,l,p){switch(l.tag){case 3:ug(l),to();break;case 5:Im(l);break;case 1:fn(l.type)&&Mn(l);break;case 4:Dh(l,l.stateNode.containerInfo);break;case 10:_m(l,l.type._context,l.memoizedProps.value);break;case 13:var v=l.memoizedState;if(v!==null)return v.dehydrated!==null?(We(Wt,Wt.current&1),l.flags|=128,null):p&l.child.childLanes?dg(o,l,p):(We(Wt,Wt.current&1),o=cr(o,l,p),o!==null?o.sibling:null);We(Wt,Wt.current&1);break;case 19:if(v=(p&l.childLanes)!==0,o.flags&128){if(v)return gg(o,l,p);l.flags|=128}var E=l.memoizedState;if(E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),We(Wt,Wt.current),v)break;return null;case 22:case 23:return l.lanes=0,ag(o,l,p)}return cr(o,l,p)}function cS(o,l){switch(Ph(l),l.tag){case 1:return fn(l.type)&&Kt(),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return ro(),at(qt),at(Mt),Fh(),o=l.flags,o&65536&&!(o&128)?(l.flags=o&-65537|128,l):null;case 5:return Uh(l),null;case 13:if(at(Wt),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(a(340));to()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return at(Wt),null;case 4:return ro(),null;case 10:return bh(l.type._context),null;case 22:case 23:return fd(),null;case 24:return null;default:return null}}var ec=!1,rs=!1,uS=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function tc(o,l){var p=o.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(v){Yn(o,l,v)}else p.current=null}function Jh(o,l,p){try{p()}catch(v){Yn(o,l,v)}}var _g=!1;function hS(o,l){for(Z(o.containerInfo),Ue=l;Ue!==null;)if(o=Ue,l=o.child,(o.subtreeFlags&1028)!==0&&l!==null)l.return=o,Ue=l;else for(;Ue!==null;){o=Ue;try{var p=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var v=p.memoizedProps,E=p.memoizedState,w=o.stateNode,F=w.getSnapshotBeforeUpdate(o.elementType===o.type?v:bi(o.type,v),E);w.__reactInternalSnapshotBeforeUpdate=F}break;case 3:Ae&&Te(o.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(X){Yn(o,o.return,X)}if(l=o.sibling,l!==null){l.return=o.return,Ue=l;break}Ue=o.return}return p=_g,_g=!1,p}function ss(o,l,p){var v=l.updateQueue;if(v=v!==null?v.lastEffect:null,v!==null){var E=v=v.next;do{if((E.tag&o)===o){var w=E.destroy;E.destroy=void 0,w!==void 0&&Jh(l,p,w)}E=E.next}while(E!==v)}}function ga(o,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var p=l=l.next;do{if((p.tag&o)===o){var v=p.create;p.destroy=v()}p=p.next}while(p!==l)}}function Kh(o){var l=o.ref;if(l!==null){var p=o.stateNode;switch(o.tag){case 5:o=ie(p);break;default:o=p}typeof l=="function"?l(o):l.current=o}}function vg(o,l,p){if(Vi&&typeof Vi.onCommitFiberUnmount=="function")try{Vi.onCommitFiberUnmount(Pl,l)}catch{}switch(l.tag){case 0:case 11:case 14:case 15:if(o=l.updateQueue,o!==null&&(o=o.lastEffect,o!==null)){var v=o=o.next;do{var E=v,w=E.destroy;E=E.tag,w!==void 0&&(E&2||E&4)&&Jh(l,p,w),v=v.next}while(v!==o)}break;case 1:if(tc(l,p),o=l.stateNode,typeof o.componentWillUnmount=="function")try{o.props=l.memoizedProps,o.state=l.memoizedState,o.componentWillUnmount()}catch(F){Yn(l,p,F)}break;case 5:tc(l,p);break;case 4:Ae?bg(o,l,p):k&&k&&(l=l.stateNode.containerInfo,p=tt(l),Tt(l,p))}}function xg(o,l,p){for(var v=l;;)if(vg(o,v,p),v.child===null||Ae&&v.tag===4){if(v===l)break;for(;v.sibling===null;){if(v.return===null||v.return===l)return;v=v.return}v.sibling.return=v.return,v=v.sibling}else v.child.return=v,v=v.child}function yg(o){var l=o.alternate;l!==null&&(o.alternate=null,yg(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&Ve(l)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Sg(o){return o.tag===5||o.tag===3||o.tag===4}function Mg(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Sg(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Eg(o){if(Ae){e:{for(var l=o.return;l!==null;){if(Sg(l))break e;l=l.return}throw Error(a(160))}var p=l;switch(p.tag){case 5:l=p.stateNode,p.flags&32&&(_e(l),p.flags&=-33),p=Mg(o),$h(o,p,l);break;case 3:case 4:l=p.stateNode.containerInfo,p=Mg(o),Qh(o,p,l);break;default:throw Error(a(161))}}}function Qh(o,l,p){var v=o.tag;if(v===5||v===6)o=o.stateNode,l?$e(p,o,l):ht(p,o);else if(v!==4&&(o=o.child,o!==null))for(Qh(o,l,p),o=o.sibling;o!==null;)Qh(o,l,p),o=o.sibling}function $h(o,l,p){var v=o.tag;if(v===5||v===6)o=o.stateNode,l?ct(p,o,l):et(p,o);else if(v!==4&&(o=o.child,o!==null))for($h(o,l,p),o=o.sibling;o!==null;)$h(o,l,p),o=o.sibling}function bg(o,l,p){for(var v=l,E=!1,w,F;;){if(!E){E=v.return;e:for(;;){if(E===null)throw Error(a(160));switch(w=E.stateNode,E.tag){case 5:F=!1;break e;case 3:w=w.containerInfo,F=!0;break e;case 4:w=w.containerInfo,F=!0;break e}E=E.return}E=!0}if(v.tag===5||v.tag===6)xg(o,v,p),F?V(w,v.stateNode):Ge(w,v.stateNode);else if(v.tag===18)F?re(w,v.stateNode):oe(w,v.stateNode);else if(v.tag===4){if(v.child!==null){w=v.stateNode.containerInfo,F=!0,v.child.return=v,v=v.child;continue}}else if(vg(o,v,p),v.child!==null){v.child.return=v,v=v.child;continue}if(v===l)break;for(;v.sibling===null;){if(v.return===null||v.return===l)return;v=v.return,v.tag===4&&(E=!1)}v.sibling.return=v.return,v=v.sibling}}function ed(o,l){if(Ae){switch(l.tag){case 0:case 11:case 14:case 15:ss(3,l,l.return),ga(3,l),ss(5,l,l.return);return;case 1:return;case 5:var p=l.stateNode;if(p!=null){var v=l.memoizedProps;o=o!==null?o.memoizedProps:v;var E=l.type,w=l.updateQueue;l.updateQueue=null,w!==null&&gt(p,w,E,o,v,l)}return;case 6:if(l.stateNode===null)throw Error(a(162));p=l.memoizedProps,Se(l.stateNode,o!==null?o.memoizedProps:p,p);return;case 3:ve&&o!==null&&o.memoizedState.isDehydrated&&$(l.stateNode.containerInfo);return;case 12:return;case 13:nc(l);return;case 19:nc(l);return;case 17:return}throw Error(a(163))}switch(l.tag){case 0:case 11:case 14:case 15:ss(3,l,l.return),ga(3,l),ss(5,l,l.return);return;case 12:return;case 13:nc(l);return;case 19:nc(l);return;case 3:ve&&o!==null&&o.memoizedState.isDehydrated&&$(l.stateNode.containerInfo);break;case 22:case 23:return}e:if(k){switch(l.tag){case 1:case 5:case 6:break e;case 3:case 4:l=l.stateNode,Tt(l.containerInfo,l.pendingChildren);break e}throw Error(a(163))}}function nc(o){var l=o.updateQueue;if(l!==null){o.updateQueue=null;var p=o.stateNode;p===null&&(p=o.stateNode=new uS),l.forEach(function(v){var E=SS.bind(null,o,v);p.has(v)||(p.add(v),v.then(E,E))})}}function dS(o,l){for(Ue=l;Ue!==null;){l=Ue;var p=l.deletions;if(p!==null)for(var v=0;v<p.length;v++){var E=p[v];try{var w=o;Ae?bg(w,E,l):xg(w,E,l);var F=E.alternate;F!==null&&(F.return=null),E.return=null}catch(Ze){Yn(E,l,Ze)}}if(p=l.child,l.subtreeFlags&12854&&p!==null)p.return=l,Ue=p;else for(;Ue!==null;){l=Ue;try{var X=l.flags;if(X&32&&Ae&&_e(l.stateNode),X&512){var ce=l.alternate;if(ce!==null){var we=ce.ref;we!==null&&(typeof we=="function"?we(null):we.current=null)}}if(X&8192)switch(l.tag){case 13:if(l.memoizedState!==null){var je=l.alternate;(je===null||je.memoizedState===null)&&(ad=pn())}break;case 22:var pt=l.memoizedState!==null,nt=l.alternate,Ft=nt!==null&&nt.memoizedState!==null;if(p=l,Ae){e:if(v=p,E=pt,w=null,Ae)for(var Qe=v;;){if(Qe.tag===5){if(w===null){w=Qe;var Ln=Qe.stateNode;E?Be(Ln):Me(Qe.stateNode,Qe.memoizedProps)}}else if(Qe.tag===6){if(w===null){var xi=Qe.stateNode;E?Fe(xi):G(xi,Qe.memoizedProps)}}else if((Qe.tag!==22&&Qe.tag!==23||Qe.memoizedState===null||Qe===v)&&Qe.child!==null){Qe.child.return=Qe,Qe=Qe.child;continue}if(Qe===v)break;for(;Qe.sibling===null;){if(Qe.return===null||Qe.return===v)break e;w===Qe&&(w=null),Qe=Qe.return}w===Qe&&(w=null),Qe.sibling.return=Qe.return,Qe=Qe.sibling}}if(pt&&!Ft&&p.mode&1){Ue=p;for(var ne=p.child;ne!==null;){for(p=Ue=ne;Ue!==null;){v=Ue;var Y=v.child;switch(v.tag){case 0:case 11:case 14:case 15:ss(4,v,v.return);break;case 1:tc(v,v.return);var ae=v.stateNode;if(typeof ae.componentWillUnmount=="function"){var ze=v.return;try{ae.props=v.memoizedProps,ae.state=v.memoizedState,ae.componentWillUnmount()}catch(Ze){Yn(v,ze,Ze)}}break;case 5:tc(v,v.return);break;case 22:if(v.memoizedState!==null){Ag(p);continue}}Y!==null?(Y.return=v,Ue=Y):Ag(p)}ne=ne.sibling}}}switch(X&4102){case 2:Eg(l),l.flags&=-3;break;case 6:Eg(l),l.flags&=-3,ed(l.alternate,l);break;case 4096:l.flags&=-4097;break;case 4100:l.flags&=-4097,ed(l.alternate,l);break;case 4:ed(l.alternate,l)}}catch(Ze){Yn(l,l.return,Ze)}if(p=l.sibling,p!==null){p.return=l.return,Ue=p;break}Ue=l.return}}}function fS(o,l,p){Ue=o,wg(o)}function wg(o,l,p){for(var v=(o.mode&1)!==0;Ue!==null;){var E=Ue,w=E.child;if(E.tag===22&&v){var F=E.memoizedState!==null||ec;if(!F){var X=E.alternate,ce=X!==null&&X.memoizedState!==null||rs;X=ec;var we=rs;if(ec=F,(rs=ce)&&!we)for(Ue=E;Ue!==null;)F=Ue,ce=F.child,F.tag===22&&F.memoizedState!==null?Cg(E):ce!==null?(ce.return=F,Ue=ce):Cg(E);for(;w!==null;)Ue=w,wg(w),w=w.sibling;Ue=E,ec=X,rs=we}Tg(o)}else E.subtreeFlags&8772&&w!==null?(w.return=E,Ue=w):Tg(o)}}function Tg(o){for(;Ue!==null;){var l=Ue;if(l.flags&8772){var p=l.alternate;try{if(l.flags&8772)switch(l.tag){case 0:case 11:case 15:rs||ga(5,l);break;case 1:var v=l.stateNode;if(l.flags&4&&!rs)if(p===null)v.componentDidMount();else{var E=l.elementType===l.type?p.memoizedProps:bi(l.type,p.memoizedProps);v.componentDidUpdate(E,p.memoizedState,v.__reactInternalSnapshotBeforeUpdate)}var w=l.updateQueue;w!==null&&ym(l,w,v);break;case 3:var F=l.updateQueue;if(F!==null){if(p=null,l.child!==null)switch(l.child.tag){case 5:p=ie(l.child.stateNode);break;case 1:p=l.child.stateNode}ym(l,F,p)}break;case 5:var X=l.stateNode;p===null&&l.flags&4&&wt(X,l.type,l.memoizedProps,l);break;case 6:break;case 4:break;case 12:break;case 13:if(ve&&l.memoizedState===null){var ce=l.alternate;if(ce!==null){var we=ce.memoizedState;if(we!==null){var je=we.dehydrated;je!==null&&se(je)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(a(163))}rs||l.flags&512&&Kh(l)}catch(pt){Yn(l,l.return,pt)}}if(l===o){Ue=null;break}if(p=l.sibling,p!==null){p.return=l.return,Ue=p;break}Ue=l.return}}function Ag(o){for(;Ue!==null;){var l=Ue;if(l===o){Ue=null;break}var p=l.sibling;if(p!==null){p.return=l.return,Ue=p;break}Ue=l.return}}function Cg(o){for(;Ue!==null;){var l=Ue;try{switch(l.tag){case 0:case 11:case 15:var p=l.return;try{ga(4,l)}catch(ce){Yn(l,p,ce)}break;case 1:var v=l.stateNode;if(typeof v.componentDidMount=="function"){var E=l.return;try{v.componentDidMount()}catch(ce){Yn(l,E,ce)}}var w=l.return;try{Kh(l)}catch(ce){Yn(l,w,ce)}break;case 5:var F=l.return;try{Kh(l)}catch(ce){Yn(l,F,ce)}}}catch(ce){Yn(l,l.return,ce)}if(l===o){Ue=null;break}var X=l.sibling;if(X!==null){X.return=l.return,Ue=X;break}Ue=l.return}}var ic=0,rc=1,sc=2,oc=3,ac=4;if(typeof Symbol=="function"&&Symbol.for){var _a=Symbol.for;ic=_a("selector.component"),rc=_a("selector.has_pseudo_class"),sc=_a("selector.role"),oc=_a("selector.test_id"),ac=_a("selector.text")}function td(o){var l=ue(o);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(a(364));return l}if(o=Q(o),o===null)throw Error(a(362));return o.stateNode.current}function nd(o,l){switch(l.$$typeof){case ic:if(o.type===l.value)return!0;break;case rc:e:{l=l.value,o=[o,0];for(var p=0;p<o.length;){var v=o[p++],E=o[p++],w=l[E];if(v.tag!==5||!me(v)){for(;w!=null&&nd(v,w);)E++,w=l[E];if(E===l.length){l=!0;break e}else for(v=v.child;v!==null;)o.push(v,E),v=v.sibling}}l=!1}return l;case sc:if(o.tag===5&&Xe(o.stateNode,l.value))return!0;break;case ac:if((o.tag===5||o.tag===6)&&(o=xe(o),o!==null&&0<=o.indexOf(l.value)))return!0;break;case oc:if(o.tag===5&&(o=o.memoizedProps["data-testname"],typeof o=="string"&&o.toLowerCase()===l.value.toLowerCase()))return!0;break;default:throw Error(a(365))}return!1}function id(o){switch(o.$$typeof){case ic:return"<"+(N(o.value)||"Unknown")+">";case rc:return":has("+(id(o)||"")+")";case sc:return'[role="'+o.value+'"]';case ac:return'"'+o.value+'"';case oc:return'[data-testname="'+o.value+'"]';default:throw Error(a(365))}}function Rg(o,l){var p=[];o=[o,0];for(var v=0;v<o.length;){var E=o[v++],w=o[v++],F=l[w];if(E.tag!==5||!me(E)){for(;F!=null&&nd(E,F);)w++,F=l[w];if(w===l.length)p.push(E);else for(E=E.child;E!==null;)o.push(E,w),E=E.sibling}}return p}function rd(o,l){if(!I)throw Error(a(363));o=td(o),o=Rg(o,l),l=[],o=Array.from(o);for(var p=0;p<o.length;){var v=o[p++];if(v.tag===5)me(v)||l.push(v.stateNode);else for(v=v.child;v!==null;)o.push(v),v=v.sibling}return l}var pS=Math.ceil,lc=c.ReactCurrentDispatcher,sd=c.ReactCurrentOwner,Qt=c.ReactCurrentBatchConfig,Et=0,rn=null,sn=null,En=0,ii=0,oo=dn(0),ln=0,va=null,ao=0,cc=0,od=0,xa=null,Xn=null,ad=0,ld=1/0;function lo(){ld=pn()+500}var uc=!1,cd=null,Rr=null,hc=!1,Pr=null,dc=0,ya=0,ud=null,fc=-1,pc=0;function kn(){return Et&6?pn():fc!==-1?fc:fc=pn()}function Lr(o){return o.mode&1?Et&2&&En!==0?En&-En:Jy.transition!==null?(pc===0&&(o=Al,Al<<=1,!(Al&4194240)&&(Al=64),pc=o),pc):(o=Pt,o!==0?o:pe()):1}function _i(o,l,p){if(50<ya)throw ya=0,ud=null,Error(a(185));var v=mc(o,l);return v===null?null:(ia(v,l,p),(!(Et&2)||v!==rn)&&(v===rn&&(!(Et&2)&&(cc|=l),ln===4&&Ir(v,En)),qn(v,p),l===1&&Et===0&&!(o.mode&1)&&(lo(),Ll&&Wi())),v)}function mc(o,l){o.lanes|=l;var p=o.alternate;for(p!==null&&(p.lanes|=l),p=o,o=o.return;o!==null;)o.childLanes|=l,p=o.alternate,p!==null&&(p.childLanes|=l),p=o,o=o.return;return p.tag===3?p.stateNode:null}function qn(o,l){var p=o.callbackNode;Hy(o,l);var v=Rl(o,o===rn?En:0);if(v===0)p!==null&&mm(p),o.callbackNode=null,o.callbackPriority=0;else if(l=v&-v,o.callbackPriority!==l){if(p!=null&&mm(p),l===1)o.tag===0?Zy(Lg.bind(null,o)):gm(Lg.bind(null,o)),Le?D(function(){Et===0&&Wi()}):vh(xh,Wi),p=null;else{switch(pm(v)){case 1:p=xh;break;case 4:p=jy;break;case 16:p=yh;break;case 536870912:p=Xy;break;default:p=yh}p=kg(p,Pg.bind(null,o))}o.callbackPriority=l,o.callbackNode=p}}function Pg(o,l){if(fc=-1,pc=0,Et&6)throw Error(a(327));var p=o.callbackNode;if(ls()&&o.callbackNode!==p)return null;var v=Rl(o,o===rn?En:0);if(v===0)return null;if(v&30||v&o.expiredLanes||l)l=gc(o,v);else{l=v;var E=Et;Et|=2;var w=Dg();(rn!==o||En!==l)&&(lo(),os(o,l));do try{_S();break}catch(X){Ng(o,X)}while(!0);Eh(),lc.current=w,Et=E,sn!==null?l=0:(rn=null,En=0,l=ln)}if(l!==0){if(l===2&&(E=mh(o),E!==0&&(v=E,l=hd(o,E))),l===1)throw p=va,os(o,0),Ir(o,v),qn(o,pn()),p;if(l===6)Ir(o,v);else{if(E=o.current.alternate,!(v&30)&&!mS(E)&&(l=gc(o,v),l===2&&(w=mh(o),w!==0&&(v=w,l=hd(o,w))),l===1))throw p=va,os(o,0),Ir(o,v),qn(o,pn()),p;switch(o.finishedWork=E,o.finishedLanes=v,l){case 0:case 1:throw Error(a(345));case 2:as(o,Xn);break;case 3:if(Ir(o,v),(v&130023424)===v&&(l=ad+500-pn(),10<l)){if(Rl(o,0)!==0)break;if(E=o.suspendedLanes,(E&v)!==v){kn(),o.pingedLanes|=o.suspendedLanes&E;break}o.timeoutHandle=Ne(as.bind(null,o,Xn),l);break}as(o,Xn);break;case 4:if(Ir(o,v),(v&4194240)===v)break;for(l=o.eventTimes,E=-1;0<v;){var F=31-$n(v);w=1<<F,F=l[F],F>E&&(E=F),v&=~w}if(v=E,v=pn()-v,v=(120>v?120:480>v?480:1080>v?1080:1920>v?1920:3e3>v?3e3:4320>v?4320:1960*pS(v/1960))-v,10<v){o.timeoutHandle=Ne(as.bind(null,o,Xn),v);break}as(o,Xn);break;case 5:as(o,Xn);break;default:throw Error(a(329))}}}return qn(o,pn()),o.callbackNode===p?Pg.bind(null,o):null}function hd(o,l){var p=xa;return o.current.memoizedState.isDehydrated&&(os(o,l).flags|=256),o=gc(o,l),o!==2&&(l=Xn,Xn=p,l!==null&&dd(l)),o}function dd(o){Xn===null?Xn=o:Xn.push.apply(Xn,o)}function mS(o){for(var l=o;;){if(l.flags&16384){var p=l.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var v=0;v<p.length;v++){var E=p[v],w=E.getSnapshot;E=E.value;try{if(!Gi(w(),E))return!1}catch{return!1}}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ir(o,l){for(l&=~od,l&=~cc,o.suspendedLanes|=l,o.pingedLanes&=~l,o=o.expirationTimes;0<l;){var p=31-$n(l),v=1<<p;o[p]=-1,l&=~v}}function Lg(o){if(Et&6)throw Error(a(327));ls();var l=Rl(o,0);if(!(l&1))return qn(o,pn()),null;var p=gc(o,l);if(o.tag!==0&&p===2){var v=mh(o);v!==0&&(l=v,p=hd(o,v))}if(p===1)throw p=va,os(o,0),Ir(o,l),qn(o,pn()),p;if(p===6)throw Error(a(345));return o.finishedWork=o.current.alternate,o.finishedLanes=l,as(o,Xn),qn(o,pn()),null}function Ig(o){Pr!==null&&Pr.tag===0&&!(Et&6)&&ls();var l=Et;Et|=1;var p=Qt.transition,v=Pt;try{if(Qt.transition=null,Pt=1,o)return o()}finally{Pt=v,Qt.transition=p,Et=l,!(Et&6)&&Wi()}}function fd(){ii=oo.current,at(oo)}function os(o,l){o.finishedWork=null,o.finishedLanes=0;var p=o.timeoutHandle;if(p!==rt&&(o.timeoutHandle=rt,Je(p)),sn!==null)for(p=sn.return;p!==null;){var v=p;switch(Ph(v),v.tag){case 1:v=v.type.childContextTypes,v!=null&&Kt();break;case 3:ro(),at(qt),at(Mt),Fh();break;case 5:Uh(v);break;case 4:ro();break;case 13:at(Wt);break;case 19:at(Wt);break;case 10:bh(v.type._context);break;case 22:case 23:fd()}p=p.return}if(rn=o,sn=o=Nr(o.current,null),En=ii=l,ln=0,va=null,od=cc=ao=0,Xn=xa=null,ji!==null){for(l=0;l<ji.length;l++)if(p=ji[l],v=p.interleaved,v!==null){p.interleaved=null;var E=v.next,w=p.pending;if(w!==null){var F=w.next;w.next=E,v.next=F}p.pending=v}ji=null}return o}function Ng(o,l){do{var p=sn;try{if(Eh(),Vl.current=Yl,Gl){for(var v=Yt.memoizedState;v!==null;){var E=v.queue;E!==null&&(E.pending=null),v=v.next}Gl=!1}if(so=0,mn=Cn=Yt=null,ca=!1,ua=0,sd.current=null,p===null||p.return===null){ln=1,va=l,sn=null;break}e:{var w=o,F=p.return,X=p,ce=l;if(l=En,X.flags|=32768,ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var we=ce,je=X,pt=je.tag;if(!(je.mode&1)&&(pt===0||pt===11||pt===15)){var nt=je.alternate;nt?(je.updateQueue=nt.updateQueue,je.memoizedState=nt.memoizedState,je.lanes=nt.lanes):(je.updateQueue=null,je.memoizedState=null)}var Ft=eg(F);if(Ft!==null){Ft.flags&=-257,tg(Ft,F,X,w,l),Ft.mode&1&&$m(w,we,l),l=Ft,ce=we;var Qe=l.updateQueue;if(Qe===null){var Ln=new Set;Ln.add(ce),l.updateQueue=Ln}else Qe.add(ce);break e}else{if(!(l&1)){$m(w,we,l),pd();break e}ce=Error(a(426))}}else if(Vt&&X.mode&1){var xi=eg(F);if(xi!==null){!(xi.flags&65536)&&(xi.flags|=256),tg(xi,F,X,w,l),Nh(ce);break e}}w=ce,ln!==4&&(ln=2),xa===null?xa=[w]:xa.push(w),ce=Wh(ce,X),X=F;do{switch(X.tag){case 3:X.flags|=65536,l&=-l,X.lanes|=l;var ne=Km(X,ce,l);xm(X,ne);break e;case 1:w=ce;var Y=X.type,ae=X.stateNode;if(!(X.flags&128)&&(typeof Y.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&(Rr===null||!Rr.has(ae)))){X.flags|=65536,l&=-l,X.lanes|=l;var ze=Qm(X,w,l);xm(X,ze);break e}}X=X.return}while(X!==null)}Og(p)}catch(Ze){l=Ze,sn===p&&p!==null&&(sn=p=p.return);continue}break}while(!0)}function Dg(){var o=lc.current;return lc.current=Yl,o===null?Yl:o}function pd(){(ln===0||ln===3||ln===2)&&(ln=4),rn===null||!(ao&268435455)&&!(cc&268435455)||Ir(rn,En)}function gc(o,l){var p=Et;Et|=2;var v=Dg();rn===o&&En===l||os(o,l);do try{gS();break}catch(E){Ng(o,E)}while(!0);if(Eh(),Et=p,lc.current=v,sn!==null)throw Error(a(261));return rn=null,En=0,ln}function gS(){for(;sn!==null;)Ug(sn)}function _S(){for(;sn!==null&&!Gy();)Ug(sn)}function Ug(o){var l=Bg(o.alternate,o,ii);o.memoizedProps=o.pendingProps,l===null?Og(o):sn=l,sd.current=null}function Og(o){var l=o;do{var p=l.alternate;if(o=l.return,l.flags&32768){if(p=cS(p,l),p!==null){p.flags&=32767,sn=p;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{ln=6,sn=null;return}}else if(p=oS(p,l,ii),p!==null){sn=p;return}if(l=l.sibling,l!==null){sn=l;return}sn=l=o}while(l!==null);ln===0&&(ln=5)}function as(o,l){var p=Pt,v=Qt.transition;try{Qt.transition=null,Pt=1,vS(o,l,p)}finally{Qt.transition=v,Pt=p}return null}function vS(o,l,p){do ls();while(Pr!==null);if(Et&6)throw Error(a(327));var v=o.finishedWork,E=o.finishedLanes;if(v===null)return null;if(o.finishedWork=null,o.finishedLanes=0,v===o.current)throw Error(a(177));o.callbackNode=null,o.callbackPriority=0;var w=v.lanes|v.childLanes;if(Vy(o,w),o===rn&&(sn=rn=null,En=0),!(v.subtreeFlags&2064)&&!(v.flags&2064)||hc||(hc=!0,kg(yh,function(){return ls(),null})),w=(v.flags&15990)!==0,v.subtreeFlags&15990||w){w=Qt.transition,Qt.transition=null;var F=Pt;Pt=1;var X=Et;Et|=4,sd.current=null,hS(o,v),dS(o,v),J(o.containerInfo),o.current=v,fS(v),Wy(),Et=X,Pt=F,Qt.transition=w}else o.current=v;if(hc&&(hc=!1,Pr=o,dc=E),w=o.pendingLanes,w===0&&(Rr=null),qy(v.stateNode),qn(o,pn()),l!==null)for(p=o.onRecoverableError,v=0;v<l.length;v++)p(l[v]);if(uc)throw uc=!1,o=cd,cd=null,o;return dc&1&&o.tag!==0&&ls(),w=o.pendingLanes,w&1?o===ud?ya++:(ya=0,ud=o):ya=0,Wi(),null}function ls(){if(Pr!==null){var o=pm(dc),l=Qt.transition,p=Pt;try{if(Qt.transition=null,Pt=16>o?16:o,Pr===null)var v=!1;else{if(o=Pr,Pr=null,dc=0,Et&6)throw Error(a(331));var E=Et;for(Et|=4,Ue=o.current;Ue!==null;){var w=Ue,F=w.child;if(Ue.flags&16){var X=w.deletions;if(X!==null){for(var ce=0;ce<X.length;ce++){var we=X[ce];for(Ue=we;Ue!==null;){var je=Ue;switch(je.tag){case 0:case 11:case 15:ss(8,je,w)}var pt=je.child;if(pt!==null)pt.return=je,Ue=pt;else for(;Ue!==null;){je=Ue;var nt=je.sibling,Ft=je.return;if(yg(je),je===we){Ue=null;break}if(nt!==null){nt.return=Ft,Ue=nt;break}Ue=Ft}}}var Qe=w.alternate;if(Qe!==null){var Ln=Qe.child;if(Ln!==null){Qe.child=null;do{var xi=Ln.sibling;Ln.sibling=null,Ln=xi}while(Ln!==null)}}Ue=w}}if(w.subtreeFlags&2064&&F!==null)F.return=w,Ue=F;else e:for(;Ue!==null;){if(w=Ue,w.flags&2048)switch(w.tag){case 0:case 11:case 15:ss(9,w,w.return)}var ne=w.sibling;if(ne!==null){ne.return=w.return,Ue=ne;break e}Ue=w.return}}var Y=o.current;for(Ue=Y;Ue!==null;){F=Ue;var ae=F.child;if(F.subtreeFlags&2064&&ae!==null)ae.return=F,Ue=ae;else e:for(F=Y;Ue!==null;){if(X=Ue,X.flags&2048)try{switch(X.tag){case 0:case 11:case 15:ga(9,X)}}catch(Ze){Yn(X,X.return,Ze)}if(X===F){Ue=null;break e}var ze=X.sibling;if(ze!==null){ze.return=X.return,Ue=ze;break e}Ue=X.return}}if(Et=E,Wi(),Vi&&typeof Vi.onPostCommitFiberRoot=="function")try{Vi.onPostCommitFiberRoot(Pl,o)}catch{}v=!0}return v}finally{Pt=p,Qt.transition=l}}return!1}function Fg(o,l,p){l=Wh(p,l),l=Km(o,l,1),Cr(o,l),l=kn(),o=mc(o,1),o!==null&&(ia(o,1,l),qn(o,l))}function Yn(o,l,p){if(o.tag===3)Fg(o,o,p);else for(;l!==null;){if(l.tag===3){Fg(l,o,p);break}else if(l.tag===1){var v=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Rr===null||!Rr.has(v))){o=Wh(p,o),o=Qm(l,o,1),Cr(l,o),o=kn(),l=mc(l,1),l!==null&&(ia(l,1,o),qn(l,o));break}}l=l.return}}function xS(o,l,p){var v=o.pingCache;v!==null&&v.delete(l),l=kn(),o.pingedLanes|=o.suspendedLanes&p,rn===o&&(En&p)===p&&(ln===4||ln===3&&(En&130023424)===En&&500>pn()-ad?os(o,0):od|=p),qn(o,l)}function zg(o,l){l===0&&(o.mode&1?(l=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):l=1);var p=kn();o=mc(o,l),o!==null&&(ia(o,l,p),qn(o,p))}function yS(o){var l=o.memoizedState,p=0;l!==null&&(p=l.retryLane),zg(o,p)}function SS(o,l){var p=0;switch(o.tag){case 13:var v=o.stateNode,E=o.memoizedState;E!==null&&(p=E.retryLane);break;case 19:v=o.stateNode;break;default:throw Error(a(314))}v!==null&&v.delete(l),zg(o,p)}var Bg;Bg=function(o,l,p){if(o!==null)if(o.memoizedProps!==l.pendingProps||qt.current)ni=!0;else{if(!(o.lanes&p)&&!(l.flags&128))return ni=!1,lS(o,l,p);ni=!!(o.flags&131072)}else ni=!1,Vt&&l.flags&1048576&&wm(l,Bl,l.index);switch(l.lanes=0,l.tag){case 2:var v=l.type;o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),o=l.pendingProps;var E=hi(l,Mt.current);Qs(l,p),E=Bh(null,l,v,o,E,p);var w=kh();return l.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,fn(v)?(w=!0,Mn(l)):w=!1,l.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,Th(l),E.updater=Fl,l.stateNode=E,E._reactInternals=l,Ch(l,v,o,p),l=qh(null,l,v,!0,w,p)):(l.tag=0,Vt&&w&&Rh(l),Bn(null,l,E,p),l=l.child),l;case 16:v=l.elementType;e:{switch(o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),o=l.pendingProps,E=v._init,v=E(v._payload),l.type=v,E=l.tag=ES(v),o=bi(v,o),E){case 0:l=Xh(null,l,v,o,p);break e;case 1:l=cg(null,l,v,o,p);break e;case 11:l=rg(null,l,v,o,p);break e;case 14:l=sg(null,l,v,bi(v.type,o),p);break e}throw Error(a(306,v,""))}return l;case 0:return v=l.type,E=l.pendingProps,E=l.elementType===v?E:bi(v,E),Xh(o,l,v,E,p);case 1:return v=l.type,E=l.pendingProps,E=l.elementType===v?E:bi(v,E),cg(o,l,v,E,p);case 3:e:{if(ug(l),o===null)throw Error(a(387));v=l.pendingProps,w=l.memoizedState,E=w.element,vm(o,l),Ol(l,v,null,p);var F=l.memoizedState;if(v=F.element,ve&&w.isDehydrated)if(w={element:v,isDehydrated:!1,cache:F.cache,transitions:F.transitions},l.updateQueue.baseState=w,l.memoizedState=w,l.flags&256){E=Error(a(423)),l=hg(o,l,v,p,E);break e}else if(v!==E){E=Error(a(424)),l=hg(o,l,v,p,E);break e}else for(ve&&(ti=bl(l.stateNode.containerInfo),ei=l,Vt=!0,wi=null,ra=!1),p=Lm(l,null,v,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(to(),v===E){l=cr(o,l,p);break e}Bn(o,l,v,p)}l=l.child}return l;case 5:return Im(l),o===null&&Ih(l),v=l.type,E=l.pendingProps,w=o!==null?o.memoizedProps:null,F=E.children,be(v,E)?F=null:w!==null&&be(v,w)&&(l.flags|=32),lg(o,l),Bn(o,l,F,p),l.child;case 6:return o===null&&Ih(l),null;case 13:return dg(o,l,p);case 4:return Dh(l,l.stateNode.containerInfo),v=l.pendingProps,o===null?l.child=no(l,null,v,p):Bn(o,l,v,p),l.child;case 11:return v=l.type,E=l.pendingProps,E=l.elementType===v?E:bi(v,E),rg(o,l,v,E,p);case 7:return Bn(o,l,l.pendingProps,p),l.child;case 8:return Bn(o,l,l.pendingProps.children,p),l.child;case 12:return Bn(o,l,l.pendingProps.children,p),l.child;case 10:e:{if(v=l.type._context,E=l.pendingProps,w=l.memoizedProps,F=E.value,_m(l,v,F),w!==null)if(Gi(w.value,F)){if(w.children===E.children&&!qt.current){l=cr(o,l,p);break e}}else for(w=l.child,w!==null&&(w.return=l);w!==null;){var X=w.dependencies;if(X!==null){F=w.child;for(var ce=X.firstContext;ce!==null;){if(ce.context===v){if(w.tag===1){ce=sr(-1,p&-p),ce.tag=2;var we=w.updateQueue;if(we!==null){we=we.shared;var je=we.pending;je===null?ce.next=ce:(ce.next=je.next,je.next=ce),we.pending=ce}}w.lanes|=p,ce=w.alternate,ce!==null&&(ce.lanes|=p),wh(w.return,p,l),X.lanes|=p;break}ce=ce.next}}else if(w.tag===10)F=w.type===l.type?null:w.child;else if(w.tag===18){if(F=w.return,F===null)throw Error(a(341));F.lanes|=p,X=F.alternate,X!==null&&(X.lanes|=p),wh(F,p,l),F=w.sibling}else F=w.child;if(F!==null)F.return=w;else for(F=w;F!==null;){if(F===l){F=null;break}if(w=F.sibling,w!==null){w.return=F.return,F=w;break}F=F.return}w=F}Bn(o,l,E.children,p),l=l.child}return l;case 9:return E=l.type,v=l.pendingProps.children,Qs(l,p),E=di(E),v=v(E),l.flags|=1,Bn(o,l,v,p),l.child;case 14:return v=l.type,E=bi(v,l.pendingProps),E=bi(v.type,E),sg(o,l,v,E,p);case 15:return og(o,l,l.type,l.pendingProps,p);case 17:return v=l.type,E=l.pendingProps,E=l.elementType===v?E:bi(v,E),o!==null&&(o.alternate=null,l.alternate=null,l.flags|=2),l.tag=1,fn(v)?(o=!0,Mn(l)):o=!1,Qs(l,p),Em(l,v,E),Ch(l,v,E,p),qh(null,l,v,!0,o,p);case 19:return gg(o,l,p);case 22:return ag(o,l,p)}throw Error(a(156,l.tag))};function kg(o,l){return vh(o,l)}function MS(o,l,p,v){this.tag=o,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vi(o,l,p,v){return new MS(o,l,p,v)}function md(o){return o=o.prototype,!(!o||!o.isReactComponent)}function ES(o){if(typeof o=="function")return md(o)?1:0;if(o!=null){if(o=o.$$typeof,o===S)return 11;if(o===b)return 14}return 2}function Nr(o,l){var p=o.alternate;return p===null?(p=vi(o.tag,l,o.key,o.mode),p.elementType=o.elementType,p.type=o.type,p.stateNode=o.stateNode,p.alternate=o,o.alternate=p):(p.pendingProps=l,p.type=o.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=o.flags&14680064,p.childLanes=o.childLanes,p.lanes=o.lanes,p.child=o.child,p.memoizedProps=o.memoizedProps,p.memoizedState=o.memoizedState,p.updateQueue=o.updateQueue,l=o.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=o.sibling,p.index=o.index,p.ref=o.ref,p}function _c(o,l,p,v,E,w){var F=2;if(v=o,typeof o=="function")md(o)&&(F=1);else if(typeof o=="string")F=5;else e:switch(o){case d:return cs(p.children,E,w,l);case f:F=8,E|=8;break;case m:return o=vi(12,p,l,E|2),o.elementType=m,o.lanes=w,o;case y:return o=vi(13,p,l,E),o.elementType=y,o.lanes=w,o;case _:return o=vi(19,p,l,E),o.elementType=_,o.lanes=w,o;case T:return vc(p,E,w,l);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case g:F=10;break e;case x:F=9;break e;case S:F=11;break e;case b:F=14;break e;case M:F=16,v=null;break e}throw Error(a(130,o==null?o:typeof o,""))}return l=vi(F,p,l,E),l.elementType=o,l.type=v,l.lanes=w,l}function cs(o,l,p,v){return o=vi(7,o,v,l),o.lanes=p,o}function vc(o,l,p,v){return o=vi(22,o,v,l),o.elementType=T,o.lanes=p,o.stateNode={},o}function gd(o,l,p){return o=vi(6,o,null,l),o.lanes=p,o}function _d(o,l,p){return l=vi(4,o.children!==null?o.children:[],o.key,l),l.lanes=p,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}function bS(o,l,p,v,E){this.tag=l,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=rt,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gh(0),this.expirationTimes=gh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gh(0),this.identifierPrefix=v,this.onRecoverableError=E,ve&&(this.mutableSourceEagerHydrationData=null)}function Hg(o,l,p,v,E,w,F,X,ce){return o=new bS(o,l,p,X,ce),l===1?(l=1,w===!0&&(l|=8)):l=0,w=vi(3,null,null,l),o.current=w,w.stateNode=o,w.memoizedState={element:v,isDehydrated:p,cache:null,transitions:null},Th(w),o}function Vg(o){if(!o)return ui;o=o._reactInternals;e:{if(A(o)!==o||o.tag!==1)throw Error(a(170));var l=o;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(fn(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(a(171))}if(o.tag===1){var p=o.type;if(fn(p))return Zs(o,p,l)}return l}function Gg(o){var l=o._reactInternals;if(l===void 0)throw typeof o.render=="function"?Error(a(188)):(o=Object.keys(o).join(","),Error(a(268,o)));return o=ee(l),o===null?null:o.stateNode}function Wg(o,l){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var p=o.retryLane;o.retryLane=p!==0&&p<l?p:l}}function vd(o,l){Wg(o,l),(o=o.alternate)&&Wg(o,l)}function wS(o){return o=ee(o),o===null?null:o.stateNode}function TS(){return null}return t.attemptContinuousHydration=function(o){if(o.tag===13){var l=kn();_i(o,134217728,l),vd(o,134217728)}},t.attemptHydrationAtCurrentPriority=function(o){if(o.tag===13){var l=kn(),p=Lr(o);_i(o,p,l),vd(o,p)}},t.attemptSynchronousHydration=function(o){switch(o.tag){case 3:var l=o.stateNode;if(l.current.memoizedState.isDehydrated){var p=na(l.pendingLanes);p!==0&&(_h(l,p|1),qn(l,pn()),!(Et&6)&&(lo(),Wi()))}break;case 13:var v=kn();Ig(function(){return _i(o,1,v)}),vd(o,1)}},t.batchedUpdates=function(o,l){var p=Et;Et|=1;try{return o(l)}finally{Et=p,Et===0&&(lo(),Ll&&Wi())}},t.createComponentSelector=function(o){return{$$typeof:ic,value:o}},t.createContainer=function(o,l,p,v,E,w,F){return Hg(o,l,!1,null,p,v,E,w,F)},t.createHasPseudoClassSelector=function(o){return{$$typeof:rc,value:o}},t.createHydrationContainer=function(o,l,p,v,E,w,F,X,ce){return o=Hg(p,v,!0,o,E,w,F,X,ce),o.context=Vg(null),p=o.current,v=kn(),E=Lr(p),w=sr(v,E),w.callback=l??null,Cr(p,w),o.current.lanes=E,ia(o,E,v),qn(o,v),o},t.createPortal=function(o,l,p){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:v==null?null:""+v,children:o,containerInfo:l,implementation:p}},t.createRoleSelector=function(o){return{$$typeof:sc,value:o}},t.createTestNameSelector=function(o){return{$$typeof:oc,value:o}},t.createTextSelector=function(o){return{$$typeof:ac,value:o}},t.deferredUpdates=function(o){var l=Pt,p=Qt.transition;try{return Qt.transition=null,Pt=16,o()}finally{Pt=l,Qt.transition=p}},t.discreteUpdates=function(o,l,p,v,E){var w=Pt,F=Qt.transition;try{return Qt.transition=null,Pt=1,o(l,p,v,E)}finally{Pt=w,Qt.transition=F,Et===0&&lo()}},t.findAllNodes=rd,t.findBoundingRects=function(o,l){if(!I)throw Error(a(363));l=rd(o,l),o=[];for(var p=0;p<l.length;p++)o.push(ye(l[p]));for(l=o.length-1;0<l;l--){p=o[l];for(var v=p.x,E=v+p.width,w=p.y,F=w+p.height,X=l-1;0<=X;X--)if(l!==X){var ce=o[X],we=ce.x,je=we+ce.width,pt=ce.y,nt=pt+ce.height;if(v>=we&&w>=pt&&E<=je&&F<=nt){o.splice(l,1);break}else if(v!==we||p.width!==ce.width||nt<w||pt>F){if(!(w!==pt||p.height!==ce.height||je<v||we>E)){we>v&&(ce.width+=we-v,ce.x=v),je<E&&(ce.width=E-we),o.splice(l,1);break}}else{pt>w&&(ce.height+=pt-w,ce.y=w),nt<F&&(ce.height=F-pt),o.splice(l,1);break}}}return o},t.findHostInstance=Gg,t.findHostInstanceWithNoPortals=function(o){return o=z(o),o=o!==null?H(o):null,o===null?null:o.stateNode},t.findHostInstanceWithWarning=function(o){return Gg(o)},t.flushControlled=function(o){var l=Et;Et|=1;var p=Qt.transition,v=Pt;try{Qt.transition=null,Pt=1,o()}finally{Pt=v,Qt.transition=p,Et=l,Et===0&&(lo(),Wi())}},t.flushPassiveEffects=ls,t.flushSync=Ig,t.focusWithin=function(o,l){if(!I)throw Error(a(363));for(o=td(o),l=Rg(o,l),l=Array.from(l),o=0;o<l.length;){var p=l[o++];if(!me(p)){if(p.tag===5&&Re(p.stateNode))return!0;for(p=p.child;p!==null;)l.push(p),p=p.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Pt},t.getFindAllNodesFailureDescription=function(o,l){if(!I)throw Error(a(363));var p=0,v=[];o=[td(o),0];for(var E=0;E<o.length;){var w=o[E++],F=o[E++],X=l[F];if((w.tag!==5||!me(w))&&(nd(w,X)&&(v.push(id(X)),F++,F>p&&(p=F)),F<l.length))for(w=w.child;w!==null;)o.push(w,F),w=w.sibling}if(p<l.length){for(o=[];p<l.length;p++)o.push(id(l[p]));return`findAllNodes was able to match part of the selector:
3718
3718
  `+(v.join(" > ")+`
3719
3719
 
3720
3720
  No matching component was found for:
3721
- `)+o.join(" > ")}return null},t.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return ie(o.child.stateNode);default:return o.child.stateNode}},t.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:wS,findFiberByHostInstance:o.findFiberByHostInstance||TS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)o=!0;else{try{Pl=l.inject(o),Vi=l}catch{}o=!!l.checkDCE}}return o},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(o,l,p,v){if(!I)throw Error(a(363));o=rd(o,l);var E=Ie(o,p,v).disconnect;return{disconnect:function(){E()}}},t.registerMutableSourceForHydration=function(o,l){var p=l._getVersion;p=p(l._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[l,p]:o.mutableSourceEagerHydrationData.push(l,p)},t.runWithPriority=function(o,l){var p=Pt;try{return Pt=o,l()}finally{Pt=p}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(o,l,p,v){var E=l.current,w=kn(),F=Lr(E);return p=Gg(p),l.context===null?l.context=p:l.pendingContext=p,l=sr(w,F),l.payload={element:o},v=v===void 0?null:v,v!==null&&(l.callback=v),Cr(E,l),o=_i(E,F,w),o!==null&&Ul(o,E,F),F},t};uy.exports=DC;var UC=uy.exports;const OC=PS(UC),om={},FC=r=>void Object.assign(om,r);function zC(r,e){function t(d,{args:f=[],attach:m,...g},x){let S=`${d[0].toUpperCase()}${d.slice(1)}`,y;if(d==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const _=g.object;y=Do(_,{type:d,root:x,attach:m,primitive:!0})}else{const _=om[S];if(!_)throw new Error(`R3F: ${S} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(f))throw new Error("R3F: The args prop must be an array!");y=Do(new _(...f),{type:d,root:x,attach:m,memoizedProps:{args:f}})}return y.__r3f.attach===void 0&&(y.isBufferGeometry?y.__r3f.attach="geometry":y.isMaterial&&(y.__r3f.attach="material")),S!=="inject"&&of(y,g),y}function n(d,f){let m=!1;if(f){var g,x;(g=f.__r3f)!=null&&g.attach?sf(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),m=!0),m||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||Do(f,{}),f.__r3f.parent=d,pp(f),Uo(f)}}function i(d,f,m){let g=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)sf(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const y=d.children.filter(b=>b!==f),_=y.indexOf(m);d.children=[...y.slice(0,_),f,...y.slice(_)],g=!0}g||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Do(f,{}),f.__r3f.parent=d,pp(f),Uo(f)}}function s(d,f,m=!1){d&&[...d].forEach(g=>a(f,g,m))}function a(d,f,m){if(f){var g,x,S;if(f.__r3f&&(f.__r3f.parent=null),(g=d.__r3f)!=null&&g.objects&&(d.__r3f.objects=d.__r3f.objects.filter(T=>T!==f)),(x=f.__r3f)!=null&&x.attach)R_(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var y;d.remove(f),(y=f.__r3f)!=null&&y.root&&jC(wu(f),f)}const b=(S=f.__r3f)==null?void 0:S.primitive,M=!b&&(m===void 0?f.dispose!==null:m);if(!b){var _;s((_=f.__r3f)==null?void 0:_.objects,f,M),s(f.children,f,M)}if(delete f.__r3f,M&&f.dispose&&f.type!=="Scene"){const T=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?dp.unstable_scheduleCallback(dp.unstable_IdlePriority,T):T()}Uo(d)}}function c(d,f,m,g){var x;const S=(x=d.__r3f)==null?void 0:x.parent;if(!S)return;const y=t(f,m,d.__r3f.root);if(d.children){for(const _ of d.children)_.__r3f&&n(y,_);d.children=d.children.filter(_=>!_.__r3f)}d.__r3f.objects.forEach(_=>n(y,_)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||a(S,d),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),n(S,y),y.raycast&&y.__r3f.eventCount&&wu(y).getState().internal.interaction.push(y),[g,g.alternate].forEach(_=>{_!==null&&(_.stateNode=y,_.ref&&(typeof _.ref=="function"?_.ref(y):_.ref.current=y))})}const u=()=>{};return{reconciler:OC({createInstance:t,removeChild:a,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const m=d.getState().scene;m.__r3f&&(m.__r3f.root=d,n(m,f))},removeChildFromContainer:(d,f)=>{f&&a(d.getState().scene,f)},insertInContainerBefore:(d,f,m)=>{if(!f||!m)return;const g=d.getState().scene;g.__r3f&&i(g,f,m)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,m,g){var x;if(((x=d==null?void 0:d.__r3f)!=null?x:{}).primitive&&g.object&&g.object!==d)return[!0];{const{args:y=[],children:_,...b}=g,{args:M=[],children:T,...R}=m;if(!Array.isArray(y))throw new Error("R3F: the args prop must be an array!");if(y.some((N,B)=>N!==M[B]))return[!0];const C=xy(d,b,R,!0);return C.changes.length?[!1,C]:null}},commitUpdate(d,[f,m],g,x,S,y){f?c(d,g,S,y):of(d,m)},commitMount(d,f,m,g){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&wu(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Do(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:m,parent:g}=(f=d.__r3f)!=null?f:{};m&&g&&R_(g,d,m),d.isObject3D&&(d.visible=!1),Uo(d)},unhideInstance(d,f){var m;const{attach:g,parent:x}=(m=d.__r3f)!=null?m:{};g&&x&&sf(x,d,g),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),Uo(d)},createTextInstance:u,hideTextInstance:u,unhideTextInstance:u,getCurrentEventPriority:()=>e?e():Ho.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&kt.fun(performance.now)?performance.now:kt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:kt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:kt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:of}}var w_,T_;const rf=r=>"colorSpace"in r||"outputColorSpace"in r,fy=()=>{var r;return(r=om.ColorManagement)!=null?r:null},py=r=>r&&r.isOrthographicCamera,BC=r=>r&&r.hasOwnProperty("current"),Sl=typeof window<"u"&&((w_=window.document)!=null&&w_.createElement||((T_=window.navigator)==null?void 0:T_.product)==="ReactNative")?W.useLayoutEffect:W.useEffect;function my(r){const e=W.useRef(r);return Sl(()=>void(e.current=r),[r]),e}function kC({set:r}){return Sl(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class gy extends W.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}gy.getDerivedStateFromError=()=>({error:!0});const _y="__default",A_=new Map,HC=r=>r&&!!r.memoized&&!!r.changes;function vy(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}const Ia=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()};function wu(r){let e=r.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const kt={obj:r=>r===Object(r)&&!kt.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(kt.str(r)||kt.num(r)||kt.boo(r))return r===e;const s=kt.obj(r);if(s&&n==="reference")return r===e;const a=kt.arr(r);if(a&&t==="reference")return r===e;if((a||s)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!kt.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(kt.und(c)){if(a&&r.length===0&&e.length===0||s&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function VC(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function Do(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function fp(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,a)=>s[a],r),{target:t,key:i}}else return{target:t,key:e}}const C_=/-\d+$/;function sf(r,e,t){if(kt.str(t)){if(C_.test(t)){const s=t.replace(C_,""),{target:a,key:c}=fp(r,s);Array.isArray(a[c])||(a[c]=[])}const{target:n,key:i}=fp(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function R_(r,e,t){var n,i;if(kt.str(t)){const{target:s,key:a}=fp(r,t),c=e.__r3f.previousAttach;c===void 0?delete s[a]:s[a]=c}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function xy(r,{children:e,key:t,ref:n,...i},{children:s,key:a,ref:c,...u}={},h=!1){const d=r.__r3f,f=Object.entries(i),m=[];if(h){const x=Object.keys(u);for(let S=0;S<x.length;S++)i.hasOwnProperty(x[S])||f.unshift([x[S],_y+"remove"])}f.forEach(([x,S])=>{var y;if((y=r.__r3f)!=null&&y.primitive&&x==="object"||kt.equ(S,u[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,S,!0,[]]);let _=[];x.includes("-")&&(_=x.split("-")),m.push([x,S,!1,_]);for(const b in i){const M=i[b];b.startsWith(`${x}-`)&&m.push([b,M,!1,b.split("-")])}});const g={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(g.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(g.attach=d.memoizedProps.attach),{memoized:g,changes:m}}function of(r,e){var t;const n=r.__r3f,i=n==null?void 0:n.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:a,changes:c}=HC(e)?e:xy(r,e),u=n==null?void 0:n.eventCount;r.__r3f&&(r.__r3f.memoizedProps=a);for(let m=0;m<c.length;m++){let[g,x,S,y]=c[m];if(rf(r)){const T="srgb",R="srgb-linear";g==="encoding"?(g="colorSpace",x=x===3001?T:R):g==="outputEncoding"&&(g="outputColorSpace",x=x===3001?T:R)}let _=r,b=_[g];if(y.length&&(b=y.reduce((M,T)=>M[T],r),!(b&&b.set))){const[M,...T]=y.reverse();_=T.reverse().reduce((R,C)=>R[C],r),g=M}if(x===_y+"remove")if(_.constructor){let M=A_.get(_.constructor);M||(M=new _.constructor,A_.set(_.constructor,M)),x=M[g]}else x=0;if(S&&n)x?n.handlers[g]=x:delete n.handlers[g],n.eventCount=Object.keys(n.handlers).length;else if(b&&b.set&&(b.copy||b instanceof Os)){if(Array.isArray(x))b.fromArray?b.fromArray(x):b.set(...x);else if(b.copy&&x&&x.constructor&&b.constructor===x.constructor)b.copy(x);else if(x!==void 0){var h;const M=(h=b)==null?void 0:h.isColor;!M&&b.setScalar?b.setScalar(x):b instanceof Os&&x instanceof Os?b.mask=x.mask:b.set(x),!fy()&&s&&!s.linear&&M&&b.convertSRGBToLinear()}}else{var d;if(_[g]=x,(d=_[g])!=null&&d.isTexture&&_[g].format===Wn&&_[g].type===$i&&s){const M=_[g];rf(M)&&rf(s.gl)?M.colorSpace=s.gl.outputColorSpace:M.encoding=s.gl.outputEncoding}}Uo(r)}if(n&&n.parent&&r.raycast&&u!==n.eventCount){const m=wu(r).getState().internal,g=m.interaction.indexOf(r);g>-1&&m.interaction.splice(g,1),n.eventCount&&m.interaction.push(r)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(t=r.__r3f)!=null&&t.parent&&pp(r),r}function Uo(r){var e,t;const n=(e=r.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function pp(r){r.onUpdate==null||r.onUpdate(r)}function GC(r,e){r.manual||(py(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function hu(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function WC(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Ho.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Ho.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Ho.ContinuousEventPriority;default:return Ho.DefaultEventPriority}}function yy(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function jC(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{yy(t.capturedMap,e,n,i)})}function XC(r){function e(u){const{internal:h}=r.getState(),d=u.offsetX-h.initialClick[0],f=u.offsetY-h.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function t(u){return u.filter(h=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=h.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function n(u,h){const d=r.getState(),f=new Set,m=[],g=h?h(d.internal.interaction):d.internal.interaction;for(let _=0;_<g.length;_++){const b=Ia(g[_]);b&&(b.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(u,d);function x(_){const b=Ia(_);if(!b||!b.events.enabled||b.raycaster.camera===null)return[];if(b.raycaster.camera===void 0){var M;b.events.compute==null||b.events.compute(u,b,(M=b.previousRoot)==null?void 0:M.getState()),b.raycaster.camera===void 0&&(b.raycaster.camera=null)}return b.raycaster.camera?b.raycaster.intersectObject(_,!0):[]}let S=g.flatMap(x).sort((_,b)=>{const M=Ia(_.object),T=Ia(b.object);return!M||!T?_.distance-b.distance:T.events.priority-M.events.priority||_.distance-b.distance}).filter(_=>{const b=hu(_);return f.has(b)?!1:(f.add(b),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const _ of S){let b=_.object;for(;b;){var y;(y=b.__r3f)!=null&&y.eventCount&&m.push({..._,eventObject:b}),b=b.parent}}if("pointerId"in u&&d.internal.capturedMap.has(u.pointerId))for(let _ of d.internal.capturedMap.get(u.pointerId).values())f.has(hu(_.intersection))||m.push(_.intersection);return m}function i(u,h,d,f){const m=r.getState();if(u.length){const g={stopped:!1};for(const x of u){const S=Ia(x.object)||m,{raycaster:y,pointer:_,camera:b,internal:M}=S,T=new U(_.x,_.y,0).unproject(b),R=P=>{var z,ee;return(z=(ee=M.capturedMap.get(P))==null?void 0:ee.has(x.eventObject))!=null?z:!1},C=P=>{const z={intersection:x,target:h.target};M.capturedMap.has(P)?M.capturedMap.get(P).set(x.eventObject,z):M.capturedMap.set(P,new Map([[x.eventObject,z]])),h.target.setPointerCapture(P)},N=P=>{const z=M.capturedMap.get(P);z&&yy(M.capturedMap,x.eventObject,z,P)};let B={};for(let P in h){let z=h[P];typeof z!="function"&&(B[P]=z)}let A={...x,...B,pointer:_,intersections:u,stopped:g.stopped,delta:d,unprojectedPoint:T,ray:y.ray,camera:b,stopPropagation(){const P="pointerId"in h&&M.capturedMap.get(h.pointerId);if((!P||P.has(x.eventObject))&&(A.stopped=g.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===x.eventObject))){const z=u.slice(0,u.indexOf(x));s([...z,x])}},target:{hasPointerCapture:R,setPointerCapture:C,releasePointerCapture:N},currentTarget:{hasPointerCapture:R,setPointerCapture:C,releasePointerCapture:N},nativeEvent:h};if(f(A),g.stopped===!0)break}}return u}function s(u){const{internal:h}=r.getState();for(const d of h.hovered.values())if(!u.length||!u.find(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const m=d.eventObject.__r3f,g=m==null?void 0:m.handlers;if(h.hovered.delete(hu(d)),m!=null&&m.eventCount){const x={...d,intersections:u};g.onPointerOut==null||g.onPointerOut(x),g.onPointerLeave==null||g.onPointerLeave(x)}}}function a(u,h){for(let d=0;d<h.length;d++){const f=h[d].__r3f;f==null||f.handlers.onPointerMissed==null||f.handlers.onPointerMissed(u)}}function c(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return h=>{const{internal:d}=r.getState();"pointerId"in h&&d.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(h.pointerId)&&(d.capturedMap.delete(h.pointerId),s([]))})}}return function(d){const{onPointerMissed:f,internal:m}=r.getState();m.lastEvent.current=d;const g=u==="onPointerMove",x=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",y=n(d,g?t:void 0),_=x?e(d):0;u==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=y.map(M=>M.eventObject)),x&&!y.length&&_<=2&&(a(d,m.interaction),f&&f(d)),g&&s(y);function b(M){const T=M.eventObject,R=T.__r3f,C=R==null?void 0:R.handlers;if(R!=null&&R.eventCount)if(g){if(C.onPointerOver||C.onPointerEnter||C.onPointerOut||C.onPointerLeave){const N=hu(M),B=m.hovered.get(N);B?B.stopped&&M.stopPropagation():(m.hovered.set(N,M),C.onPointerOver==null||C.onPointerOver(M),C.onPointerEnter==null||C.onPointerEnter(M))}C.onPointerMove==null||C.onPointerMove(M)}else{const N=C[u];N?(!x||m.initialHits.includes(T))&&(a(d,m.interaction.filter(B=>!m.initialHits.includes(B))),N(M)):x&&m.initialHits.includes(T)&&a(d,m.interaction.filter(B=>!m.initialHits.includes(B)))}}i(y,d,_,b)}}return{handlePointer:c}}const Sy=r=>!!(r!=null&&r.render),My=W.createContext(null),qC=(r,e)=>{const t=NC((c,u)=>{const h=new U,d=new U,f=new U;function m(_=u().camera,b=d,M=u().size){const{width:T,height:R,top:C,left:N}=M,B=T/R;b.isVector3?f.copy(b):f.set(...b);const A=_.getWorldPosition(h).distanceTo(f);if(py(_))return{width:T/_.zoom,height:R/_.zoom,top:C,left:N,factor:1,distance:A,aspect:B};{const P=_.fov*Math.PI/180,z=2*Math.tan(P/2)*A,ee=z*(T/R);return{width:ee,height:z,top:C,left:N,factor:T/ee,distance:A,aspect:B}}}let g;const x=_=>c(b=>({performance:{...b.performance,current:_}})),S=new he;return{set:c,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(_=1)=>r(u(),_),advance:(_,b)=>e(_,b,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new nm,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const _=u();g&&clearTimeout(g),_.performance.current!==_.performance.min&&x(_.performance.min),g=setTimeout(()=>x(u().performance.max),_.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:_=>c(b=>({...b,events:{...b.events,..._}})),setSize:(_,b,M,T,R)=>{const C=u().camera,N={width:_,height:b,top:T||0,left:R||0,updateStyle:M};c(B=>({size:N,viewport:{...B.viewport,...m(C,d,N)}}))},setDpr:_=>c(b=>{const M=vy(_);return{viewport:{...b.viewport,dpr:M,initialDpr:b.viewport.initialDpr||M}}}),setFrameloop:(_="always")=>{const b=u().clock;b.stop(),b.elapsedTime=0,_!=="never"&&(b.start(),b.elapsedTime=0),c(()=>({frameloop:_}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:W.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(_,b,M)=>{const T=u().internal;return T.priority=T.priority+(b>0?1:0),T.subscribers.push({ref:_,priority:b,store:M}),T.subscribers=T.subscribers.sort((R,C)=>R.priority-C.priority),()=>{const R=u().internal;R!=null&&R.subscribers&&(R.priority=R.priority-(b>0?1:0),R.subscribers=R.subscribers.filter(C=>C.ref!==_))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,a=n.camera;return t.subscribe(()=>{const{camera:c,size:u,viewport:h,gl:d,set:f}=t.getState();if(u.width!==i.width||u.height!==i.height||h.dpr!==s){var m;i=u,s=h.dpr,GC(c,u),d.setPixelRatio(h.dpr);const g=(m=u.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(u.width,u.height,g)}c!==a&&(a=c,f(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};let du,YC=new Set,ZC=new Set,JC=new Set;function af(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function Na(r,e){switch(r){case"before":return af(YC,e);case"after":return af(ZC,e);case"tail":return af(JC,e)}}let lf,cf;function uf(r,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),lf=e.internal.subscribers,du=0;du<lf.length;du++)cf=lf[du],cf.ref.current(cf.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function KC(r){let e=!1,t=!1,n,i,s;function a(h){i=requestAnimationFrame(a),e=!0,n=0,Na("before",h),t=!0;for(const f of r.values()){var d;s=f.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(n+=uf(h,s))}if(t=!1,Na("after",h),n===0)return Na("tail",h),e=!1,cancelAnimationFrame(i)}function c(h,d=1){var f;if(!h)return r.forEach(m=>c(m.store.getState(),d));(f=h.gl.xr)!=null&&f.isPresenting||!h.internal.active||h.frameloop==="never"||(d>1?h.internal.frames=Math.min(60,h.internal.frames+d):t?h.internal.frames=2:h.internal.frames=1,e||(e=!0,requestAnimationFrame(a)))}function u(h,d=!0,f,m){if(d&&Na("before",h),f)uf(h,f,m);else for(const g of r.values())uf(h,g.store.getState());d&&Na("after",h)}return{loop:a,invalidate:c,advance:u}}function Ey(){const r=W.useContext(My);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function Pi(r=t=>t,e){return Ey()(r,e)}function Bi(r,e=0){const t=Ey(),n=t.getState().internal.subscribe,i=my(r);return Sl(()=>n(i,e,t),[e,n,t]),null}const Yo=new Map,{invalidate:P_,advance:L_}=KC(Yo),{reconciler:Uu,applyProps:Io}=zC(Yo,WC),No={objects:"shallow",strict:!1},QC=(r,e)=>{const t=typeof r=="function"?r(e):r;return Sy(t)?t:new Fp({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function $C(r,e){const t=typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement;if(e){const{width:n,height:i,top:s,left:a,updateStyle:c=t}=e;return{width:n,height:i,top:s,left:a,updateStyle:c}}else if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:n,height:i,top:s,left:a}=r.parentElement.getBoundingClientRect();return{width:n,height:i,top:s,left:a,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function eR(r){const e=Yo.get(r),t=e==null?void 0:e.fiber,n=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=n||qC(P_,L_),a=t||Uu.createContainer(s,Ho.ConcurrentRoot,null,!1,null,"",i,null);e||Yo.set(r,{fiber:a,store:s});let c,u=!1,h;return{configure(d={}){let{gl:f,size:m,scene:g,events:x,onCreated:S,shadows:y=!1,linear:_=!1,flat:b=!1,legacy:M=!1,orthographic:T=!1,frameloop:R="always",dpr:C=[1,2],performance:N,raycaster:B,camera:A,onPointerMissed:P}=d,z=s.getState(),ee=z.gl;z.gl||z.set({gl:ee=QC(f,r)});let de=z.raycaster;de||z.set({raycaster:de=new oy});const{params:H,...q}=B||{};if(kt.equ(q,de,No)||Io(de,{...q}),kt.equ(H,de.params,No)||Io(de,{params:{...de.params,...H}}),!z.camera||z.camera===h&&!kt.equ(h,A,No)){h=A;const J=A instanceof fl,te=J?A:T?new er(0,0,0,0,.1,1e3):new jt(75,0,.1,1e3);J||(te.position.z=5,A&&(Io(te,A),("aspect"in A||"left"in A||"right"in A||"bottom"in A||"top"in A)&&(te.manual=!0,te.updateProjectionMatrix())),!z.camera&&!(A!=null&&A.rotation)&&te.lookAt(0,0,0)),z.set({camera:te}),de.camera=te}if(!z.scene){let J;g!=null&&g.isScene?J=g:(J=new zp,g&&Io(J,g)),z.set({scene:Do(J)})}if(!z.xr){var ie;const J=(K,fe)=>{const be=s.getState();be.frameloop!=="never"&&L_(K,!0,be,fe)},te=()=>{const K=s.getState();K.gl.xr.enabled=K.gl.xr.isPresenting,K.gl.xr.setAnimationLoop(K.gl.xr.isPresenting?J:null),K.gl.xr.isPresenting||P_(K)},ge={connect(){const K=s.getState().gl;K.xr.addEventListener("sessionstart",te),K.xr.addEventListener("sessionend",te)},disconnect(){const K=s.getState().gl;K.xr.removeEventListener("sessionstart",te),K.xr.removeEventListener("sessionend",te)}};typeof((ie=ee.xr)==null?void 0:ie.addEventListener)=="function"&&ge.connect(),z.set({xr:ge})}if(ee.shadowMap){const J=ee.shadowMap.enabled,te=ee.shadowMap.type;if(ee.shadowMap.enabled=!!y,kt.boo(y))ee.shadowMap.type=Fa;else if(kt.str(y)){var le;const ge={basic:tv,percentage:Ou,soft:Fa,variance:Ri};ee.shadowMap.type=(le=ge[y])!=null?le:Fa}else kt.obj(y)&&Object.assign(ee.shadowMap,y);(J!==ee.shadowMap.enabled||te!==ee.shadowMap.type)&&(ee.shadowMap.needsUpdate=!0)}const j=fy();j&&("enabled"in j?j.enabled=!M:"legacyMode"in j&&(j.legacyMode=M)),u||Io(ee,{outputEncoding:_?3e3:3001,toneMapping:b?Qi:Fu}),z.legacy!==M&&z.set(()=>({legacy:M})),z.linear!==_&&z.set(()=>({linear:_})),z.flat!==b&&z.set(()=>({flat:b})),f&&!kt.fun(f)&&!Sy(f)&&!kt.equ(f,ee,No)&&Io(ee,f),x&&!z.events.handlers&&z.set({events:x(s)});const Z=$C(r,m);return kt.equ(Z,z.size,No)||z.setSize(Z.width,Z.height,Z.updateStyle,Z.top,Z.left),C&&z.viewport.dpr!==vy(C)&&z.setDpr(C),z.frameloop!==R&&z.setFrameloop(R),z.onPointerMissed||z.set({onPointerMissed:P}),N&&!kt.equ(N,z.performance,No)&&z.set(J=>({performance:{...J.performance,...N}})),c=S,u=!0,this},render(d){return u||this.configure(),Uu.updateContainer(L.jsx(tR,{store:s,children:d,onCreated:c,rootElement:r}),a,null,()=>{}),s},unmount(){by(r)}}}function tR({store:r,children:e,onCreated:t,rootElement:n}){return Sl(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),L.jsx(My.Provider,{value:r,children:e})}function by(r,e){const t=Yo.get(r),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),Uu.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var s,a,c,u;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(u=i.gl)!=null&&u.xr&&i.xr.disconnect(),VC(i),Yo.delete(r)}catch{}},500)})}}Uu.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:W.version});const hf={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function nR(r){const{handlePointer:e}=XC(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(hf).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:s}=r.getState();s.disconnect==null||s.disconnect(),i(a=>({events:{...a.events,connected:t}})),Object.entries((n=s.handlers)!=null?n:[]).forEach(([a,c])=>{const[u,h]=hf[a];t.addEventListener(u,c,{passive:h})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,a])=>{if(n&&n.connected instanceof HTMLElement){const[c]=hf[s];n.connected.removeEventListener(c,a)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function I_(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function iR({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=W.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=W.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),u=r?typeof r=="number"?r:r.scroll:null,h=r?typeof r=="number"?r:r.resize:null,d=W.useRef(!1);W.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,m,g]=W.useMemo(()=>{const _=()=>{if(!c.current.element)return;const{left:b,top:M,width:T,height:R,bottom:C,right:N,x:B,y:A}=c.current.element.getBoundingClientRect(),P={left:b,top:M,width:T,height:R,bottom:C,right:N,x:B,y:A};c.current.element instanceof HTMLElement&&n&&(P.height=c.current.element.offsetHeight,P.width=c.current.element.offsetWidth),Object.freeze(P),d.current&&!aR(c.current.lastBounds,P)&&a(c.current.lastBounds=P)};return[_,h?I_(_,h):_,u?I_(_,u):_]},[a,n,u,h]);function x(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function S(){c.current.element&&(c.current.resizeObserver=new i(g),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(_=>_.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const y=_=>{!_||_===c.current.element||(x(),c.current.element=_,c.current.scrollContainers=wy(_),S())};return sR(g,!!e),rR(m),W.useEffect(()=>{x(),S()},[e,g,m]),W.useEffect(()=>x,[]),[y,s,f]}function rR(r){W.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[r])}function sR(r,e){W.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[r,e])}function wy(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(s=>s==="auto"||s==="scroll")&&e.push(r),[...e,...wy(r.parentElement)]}const oR=["x","y","top","bottom","left","right","width","height"],aR=(r,e)=>oR.every(t=>r[t]===e[t]);var lR=Object.defineProperty,cR=Object.defineProperties,uR=Object.getOwnPropertyDescriptors,N_=Object.getOwnPropertySymbols,hR=Object.prototype.hasOwnProperty,dR=Object.prototype.propertyIsEnumerable,D_=(r,e,t)=>e in r?lR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,U_=(r,e)=>{for(var t in e||(e={}))hR.call(e,t)&&D_(r,t,e[t]);if(N_)for(var t of N_(e))dR.call(e,t)&&D_(r,t,e[t]);return r},fR=(r,e)=>cR(r,uR(e)),O_,F_;typeof window<"u"&&((O_=window.document)!=null&&O_.createElement||((F_=window.navigator)==null?void 0:F_.product)==="ReactNative")?W.useLayoutEffect:W.useEffect;function Ty(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=r.child;for(;n;){const i=Ty(n,e,t);if(i)return i;n=n.sibling}}function Ay(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const z_=console.error;console.error=function(){const r=[...arguments].join("");if(r!=null&&r.startsWith("Warning:")&&r.includes("useContext")){console.error=z_;return}return z_.apply(this,arguments)};const am=Ay(W.createContext(null));class Cy extends W.Component{render(){return W.createElement(am.Provider,{value:this._reactInternals},this.props.children)}}function pR(){const r=W.useContext(am);if(r===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=W.useId();return W.useMemo(()=>{for(const n of[r,r==null?void 0:r.alternate]){if(!n)continue;const i=Ty(n,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[r,e])}function mR(){const r=pR(),[e]=W.useState(()=>new Map);e.clear();let t=r;for(;t;){if(t.type&&typeof t.type=="object"){const i=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;i&&i!==am&&!e.has(i)&&e.set(i,W.useContext(Ay(i)))}t=t.return}return e}function gR(){const r=mR();return W.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>W.createElement(e,null,W.createElement(t.Provider,fR(U_({},n),{value:r.get(t)}))),e=>W.createElement(Cy,U_({},e))),[r])}const _R=W.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:a=nR,eventSource:c,eventPrefix:u,shadows:h,linear:d,flat:f,legacy:m,orthographic:g,frameloop:x,dpr:S,performance:y,raycaster:_,camera:b,scene:M,onPointerMissed:T,onCreated:R,...C},N){W.useMemo(()=>FC(PC),[]);const B=gR(),[A,P]=iR({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=W.useRef(null),ee=W.useRef(null);W.useImperativeHandle(N,()=>z.current);const de=my(T),[H,q]=W.useState(!1),[ie,le]=W.useState(!1);if(H)throw H;if(ie)throw ie;const j=W.useRef(null);Sl(()=>{const J=z.current;P.width>0&&P.height>0&&J&&(j.current||(j.current=eR(J)),j.current.configure({gl:s,events:a,shadows:h,linear:d,flat:f,legacy:m,orthographic:g,frameloop:x,dpr:S,performance:y,raycaster:_,camera:b,scene:M,size:P,onPointerMissed:(...te)=>de.current==null?void 0:de.current(...te),onCreated:te=>{te.events.connect==null||te.events.connect(c?BC(c)?c.current:c:ee.current),u&&te.setEvents({compute:(ge,K)=>{const fe=ge[u+"X"],be=ge[u+"Y"];K.pointer.set(fe/K.size.width*2-1,-(be/K.size.height)*2+1),K.raycaster.setFromCamera(K.pointer,K.camera)}}),R==null||R(te)}}),j.current.render(L.jsx(B,{children:L.jsx(gy,{set:le,children:L.jsx(W.Suspense,{fallback:L.jsx(kC,{set:q}),children:e??null})})})))}),W.useEffect(()=>{const J=z.current;if(J)return()=>by(J)},[]);const Z=c?"none":"auto";return L.jsx("div",{ref:ee,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Z,...i},...C,children:L.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:L.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}),vR=W.forwardRef(function(e,t){return L.jsx(Cy,{children:L.jsx(_R,{...e,ref:t})})});function Ei(){return Ei=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Ei.apply(null,arguments)}const Ml=new U,lm=new U,xR=new U,B_=new he;function yR(r,e,t){const n=Ml.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,s=t.height/2;return[n.x*i+i,-(n.y*s)+s]}function SR(r,e){const t=Ml.setFromMatrixPosition(r.matrixWorld),n=lm.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),s=e.getWorldDirection(xR);return i.angleTo(s)>Math.PI/2}function MR(r,e,t,n){const i=Ml.setFromMatrixPosition(r.matrixWorld),s=i.clone();s.project(e),B_.set(s.x,s.y),t.setFromCamera(B_,e);const a=t.intersectObjects(n,!0);if(a.length){const c=a[0].distance;return i.distanceTo(t.ray.origin)<c}return!0}function ER(r,e){if(e instanceof er)return e.zoom;if(e instanceof jt){const t=Ml.setFromMatrixPosition(r.matrixWorld),n=lm.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,s=t.distanceTo(n);return 1/(2*Math.tan(i/2)*s)}else return 1}function bR(r,e,t){if(e instanceof jt||e instanceof er){const n=Ml.setFromMatrixPosition(r.matrixWorld),i=lm.setFromMatrixPosition(e.matrixWorld),s=n.distanceTo(i),a=(t[1]-t[0])/(e.far-e.near),c=t[1]-a*e.far;return Math.round(a*s+c)}}const mp=r=>Math.abs(r)<1e-10?0:r;function Ry(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=mp(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const wR=(r=>e=>Ry(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),TR=(r=>(e,t)=>Ry(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]);function AR(r){return r&&typeof r=="object"&&"current"in r}const cm=W.forwardRef(({children:r,eps:e=.001,style:t,className:n,prepend:i,center:s,fullscreen:a,portal:c,distanceFactor:u,sprite:h=!1,transform:d=!1,occlude:f,onOcclude:m,castShadow:g,receiveShadow:x,material:S,geometry:y,zIndexRange:_=[16777271,0],calculatePosition:b=yR,as:M="div",wrapperClass:T,pointerEvents:R="auto",...C},N)=>{const{gl:B,camera:A,scene:P,size:z,raycaster:ee,events:de,viewport:H}=Pi(),[q]=W.useState(()=>document.createElement(M)),ie=W.useRef(),le=W.useRef(null),j=W.useRef(0),Z=W.useRef([0,0]),J=W.useRef(null),te=W.useRef(null),ge=(c==null?void 0:c.current)||de.connected||B.domElement.parentNode,K=W.useRef(null),fe=W.useRef(!1),be=W.useMemo(()=>f&&f!=="blending"||Array.isArray(f)&&f.length&&AR(f[0]),[f]);W.useLayoutEffect(()=>{const Pe=B.domElement;f&&f==="blending"?(Pe.style.zIndex=`${Math.floor(_[0]/2)}`,Pe.style.position="absolute",Pe.style.pointerEvents="none"):(Pe.style.zIndex=null,Pe.style.position=null,Pe.style.pointerEvents=null)},[f]),W.useLayoutEffect(()=>{if(le.current){const Pe=ie.current=LS(q);if(P.updateMatrixWorld(),d)q.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const Ae=b(le.current,A,z);q.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${Ae[0]}px,${Ae[1]}px,0);transform-origin:0 0;`}return ge&&(i?ge.prepend(q):ge.appendChild(q)),()=>{ge&&ge.removeChild(q),Pe.unmount()}}},[ge,d]),W.useLayoutEffect(()=>{T&&(q.className=T)},[T]);const Oe=W.useMemo(()=>d?{position:"absolute",top:0,left:0,width:z.width,height:z.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...a&&{top:-z.height/2,left:-z.width/2,width:z.width,height:z.height},...t},[t,s,a,z,d]),Ne=W.useMemo(()=>({position:"absolute",pointerEvents:R}),[R]);W.useLayoutEffect(()=>{if(fe.current=!1,d){var Pe;(Pe=ie.current)==null||Pe.render(W.createElement("div",{ref:J,style:Oe},W.createElement("div",{ref:te,style:Ne},W.createElement("div",{ref:N,className:n,style:t,children:r}))))}else{var Ae;(Ae=ie.current)==null||Ae.render(W.createElement("div",{ref:N,style:Oe,className:n,children:r}))}});const Je=W.useRef(!0);Bi(Pe=>{if(le.current){A.updateMatrixWorld(),le.current.updateWorldMatrix(!0,!1);const Ae=d?Z.current:b(le.current,A,z);if(d||Math.abs(j.current-A.zoom)>e||Math.abs(Z.current[0]-Ae[0])>e||Math.abs(Z.current[1]-Ae[1])>e){const k=SR(le.current,A);let ve=!1;be&&(Array.isArray(f)?ve=f.map(Ve=>Ve.current):f!=="blending"&&(ve=[P]));const ue=Je.current;if(ve){const Ve=MR(le.current,A,ee,ve);Je.current=Ve&&!k}else Je.current=!k;ue!==Je.current&&(m?m(!Je.current):q.style.display=Je.current?"block":"none");const Ee=Math.floor(_[0]/2),pe=f?be?[_[0],Ee]:[Ee-1,0]:_;if(q.style.zIndex=`${bR(le.current,A,pe)}`,d){const[Ve,Le]=[z.width/2,z.height/2],D=A.projectionMatrix.elements[5]*Le,{isOrthographicCamera:I,top:Q,left:ye,bottom:xe,right:me}=A,Xe=wR(A.matrixWorldInverse),Re=I?`scale(${D})translate(${mp(-(me+ye)/2)}px,${mp((Q+xe)/2)}px)`:`translateZ(${D}px)`;let Ie=le.current.matrixWorld;h&&(Ie=A.matrixWorldInverse.clone().transpose().copyPosition(Ie).scale(le.current.scale),Ie.elements[3]=Ie.elements[7]=Ie.elements[11]=0,Ie.elements[15]=1),q.style.width=z.width+"px",q.style.height=z.height+"px",q.style.perspective=I?"":`${D}px`,J.current&&te.current&&(J.current.style.transform=`${Re}${Xe}translate(${Ve}px,${Le}px)`,te.current.style.transform=TR(Ie,1/((u||10)/400)))}else{const Ve=u===void 0?1:ER(le.current,A)*u;q.style.transform=`translate3d(${Ae[0]}px,${Ae[1]}px,0) scale(${Ve})`}Z.current=Ae,j.current=A.zoom}}if(!be&&K.current&&!fe.current)if(d){if(J.current){const Ae=J.current.children[0];if(Ae!=null&&Ae.clientWidth&&Ae!=null&&Ae.clientHeight){const{isOrthographicCamera:k}=A;if(k||y)C.scale&&(Array.isArray(C.scale)?C.scale instanceof U?K.current.scale.copy(C.scale.clone().divideScalar(1)):K.current.scale.set(1/C.scale[0],1/C.scale[1],1/C.scale[2]):K.current.scale.setScalar(1/C.scale));else{const ve=(u||10)/400,ue=Ae.clientWidth*ve,Ee=Ae.clientHeight*ve;K.current.scale.set(ue,Ee,1)}fe.current=!0}}}else{const Ae=q.children[0];if(Ae!=null&&Ae.clientWidth&&Ae!=null&&Ae.clientHeight){const k=1/H.factor,ve=Ae.clientWidth*k,ue=Ae.clientHeight*k;K.current.scale.set(ve,ue,1),fe.current=!0}K.current.lookAt(Pe.camera.position)}});const rt=W.useMemo(()=>({vertexShader:d?void 0:`
3721
+ `)+o.join(" > ")}return null},t.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return ie(o.child.stateNode);default:return o.child.stateNode}},t.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:wS,findFiberByHostInstance:o.findFiberByHostInstance||TS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)o=!0;else{try{Pl=l.inject(o),Vi=l}catch{}o=!!l.checkDCE}}return o},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(o,l,p,v){if(!I)throw Error(a(363));o=rd(o,l);var E=Ie(o,p,v).disconnect;return{disconnect:function(){E()}}},t.registerMutableSourceForHydration=function(o,l){var p=l._getVersion;p=p(l._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[l,p]:o.mutableSourceEagerHydrationData.push(l,p)},t.runWithPriority=function(o,l){var p=Pt;try{return Pt=o,l()}finally{Pt=p}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(o,l,p,v){var E=l.current,w=kn(),F=Lr(E);return p=Vg(p),l.context===null?l.context=p:l.pendingContext=p,l=sr(w,F),l.payload={element:o},v=v===void 0?null:v,v!==null&&(l.callback=v),Cr(E,l),o=_i(E,F,w),o!==null&&Ul(o,E,F),F},t};uy.exports=DC;var UC=uy.exports;const OC=PS(UC),sm={},FC=r=>void Object.assign(sm,r);function zC(r,e){function t(d,{args:f=[],attach:m,...g},x){let S=`${d[0].toUpperCase()}${d.slice(1)}`,y;if(d==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const _=g.object;y=Do(_,{type:d,root:x,attach:m,primitive:!0})}else{const _=sm[S];if(!_)throw new Error(`R3F: ${S} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(f))throw new Error("R3F: The args prop must be an array!");y=Do(new _(...f),{type:d,root:x,attach:m,memoizedProps:{args:f}})}return y.__r3f.attach===void 0&&(y.isBufferGeometry?y.__r3f.attach="geometry":y.isMaterial&&(y.__r3f.attach="material")),S!=="inject"&&of(y,g),y}function n(d,f){let m=!1;if(f){var g,x;(g=f.__r3f)!=null&&g.attach?sf(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),m=!0),m||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||Do(f,{}),f.__r3f.parent=d,fp(f),Uo(f)}}function i(d,f,m){let g=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)sf(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const y=d.children.filter(b=>b!==f),_=y.indexOf(m);d.children=[...y.slice(0,_),f,...y.slice(_)],g=!0}g||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Do(f,{}),f.__r3f.parent=d,fp(f),Uo(f)}}function s(d,f,m=!1){d&&[...d].forEach(g=>a(f,g,m))}function a(d,f,m){if(f){var g,x,S;if(f.__r3f&&(f.__r3f.parent=null),(g=d.__r3f)!=null&&g.objects&&(d.__r3f.objects=d.__r3f.objects.filter(T=>T!==f)),(x=f.__r3f)!=null&&x.attach)C_(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var y;d.remove(f),(y=f.__r3f)!=null&&y.root&&jC(wu(f),f)}const b=(S=f.__r3f)==null?void 0:S.primitive,M=!b&&(m===void 0?f.dispose!==null:m);if(!b){var _;s((_=f.__r3f)==null?void 0:_.objects,f,M),s(f.children,f,M)}if(delete f.__r3f,M&&f.dispose&&f.type!=="Scene"){const T=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?hp.unstable_scheduleCallback(hp.unstable_IdlePriority,T):T()}Uo(d)}}function c(d,f,m,g){var x;const S=(x=d.__r3f)==null?void 0:x.parent;if(!S)return;const y=t(f,m,d.__r3f.root);if(d.children){for(const _ of d.children)_.__r3f&&n(y,_);d.children=d.children.filter(_=>!_.__r3f)}d.__r3f.objects.forEach(_=>n(y,_)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||a(S,d),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),n(S,y),y.raycast&&y.__r3f.eventCount&&wu(y).getState().internal.interaction.push(y),[g,g.alternate].forEach(_=>{_!==null&&(_.stateNode=y,_.ref&&(typeof _.ref=="function"?_.ref(y):_.ref.current=y))})}const u=()=>{};return{reconciler:OC({createInstance:t,removeChild:a,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const m=d.getState().scene;m.__r3f&&(m.__r3f.root=d,n(m,f))},removeChildFromContainer:(d,f)=>{f&&a(d.getState().scene,f)},insertInContainerBefore:(d,f,m)=>{if(!f||!m)return;const g=d.getState().scene;g.__r3f&&i(g,f,m)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,m,g){var x;if(((x=d==null?void 0:d.__r3f)!=null?x:{}).primitive&&g.object&&g.object!==d)return[!0];{const{args:y=[],children:_,...b}=g,{args:M=[],children:T,...R}=m;if(!Array.isArray(y))throw new Error("R3F: the args prop must be an array!");if(y.some((N,B)=>N!==M[B]))return[!0];const C=xy(d,b,R,!0);return C.changes.length?[!1,C]:null}},commitUpdate(d,[f,m],g,x,S,y){f?c(d,g,S,y):of(d,m)},commitMount(d,f,m,g){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&wu(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Do(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:m,parent:g}=(f=d.__r3f)!=null?f:{};m&&g&&C_(g,d,m),d.isObject3D&&(d.visible=!1),Uo(d)},unhideInstance(d,f){var m;const{attach:g,parent:x}=(m=d.__r3f)!=null?m:{};g&&x&&sf(x,d,g),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),Uo(d)},createTextInstance:u,hideTextInstance:u,unhideTextInstance:u,getCurrentEventPriority:()=>e?e():Ho.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&kt.fun(performance.now)?performance.now:kt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:kt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:kt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:of}}var b_,w_;const rf=r=>"colorSpace"in r||"outputColorSpace"in r,fy=()=>{var r;return(r=sm.ColorManagement)!=null?r:null},py=r=>r&&r.isOrthographicCamera,BC=r=>r&&r.hasOwnProperty("current"),Sl=typeof window<"u"&&((b_=window.document)!=null&&b_.createElement||((w_=window.navigator)==null?void 0:w_.product)==="ReactNative")?W.useLayoutEffect:W.useEffect;function my(r){const e=W.useRef(r);return Sl(()=>void(e.current=r),[r]),e}function kC({set:r}){return Sl(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class gy extends W.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}gy.getDerivedStateFromError=()=>({error:!0});const _y="__default",T_=new Map,HC=r=>r&&!!r.memoized&&!!r.changes;function vy(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}const Ia=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()};function wu(r){let e=r.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const kt={obj:r=>r===Object(r)&&!kt.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(kt.str(r)||kt.num(r)||kt.boo(r))return r===e;const s=kt.obj(r);if(s&&n==="reference")return r===e;const a=kt.arr(r);if(a&&t==="reference")return r===e;if((a||s)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!kt.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(kt.und(c)){if(a&&r.length===0&&e.length===0||s&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function VC(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function Do(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function dp(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,a)=>s[a],r),{target:t,key:i}}else return{target:t,key:e}}const A_=/-\d+$/;function sf(r,e,t){if(kt.str(t)){if(A_.test(t)){const s=t.replace(A_,""),{target:a,key:c}=dp(r,s);Array.isArray(a[c])||(a[c]=[])}const{target:n,key:i}=dp(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function C_(r,e,t){var n,i;if(kt.str(t)){const{target:s,key:a}=dp(r,t),c=e.__r3f.previousAttach;c===void 0?delete s[a]:s[a]=c}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function xy(r,{children:e,key:t,ref:n,...i},{children:s,key:a,ref:c,...u}={},h=!1){const d=r.__r3f,f=Object.entries(i),m=[];if(h){const x=Object.keys(u);for(let S=0;S<x.length;S++)i.hasOwnProperty(x[S])||f.unshift([x[S],_y+"remove"])}f.forEach(([x,S])=>{var y;if((y=r.__r3f)!=null&&y.primitive&&x==="object"||kt.equ(S,u[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,S,!0,[]]);let _=[];x.includes("-")&&(_=x.split("-")),m.push([x,S,!1,_]);for(const b in i){const M=i[b];b.startsWith(`${x}-`)&&m.push([b,M,!1,b.split("-")])}});const g={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(g.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(g.attach=d.memoizedProps.attach),{memoized:g,changes:m}}function of(r,e){var t;const n=r.__r3f,i=n==null?void 0:n.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:a,changes:c}=HC(e)?e:xy(r,e),u=n==null?void 0:n.eventCount;r.__r3f&&(r.__r3f.memoizedProps=a);for(let m=0;m<c.length;m++){let[g,x,S,y]=c[m];if(rf(r)){const T="srgb",R="srgb-linear";g==="encoding"?(g="colorSpace",x=x===3001?T:R):g==="outputEncoding"&&(g="outputColorSpace",x=x===3001?T:R)}let _=r,b=_[g];if(y.length&&(b=y.reduce((M,T)=>M[T],r),!(b&&b.set))){const[M,...T]=y.reverse();_=T.reverse().reduce((R,C)=>R[C],r),g=M}if(x===_y+"remove")if(_.constructor){let M=T_.get(_.constructor);M||(M=new _.constructor,T_.set(_.constructor,M)),x=M[g]}else x=0;if(S&&n)x?n.handlers[g]=x:delete n.handlers[g],n.eventCount=Object.keys(n.handlers).length;else if(b&&b.set&&(b.copy||b instanceof Os)){if(Array.isArray(x))b.fromArray?b.fromArray(x):b.set(...x);else if(b.copy&&x&&x.constructor&&b.constructor===x.constructor)b.copy(x);else if(x!==void 0){var h;const M=(h=b)==null?void 0:h.isColor;!M&&b.setScalar?b.setScalar(x):b instanceof Os&&x instanceof Os?b.mask=x.mask:b.set(x),!fy()&&s&&!s.linear&&M&&b.convertSRGBToLinear()}}else{var d;if(_[g]=x,(d=_[g])!=null&&d.isTexture&&_[g].format===Wn&&_[g].type===$i&&s){const M=_[g];rf(M)&&rf(s.gl)?M.colorSpace=s.gl.outputColorSpace:M.encoding=s.gl.outputEncoding}}Uo(r)}if(n&&n.parent&&r.raycast&&u!==n.eventCount){const m=wu(r).getState().internal,g=m.interaction.indexOf(r);g>-1&&m.interaction.splice(g,1),n.eventCount&&m.interaction.push(r)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(t=r.__r3f)!=null&&t.parent&&fp(r),r}function Uo(r){var e,t;const n=(e=r.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function fp(r){r.onUpdate==null||r.onUpdate(r)}function GC(r,e){r.manual||(py(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function hu(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function WC(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Ho.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Ho.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Ho.ContinuousEventPriority;default:return Ho.DefaultEventPriority}}function yy(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function jC(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{yy(t.capturedMap,e,n,i)})}function XC(r){function e(u){const{internal:h}=r.getState(),d=u.offsetX-h.initialClick[0],f=u.offsetY-h.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function t(u){return u.filter(h=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=h.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function n(u,h){const d=r.getState(),f=new Set,m=[],g=h?h(d.internal.interaction):d.internal.interaction;for(let _=0;_<g.length;_++){const b=Ia(g[_]);b&&(b.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(u,d);function x(_){const b=Ia(_);if(!b||!b.events.enabled||b.raycaster.camera===null)return[];if(b.raycaster.camera===void 0){var M;b.events.compute==null||b.events.compute(u,b,(M=b.previousRoot)==null?void 0:M.getState()),b.raycaster.camera===void 0&&(b.raycaster.camera=null)}return b.raycaster.camera?b.raycaster.intersectObject(_,!0):[]}let S=g.flatMap(x).sort((_,b)=>{const M=Ia(_.object),T=Ia(b.object);return!M||!T?_.distance-b.distance:T.events.priority-M.events.priority||_.distance-b.distance}).filter(_=>{const b=hu(_);return f.has(b)?!1:(f.add(b),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const _ of S){let b=_.object;for(;b;){var y;(y=b.__r3f)!=null&&y.eventCount&&m.push({..._,eventObject:b}),b=b.parent}}if("pointerId"in u&&d.internal.capturedMap.has(u.pointerId))for(let _ of d.internal.capturedMap.get(u.pointerId).values())f.has(hu(_.intersection))||m.push(_.intersection);return m}function i(u,h,d,f){const m=r.getState();if(u.length){const g={stopped:!1};for(const x of u){const S=Ia(x.object)||m,{raycaster:y,pointer:_,camera:b,internal:M}=S,T=new U(_.x,_.y,0).unproject(b),R=P=>{var z,ee;return(z=(ee=M.capturedMap.get(P))==null?void 0:ee.has(x.eventObject))!=null?z:!1},C=P=>{const z={intersection:x,target:h.target};M.capturedMap.has(P)?M.capturedMap.get(P).set(x.eventObject,z):M.capturedMap.set(P,new Map([[x.eventObject,z]])),h.target.setPointerCapture(P)},N=P=>{const z=M.capturedMap.get(P);z&&yy(M.capturedMap,x.eventObject,z,P)};let B={};for(let P in h){let z=h[P];typeof z!="function"&&(B[P]=z)}let A={...x,...B,pointer:_,intersections:u,stopped:g.stopped,delta:d,unprojectedPoint:T,ray:y.ray,camera:b,stopPropagation(){const P="pointerId"in h&&M.capturedMap.get(h.pointerId);if((!P||P.has(x.eventObject))&&(A.stopped=g.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(z=>z.eventObject===x.eventObject))){const z=u.slice(0,u.indexOf(x));s([...z,x])}},target:{hasPointerCapture:R,setPointerCapture:C,releasePointerCapture:N},currentTarget:{hasPointerCapture:R,setPointerCapture:C,releasePointerCapture:N},nativeEvent:h};if(f(A),g.stopped===!0)break}}return u}function s(u){const{internal:h}=r.getState();for(const d of h.hovered.values())if(!u.length||!u.find(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const m=d.eventObject.__r3f,g=m==null?void 0:m.handlers;if(h.hovered.delete(hu(d)),m!=null&&m.eventCount){const x={...d,intersections:u};g.onPointerOut==null||g.onPointerOut(x),g.onPointerLeave==null||g.onPointerLeave(x)}}}function a(u,h){for(let d=0;d<h.length;d++){const f=h[d].__r3f;f==null||f.handlers.onPointerMissed==null||f.handlers.onPointerMissed(u)}}function c(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return h=>{const{internal:d}=r.getState();"pointerId"in h&&d.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(h.pointerId)&&(d.capturedMap.delete(h.pointerId),s([]))})}}return function(d){const{onPointerMissed:f,internal:m}=r.getState();m.lastEvent.current=d;const g=u==="onPointerMove",x=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",y=n(d,g?t:void 0),_=x?e(d):0;u==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=y.map(M=>M.eventObject)),x&&!y.length&&_<=2&&(a(d,m.interaction),f&&f(d)),g&&s(y);function b(M){const T=M.eventObject,R=T.__r3f,C=R==null?void 0:R.handlers;if(R!=null&&R.eventCount)if(g){if(C.onPointerOver||C.onPointerEnter||C.onPointerOut||C.onPointerLeave){const N=hu(M),B=m.hovered.get(N);B?B.stopped&&M.stopPropagation():(m.hovered.set(N,M),C.onPointerOver==null||C.onPointerOver(M),C.onPointerEnter==null||C.onPointerEnter(M))}C.onPointerMove==null||C.onPointerMove(M)}else{const N=C[u];N?(!x||m.initialHits.includes(T))&&(a(d,m.interaction.filter(B=>!m.initialHits.includes(B))),N(M)):x&&m.initialHits.includes(T)&&a(d,m.interaction.filter(B=>!m.initialHits.includes(B)))}}i(y,d,_,b)}}return{handlePointer:c}}const Sy=r=>!!(r!=null&&r.render),My=W.createContext(null),qC=(r,e)=>{const t=NC((c,u)=>{const h=new U,d=new U,f=new U;function m(_=u().camera,b=d,M=u().size){const{width:T,height:R,top:C,left:N}=M,B=T/R;b.isVector3?f.copy(b):f.set(...b);const A=_.getWorldPosition(h).distanceTo(f);if(py(_))return{width:T/_.zoom,height:R/_.zoom,top:C,left:N,factor:1,distance:A,aspect:B};{const P=_.fov*Math.PI/180,z=2*Math.tan(P/2)*A,ee=z*(T/R);return{width:ee,height:z,top:C,left:N,factor:T/ee,distance:A,aspect:B}}}let g;const x=_=>c(b=>({performance:{...b.performance,current:_}})),S=new he;return{set:c,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(_=1)=>r(u(),_),advance:(_,b)=>e(_,b,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new tm,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const _=u();g&&clearTimeout(g),_.performance.current!==_.performance.min&&x(_.performance.min),g=setTimeout(()=>x(u().performance.max),_.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:_=>c(b=>({...b,events:{...b.events,..._}})),setSize:(_,b,M,T,R)=>{const C=u().camera,N={width:_,height:b,top:T||0,left:R||0,updateStyle:M};c(B=>({size:N,viewport:{...B.viewport,...m(C,d,N)}}))},setDpr:_=>c(b=>{const M=vy(_);return{viewport:{...b.viewport,dpr:M,initialDpr:b.viewport.initialDpr||M}}}),setFrameloop:(_="always")=>{const b=u().clock;b.stop(),b.elapsedTime=0,_!=="never"&&(b.start(),b.elapsedTime=0),c(()=>({frameloop:_}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:W.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(_,b,M)=>{const T=u().internal;return T.priority=T.priority+(b>0?1:0),T.subscribers.push({ref:_,priority:b,store:M}),T.subscribers=T.subscribers.sort((R,C)=>R.priority-C.priority),()=>{const R=u().internal;R!=null&&R.subscribers&&(R.priority=R.priority-(b>0?1:0),R.subscribers=R.subscribers.filter(C=>C.ref!==_))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,a=n.camera;return t.subscribe(()=>{const{camera:c,size:u,viewport:h,gl:d,set:f}=t.getState();if(u.width!==i.width||u.height!==i.height||h.dpr!==s){var m;i=u,s=h.dpr,GC(c,u),d.setPixelRatio(h.dpr);const g=(m=u.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(u.width,u.height,g)}c!==a&&(a=c,f(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};let du,YC=new Set,ZC=new Set,JC=new Set;function af(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function Na(r,e){switch(r){case"before":return af(YC,e);case"after":return af(ZC,e);case"tail":return af(JC,e)}}let lf,cf;function uf(r,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),lf=e.internal.subscribers,du=0;du<lf.length;du++)cf=lf[du],cf.ref.current(cf.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function KC(r){let e=!1,t=!1,n,i,s;function a(h){i=requestAnimationFrame(a),e=!0,n=0,Na("before",h),t=!0;for(const f of r.values()){var d;s=f.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(n+=uf(h,s))}if(t=!1,Na("after",h),n===0)return Na("tail",h),e=!1,cancelAnimationFrame(i)}function c(h,d=1){var f;if(!h)return r.forEach(m=>c(m.store.getState(),d));(f=h.gl.xr)!=null&&f.isPresenting||!h.internal.active||h.frameloop==="never"||(d>1?h.internal.frames=Math.min(60,h.internal.frames+d):t?h.internal.frames=2:h.internal.frames=1,e||(e=!0,requestAnimationFrame(a)))}function u(h,d=!0,f,m){if(d&&Na("before",h),f)uf(h,f,m);else for(const g of r.values())uf(h,g.store.getState());d&&Na("after",h)}return{loop:a,invalidate:c,advance:u}}function Ey(){const r=W.useContext(My);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function Pi(r=t=>t,e){return Ey()(r,e)}function Bi(r,e=0){const t=Ey(),n=t.getState().internal.subscribe,i=my(r);return Sl(()=>n(i,e,t),[e,n,t]),null}const Yo=new Map,{invalidate:R_,advance:P_}=KC(Yo),{reconciler:Uu,applyProps:Io}=zC(Yo,WC),No={objects:"shallow",strict:!1},QC=(r,e)=>{const t=typeof r=="function"?r(e):r;return Sy(t)?t:new Op({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function $C(r,e){const t=typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement;if(e){const{width:n,height:i,top:s,left:a,updateStyle:c=t}=e;return{width:n,height:i,top:s,left:a,updateStyle:c}}else if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:n,height:i,top:s,left:a}=r.parentElement.getBoundingClientRect();return{width:n,height:i,top:s,left:a,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function eR(r){const e=Yo.get(r),t=e==null?void 0:e.fiber,n=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=n||qC(R_,P_),a=t||Uu.createContainer(s,Ho.ConcurrentRoot,null,!1,null,"",i,null);e||Yo.set(r,{fiber:a,store:s});let c,u=!1,h;return{configure(d={}){let{gl:f,size:m,scene:g,events:x,onCreated:S,shadows:y=!1,linear:_=!1,flat:b=!1,legacy:M=!1,orthographic:T=!1,frameloop:R="always",dpr:C=[1,2],performance:N,raycaster:B,camera:A,onPointerMissed:P}=d,z=s.getState(),ee=z.gl;z.gl||z.set({gl:ee=QC(f,r)});let de=z.raycaster;de||z.set({raycaster:de=new oy});const{params:H,...q}=B||{};if(kt.equ(q,de,No)||Io(de,{...q}),kt.equ(H,de.params,No)||Io(de,{params:{...de.params,...H}}),!z.camera||z.camera===h&&!kt.equ(h,A,No)){h=A;const J=A instanceof fl,te=J?A:T?new er(0,0,0,0,.1,1e3):new jt(75,0,.1,1e3);J||(te.position.z=5,A&&(Io(te,A),("aspect"in A||"left"in A||"right"in A||"bottom"in A||"top"in A)&&(te.manual=!0,te.updateProjectionMatrix())),!z.camera&&!(A!=null&&A.rotation)&&te.lookAt(0,0,0)),z.set({camera:te}),de.camera=te}if(!z.scene){let J;g!=null&&g.isScene?J=g:(J=new Fp,g&&Io(J,g)),z.set({scene:Do(J)})}if(!z.xr){var ie;const J=(K,fe)=>{const be=s.getState();be.frameloop!=="never"&&P_(K,!0,be,fe)},te=()=>{const K=s.getState();K.gl.xr.enabled=K.gl.xr.isPresenting,K.gl.xr.setAnimationLoop(K.gl.xr.isPresenting?J:null),K.gl.xr.isPresenting||R_(K)},ge={connect(){const K=s.getState().gl;K.xr.addEventListener("sessionstart",te),K.xr.addEventListener("sessionend",te)},disconnect(){const K=s.getState().gl;K.xr.removeEventListener("sessionstart",te),K.xr.removeEventListener("sessionend",te)}};typeof((ie=ee.xr)==null?void 0:ie.addEventListener)=="function"&&ge.connect(),z.set({xr:ge})}if(ee.shadowMap){const J=ee.shadowMap.enabled,te=ee.shadowMap.type;if(ee.shadowMap.enabled=!!y,kt.boo(y))ee.shadowMap.type=Fa;else if(kt.str(y)){var le;const ge={basic:tv,percentage:Ou,soft:Fa,variance:Ri};ee.shadowMap.type=(le=ge[y])!=null?le:Fa}else kt.obj(y)&&Object.assign(ee.shadowMap,y);(J!==ee.shadowMap.enabled||te!==ee.shadowMap.type)&&(ee.shadowMap.needsUpdate=!0)}const j=fy();j&&("enabled"in j?j.enabled=!M:"legacyMode"in j&&(j.legacyMode=M)),u||Io(ee,{outputEncoding:_?3e3:3001,toneMapping:b?Qi:Fu}),z.legacy!==M&&z.set(()=>({legacy:M})),z.linear!==_&&z.set(()=>({linear:_})),z.flat!==b&&z.set(()=>({flat:b})),f&&!kt.fun(f)&&!Sy(f)&&!kt.equ(f,ee,No)&&Io(ee,f),x&&!z.events.handlers&&z.set({events:x(s)});const Z=$C(r,m);return kt.equ(Z,z.size,No)||z.setSize(Z.width,Z.height,Z.updateStyle,Z.top,Z.left),C&&z.viewport.dpr!==vy(C)&&z.setDpr(C),z.frameloop!==R&&z.setFrameloop(R),z.onPointerMissed||z.set({onPointerMissed:P}),N&&!kt.equ(N,z.performance,No)&&z.set(J=>({performance:{...J.performance,...N}})),c=S,u=!0,this},render(d){return u||this.configure(),Uu.updateContainer(L.jsx(tR,{store:s,children:d,onCreated:c,rootElement:r}),a,null,()=>{}),s},unmount(){by(r)}}}function tR({store:r,children:e,onCreated:t,rootElement:n}){return Sl(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),L.jsx(My.Provider,{value:r,children:e})}function by(r,e){const t=Yo.get(r),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),Uu.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var s,a,c,u;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(u=i.gl)!=null&&u.xr&&i.xr.disconnect(),VC(i),Yo.delete(r)}catch{}},500)})}}Uu.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:W.version});const hf={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function nR(r){const{handlePointer:e}=XC(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(hf).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:s}=r.getState();s.disconnect==null||s.disconnect(),i(a=>({events:{...a.events,connected:t}})),Object.entries((n=s.handlers)!=null?n:[]).forEach(([a,c])=>{const[u,h]=hf[a];t.addEventListener(u,c,{passive:h})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,a])=>{if(n&&n.connected instanceof HTMLElement){const[c]=hf[s];n.connected.removeEventListener(c,a)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function L_(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function iR({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=W.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=W.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),u=r?typeof r=="number"?r:r.scroll:null,h=r?typeof r=="number"?r:r.resize:null,d=W.useRef(!1);W.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,m,g]=W.useMemo(()=>{const _=()=>{if(!c.current.element)return;const{left:b,top:M,width:T,height:R,bottom:C,right:N,x:B,y:A}=c.current.element.getBoundingClientRect(),P={left:b,top:M,width:T,height:R,bottom:C,right:N,x:B,y:A};c.current.element instanceof HTMLElement&&n&&(P.height=c.current.element.offsetHeight,P.width=c.current.element.offsetWidth),Object.freeze(P),d.current&&!aR(c.current.lastBounds,P)&&a(c.current.lastBounds=P)};return[_,h?L_(_,h):_,u?L_(_,u):_]},[a,n,u,h]);function x(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function S(){c.current.element&&(c.current.resizeObserver=new i(g),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(_=>_.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const y=_=>{!_||_===c.current.element||(x(),c.current.element=_,c.current.scrollContainers=wy(_),S())};return sR(g,!!e),rR(m),W.useEffect(()=>{x(),S()},[e,g,m]),W.useEffect(()=>x,[]),[y,s,f]}function rR(r){W.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[r])}function sR(r,e){W.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[r,e])}function wy(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(s=>s==="auto"||s==="scroll")&&e.push(r),[...e,...wy(r.parentElement)]}const oR=["x","y","top","bottom","left","right","width","height"],aR=(r,e)=>oR.every(t=>r[t]===e[t]);var lR=Object.defineProperty,cR=Object.defineProperties,uR=Object.getOwnPropertyDescriptors,I_=Object.getOwnPropertySymbols,hR=Object.prototype.hasOwnProperty,dR=Object.prototype.propertyIsEnumerable,N_=(r,e,t)=>e in r?lR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,D_=(r,e)=>{for(var t in e||(e={}))hR.call(e,t)&&N_(r,t,e[t]);if(I_)for(var t of I_(e))dR.call(e,t)&&N_(r,t,e[t]);return r},fR=(r,e)=>cR(r,uR(e)),U_,O_;typeof window<"u"&&((U_=window.document)!=null&&U_.createElement||((O_=window.navigator)==null?void 0:O_.product)==="ReactNative")?W.useLayoutEffect:W.useEffect;function Ty(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=r.child;for(;n;){const i=Ty(n,e,t);if(i)return i;n=n.sibling}}function Ay(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const F_=console.error;console.error=function(){const r=[...arguments].join("");if(r!=null&&r.startsWith("Warning:")&&r.includes("useContext")){console.error=F_;return}return F_.apply(this,arguments)};const om=Ay(W.createContext(null));class Cy extends W.Component{render(){return W.createElement(om.Provider,{value:this._reactInternals},this.props.children)}}function pR(){const r=W.useContext(om);if(r===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=W.useId();return W.useMemo(()=>{for(const n of[r,r==null?void 0:r.alternate]){if(!n)continue;const i=Ty(n,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[r,e])}function mR(){const r=pR(),[e]=W.useState(()=>new Map);e.clear();let t=r;for(;t;){if(t.type&&typeof t.type=="object"){const i=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;i&&i!==om&&!e.has(i)&&e.set(i,W.useContext(Ay(i)))}t=t.return}return e}function gR(){const r=mR();return W.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>W.createElement(e,null,W.createElement(t.Provider,fR(D_({},n),{value:r.get(t)}))),e=>W.createElement(Cy,D_({},e))),[r])}const _R=W.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:a=nR,eventSource:c,eventPrefix:u,shadows:h,linear:d,flat:f,legacy:m,orthographic:g,frameloop:x,dpr:S,performance:y,raycaster:_,camera:b,scene:M,onPointerMissed:T,onCreated:R,...C},N){W.useMemo(()=>FC(PC),[]);const B=gR(),[A,P]=iR({scroll:!0,debounce:{scroll:50,resize:0},...n}),z=W.useRef(null),ee=W.useRef(null);W.useImperativeHandle(N,()=>z.current);const de=my(T),[H,q]=W.useState(!1),[ie,le]=W.useState(!1);if(H)throw H;if(ie)throw ie;const j=W.useRef(null);Sl(()=>{const J=z.current;P.width>0&&P.height>0&&J&&(j.current||(j.current=eR(J)),j.current.configure({gl:s,events:a,shadows:h,linear:d,flat:f,legacy:m,orthographic:g,frameloop:x,dpr:S,performance:y,raycaster:_,camera:b,scene:M,size:P,onPointerMissed:(...te)=>de.current==null?void 0:de.current(...te),onCreated:te=>{te.events.connect==null||te.events.connect(c?BC(c)?c.current:c:ee.current),u&&te.setEvents({compute:(ge,K)=>{const fe=ge[u+"X"],be=ge[u+"Y"];K.pointer.set(fe/K.size.width*2-1,-(be/K.size.height)*2+1),K.raycaster.setFromCamera(K.pointer,K.camera)}}),R==null||R(te)}}),j.current.render(L.jsx(B,{children:L.jsx(gy,{set:le,children:L.jsx(W.Suspense,{fallback:L.jsx(kC,{set:q}),children:e??null})})})))}),W.useEffect(()=>{const J=z.current;if(J)return()=>by(J)},[]);const Z=c?"none":"auto";return L.jsx("div",{ref:ee,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Z,...i},...C,children:L.jsx("div",{ref:A,style:{width:"100%",height:"100%"},children:L.jsx("canvas",{ref:z,style:{display:"block"},children:t})})})}),vR=W.forwardRef(function(e,t){return L.jsx(Cy,{children:L.jsx(_R,{...e,ref:t})})});function Ei(){return Ei=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Ei.apply(null,arguments)}const Ml=new U,am=new U,xR=new U,z_=new he;function yR(r,e,t){const n=Ml.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,s=t.height/2;return[n.x*i+i,-(n.y*s)+s]}function SR(r,e){const t=Ml.setFromMatrixPosition(r.matrixWorld),n=am.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),s=e.getWorldDirection(xR);return i.angleTo(s)>Math.PI/2}function MR(r,e,t,n){const i=Ml.setFromMatrixPosition(r.matrixWorld),s=i.clone();s.project(e),z_.set(s.x,s.y),t.setFromCamera(z_,e);const a=t.intersectObjects(n,!0);if(a.length){const c=a[0].distance;return i.distanceTo(t.ray.origin)<c}return!0}function ER(r,e){if(e instanceof er)return e.zoom;if(e instanceof jt){const t=Ml.setFromMatrixPosition(r.matrixWorld),n=am.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,s=t.distanceTo(n);return 1/(2*Math.tan(i/2)*s)}else return 1}function bR(r,e,t){if(e instanceof jt||e instanceof er){const n=Ml.setFromMatrixPosition(r.matrixWorld),i=am.setFromMatrixPosition(e.matrixWorld),s=n.distanceTo(i),a=(t[1]-t[0])/(e.far-e.near),c=t[1]-a*e.far;return Math.round(a*s+c)}}const pp=r=>Math.abs(r)<1e-10?0:r;function Ry(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=pp(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const wR=(r=>e=>Ry(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),TR=(r=>(e,t)=>Ry(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]);function AR(r){return r&&typeof r=="object"&&"current"in r}const lm=W.forwardRef(({children:r,eps:e=.001,style:t,className:n,prepend:i,center:s,fullscreen:a,portal:c,distanceFactor:u,sprite:h=!1,transform:d=!1,occlude:f,onOcclude:m,castShadow:g,receiveShadow:x,material:S,geometry:y,zIndexRange:_=[16777271,0],calculatePosition:b=yR,as:M="div",wrapperClass:T,pointerEvents:R="auto",...C},N)=>{const{gl:B,camera:A,scene:P,size:z,raycaster:ee,events:de,viewport:H}=Pi(),[q]=W.useState(()=>document.createElement(M)),ie=W.useRef(),le=W.useRef(null),j=W.useRef(0),Z=W.useRef([0,0]),J=W.useRef(null),te=W.useRef(null),ge=(c==null?void 0:c.current)||de.connected||B.domElement.parentNode,K=W.useRef(null),fe=W.useRef(!1),be=W.useMemo(()=>f&&f!=="blending"||Array.isArray(f)&&f.length&&AR(f[0]),[f]);W.useLayoutEffect(()=>{const Pe=B.domElement;f&&f==="blending"?(Pe.style.zIndex=`${Math.floor(_[0]/2)}`,Pe.style.position="absolute",Pe.style.pointerEvents="none"):(Pe.style.zIndex=null,Pe.style.position=null,Pe.style.pointerEvents=null)},[f]),W.useLayoutEffect(()=>{if(le.current){const Pe=ie.current=LS(q);if(P.updateMatrixWorld(),d)q.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const Ae=b(le.current,A,z);q.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${Ae[0]}px,${Ae[1]}px,0);transform-origin:0 0;`}return ge&&(i?ge.prepend(q):ge.appendChild(q)),()=>{ge&&ge.removeChild(q),Pe.unmount()}}},[ge,d]),W.useLayoutEffect(()=>{T&&(q.className=T)},[T]);const Oe=W.useMemo(()=>d?{position:"absolute",top:0,left:0,width:z.width,height:z.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...a&&{top:-z.height/2,left:-z.width/2,width:z.width,height:z.height},...t},[t,s,a,z,d]),Ne=W.useMemo(()=>({position:"absolute",pointerEvents:R}),[R]);W.useLayoutEffect(()=>{if(fe.current=!1,d){var Pe;(Pe=ie.current)==null||Pe.render(W.createElement("div",{ref:J,style:Oe},W.createElement("div",{ref:te,style:Ne},W.createElement("div",{ref:N,className:n,style:t,children:r}))))}else{var Ae;(Ae=ie.current)==null||Ae.render(W.createElement("div",{ref:N,style:Oe,className:n,children:r}))}});const Je=W.useRef(!0);Bi(Pe=>{if(le.current){A.updateMatrixWorld(),le.current.updateWorldMatrix(!0,!1);const Ae=d?Z.current:b(le.current,A,z);if(d||Math.abs(j.current-A.zoom)>e||Math.abs(Z.current[0]-Ae[0])>e||Math.abs(Z.current[1]-Ae[1])>e){const k=SR(le.current,A);let ve=!1;be&&(Array.isArray(f)?ve=f.map(Ve=>Ve.current):f!=="blending"&&(ve=[P]));const ue=Je.current;if(ve){const Ve=MR(le.current,A,ee,ve);Je.current=Ve&&!k}else Je.current=!k;ue!==Je.current&&(m?m(!Je.current):q.style.display=Je.current?"block":"none");const Ee=Math.floor(_[0]/2),pe=f?be?[_[0],Ee]:[Ee-1,0]:_;if(q.style.zIndex=`${bR(le.current,A,pe)}`,d){const[Ve,Le]=[z.width/2,z.height/2],D=A.projectionMatrix.elements[5]*Le,{isOrthographicCamera:I,top:Q,left:ye,bottom:xe,right:me}=A,Xe=wR(A.matrixWorldInverse),Re=I?`scale(${D})translate(${pp(-(me+ye)/2)}px,${pp((Q+xe)/2)}px)`:`translateZ(${D}px)`;let Ie=le.current.matrixWorld;h&&(Ie=A.matrixWorldInverse.clone().transpose().copyPosition(Ie).scale(le.current.scale),Ie.elements[3]=Ie.elements[7]=Ie.elements[11]=0,Ie.elements[15]=1),q.style.width=z.width+"px",q.style.height=z.height+"px",q.style.perspective=I?"":`${D}px`,J.current&&te.current&&(J.current.style.transform=`${Re}${Xe}translate(${Ve}px,${Le}px)`,te.current.style.transform=TR(Ie,1/((u||10)/400)))}else{const Ve=u===void 0?1:ER(le.current,A)*u;q.style.transform=`translate3d(${Ae[0]}px,${Ae[1]}px,0) scale(${Ve})`}Z.current=Ae,j.current=A.zoom}}if(!be&&K.current&&!fe.current)if(d){if(J.current){const Ae=J.current.children[0];if(Ae!=null&&Ae.clientWidth&&Ae!=null&&Ae.clientHeight){const{isOrthographicCamera:k}=A;if(k||y)C.scale&&(Array.isArray(C.scale)?C.scale instanceof U?K.current.scale.copy(C.scale.clone().divideScalar(1)):K.current.scale.set(1/C.scale[0],1/C.scale[1],1/C.scale[2]):K.current.scale.setScalar(1/C.scale));else{const ve=(u||10)/400,ue=Ae.clientWidth*ve,Ee=Ae.clientHeight*ve;K.current.scale.set(ue,Ee,1)}fe.current=!0}}}else{const Ae=q.children[0];if(Ae!=null&&Ae.clientWidth&&Ae!=null&&Ae.clientHeight){const k=1/H.factor,ve=Ae.clientWidth*k,ue=Ae.clientHeight*k;K.current.scale.set(ve,ue,1),fe.current=!0}K.current.lookAt(Pe.camera.position)}});const rt=W.useMemo(()=>({vertexShader:d?void 0:`
3722
3722
  /*
3723
3723
  This shader is from the THREE's SpriteMaterial.
3724
3724
  We need to turn the backing plane into a Sprite
@@ -3755,7 +3755,7 @@ No matching component was found for:
3755
3755
  void main() {
3756
3756
  gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
3757
3757
  }
3758
- `}),[d]);return W.createElement("group",Ei({},C,{ref:le}),f&&!be&&W.createElement("mesh",{castShadow:g,receiveShadow:x,ref:K},y||W.createElement("planeGeometry",null),S||W.createElement("shaderMaterial",{side:Si,vertexShader:rt.vertexShader,fragmentShader:rt.fragmentShader})))}),Py=parseInt(Zo.replace(/\D+/g,"")),Ly=Py>=125?"uv1":"uv2";var CR=Object.defineProperty,RR=(r,e,t)=>e in r?CR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,PR=(r,e,t)=>(RR(r,e+"",t),t);class LR{constructor(){PR(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}var IR=Object.defineProperty,NR=(r,e,t)=>e in r?IR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,it=(r,e,t)=>(NR(r,typeof e!="symbol"?e+"":e,t),t);const fu=new Vs,k_=new _r,DR=Math.cos(70*(Math.PI/180)),H_=(r,e)=>(r%e+e)%e;let UR=class extends LR{constructor(e,t){super(),it(this,"object"),it(this,"domElement"),it(this,"enabled",!0),it(this,"target",new U),it(this,"minDistance",0),it(this,"maxDistance",1/0),it(this,"minZoom",0),it(this,"maxZoom",1/0),it(this,"minPolarAngle",0),it(this,"maxPolarAngle",Math.PI),it(this,"minAzimuthAngle",-1/0),it(this,"maxAzimuthAngle",1/0),it(this,"enableDamping",!1),it(this,"dampingFactor",.05),it(this,"enableZoom",!0),it(this,"zoomSpeed",1),it(this,"enableRotate",!0),it(this,"rotateSpeed",1),it(this,"enablePan",!0),it(this,"panSpeed",1),it(this,"screenSpacePanning",!0),it(this,"keyPanSpeed",7),it(this,"zoomToCursor",!1),it(this,"autoRotate",!1),it(this,"autoRotateSpeed",2),it(this,"reverseOrbit",!1),it(this,"reverseHorizontalOrbit",!1),it(this,"reverseVerticalOrbit",!1),it(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),it(this,"mouseButtons",{LEFT:Ms.ROTATE,MIDDLE:Ms.DOLLY,RIGHT:Ms.PAN}),it(this,"touches",{ONE:Es.ROTATE,TWO:Es.DOLLY_PAN}),it(this,"target0"),it(this,"position0"),it(this,"zoom0"),it(this,"_domElementKeyEvents",null),it(this,"getPolarAngle"),it(this,"getAzimuthalAngle"),it(this,"setPolarAngle"),it(this,"setAzimuthalAngle"),it(this,"getDistance"),it(this,"getZoomScale"),it(this,"listenToKeyEvents"),it(this,"stopListenToKeyEvents"),it(this,"saveState"),it(this,"reset"),it(this,"update"),it(this,"connect"),it(this,"dispose"),it(this,"dollyIn"),it(this,"dollyOut"),it(this,"getScale"),it(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=V=>{let _e=H_(V,2*Math.PI),Be=d.phi;Be<0&&(Be+=2*Math.PI),_e<0&&(_e+=2*Math.PI);let Fe=Math.abs(_e-Be);2*Math.PI-Fe<Fe&&(_e<Be?_e+=2*Math.PI:Be+=2*Math.PI),f.phi=_e-Be,n.update()},this.setAzimuthalAngle=V=>{let _e=H_(V,2*Math.PI),Be=d.theta;Be<0&&(Be+=2*Math.PI),_e<0&&(_e+=2*Math.PI);let Fe=Math.abs(_e-Be);2*Math.PI-Fe<Fe&&(_e<Be?_e+=2*Math.PI:Be+=2*Math.PI),f.theta=_e-Be,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=V=>{V.addEventListener("keydown",et),this._domElementKeyEvents=V},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",et),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),u=c.NONE},this.update=(()=>{const V=new U,_e=new U(0,1,0),Be=new On().setFromUnitVectors(e.up,_e),Fe=Be.clone().invert(),Me=new U,G=new On,Te=2*Math.PI;return function(){const tt=n.object.position;Be.setFromUnitVectors(e.up,_e),Fe.copy(Be).invert(),V.copy(tt).sub(n.target),V.applyQuaternion(Be),d.setFromVector3(V),n.autoRotate&&u===c.NONE&&H(ee()),n.enableDamping?(d.theta+=f.theta*n.dampingFactor,d.phi+=f.phi*n.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let Ye=n.minAzimuthAngle,bt=n.maxAzimuthAngle;isFinite(Ye)&&isFinite(bt)&&(Ye<-Math.PI?Ye+=Te:Ye>Math.PI&&(Ye-=Te),bt<-Math.PI?bt+=Te:bt>Math.PI&&(bt-=Te),Ye<=bt?d.theta=Math.max(Ye,Math.min(bt,d.theta)):d.theta=d.theta>(Ye+bt)/2?Math.max(Ye,d.theta):Math.min(bt,d.theta)),d.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,d.phi)),d.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(g,n.dampingFactor):n.target.add(g),n.zoomToCursor&&A||n.object.isOrthographicCamera?d.radius=K(d.radius):d.radius=K(d.radius*m),V.setFromSpherical(d),V.applyQuaternion(Fe),tt.copy(n.target).add(V),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,g.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),g.set(0,0,0));let Tt=!1;if(n.zoomToCursor&&A){let Ot=null;if(n.object instanceof jt&&n.object.isPerspectiveCamera){const Ht=V.length();Ot=K(Ht*m);const Ct=Ht-Ot;n.object.position.addScaledVector(N,Ct),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const Ht=new U(B.x,B.y,0);Ht.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Tt=!0;const Ct=new U(B.x,B.y,0);Ct.unproject(n.object),n.object.position.sub(Ct).add(Ht),n.object.updateMatrixWorld(),Ot=V.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Ot!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Ot).add(n.object.position):(fu.origin.copy(n.object.position),fu.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(fu.direction))<DR?e.lookAt(n.target):(k_.setFromNormalAndCoplanarPoint(n.object.up,n.target),fu.intersectPlane(k_,n.target))))}else n.object instanceof er&&n.object.isOrthographicCamera&&(Tt=m!==1,Tt&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix()));return m=1,A=!1,Tt||Me.distanceToSquared(n.object.position)>h||8*(1-G.dot(n.object.quaternion))>h?(n.dispatchEvent(i),Me.copy(n.object.position),G.copy(n.object.quaternion),Tt=!1,!0):!1}})(),this.connect=V=>{n.domElement=V,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",wt),n.domElement.addEventListener("pointerdown",ye),n.domElement.addEventListener("pointercancel",me),n.domElement.addEventListener("wheel",Ie)},this.dispose=()=>{var V,_e,Be,Fe,Me,G;n.domElement&&(n.domElement.style.touchAction="auto"),(V=n.domElement)==null||V.removeEventListener("contextmenu",wt),(_e=n.domElement)==null||_e.removeEventListener("pointerdown",ye),(Be=n.domElement)==null||Be.removeEventListener("pointercancel",me),(Fe=n.domElement)==null||Fe.removeEventListener("wheel",Ie),(Me=n.domElement)==null||Me.ownerDocument.removeEventListener("pointermove",xe),(G=n.domElement)==null||G.ownerDocument.removeEventListener("pointerup",me),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",et)};const n=this,i={type:"change"},s={type:"start"},a={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=c.NONE;const h=1e-6,d=new hp,f=new hp;let m=1;const g=new U,x=new he,S=new he,y=new he,_=new he,b=new he,M=new he,T=new he,R=new he,C=new he,N=new U,B=new he;let A=!1;const P=[],z={};function ee(){return 2*Math.PI/60/60*n.autoRotateSpeed}function de(){return Math.pow(.95,n.zoomSpeed)}function H(V){n.reverseOrbit||n.reverseHorizontalOrbit?f.theta+=V:f.theta-=V}function q(V){n.reverseOrbit||n.reverseVerticalOrbit?f.phi+=V:f.phi-=V}const ie=(()=>{const V=new U;return function(Be,Fe){V.setFromMatrixColumn(Fe,0),V.multiplyScalar(-Be),g.add(V)}})(),le=(()=>{const V=new U;return function(Be,Fe){n.screenSpacePanning===!0?V.setFromMatrixColumn(Fe,1):(V.setFromMatrixColumn(Fe,0),V.crossVectors(n.object.up,V)),V.multiplyScalar(Be),g.add(V)}})(),j=(()=>{const V=new U;return function(Be,Fe){const Me=n.domElement;if(Me&&n.object instanceof jt&&n.object.isPerspectiveCamera){const G=n.object.position;V.copy(G).sub(n.target);let Te=V.length();Te*=Math.tan(n.object.fov/2*Math.PI/180),ie(2*Be*Te/Me.clientHeight,n.object.matrix),le(2*Fe*Te/Me.clientHeight,n.object.matrix)}else Me&&n.object instanceof er&&n.object.isOrthographicCamera?(ie(Be*(n.object.right-n.object.left)/n.object.zoom/Me.clientWidth,n.object.matrix),le(Fe*(n.object.top-n.object.bottom)/n.object.zoom/Me.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function Z(V){n.object instanceof jt&&n.object.isPerspectiveCamera||n.object instanceof er&&n.object.isOrthographicCamera?m=V:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function J(V){Z(m/V)}function te(V){Z(m*V)}function ge(V){if(!n.zoomToCursor||!n.domElement)return;A=!0;const _e=n.domElement.getBoundingClientRect(),Be=V.clientX-_e.left,Fe=V.clientY-_e.top,Me=_e.width,G=_e.height;B.x=Be/Me*2-1,B.y=-(Fe/G)*2+1,N.set(B.x,B.y,1).unproject(n.object).sub(n.object.position).normalize()}function K(V){return Math.max(n.minDistance,Math.min(n.maxDistance,V))}function fe(V){x.set(V.clientX,V.clientY)}function be(V){ge(V),T.set(V.clientX,V.clientY)}function Oe(V){_.set(V.clientX,V.clientY)}function Ne(V){S.set(V.clientX,V.clientY),y.subVectors(S,x).multiplyScalar(n.rotateSpeed);const _e=n.domElement;_e&&(H(2*Math.PI*y.x/_e.clientHeight),q(2*Math.PI*y.y/_e.clientHeight)),x.copy(S),n.update()}function Je(V){R.set(V.clientX,V.clientY),C.subVectors(R,T),C.y>0?J(de()):C.y<0&&te(de()),T.copy(R),n.update()}function rt(V){b.set(V.clientX,V.clientY),M.subVectors(b,_).multiplyScalar(n.panSpeed),j(M.x,M.y),_.copy(b),n.update()}function Pe(V){ge(V),V.deltaY<0?te(de()):V.deltaY>0&&J(de()),n.update()}function Ae(V){let _e=!1;switch(V.code){case n.keys.UP:j(0,n.keyPanSpeed),_e=!0;break;case n.keys.BOTTOM:j(0,-n.keyPanSpeed),_e=!0;break;case n.keys.LEFT:j(n.keyPanSpeed,0),_e=!0;break;case n.keys.RIGHT:j(-n.keyPanSpeed,0),_e=!0;break}_e&&(V.preventDefault(),n.update())}function k(){if(P.length==1)x.set(P[0].pageX,P[0].pageY);else{const V=.5*(P[0].pageX+P[1].pageX),_e=.5*(P[0].pageY+P[1].pageY);x.set(V,_e)}}function ve(){if(P.length==1)_.set(P[0].pageX,P[0].pageY);else{const V=.5*(P[0].pageX+P[1].pageX),_e=.5*(P[0].pageY+P[1].pageY);_.set(V,_e)}}function ue(){const V=P[0].pageX-P[1].pageX,_e=P[0].pageY-P[1].pageY,Be=Math.sqrt(V*V+_e*_e);T.set(0,Be)}function Ee(){n.enableZoom&&ue(),n.enablePan&&ve()}function pe(){n.enableZoom&&ue(),n.enableRotate&&k()}function Ve(V){if(P.length==1)S.set(V.pageX,V.pageY);else{const Be=Ge(V),Fe=.5*(V.pageX+Be.x),Me=.5*(V.pageY+Be.y);S.set(Fe,Me)}y.subVectors(S,x).multiplyScalar(n.rotateSpeed);const _e=n.domElement;_e&&(H(2*Math.PI*y.x/_e.clientHeight),q(2*Math.PI*y.y/_e.clientHeight)),x.copy(S)}function Le(V){if(P.length==1)b.set(V.pageX,V.pageY);else{const _e=Ge(V),Be=.5*(V.pageX+_e.x),Fe=.5*(V.pageY+_e.y);b.set(Be,Fe)}M.subVectors(b,_).multiplyScalar(n.panSpeed),j(M.x,M.y),_.copy(b)}function D(V){const _e=Ge(V),Be=V.pageX-_e.x,Fe=V.pageY-_e.y,Me=Math.sqrt(Be*Be+Fe*Fe);R.set(0,Me),C.set(0,Math.pow(R.y/T.y,n.zoomSpeed)),J(C.y),T.copy(R)}function I(V){n.enableZoom&&D(V),n.enablePan&&Le(V)}function Q(V){n.enableZoom&&D(V),n.enableRotate&&Ve(V)}function ye(V){var _e,Be;n.enabled!==!1&&(P.length===0&&((_e=n.domElement)==null||_e.ownerDocument.addEventListener("pointermove",xe),(Be=n.domElement)==null||Be.ownerDocument.addEventListener("pointerup",me)),gt(V),V.pointerType==="touch"?ht(V):Xe(V))}function xe(V){n.enabled!==!1&&(V.pointerType==="touch"?Se(V):Re(V))}function me(V){var _e,Be,Fe;ct(V),P.length===0&&((_e=n.domElement)==null||_e.releasePointerCapture(V.pointerId),(Be=n.domElement)==null||Be.ownerDocument.removeEventListener("pointermove",xe),(Fe=n.domElement)==null||Fe.ownerDocument.removeEventListener("pointerup",me)),n.dispatchEvent(a),u=c.NONE}function Xe(V){let _e;switch(V.button){case 0:_e=n.mouseButtons.LEFT;break;case 1:_e=n.mouseButtons.MIDDLE;break;case 2:_e=n.mouseButtons.RIGHT;break;default:_e=-1}switch(_e){case Ms.DOLLY:if(n.enableZoom===!1)return;be(V),u=c.DOLLY;break;case Ms.ROTATE:if(V.ctrlKey||V.metaKey||V.shiftKey){if(n.enablePan===!1)return;Oe(V),u=c.PAN}else{if(n.enableRotate===!1)return;fe(V),u=c.ROTATE}break;case Ms.PAN:if(V.ctrlKey||V.metaKey||V.shiftKey){if(n.enableRotate===!1)return;fe(V),u=c.ROTATE}else{if(n.enablePan===!1)return;Oe(V),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function Re(V){if(n.enabled!==!1)switch(u){case c.ROTATE:if(n.enableRotate===!1)return;Ne(V);break;case c.DOLLY:if(n.enableZoom===!1)return;Je(V);break;case c.PAN:if(n.enablePan===!1)return;rt(V);break}}function Ie(V){n.enabled===!1||n.enableZoom===!1||u!==c.NONE&&u!==c.ROTATE||(V.preventDefault(),n.dispatchEvent(s),Pe(V),n.dispatchEvent(a))}function et(V){n.enabled===!1||n.enablePan===!1||Ae(V)}function ht(V){switch($e(V),P.length){case 1:switch(n.touches.ONE){case Es.ROTATE:if(n.enableRotate===!1)return;k(),u=c.TOUCH_ROTATE;break;case Es.PAN:if(n.enablePan===!1)return;ve(),u=c.TOUCH_PAN;break;default:u=c.NONE}break;case 2:switch(n.touches.TWO){case Es.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ee(),u=c.TOUCH_DOLLY_PAN;break;case Es.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;pe(),u=c.TOUCH_DOLLY_ROTATE;break;default:u=c.NONE}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function Se(V){switch($e(V),u){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ve(V),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;Le(V),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;I(V),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Q(V),n.update();break;default:u=c.NONE}}function wt(V){n.enabled!==!1&&V.preventDefault()}function gt(V){P.push(V)}function ct(V){delete z[V.pointerId];for(let _e=0;_e<P.length;_e++)if(P[_e].pointerId==V.pointerId){P.splice(_e,1);return}}function $e(V){let _e=z[V.pointerId];_e===void 0&&(_e=new he,z[V.pointerId]=_e),_e.set(V.pageX,V.pageY)}function Ge(V){const _e=V.pointerId===P[0].pointerId?P[1]:P[0];return z[_e.pointerId]}this.dollyIn=(V=de())=>{te(V),n.update()},this.dollyOut=(V=de())=>{J(V),n.update()},this.getScale=()=>m,this.setScale=V=>{Z(V),n.update()},this.getZoomScale=()=>de(),t!==void 0&&this.connect(t),this.update()}};const V_=new vn,pu=new U;class um extends em{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new qe(e,3)),this.setAttribute("uv",new qe(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new Du(t,6,1);return this.setAttribute("instanceStart",new ai(n,3,0)),this.setAttribute("instanceEnd",new ai(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new Du(n,t*2,1);return this.setAttribute("instanceColorStart",new ai(i,t,0)),this.setAttribute("instanceColorEnd",new ai(i,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new qp(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new vn);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),V_.setFromBufferAttribute(t),this.boundingBox.union(V_))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new xn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)pu.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(pu)),pu.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(pu));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class Iy extends um{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e,t=3){const n=e.length-t,i=new Float32Array(2*n);if(t===3)for(let s=0;s<n;s+=t)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5];else for(let s=0;s<n;s+=t)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5],i[2*s+6]=e[s+6],i[2*s+7]=e[s+7];return super.setColors(i,t),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class hm extends Oi{constructor(e){super({type:"LineMaterial",uniforms:Iu.clone(Iu.merge([Ce.common,Ce.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new he(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
3758
+ `}),[d]);return W.createElement("group",Ei({},C,{ref:le}),f&&!be&&W.createElement("mesh",{castShadow:g,receiveShadow:x,ref:K},y||W.createElement("planeGeometry",null),S||W.createElement("shaderMaterial",{side:Si,vertexShader:rt.vertexShader,fragmentShader:rt.fragmentShader})))}),Py=parseInt(Zo.replace(/\D+/g,"")),Ly=Py>=125?"uv1":"uv2";var CR=Object.defineProperty,RR=(r,e,t)=>e in r?CR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,PR=(r,e,t)=>(RR(r,e+"",t),t);class LR{constructor(){PR(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}var IR=Object.defineProperty,NR=(r,e,t)=>e in r?IR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,it=(r,e,t)=>(NR(r,typeof e!="symbol"?e+"":e,t),t);const fu=new Vs,B_=new _r,DR=Math.cos(70*(Math.PI/180)),k_=(r,e)=>(r%e+e)%e;let UR=class extends LR{constructor(e,t){super(),it(this,"object"),it(this,"domElement"),it(this,"enabled",!0),it(this,"target",new U),it(this,"minDistance",0),it(this,"maxDistance",1/0),it(this,"minZoom",0),it(this,"maxZoom",1/0),it(this,"minPolarAngle",0),it(this,"maxPolarAngle",Math.PI),it(this,"minAzimuthAngle",-1/0),it(this,"maxAzimuthAngle",1/0),it(this,"enableDamping",!1),it(this,"dampingFactor",.05),it(this,"enableZoom",!0),it(this,"zoomSpeed",1),it(this,"enableRotate",!0),it(this,"rotateSpeed",1),it(this,"enablePan",!0),it(this,"panSpeed",1),it(this,"screenSpacePanning",!0),it(this,"keyPanSpeed",7),it(this,"zoomToCursor",!1),it(this,"autoRotate",!1),it(this,"autoRotateSpeed",2),it(this,"reverseOrbit",!1),it(this,"reverseHorizontalOrbit",!1),it(this,"reverseVerticalOrbit",!1),it(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),it(this,"mouseButtons",{LEFT:Ms.ROTATE,MIDDLE:Ms.DOLLY,RIGHT:Ms.PAN}),it(this,"touches",{ONE:Es.ROTATE,TWO:Es.DOLLY_PAN}),it(this,"target0"),it(this,"position0"),it(this,"zoom0"),it(this,"_domElementKeyEvents",null),it(this,"getPolarAngle"),it(this,"getAzimuthalAngle"),it(this,"setPolarAngle"),it(this,"setAzimuthalAngle"),it(this,"getDistance"),it(this,"getZoomScale"),it(this,"listenToKeyEvents"),it(this,"stopListenToKeyEvents"),it(this,"saveState"),it(this,"reset"),it(this,"update"),it(this,"connect"),it(this,"dispose"),it(this,"dollyIn"),it(this,"dollyOut"),it(this,"getScale"),it(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=V=>{let _e=k_(V,2*Math.PI),Be=d.phi;Be<0&&(Be+=2*Math.PI),_e<0&&(_e+=2*Math.PI);let Fe=Math.abs(_e-Be);2*Math.PI-Fe<Fe&&(_e<Be?_e+=2*Math.PI:Be+=2*Math.PI),f.phi=_e-Be,n.update()},this.setAzimuthalAngle=V=>{let _e=k_(V,2*Math.PI),Be=d.theta;Be<0&&(Be+=2*Math.PI),_e<0&&(_e+=2*Math.PI);let Fe=Math.abs(_e-Be);2*Math.PI-Fe<Fe&&(_e<Be?_e+=2*Math.PI:Be+=2*Math.PI),f.theta=_e-Be,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=V=>{V.addEventListener("keydown",et),this._domElementKeyEvents=V},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",et),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),u=c.NONE},this.update=(()=>{const V=new U,_e=new U(0,1,0),Be=new On().setFromUnitVectors(e.up,_e),Fe=Be.clone().invert(),Me=new U,G=new On,Te=2*Math.PI;return function(){const tt=n.object.position;Be.setFromUnitVectors(e.up,_e),Fe.copy(Be).invert(),V.copy(tt).sub(n.target),V.applyQuaternion(Be),d.setFromVector3(V),n.autoRotate&&u===c.NONE&&H(ee()),n.enableDamping?(d.theta+=f.theta*n.dampingFactor,d.phi+=f.phi*n.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let Ye=n.minAzimuthAngle,bt=n.maxAzimuthAngle;isFinite(Ye)&&isFinite(bt)&&(Ye<-Math.PI?Ye+=Te:Ye>Math.PI&&(Ye-=Te),bt<-Math.PI?bt+=Te:bt>Math.PI&&(bt-=Te),Ye<=bt?d.theta=Math.max(Ye,Math.min(bt,d.theta)):d.theta=d.theta>(Ye+bt)/2?Math.max(Ye,d.theta):Math.min(bt,d.theta)),d.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,d.phi)),d.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(g,n.dampingFactor):n.target.add(g),n.zoomToCursor&&A||n.object.isOrthographicCamera?d.radius=K(d.radius):d.radius=K(d.radius*m),V.setFromSpherical(d),V.applyQuaternion(Fe),tt.copy(n.target).add(V),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,g.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),g.set(0,0,0));let Tt=!1;if(n.zoomToCursor&&A){let Ot=null;if(n.object instanceof jt&&n.object.isPerspectiveCamera){const Ht=V.length();Ot=K(Ht*m);const Ct=Ht-Ot;n.object.position.addScaledVector(N,Ct),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const Ht=new U(B.x,B.y,0);Ht.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Tt=!0;const Ct=new U(B.x,B.y,0);Ct.unproject(n.object),n.object.position.sub(Ct).add(Ht),n.object.updateMatrixWorld(),Ot=V.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Ot!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Ot).add(n.object.position):(fu.origin.copy(n.object.position),fu.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(fu.direction))<DR?e.lookAt(n.target):(B_.setFromNormalAndCoplanarPoint(n.object.up,n.target),fu.intersectPlane(B_,n.target))))}else n.object instanceof er&&n.object.isOrthographicCamera&&(Tt=m!==1,Tt&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix()));return m=1,A=!1,Tt||Me.distanceToSquared(n.object.position)>h||8*(1-G.dot(n.object.quaternion))>h?(n.dispatchEvent(i),Me.copy(n.object.position),G.copy(n.object.quaternion),Tt=!1,!0):!1}})(),this.connect=V=>{n.domElement=V,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",wt),n.domElement.addEventListener("pointerdown",ye),n.domElement.addEventListener("pointercancel",me),n.domElement.addEventListener("wheel",Ie)},this.dispose=()=>{var V,_e,Be,Fe,Me,G;n.domElement&&(n.domElement.style.touchAction="auto"),(V=n.domElement)==null||V.removeEventListener("contextmenu",wt),(_e=n.domElement)==null||_e.removeEventListener("pointerdown",ye),(Be=n.domElement)==null||Be.removeEventListener("pointercancel",me),(Fe=n.domElement)==null||Fe.removeEventListener("wheel",Ie),(Me=n.domElement)==null||Me.ownerDocument.removeEventListener("pointermove",xe),(G=n.domElement)==null||G.ownerDocument.removeEventListener("pointerup",me),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",et)};const n=this,i={type:"change"},s={type:"start"},a={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=c.NONE;const h=1e-6,d=new up,f=new up;let m=1;const g=new U,x=new he,S=new he,y=new he,_=new he,b=new he,M=new he,T=new he,R=new he,C=new he,N=new U,B=new he;let A=!1;const P=[],z={};function ee(){return 2*Math.PI/60/60*n.autoRotateSpeed}function de(){return Math.pow(.95,n.zoomSpeed)}function H(V){n.reverseOrbit||n.reverseHorizontalOrbit?f.theta+=V:f.theta-=V}function q(V){n.reverseOrbit||n.reverseVerticalOrbit?f.phi+=V:f.phi-=V}const ie=(()=>{const V=new U;return function(Be,Fe){V.setFromMatrixColumn(Fe,0),V.multiplyScalar(-Be),g.add(V)}})(),le=(()=>{const V=new U;return function(Be,Fe){n.screenSpacePanning===!0?V.setFromMatrixColumn(Fe,1):(V.setFromMatrixColumn(Fe,0),V.crossVectors(n.object.up,V)),V.multiplyScalar(Be),g.add(V)}})(),j=(()=>{const V=new U;return function(Be,Fe){const Me=n.domElement;if(Me&&n.object instanceof jt&&n.object.isPerspectiveCamera){const G=n.object.position;V.copy(G).sub(n.target);let Te=V.length();Te*=Math.tan(n.object.fov/2*Math.PI/180),ie(2*Be*Te/Me.clientHeight,n.object.matrix),le(2*Fe*Te/Me.clientHeight,n.object.matrix)}else Me&&n.object instanceof er&&n.object.isOrthographicCamera?(ie(Be*(n.object.right-n.object.left)/n.object.zoom/Me.clientWidth,n.object.matrix),le(Fe*(n.object.top-n.object.bottom)/n.object.zoom/Me.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function Z(V){n.object instanceof jt&&n.object.isPerspectiveCamera||n.object instanceof er&&n.object.isOrthographicCamera?m=V:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function J(V){Z(m/V)}function te(V){Z(m*V)}function ge(V){if(!n.zoomToCursor||!n.domElement)return;A=!0;const _e=n.domElement.getBoundingClientRect(),Be=V.clientX-_e.left,Fe=V.clientY-_e.top,Me=_e.width,G=_e.height;B.x=Be/Me*2-1,B.y=-(Fe/G)*2+1,N.set(B.x,B.y,1).unproject(n.object).sub(n.object.position).normalize()}function K(V){return Math.max(n.minDistance,Math.min(n.maxDistance,V))}function fe(V){x.set(V.clientX,V.clientY)}function be(V){ge(V),T.set(V.clientX,V.clientY)}function Oe(V){_.set(V.clientX,V.clientY)}function Ne(V){S.set(V.clientX,V.clientY),y.subVectors(S,x).multiplyScalar(n.rotateSpeed);const _e=n.domElement;_e&&(H(2*Math.PI*y.x/_e.clientHeight),q(2*Math.PI*y.y/_e.clientHeight)),x.copy(S),n.update()}function Je(V){R.set(V.clientX,V.clientY),C.subVectors(R,T),C.y>0?J(de()):C.y<0&&te(de()),T.copy(R),n.update()}function rt(V){b.set(V.clientX,V.clientY),M.subVectors(b,_).multiplyScalar(n.panSpeed),j(M.x,M.y),_.copy(b),n.update()}function Pe(V){ge(V),V.deltaY<0?te(de()):V.deltaY>0&&J(de()),n.update()}function Ae(V){let _e=!1;switch(V.code){case n.keys.UP:j(0,n.keyPanSpeed),_e=!0;break;case n.keys.BOTTOM:j(0,-n.keyPanSpeed),_e=!0;break;case n.keys.LEFT:j(n.keyPanSpeed,0),_e=!0;break;case n.keys.RIGHT:j(-n.keyPanSpeed,0),_e=!0;break}_e&&(V.preventDefault(),n.update())}function k(){if(P.length==1)x.set(P[0].pageX,P[0].pageY);else{const V=.5*(P[0].pageX+P[1].pageX),_e=.5*(P[0].pageY+P[1].pageY);x.set(V,_e)}}function ve(){if(P.length==1)_.set(P[0].pageX,P[0].pageY);else{const V=.5*(P[0].pageX+P[1].pageX),_e=.5*(P[0].pageY+P[1].pageY);_.set(V,_e)}}function ue(){const V=P[0].pageX-P[1].pageX,_e=P[0].pageY-P[1].pageY,Be=Math.sqrt(V*V+_e*_e);T.set(0,Be)}function Ee(){n.enableZoom&&ue(),n.enablePan&&ve()}function pe(){n.enableZoom&&ue(),n.enableRotate&&k()}function Ve(V){if(P.length==1)S.set(V.pageX,V.pageY);else{const Be=Ge(V),Fe=.5*(V.pageX+Be.x),Me=.5*(V.pageY+Be.y);S.set(Fe,Me)}y.subVectors(S,x).multiplyScalar(n.rotateSpeed);const _e=n.domElement;_e&&(H(2*Math.PI*y.x/_e.clientHeight),q(2*Math.PI*y.y/_e.clientHeight)),x.copy(S)}function Le(V){if(P.length==1)b.set(V.pageX,V.pageY);else{const _e=Ge(V),Be=.5*(V.pageX+_e.x),Fe=.5*(V.pageY+_e.y);b.set(Be,Fe)}M.subVectors(b,_).multiplyScalar(n.panSpeed),j(M.x,M.y),_.copy(b)}function D(V){const _e=Ge(V),Be=V.pageX-_e.x,Fe=V.pageY-_e.y,Me=Math.sqrt(Be*Be+Fe*Fe);R.set(0,Me),C.set(0,Math.pow(R.y/T.y,n.zoomSpeed)),J(C.y),T.copy(R)}function I(V){n.enableZoom&&D(V),n.enablePan&&Le(V)}function Q(V){n.enableZoom&&D(V),n.enableRotate&&Ve(V)}function ye(V){var _e,Be;n.enabled!==!1&&(P.length===0&&((_e=n.domElement)==null||_e.ownerDocument.addEventListener("pointermove",xe),(Be=n.domElement)==null||Be.ownerDocument.addEventListener("pointerup",me)),gt(V),V.pointerType==="touch"?ht(V):Xe(V))}function xe(V){n.enabled!==!1&&(V.pointerType==="touch"?Se(V):Re(V))}function me(V){var _e,Be,Fe;ct(V),P.length===0&&((_e=n.domElement)==null||_e.releasePointerCapture(V.pointerId),(Be=n.domElement)==null||Be.ownerDocument.removeEventListener("pointermove",xe),(Fe=n.domElement)==null||Fe.ownerDocument.removeEventListener("pointerup",me)),n.dispatchEvent(a),u=c.NONE}function Xe(V){let _e;switch(V.button){case 0:_e=n.mouseButtons.LEFT;break;case 1:_e=n.mouseButtons.MIDDLE;break;case 2:_e=n.mouseButtons.RIGHT;break;default:_e=-1}switch(_e){case Ms.DOLLY:if(n.enableZoom===!1)return;be(V),u=c.DOLLY;break;case Ms.ROTATE:if(V.ctrlKey||V.metaKey||V.shiftKey){if(n.enablePan===!1)return;Oe(V),u=c.PAN}else{if(n.enableRotate===!1)return;fe(V),u=c.ROTATE}break;case Ms.PAN:if(V.ctrlKey||V.metaKey||V.shiftKey){if(n.enableRotate===!1)return;fe(V),u=c.ROTATE}else{if(n.enablePan===!1)return;Oe(V),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function Re(V){if(n.enabled!==!1)switch(u){case c.ROTATE:if(n.enableRotate===!1)return;Ne(V);break;case c.DOLLY:if(n.enableZoom===!1)return;Je(V);break;case c.PAN:if(n.enablePan===!1)return;rt(V);break}}function Ie(V){n.enabled===!1||n.enableZoom===!1||u!==c.NONE&&u!==c.ROTATE||(V.preventDefault(),n.dispatchEvent(s),Pe(V),n.dispatchEvent(a))}function et(V){n.enabled===!1||n.enablePan===!1||Ae(V)}function ht(V){switch($e(V),P.length){case 1:switch(n.touches.ONE){case Es.ROTATE:if(n.enableRotate===!1)return;k(),u=c.TOUCH_ROTATE;break;case Es.PAN:if(n.enablePan===!1)return;ve(),u=c.TOUCH_PAN;break;default:u=c.NONE}break;case 2:switch(n.touches.TWO){case Es.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ee(),u=c.TOUCH_DOLLY_PAN;break;case Es.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;pe(),u=c.TOUCH_DOLLY_ROTATE;break;default:u=c.NONE}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function Se(V){switch($e(V),u){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ve(V),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;Le(V),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;I(V),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Q(V),n.update();break;default:u=c.NONE}}function wt(V){n.enabled!==!1&&V.preventDefault()}function gt(V){P.push(V)}function ct(V){delete z[V.pointerId];for(let _e=0;_e<P.length;_e++)if(P[_e].pointerId==V.pointerId){P.splice(_e,1);return}}function $e(V){let _e=z[V.pointerId];_e===void 0&&(_e=new he,z[V.pointerId]=_e),_e.set(V.pageX,V.pageY)}function Ge(V){const _e=V.pointerId===P[0].pointerId?P[1]:P[0];return z[_e.pointerId]}this.dollyIn=(V=de())=>{te(V),n.update()},this.dollyOut=(V=de())=>{J(V),n.update()},this.getScale=()=>m,this.setScale=V=>{Z(V),n.update()},this.getZoomScale=()=>de(),t!==void 0&&this.connect(t),this.update()}};const H_=new vn,pu=new U;class cm extends $p{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new qe(e,3)),this.setAttribute("uv",new qe(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new Du(t,6,1);return this.setAttribute("instanceStart",new ai(n,3,0)),this.setAttribute("instanceEnd",new ai(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new Du(n,t*2,1);return this.setAttribute("instanceColorStart",new ai(i,t,0)),this.setAttribute("instanceColorEnd",new ai(i,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Xp(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new vn);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),H_.setFromBufferAttribute(t),this.boundingBox.union(H_))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new xn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)pu.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(pu)),pu.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(pu));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class Iy extends cm{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e,t=3){const n=e.length-t,i=new Float32Array(2*n);if(t===3)for(let s=0;s<n;s+=t)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5];else for(let s=0;s<n;s+=t)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5],i[2*s+6]=e[s+6],i[2*s+7]=e[s+7];return super.setColors(i,t),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class um extends Oi{constructor(e){super({type:"LineMaterial",uniforms:Iu.clone(Iu.merge([Ce.common,Ce.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new he(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
3759
3759
  #include <common>
3760
3760
  #include <fog_pars_vertex>
3761
3761
  #include <logdepthbuf_pars_vertex>
@@ -4163,7 +4163,7 @@ No matching component was found for:
4163
4163
  #include <premultiplied_alpha_fragment>
4164
4164
 
4165
4165
  }
4166
- `,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const df=new At,G_=new U,W_=new U,bn=new At,wn=new At,Zi=new At,ff=new U,pf=new lt,Tn=new ay,j_=new U,mu=new vn,gu=new xn,Ji=new At;let Ki,Bs;function X_(r,e,t){return Ji.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),Ji.multiplyScalar(1/Ji.w),Ji.x=Bs/t.width,Ji.y=Bs/t.height,Ji.applyMatrix4(r.projectionMatrixInverse),Ji.multiplyScalar(1/Ji.w),Math.abs(Math.max(Ji.x,Ji.y))}function OR(r,e){const t=r.matrixWorld,n=r.geometry,i=n.attributes.instanceStart,s=n.attributes.instanceEnd,a=Math.min(n.instanceCount,i.count);for(let c=0,u=a;c<u;c++){Tn.start.fromBufferAttribute(i,c),Tn.end.fromBufferAttribute(s,c),Tn.applyMatrix4(t);const h=new U,d=new U;Ki.distanceSqToSegment(Tn.start,Tn.end,d,h),d.distanceTo(h)<Bs*.5&&e.push({point:d,pointOnLine:h,distance:Ki.origin.distanceTo(d),object:r,face:null,faceIndex:c,uv:null,[Ly]:null})}}function FR(r,e,t){const n=e.projectionMatrix,s=r.material.resolution,a=r.matrixWorld,c=r.geometry,u=c.attributes.instanceStart,h=c.attributes.instanceEnd,d=Math.min(c.instanceCount,u.count),f=-e.near;Ki.at(1,Zi),Zi.w=1,Zi.applyMatrix4(e.matrixWorldInverse),Zi.applyMatrix4(n),Zi.multiplyScalar(1/Zi.w),Zi.x*=s.x/2,Zi.y*=s.y/2,Zi.z=0,ff.copy(Zi),pf.multiplyMatrices(e.matrixWorldInverse,a);for(let m=0,g=d;m<g;m++){if(bn.fromBufferAttribute(u,m),wn.fromBufferAttribute(h,m),bn.w=1,wn.w=1,bn.applyMatrix4(pf),wn.applyMatrix4(pf),bn.z>f&&wn.z>f)continue;if(bn.z>f){const M=bn.z-wn.z,T=(bn.z-f)/M;bn.lerp(wn,T)}else if(wn.z>f){const M=wn.z-bn.z,T=(wn.z-f)/M;wn.lerp(bn,T)}bn.applyMatrix4(n),wn.applyMatrix4(n),bn.multiplyScalar(1/bn.w),wn.multiplyScalar(1/wn.w),bn.x*=s.x/2,bn.y*=s.y/2,wn.x*=s.x/2,wn.y*=s.y/2,Tn.start.copy(bn),Tn.start.z=0,Tn.end.copy(wn),Tn.end.z=0;const S=Tn.closestPointToPointParameter(ff,!0);Tn.at(S,j_);const y=ex.lerp(bn.z,wn.z,S),_=y>=-1&&y<=1,b=ff.distanceTo(j_)<Bs*.5;if(_&&b){Tn.start.fromBufferAttribute(u,m),Tn.end.fromBufferAttribute(h,m),Tn.start.applyMatrix4(a),Tn.end.applyMatrix4(a);const M=new U,T=new U;Ki.distanceSqToSegment(Tn.start,Tn.end,T,M),t.push({point:T,pointOnLine:M,distance:Ki.origin.distanceTo(T),object:r,face:null,faceIndex:m,uv:null,[Ly]:null})}}}class Ny extends an{constructor(e=new um,t=new hm({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let a=0,c=0,u=t.count;a<u;a++,c+=2)G_.fromBufferAttribute(t,a),W_.fromBufferAttribute(n,a),i[c]=c===0?0:i[c-1],i[c+1]=i[c]+G_.distanceTo(W_);const s=new Du(i,2,1);return e.setAttribute("instanceDistanceStart",new ai(s,1,0)),e.setAttribute("instanceDistanceEnd",new ai(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera;i===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Ki=e.ray;const a=this.matrixWorld,c=this.geometry,u=this.material;Bs=u.linewidth+s,c.boundingSphere===null&&c.computeBoundingSphere(),gu.copy(c.boundingSphere).applyMatrix4(a);let h;if(n)h=Bs*.5;else{const f=Math.max(i.near,gu.distanceToPoint(Ki.origin));h=X_(i,f,u.resolution)}if(gu.radius+=h,Ki.intersectsSphere(gu)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),mu.copy(c.boundingBox).applyMatrix4(a);let d;if(n)d=Bs*.5;else{const f=Math.max(i.near,mu.distanceToPoint(Ki.origin));d=X_(i,f,u.resolution)}mu.expandByScalar(d),Ki.intersectsBox(mu)!==!1&&(n?OR(this,t):FR(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(df),this.material.uniforms.resolution.value.set(df.z,df.w))}}class zR extends Ny{constructor(e=new Iy,t=new hm({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Tu=W.forwardRef(function({points:e,color:t=16777215,vertexColors:n,linewidth:i,lineWidth:s,segments:a,dashed:c,...u},h){var d,f;const m=Pi(_=>_.size),g=W.useMemo(()=>a?new Ny:new zR,[a]),[x]=W.useState(()=>new hm),S=(n==null||(d=n[0])==null?void 0:d.length)===4?4:3,y=W.useMemo(()=>{const _=a?new um:new Iy,b=e.map(M=>{const T=Array.isArray(M);return M instanceof U||M instanceof At?[M.x,M.y,M.z]:M instanceof he?[M.x,M.y,0]:T&&M.length===3?[M[0],M[1],M[2]]:T&&M.length===2?[M[0],M[1],0]:M});if(_.setPositions(b.flat()),n){t=16777215;const M=n.map(T=>T instanceof ke?T.toArray():T);_.setColors(M.flat(),S)}return _},[e,a,n,S]);return W.useLayoutEffect(()=>{g.computeLineDistances()},[e,g]),W.useLayoutEffect(()=>{c?x.defines.USE_DASH="":delete x.defines.USE_DASH,x.needsUpdate=!0},[c,x]),W.useEffect(()=>()=>{y.dispose(),x.dispose()},[y]),W.createElement("primitive",Ei({object:g,ref:h},u),W.createElement("primitive",{object:y,attach:"geometry"}),W.createElement("primitive",Ei({object:x,attach:"material",color:t,vertexColors:!!n,resolution:[m.width,m.height],linewidth:(f=i??s)!==null&&f!==void 0?f:1,dashed:c,transparent:S===4},u)))}),BR=()=>parseInt(Zo.replace(/\D+/g,"")),Dy=BR(),kR=W.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:s=!1,onChange:a,onStart:c,onEnd:u,...h},d)=>{const f=Pi(C=>C.invalidate),m=Pi(C=>C.camera),g=Pi(C=>C.gl),x=Pi(C=>C.events),S=Pi(C=>C.setEvents),y=Pi(C=>C.set),_=Pi(C=>C.get),b=Pi(C=>C.performance),M=e||m,T=n||x.connected||g.domElement,R=W.useMemo(()=>new UR(M),[M]);return Bi(()=>{R.enabled&&R.update()},-1),W.useEffect(()=>(s&&R.connect(s===!0?T:s),R.connect(T),()=>void R.dispose()),[s,T,t,R,f]),W.useEffect(()=>{const C=A=>{f(),t&&b.regress(),a&&a(A)},N=A=>{c&&c(A)},B=A=>{u&&u(A)};return R.addEventListener("change",C),R.addEventListener("start",N),R.addEventListener("end",B),()=>{R.removeEventListener("start",N),R.removeEventListener("end",B),R.removeEventListener("change",C)}},[a,c,u,R,f,S]),W.useEffect(()=>{if(r){const C=_().controls;return y({controls:R}),()=>y({controls:C})}},[r,R]),W.createElement("primitive",Ei({ref:d,object:R,enableDamping:i},h))}),mf=Dy>=154?"opaque_fragment":"output_fragment";class HR extends Yu{constructor(e){super(e),this.onBeforeCompile=(t,n)=>{const{isWebGL2:i}=n.capabilities;t.fragmentShader=t.fragmentShader.replace(`#include <${mf}>`,`
4166
+ `,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(t){!!t!="USE_DASH"in this.defines&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(t){!!t!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const df=new At,V_=new U,G_=new U,bn=new At,wn=new At,Zi=new At,ff=new U,pf=new lt,Tn=new ay,W_=new U,mu=new vn,gu=new xn,Ji=new At;let Ki,Bs;function j_(r,e,t){return Ji.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),Ji.multiplyScalar(1/Ji.w),Ji.x=Bs/t.width,Ji.y=Bs/t.height,Ji.applyMatrix4(r.projectionMatrixInverse),Ji.multiplyScalar(1/Ji.w),Math.abs(Math.max(Ji.x,Ji.y))}function OR(r,e){const t=r.matrixWorld,n=r.geometry,i=n.attributes.instanceStart,s=n.attributes.instanceEnd,a=Math.min(n.instanceCount,i.count);for(let c=0,u=a;c<u;c++){Tn.start.fromBufferAttribute(i,c),Tn.end.fromBufferAttribute(s,c),Tn.applyMatrix4(t);const h=new U,d=new U;Ki.distanceSqToSegment(Tn.start,Tn.end,d,h),d.distanceTo(h)<Bs*.5&&e.push({point:d,pointOnLine:h,distance:Ki.origin.distanceTo(d),object:r,face:null,faceIndex:c,uv:null,[Ly]:null})}}function FR(r,e,t){const n=e.projectionMatrix,s=r.material.resolution,a=r.matrixWorld,c=r.geometry,u=c.attributes.instanceStart,h=c.attributes.instanceEnd,d=Math.min(c.instanceCount,u.count),f=-e.near;Ki.at(1,Zi),Zi.w=1,Zi.applyMatrix4(e.matrixWorldInverse),Zi.applyMatrix4(n),Zi.multiplyScalar(1/Zi.w),Zi.x*=s.x/2,Zi.y*=s.y/2,Zi.z=0,ff.copy(Zi),pf.multiplyMatrices(e.matrixWorldInverse,a);for(let m=0,g=d;m<g;m++){if(bn.fromBufferAttribute(u,m),wn.fromBufferAttribute(h,m),bn.w=1,wn.w=1,bn.applyMatrix4(pf),wn.applyMatrix4(pf),bn.z>f&&wn.z>f)continue;if(bn.z>f){const M=bn.z-wn.z,T=(bn.z-f)/M;bn.lerp(wn,T)}else if(wn.z>f){const M=wn.z-bn.z,T=(wn.z-f)/M;wn.lerp(bn,T)}bn.applyMatrix4(n),wn.applyMatrix4(n),bn.multiplyScalar(1/bn.w),wn.multiplyScalar(1/wn.w),bn.x*=s.x/2,bn.y*=s.y/2,wn.x*=s.x/2,wn.y*=s.y/2,Tn.start.copy(bn),Tn.start.z=0,Tn.end.copy(wn),Tn.end.z=0;const S=Tn.closestPointToPointParameter(ff,!0);Tn.at(S,W_);const y=ex.lerp(bn.z,wn.z,S),_=y>=-1&&y<=1,b=ff.distanceTo(W_)<Bs*.5;if(_&&b){Tn.start.fromBufferAttribute(u,m),Tn.end.fromBufferAttribute(h,m),Tn.start.applyMatrix4(a),Tn.end.applyMatrix4(a);const M=new U,T=new U;Ki.distanceSqToSegment(Tn.start,Tn.end,T,M),t.push({point:T,pointOnLine:M,distance:Ki.origin.distanceTo(T),object:r,face:null,faceIndex:m,uv:null,[Ly]:null})}}}class Ny extends an{constructor(e=new cm,t=new um({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let a=0,c=0,u=t.count;a<u;a++,c+=2)V_.fromBufferAttribute(t,a),G_.fromBufferAttribute(n,a),i[c]=c===0?0:i[c-1],i[c+1]=i[c]+V_.distanceTo(G_);const s=new Du(i,2,1);return e.setAttribute("instanceDistanceStart",new ai(s,1,0)),e.setAttribute("instanceDistanceEnd",new ai(s,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera;i===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Ki=e.ray;const a=this.matrixWorld,c=this.geometry,u=this.material;Bs=u.linewidth+s,c.boundingSphere===null&&c.computeBoundingSphere(),gu.copy(c.boundingSphere).applyMatrix4(a);let h;if(n)h=Bs*.5;else{const f=Math.max(i.near,gu.distanceToPoint(Ki.origin));h=j_(i,f,u.resolution)}if(gu.radius+=h,Ki.intersectsSphere(gu)===!1)return;c.boundingBox===null&&c.computeBoundingBox(),mu.copy(c.boundingBox).applyMatrix4(a);let d;if(n)d=Bs*.5;else{const f=Math.max(i.near,mu.distanceToPoint(Ki.origin));d=j_(i,f,u.resolution)}mu.expandByScalar(d),Ki.intersectsBox(mu)!==!1&&(n?OR(this,t):FR(this,i,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(df),this.material.uniforms.resolution.value.set(df.z,df.w))}}class zR extends Ny{constructor(e=new Iy,t=new um({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Tu=W.forwardRef(function({points:e,color:t=16777215,vertexColors:n,linewidth:i,lineWidth:s,segments:a,dashed:c,...u},h){var d,f;const m=Pi(_=>_.size),g=W.useMemo(()=>a?new Ny:new zR,[a]),[x]=W.useState(()=>new um),S=(n==null||(d=n[0])==null?void 0:d.length)===4?4:3,y=W.useMemo(()=>{const _=a?new cm:new Iy,b=e.map(M=>{const T=Array.isArray(M);return M instanceof U||M instanceof At?[M.x,M.y,M.z]:M instanceof he?[M.x,M.y,0]:T&&M.length===3?[M[0],M[1],M[2]]:T&&M.length===2?[M[0],M[1],0]:M});if(_.setPositions(b.flat()),n){t=16777215;const M=n.map(T=>T instanceof ke?T.toArray():T);_.setColors(M.flat(),S)}return _},[e,a,n,S]);return W.useLayoutEffect(()=>{g.computeLineDistances()},[e,g]),W.useLayoutEffect(()=>{c?x.defines.USE_DASH="":delete x.defines.USE_DASH,x.needsUpdate=!0},[c,x]),W.useEffect(()=>()=>{y.dispose(),x.dispose()},[y]),W.createElement("primitive",Ei({object:g,ref:h},u),W.createElement("primitive",{object:y,attach:"geometry"}),W.createElement("primitive",Ei({object:x,attach:"material",color:t,vertexColors:!!n,resolution:[m.width,m.height],linewidth:(f=i??s)!==null&&f!==void 0?f:1,dashed:c,transparent:S===4},u)))}),BR=()=>parseInt(Zo.replace(/\D+/g,"")),Dy=BR(),kR=W.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:s=!1,onChange:a,onStart:c,onEnd:u,...h},d)=>{const f=Pi(C=>C.invalidate),m=Pi(C=>C.camera),g=Pi(C=>C.gl),x=Pi(C=>C.events),S=Pi(C=>C.setEvents),y=Pi(C=>C.set),_=Pi(C=>C.get),b=Pi(C=>C.performance),M=e||m,T=n||x.connected||g.domElement,R=W.useMemo(()=>new UR(M),[M]);return Bi(()=>{R.enabled&&R.update()},-1),W.useEffect(()=>(s&&R.connect(s===!0?T:s),R.connect(T),()=>void R.dispose()),[s,T,t,R,f]),W.useEffect(()=>{const C=A=>{f(),t&&b.regress(),a&&a(A)},N=A=>{c&&c(A)},B=A=>{u&&u(A)};return R.addEventListener("change",C),R.addEventListener("start",N),R.addEventListener("end",B),()=>{R.removeEventListener("start",N),R.removeEventListener("end",B),R.removeEventListener("change",C)}},[a,c,u,R,f,S]),W.useEffect(()=>{if(r){const C=_().controls;return y({controls:R}),()=>y({controls:C})}},[r,R]),W.createElement("primitive",Ei({ref:d,object:R,enableDamping:i},h))}),mf=Dy>=154?"opaque_fragment":"output_fragment";class HR extends Yu{constructor(e){super(e),this.onBeforeCompile=(t,n)=>{const{isWebGL2:i}=n.capabilities;t.fragmentShader=t.fragmentShader.replace(`#include <${mf}>`,`
4167
4167
  ${i?`#include <${mf}>`:`#extension GL_OES_standard_derivatives : enable
4168
4168
  #include <${mf}>`}
4169
4169
  vec2 cxy = 2.0 * gl_PointCoord - 1.0;
@@ -4173,5 +4173,5 @@ No matching component was found for:
4173
4173
  gl_FragColor = vec4(gl_FragColor.rgb, mask * gl_FragColor.a );
4174
4174
  #include <tonemapping_fragment>
4175
4175
  #include <${Dy>=154?"colorspace_fragment":"encodings_fragment"}>
4176
- `)}}}const VR=W.forwardRef((r,e)=>{const[t]=W.useState(()=>new HR(null));return W.createElement("primitive",Ei({},r,{object:t,ref:e,attach:"material"}))});function GR(r,e){const t=r+"Geometry";return W.forwardRef(({args:n,children:i,...s},a)=>{const c=W.useRef(null);return W.useImperativeHandle(a,()=>c.current),W.useLayoutEffect(()=>void(e==null?void 0:e(c.current))),W.createElement("mesh",Ei({ref:c},s),W.createElement(t,{attach:"geometry",args:n}),i)})}const gp=GR("sphere");let Ss,Da;const WR=W.createContext(null),q_=new lt,Y_=new U,jR=W.forwardRef(({children:r,range:e,limit:t=1e3,...n},i)=>{const s=W.useRef(null);W.useImperativeHandle(i,()=>s.current,[]);const[a,c]=W.useState([]),[[u,h,d]]=W.useState(()=>[new Float32Array(t*3),Float32Array.from({length:t*3},()=>1),Float32Array.from({length:t},()=>1)]);W.useEffect(()=>{s.current.geometry.attributes.position.needsUpdate=!0}),Bi(()=>{for(s.current.updateMatrix(),s.current.updateMatrixWorld(),q_.copy(s.current.matrixWorld).invert(),s.current.geometry.drawRange.count=Math.min(t,e!==void 0?e:t,a.length),Ss=0;Ss<a.length;Ss++)Da=a[Ss].current,Da.getWorldPosition(Y_).applyMatrix4(q_),Y_.toArray(u,Ss*3),s.current.geometry.attributes.position.needsUpdate=!0,Da.matrixWorldNeedsUpdate=!0,Da.color.toArray(h,Ss*3),s.current.geometry.attributes.color.needsUpdate=!0,d.set([Da.size],Ss),s.current.geometry.attributes.size.needsUpdate=!0});const f=W.useMemo(()=>({getParent:()=>s,subscribe:m=>(c(g=>[...g,m]),()=>c(g=>g.filter(x=>x.current!==m.current)))}),[]);return W.createElement("points",Ei({userData:{instances:a},matrixAutoUpdate:!1,ref:s,raycast:()=>null},n),W.createElement("bufferGeometry",null,W.createElement("bufferAttribute",{attach:"attributes-position",count:u.length/3,array:u,itemSize:3,usage:Ds}),W.createElement("bufferAttribute",{attach:"attributes-color",count:h.length/3,array:h,itemSize:3,usage:Ds}),W.createElement("bufferAttribute",{attach:"attributes-size",count:d.length,array:d,itemSize:1,usage:Ds})),W.createElement(WR.Provider,{value:f},r))}),XR=W.forwardRef(({children:r,positions:e,colors:t,sizes:n,stride:i=3,...s},a)=>{const c=W.useRef(null);return W.useImperativeHandle(a,()=>c.current,[]),Bi(()=>{const u=c.current.geometry.attributes;u.position.needsUpdate=!0,t&&(u.color.needsUpdate=!0),n&&(u.size.needsUpdate=!0)}),W.createElement("points",Ei({ref:c},s),W.createElement("bufferGeometry",null,W.createElement("bufferAttribute",{attach:"attributes-position",count:e.length/i,array:e,itemSize:i,usage:Ds}),t&&W.createElement("bufferAttribute",{attach:"attributes-color",count:t.length/i,array:t,itemSize:3,usage:Ds}),n&&W.createElement("bufferAttribute",{attach:"attributes-size",count:n.length/i,array:n,itemSize:1,usage:Ds})),r)}),qR=W.forwardRef((r,e)=>r.positions instanceof Float32Array?W.createElement(XR,Ei({},r,{ref:e})):W.createElement(jR,Ei({},r,{ref:e})));function El(r){return new ke(r)}function dm(r){return El(Is[r])}function Uy(r){return IS[r]}function YR(r){return El(K_[r])}function ZR(r){return El(Q_[r])}function JR(r){return El(NS[r])}function KR(r){return Xg[r]??Xg.other??"#7f8c8d"}function QR(r){return El(KR(r))}function $R(r){return r>=80?"#22c55e":r>=60?"#eab308":r>=40?"#f97316":"#ef4444"}function Mi(r){return new U(r.x,r.y,r.z)}function e2(r,e){const t=e.x-r.x,n=e.y-r.y,i=e.z-r.z;return Math.sqrt(t*t+n*n+i*i)}function Oy(r,e){return{x:(r.x+e.x)/2,y:(r.y+e.y)/2,z:(r.z+e.z)/2}}function Z_(r){const e=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z);return e===0?{x:0,y:0,z:0}:{x:r.x/e,y:r.y/e,z:r.z/e}}function t2(r,e){return{x:r.x-e.x,y:r.y-e.y,z:r.z-e.z}}function n2(r,e,t=50,n=.3){const i=Oy(r,e),s=e2(r,e),a=Z_(t2(e,r)),c=Z_({x:-a.z,y:a.y+n*s,z:a.x}),u={x:i.x+c.x*s*n,y:i.y+c.y*s*n,z:i.z+c.z*s*n};return new Vp([Mi(r),Mi(u),Mi(e)])}function i2(r,e,t,n=0){const i=r.x+Math.cos(t)*e,s=r.y+Math.sin(n)*Math.sin(t)*e*.3,a=r.z+Math.sin(t)*e;return{x:i,y:s,z:a}}function r2(r,e,t=.5,n=3){const i=Math.log10(r+1)/6,s=Math.log10(e+1)/4,a=i*.6+s*.4;return t+a*(n-t)}function s2(r,e,t=.15){const n=Math.log10(r+1)/3,i=e?1.5:1;return t*(1+n*.5)*i}function o2(r,e=.05,t=.3){const n=Math.log10(r+1)/3;return e+n*(t-e)}const J_={hover:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.1,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:.1,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:.5,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},select:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.1,p_env_punch:.3,p_env_decay:.2,p_base_freq:.4,p_freq_limit:0,p_freq_ramp:.2,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.5,p_arp_speed:.6,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.2,sample_rate:44100,sample_size:8},deselect:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.15,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:-.2,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.8,p_lpf_ramp:-.2,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},zoom:{oldParams:!0,wave_type:3,p_env_attack:.1,p_env_sustain:.2,p_env_punch:0,p_env_decay:.3,p_base_freq:.1,p_freq_limit:0,p_freq_ramp:.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.5,p_lpf_ramp:.2,p_lpf_resonance:.5,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.1,sample_rate:44100,sample_size:8},pathActivate:{oldParams:!0,wave_type:2,p_env_attack:0,p_env_sustain:.15,p_env_punch:.2,p_env_decay:.25,p_base_freq:.3,p_freq_limit:0,p_freq_ramp:.15,p_freq_dramp:0,p_vib_strength:.1,p_vib_speed:.3,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.7,p_lpf_ramp:0,p_lpf_resonance:.3,p_hpf_freq:.05,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},dataFlow:{oldParams:!0,wave_type:0,p_env_attack:.05,p_env_sustain:.1,p_env_punch:0,p_env_decay:.1,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:.2,p_vib_speed:.5,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.6,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.2,p_hpf_ramp:0,sound_vol:.08,sample_rate:44100,sample_size:8},alertLow:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.1,p_env_punch:0,p_env_decay:.2,p_base_freq:.35,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},alertMedium:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.15,p_env_punch:.1,p_env_decay:.15,p_base_freq:.4,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.3,p_arp_speed:.5,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.5,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},alertHigh:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.2,p_env_punch:.2,p_env_decay:.1,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.4,p_arp_speed:.4,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.4,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.22,sample_rate:44100,sample_size:8},alertCritical:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.25,p_env_punch:.3,p_env_decay:.1,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:-.1,p_freq_dramp:0,p_vib_strength:.1,p_vib_speed:.8,p_arp_mod:.5,p_arp_speed:.3,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.3,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.25,sample_rate:44100,sample_size:8},warp:{oldParams:!0,wave_type:3,p_env_attack:.1,p_env_sustain:.3,p_env_punch:.2,p_env_decay:.4,p_base_freq:.05,p_freq_limit:0,p_freq_ramp:.4,p_freq_dramp:.1,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.3,p_lpf_ramp:.3,p_lpf_resonance:.5,p_hpf_freq:0,p_hpf_ramp:.1,sound_vol:.2,sample_rate:44100,sample_size:8},scan:{oldParams:!0,wave_type:2,p_env_attack:.05,p_env_sustain:.4,p_env_punch:0,p_env_decay:.2,p_base_freq:.2,p_freq_limit:0,p_freq_ramp:.2,p_freq_dramp:-.1,p_vib_strength:.3,p_vib_speed:.6,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:.6,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.5,p_lpf_ramp:0,p_lpf_resonance:.3,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.12,sample_rate:44100,sample_size:8},powerUp:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.2,p_env_punch:.3,p_env_decay:.3,p_base_freq:.2,p_freq_limit:0,p_freq_ramp:.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.5,p_arp_speed:.5,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.2,sample_rate:44100,sample_size:8},powerDown:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.15,p_env_punch:0,p_env_decay:.4,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:-.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:-.3,p_arp_speed:.5,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.8,p_lpf_ramp:-.3,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},click:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.02,p_env_punch:0,p_env_decay:.05,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:.5,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.3,p_hpf_ramp:0,sound_vol:.12,sample_rate:44100,sample_size:8},blip:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.1,p_base_freq:.55,p_freq_limit:0,p_freq_ramp:.1,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8}};class a2{constructor(e={}){co(this,"config");co(this,"audioCache",new Map);co(this,"sfxr",null);co(this,"initialized",!1);co(this,"initPromise",null);this.config={enabled:!0,volume:.5,muted:!1,...e}}async initialize(){if(!this.initialized)return this.initPromise?this.initPromise:(this.initPromise=this.doInitialize(),this.initPromise)}async doInitialize(){try{this.sfxr=await DS(()=>import("./sfxr-Cr89uVKo.js").then(e=>e.s),__vite__mapDeps([0,1,2]));for(const[e,t]of Object.entries(J_)){const n=this.sfxr.sfxr.toAudio(t);this.audioCache.set(e,n)}this.initialized=!0}catch(e){console.warn("Failed to initialize Galaxy sound engine:",e),this.config.enabled=!1}}async play(e){if(!this.config.enabled||this.config.muted)return;this.initialized||await this.initialize();const t=this.audioCache.get(e);if(t)try{const n=t.cloneNode();n.volume=this.config.volume,await n.play()}catch{}}async playWithVariation(e,t=.1){if(!this.config.enabled||this.config.muted||!this.sfxr)return;this.initialized||await this.initialize();const n={...J_[e]},i=n.p_base_freq;n.p_base_freq=i*(1+(Math.random()-.5)*t*2);try{const s=this.sfxr.sfxr.toAudio(n);s.volume=this.config.volume,await s.play()}catch{}}async playAlert(e){const t={low:"alertLow",medium:"alertMedium",high:"alertHigh",critical:"alertCritical"};await this.play(t[e])}setConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}toggleMute(){return this.config.muted=!this.config.muted,this.config.muted}setVolume(e){this.config.volume=Math.max(0,Math.min(1,e))}setEnabled(e){this.config.enabled=e}}let gf=null;function l2(){return gf||(gf=new a2),gf}function fm(r={}){const{enabled:e=!0,volume:t=.5,debounceMs:n=50}=r,i=l2(),s=W.useRef(new Map);W.useEffect(()=>{i.setConfig({enabled:e,volume:t})},[e,t,i]);const a=W.useCallback(g=>{const x=Date.now(),S=s.current.get(g)??0;x-S<n||(s.current.set(g,x),i.play(g))},[i,n]),c=W.useCallback((g,x=.1)=>{const S=Date.now(),y=s.current.get(g)??0;S-y<n||(s.current.set(g,S),i.playWithVariation(g,x))},[i,n]),u=W.useCallback(g=>{i.playAlert(g)},[i]),h=W.useCallback(()=>i.toggleMute(),[i]),d=W.useCallback(g=>{i.setVolume(g)},[i]),f=W.useCallback(()=>i.getConfig(),[i]),m=W.useCallback(g=>{i.setConfig(g)},[i]);return{play:a,playVaried:c,playAlert:u,toggleMute:h,setVolume:d,getConfig:f,setConfig:m}}function c2({table:r,isSelected:e=!1,isHovered:t=!1,onClick:n,onPointerOver:i,onPointerOut:s}){const a=W.useRef(null),c=W.useRef(null),[u,h]=W.useState(!1),{display:d,viewMode:f}=Fn(),{play:m,playVaried:g}=fm({debounceMs:100}),x=W.useCallback(R=>{R.stopPropagation(),h(!0);const C=r.sensitivity==="critical"?.3:.1;g("hover",C),i==null||i()},[r.sensitivity,g,i]),S=W.useCallback(R=>{R.stopPropagation(),h(!1),s==null||s()},[s]),y=W.useCallback(()=>{m("select"),n==null||n()},[m,n]),_=W.useMemo(()=>r2(r.rowCount,r.accessCount,qg.MIN_RADIUS,qg.MAX_RADIUS),[r.rowCount,r.accessCount]),b=W.useMemo(()=>{const R=dm(r.sensitivity),C=Uy(r.sensitivity),N=QR(r.cluster||"other");return{main:R,emissive:R,emissiveIntensity:C,cluster:N}},[r.sensitivity,r.cluster]),M=W.useMemo(()=>r.position?Mi(r.position):new U(0,0,0),[r.position]);Bi((R,C)=>{if(!a.current)return;a.current.rotation.y+=Wr.IDLE_ROTATION*d.animationSpeed;const N=e?Wr.SELECTION_SCALE:t||u?Wr.HOVER_SCALE:1;if(a.current.scale.lerp(new U(N,N,N),.1),c.current&&r.sensitivity!=="public"){const B=Math.sin(R.clock.elapsedTime*Wr.PULSE_FREQUENCY)*.5+.5,A=c.current.material;A.opacity=.1+B*.2*b.emissiveIntensity}});const T=f==="security"&&(r.sensitivity==="critical"||r.sensitivity==="high");return L.jsxs("group",{position:M,children:[L.jsx(gp,{ref:a,args:[_,32,32],onClick:y,onPointerOver:x,onPointerOut:S,children:L.jsx("meshStandardMaterial",{color:b.main,emissive:b.emissive,emissiveIntensity:T?b.emissiveIntensity*2:b.emissiveIntensity,roughness:.7,metalness:.3})}),r.sensitivity!=="public"&&d.enableBloom&&L.jsx(gp,{ref:c,args:[_*1.3,16,16],children:L.jsx("meshBasicMaterial",{color:b.main,transparent:!0,opacity:.15,side:An})}),e&&L.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[L.jsx("ringGeometry",{args:[_*1.5,_*1.7,32]}),L.jsx("meshBasicMaterial",{color:"#ffffff",transparent:!0,opacity:.8,side:Si})]}),d.showLabels&&(t||u||e)&&L.jsx(cm,{position:[0,_+Gn.OFFSET,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:`${Gn.FONT_SIZE}px`,fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${b.main.getStyle()}`},children:[L.jsx("div",{style:{fontWeight:600},children:r.name}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7},children:[r.fields.length," fields • ",r.accessCount," accesses"]})]})})]})}function u2({field:r,parentPosition:e,parentRadius:t,orbitIndex:n,totalFields:i,isSelected:s=!1,isHovered:a=!1,onClick:c,onPointerOver:u,onPointerOut:h}){const d=W.useRef(null),f=W.useRef(n/i*Math.PI*2+Math.random()*.5),{display:m,viewMode:g}=Fn(),x=W.useMemo(()=>{const M=r.sensitivity!=="public"&&r.sensitivity!=="low";return s2(r.accessCount,M,xd.RADIUS)},[r.accessCount,r.sensitivity]),S=W.useMemo(()=>{const M=dm(r.sensitivity),T=Uy(r.sensitivity);return{main:M,emissive:M,emissiveIntensity:T}},[r.sensitivity]),y=t+xd.ORBIT_RADIUS,_=W.useMemo(()=>(n%3-1)*.3,[n]);Bi((M,T)=>{if(!d.current)return;f.current+=xd.ORBIT_SPEED*T*m.animationSpeed;const R=i2(e,y,f.current,_);d.current.position.set(R.x,R.y,R.z),d.current.rotation.y+=.02*m.animationSpeed;const C=s?Wr.SELECTION_SCALE:a?Wr.HOVER_SCALE:1;d.current.scale.lerp(new U(C,C,C),.1)});const b=g==="security"&&(r.sensitivity==="critical"||r.sensitivity==="high");return m.showFields?L.jsxs("group",{children:[L.jsx(gp,{ref:d,args:[x,16,16],onClick:M=>{M.stopPropagation(),c==null||c()},onPointerOver:M=>{M.stopPropagation(),u==null||u()},onPointerOut:M=>{M.stopPropagation(),h==null||h()},children:L.jsx("meshStandardMaterial",{color:S.main,emissive:S.emissive,emissiveIntensity:b?S.emissiveIntensity*3:S.emissiveIntensity,roughness:.5,metalness:.5})}),m.showLabels&&a&&d.current&&L.jsx(cm,{position:d.current.position.clone().add(new U(0,x+.3,0)),center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:"10px",fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${S.main.getStyle()}`},children:[L.jsx("div",{style:{fontWeight:600},children:r.name}),L.jsxs("div",{style:{opacity:.7},children:[r.dataType," • ",r.sensitivity]}),r.isPrimaryKey&&L.jsx("div",{style:{color:"#fbbf24"},children:"🔑 Primary Key"}),r.isForeignKey&&L.jsx("div",{style:{color:"#60a5fa"},children:"🔗 Foreign Key"}),!r.isTested&&L.jsx("div",{style:{color:"#ef4444"},children:"⚠️ Untested"})]})})]}):null}const _f={GET:"#22c55e",POST:"#3b82f6",PUT:"#f59e0b",PATCH:"#8b5cf6",DELETE:"#ef4444",ALL:"#6b7280"};function h2({entryPoint:r,isSelected:e=!1,isHovered:t=!1,onClick:n,onPointerOver:i,onPointerOut:s}){const a=W.useRef(null),[c,u]=W.useState(!1),{display:h,viewMode:d}=Fn(),{play:f,playAlert:m}=fm({debounceMs:100}),g=W.useCallback(T=>{T.stopPropagation(),u(!0),r.authLevel==="public"?m("medium"):f("hover"),i==null||i()},[r.authLevel,f,m,i]),x=W.useCallback(T=>{T.stopPropagation(),u(!1),s==null||s()},[s]),S=W.useCallback(()=>{r.securityTier==="P0"?m("critical"):r.securityTier==="P1"?m("high"):f("select"),n==null||n()},[r.securityTier,f,m,n]),y=W.useMemo(()=>{const T=ZR(r.authLevel),R=YR(r.securityTier),C=new ke(_f[r.method]??_f.ALL??"#6b7280");return{auth:T,tier:R,method:C}},[r.authLevel,r.securityTier,r.method]),_=W.useMemo(()=>r.position?Mi(r.position):new U(0,0,0),[r.position]);Bi((T,R)=>{if(!a.current)return;a.current.rotation.y+=.005*h.animationSpeed;const C=e?Wr.SELECTION_SCALE:t||c?Wr.HOVER_SCALE:1;a.current.scale.lerp(new U(C,C,C),.1)});const b=d==="security"&&r.authLevel==="public",M=US.SCALE;return L.jsxs("group",{ref:a,position:_,onClick:S,onPointerOver:g,onPointerOut:x,children:[L.jsxs("mesh",{children:[L.jsx("octahedronGeometry",{args:[M,0]}),L.jsx("meshStandardMaterial",{color:y.auth,emissive:y.auth,emissiveIntensity:b?.8:.3,roughness:.3,metalness:.7})]}),L.jsxs("mesh",{children:[L.jsx("octahedronGeometry",{args:[M*.5,0]}),L.jsx("meshStandardMaterial",{color:y.method,emissive:y.method,emissiveIntensity:.5,roughness:.2,metalness:.8})]}),L.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[L.jsx("torusGeometry",{args:[M*1.5,M*.1,8,32]}),L.jsx("meshStandardMaterial",{color:y.tier,emissive:y.tier,emissiveIntensity:.4,roughness:.4,metalness:.6})]}),e&&L.jsxs("mesh",{rotation:[0,0,Math.PI/4],children:[L.jsx("torusGeometry",{args:[M*2,M*.05,8,32]}),L.jsx("meshBasicMaterial",{color:"#ffffff",transparent:!0,opacity:.8})]}),r.authLevel==="public"&&h.enableBloom&&L.jsxs("mesh",{children:[L.jsx("sphereGeometry",{args:[M*2,16,16]}),L.jsx("meshBasicMaterial",{color:"#ff3333",transparent:!0,opacity:.1,side:An})]}),h.showLabels&&(t||c||e)&&L.jsx(cm,{position:[0,M*2,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:`${Gn.FONT_SIZE}px`,fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${y.auth.getStyle()}`,maxWidth:"250px"},children:[L.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[L.jsx("span",{style:{background:_f[r.method],padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:700},children:r.method}),L.jsx("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis"},children:r.path})]}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7,marginTop:"4px"},children:[r.framework," • ",r.authLevel,r.authLevel==="public"&&L.jsx("span",{style:{color:"#ef4444",marginLeft:"4px"},children:"⚠️ PUBLIC"})]}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7},children:["Reaches ",r.reachableTables.length," tables"]})]})})]})}function d2({path:r,sourcePosition:e,targetPosition:t,isSelected:n=!1,isHovered:i=!1,onClick:s,onPointerOver:a,onPointerOut:c}){const u=W.useRef(null),h=W.useRef(0),{display:d,viewMode:f}=Fn(),m=W.useMemo(()=>n2(e,t,us.CURVE_SEGMENTS),[e,t]),g=W.useMemo(()=>m.getPoints(us.CURVE_SEGMENTS),[m]),x=W.useMemo(()=>o2(r.frequency,us.BASE_WIDTH,us.MAX_WIDTH),[r.frequency]),S=W.useMemo(()=>f==="security"?dm(r.sensitivity):JR(r.operation),[r.operation,r.sensitivity,f]),y=W.useMemo(()=>{let _=d.pathOpacity;return f==="coverage"&&!r.isTested&&(_=Math.min(1,_*1.5)),n?1:i?Math.min(1,_*1.3):_},[d.pathOpacity,f,r.isTested,n,i]);return Bi((_,b)=>{if(!u.current)return;h.current-=us.FLOW_SPEED*b*d.animationSpeed;const M=u.current.material;M&&"dashOffset"in M&&(M.dashOffset=h.current)}),d.showPaths?L.jsxs("group",{onClick:s,onPointerOver:a,onPointerOut:c,children:[L.jsx(Tu,{ref:u,points:g,color:S,lineWidth:n?x*2:x,transparent:!0,opacity:y,dashed:!0,dashSize:us.DASH_SIZE,gapSize:us.GAP_SIZE}),(n||i)&&L.jsx(Tu,{points:g,color:S,lineWidth:x*3,transparent:!0,opacity:y*.3}),!r.isTested&&f==="coverage"&&L.jsx(Tu,{points:g,color:"#ef4444",lineWidth:x*.5,transparent:!0,opacity:.5,dashed:!0,dashSize:.2,gapSize:.8})]}):null}const f2={"one-to-one":"#60a5fa","one-to-many":"#34d399","many-to-many":"#a78bfa"};function p2({relationship:r,sourcePosition:e,targetPosition:t,isHighlighted:n=!1}){const{display:i}=Fn(),s=W.useMemo(()=>{const c=Mi(e),u=Mi(t),h=Mi(Oy(e,t));return h.y+=1,new Ku(c,h,u).getPoints(20)},[e,t]),a=W.useMemo(()=>f2[r.type]||"#6b7280",[r.type]);return i.showRelationships?L.jsxs("group",{children:[L.jsx(Tu,{points:s,color:a,lineWidth:n?2:1,transparent:!0,opacity:n?.8:.3,dashed:!n,dashSize:.3,gapSize:.2}),n&&L.jsxs(L.Fragment,{children:[L.jsxs("mesh",{position:Mi(e),children:[L.jsx("sphereGeometry",{args:[.15,8,8]}),L.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.8})]}),L.jsxs("mesh",{position:Mi(t),children:[r.type.endsWith("many")?L.jsx("coneGeometry",{args:[.2,.3,8]}):L.jsx("sphereGeometry",{args:[.15,8,8]}),L.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.8})]})]})]}):null}function m2({count:r=Yg.STAR_COUNT,radius:e=Ii.RADIUS*3,size:t=Yg.STAR_SIZE,twinkle:n=!0}){const i=W.useRef(null),s=W.useMemo(()=>{const u=new Float32Array(r*3);for(let h=0;h<r;h++){const d=Math.random()*Math.PI*2,f=Math.acos(2*Math.random()-1),m=e*(.5+Math.random()*.5);u[h*3]=m*Math.sin(f)*Math.cos(d),u[h*3+1]=m*Math.sin(f)*Math.sin(d),u[h*3+2]=m*Math.cos(f)}return u},[r,e]),a=W.useMemo(()=>{const u=new Float32Array(r);for(let h=0;h<r;h++)u[h]=t*(.5+Math.random()*1.5);return u},[r,t]),c=W.useMemo(()=>{const u=new Float32Array(r*3);for(let h=0;h<r;h++){const d=Math.random();d<.1?(u[h*3]=.7,u[h*3+1]=.8,u[h*3+2]=1):d<.2?(u[h*3]=1,u[h*3+1]=.95,u[h*3+2]=.8):(u[h*3]=1,u[h*3+1]=1,u[h*3+2]=1)}return u},[r]);return Bi(u=>{if(!n||!i.current)return;const d=i.current.geometry.getAttribute("size");if(d){const f=u.clock.elapsedTime;for(let m=0;m<r;m++){const g=.5+m%10*.1,x=Math.sin(f*g+m)*.3+.7;d.array[m]=a[m]*x}d.needsUpdate=!0}}),L.jsxs(qR,{ref:i,limit:r,children:[L.jsxs("bufferGeometry",{children:[L.jsx("bufferAttribute",{attach:"attributes-position",count:r,array:s,itemSize:3}),L.jsx("bufferAttribute",{attach:"attributes-color",count:r,array:c,itemSize:3}),L.jsx("bufferAttribute",{attach:"attributes-size",count:r,array:a,itemSize:1})]}),L.jsx(VR,{transparent:!0,vertexColors:!0,size:t,sizeAttenuation:!0,depthWrite:!1,opacity:.8})]})}function g2(){const{display:r}=Fn();return r.enableBloom,null}function _2({enableControls:r=!0,autoRotate:e=!1,autoRotateSpeed:t=.5}){const n=W.useRef(null),{camera:i}=Pi(),{camera:s,setCameraPosition:a,setCameraTarget:c}=Fn();W.useEffect(()=>{if(s.position){const h=Mi(s.position);i.position.copy(h)}},[s.position,i]),W.useEffect(()=>{if(n.current&&s.target){const h=Mi(s.target);n.current.target.copy(h),n.current.update()}},[s.target]),W.useEffect(()=>{i.zoom=s.zoom,i.updateProjectionMatrix()},[s.zoom,i]),Bi(()=>{if(!n.current)return;const h=i.position,d=n.current.target;Math.abs(h.x-s.position.x)+Math.abs(h.y-s.position.y)+Math.abs(h.z-s.position.z)>.1&&a({x:h.x,y:h.y,z:h.z}),Math.abs(d.x-s.target.x)+Math.abs(d.y-s.target.y)+Math.abs(d.z-s.target.z)>.1&&c({x:d.x,y:d.y,z:d.z})});const u={autoRotate:e,autoRotateSpeed:t,minDistance:Vr.MIN_ZOOM*20,maxDistance:Vr.MAX_ZOOM*100,maxPolarAngle:Math.PI*.85,minPolarAngle:Math.PI*.15};return L.jsx(kR,{ref:n,...u})}function v2(){const r=W.useRef(null),e=W.useRef(null),{viewMode:t}=Fn();Bi(s=>{const a=s.clock.elapsedTime;r.current&&(r.current.position.x=Math.sin(a*.1)*30,r.current.position.z=Math.cos(a*.1)*30),e.current&&(e.current.position.x=Math.cos(a*.08)*25,e.current.position.z=Math.sin(a*.08)*25)});const n=t==="security"?.2:.3,i=t==="security"?.8:.6;return L.jsxs(L.Fragment,{children:[L.jsx("ambientLight",{intensity:n,color:"#4a5568"}),L.jsx("directionalLight",{position:[50,50,25],intensity:.5,color:"#ffffff",castShadow:!1}),L.jsx("pointLight",{ref:r,position:[30,20,30],intensity:i,color:"#60a5fa",distance:100,decay:2}),L.jsx("pointLight",{ref:e,position:[-25,-10,-25],intensity:i*.7,color:"#f472b6",distance:80,decay:2}),L.jsx("pointLight",{position:[0,0,0],intensity:.4,color:"#a78bfa",distance:50,decay:2}),t==="security"&&L.jsx("pointLight",{position:[0,30,0],intensity:.3,color:"#ef4444",distance:100,decay:2})]})}function Fy(){return L.jsxs("mesh",{children:[L.jsx("sphereGeometry",{args:[1,16,16]}),L.jsx("meshBasicMaterial",{color:"#4a5568",wireframe:!0})]})}function x2(){const{galaxyData:r,selection:e,display:t,selectTable:n,selectEntryPoint:i,selectPath:s,setHovered:a}=Fn(),c=OS(),u=FS(),h=zS(),d=W.useMemo(()=>{const S=new Map;if(r){for(const y of r.tables)y.position&&S.set(y.id,y.position);for(const y of r.entryPoints)y.position&&S.set(y.id,y.position)}return S},[r]),f=W.useCallback(S=>{n(S)},[n]),m=W.useCallback(S=>{i(S)},[i]),g=W.useCallback(S=>{s(S)},[s]),x=W.useCallback((S,y)=>{a(S,y)},[a]);return r?L.jsxs(L.Fragment,{children:[L.jsx(m2,{}),L.jsx(v2,{}),L.jsx(_2,{}),L.jsx(g2,{}),t.showRelationships&&r.relationships.map(S=>{const y=d.get(S.sourceTableId),_=d.get(S.targetTableId);if(!y||!_)return null;const b=e.selectedTable===S.sourceTableId||e.selectedTable===S.targetTableId;return L.jsx(p2,{relationship:S,sourcePosition:y,targetPosition:_,isHighlighted:b},S.id)}),u.map(S=>{const y=d.get(S.sourceId),_=d.get(S.targetTableId);return!y||!_?null:L.jsx(d2,{path:S,sourcePosition:y,targetPosition:_,isSelected:e.selectedPath===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>g(S.id),onPointerOver:()=>x(S.id,"path"),onPointerOut:()=>x(null,null)},S.id)}),c.map(S=>L.jsxs("group",{children:[L.jsx(c2,{table:S,isSelected:e.selectedTable===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>f(S.id),onPointerOver:()=>x(S.id,"table"),onPointerOut:()=>x(null,null)}),t.showFields&&S.position&&S.fields.map((y,_)=>L.jsx(u2,{field:y,parentPosition:S.position,parentRadius:1,orbitIndex:_,totalFields:S.fields.length,isSelected:e.selectedField===y.id,isHovered:e.hoveredNode===y.id,onClick:()=>n(S.id),onPointerOver:()=>x(y.id,"field"),onPointerOut:()=>x(null,null)},y.id))]},S.id)),h.map(S=>L.jsx(h2,{entryPoint:S,isSelected:e.selectedEntryPoint===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>m(S.id),onPointerOver:()=>x(S.id,"entryPoint"),onPointerOut:()=>x(null,null)},S.id))]}):L.jsx(Fy,{})}function y2({className:r="",enableControls:e=!0,autoRotate:t=!1}){return L.jsx("div",{className:`w-full h-full ${r}`,children:L.jsxs(vR,{camera:{position:[Vr.DEFAULT_POSITION.x,Vr.DEFAULT_POSITION.y,Vr.DEFAULT_POSITION.z],fov:Vr.FOV,near:Vr.NEAR,far:Vr.FAR},gl:{antialias:!0,toneMapping:Fu,toneMappingExposure:1},dpr:[1,2],children:[L.jsx("color",{attach:"background",args:["#0f172a"]}),L.jsx("fog",{attach:"fog",args:["#0f172a",50,200]}),L.jsx(W.Suspense,{fallback:L.jsx(Fy,{}),children:L.jsx(x2,{})})]})})}function pm(r){const e=r.toLowerCase();for(const[t,n]of Object.entries(BS))if(n.some(i=>e.includes(i)))return t;return"other"}function S2(r,e){for(let t=0;t<r.length;t++)for(let n=t+1;n<r.length;n++){const i=r[t],s=r[n];if(i.fixed&&s.fixed)continue;const a=s.x-i.x,c=s.y-i.y,u=s.z-i.z,h=Math.sqrt(a*a+c*c+u*u)||.1,d=i.cluster===s.cluster?.5:1,f=e*d/(h*h),m=a/h*f,g=c/h*f,x=u/h*f;i.fixed||(i.vx-=m/i.mass,i.vy-=g/i.mass,i.vz-=x/i.mass),s.fixed||(s.vx+=m/s.mass,s.vy+=g/s.mass,s.vz+=x/s.mass)}}function M2(r,e,t){const n=new Map(r.map(i=>[i.id,i]));for(const i of e){const s=n.get(i.source),a=n.get(i.target);if(!s||!a||s.fixed&&a.fixed)continue;const c=a.x-s.x,u=a.y-s.y,h=a.z-s.z,d=Math.sqrt(c*c+u*u+h*h)||.1,f=(d-t)*i.strength*.1,m=c/d*f,g=u/d*f,x=h/d*f;s.fixed||(s.vx+=m/s.mass,s.vy+=g/s.mass,s.vz+=x/s.mass),a.fixed||(a.vx-=m/a.mass,a.vy-=g/a.mass,a.vz-=x/a.mass)}}function E2(r,e,t){for(const n of r){if(n.fixed)continue;const i=e.get(n.cluster);if(!i)continue;const s=i.x-n.x,a=i.y-n.y,c=i.z-n.z;n.vx+=s*t,n.vy+=a*t,n.vz+=c*t}}function b2(r,e){for(const t of r)t.fixed||(t.x+=t.vx,t.y+=t.vy,t.z+=t.vz,t.vx*=e,t.vy*=e,t.vz*=e)}function w2(r,e,t){for(const n of r){const i=Math.sqrt(n.x*n.x+n.z*n.z);if(i>e){const s=e/i;n.x*=s,n.z*=s}n.y=Math.max(-t/2,Math.min(t/2,n.y))}}function T2(r){const e=new Map,t=2*Math.PI/r.length,n=Ii.RADIUS*.6;return r.forEach((i,s)=>{const a=s*t;e.set(i,{x:Math.cos(a)*n,y:(Math.random()-.5)*Ii.HEIGHT*.3,z:Math.sin(a)*n})}),e}function A2(r,e){return r.map(t=>{const n=t.cluster||pm(t.name),i=e.get(n)||{x:0,y:0,z:0},s=Ii.CLUSTER_SEPARATION*.3;return{id:t.id,x:i.x+(Math.random()-.5)*s,y:i.y+(Math.random()-.5)*s,z:i.z+(Math.random()-.5)*s,vx:0,vy:0,vz:0,mass:1+Math.log10(t.accessCount+1),cluster:n,fixed:!1}})}function C2(r){return r.map(e=>({source:e.sourceTableId,target:e.targetTableId,strength:e.type==="one-to-one"?1:.5}))}function R2(r,e,t){const n=new Map,i=Ii.RADIUS+15,s=new Map;for(const c of r){const u=new Map;for(const m of c.reachableTables){const g=e.find(x=>x.id===m);if(g){const x=g.cluster||pm(g.name);u.set(x,(u.get(x)||0)+1)}}let h="other",d=0;for(const[m,g]of u)g>d&&(h=m,d=g);const f=s.get(h)||[];s.set(h,[...f,c])}let a=0;for(const[c,u]of s)for(let h=0;h<u.length;h++){const d=a/r.length*2*Math.PI,f=(Math.random()-.5)*Ii.HEIGHT;n.set(u[h].id,{x:Math.cos(d)*i,y:f,z:Math.sin(d)*i}),a++}return n}function P2(r,e,t){const n=[...new Set(r.map(f=>f.cluster||pm(f.name)))],i=T2(n),s=A2(r,i),a=C2(t),c=Ii.SIMULATION_ITERATIONS,u=.9;for(let f=0;f<c;f++){const m=1-f/c;S2(s,Ii.FORCE_STRENGTH*m),M2(s,a,Ii.LINK_DISTANCE),E2(s,i,.05*m),b2(s,u),w2(s,Ii.RADIUS,Ii.HEIGHT)}const h=new Map;for(const f of s)h.set(f.id,{x:f.x,y:f.y,z:f.z});const d=R2(e,r);return{tables:h,entryPoints:d,clusters:i}}function L2(r,e,t){const n=[],i=new Set;for(const u of t){const h=`${u.sourceId}-${u.targetTableId}`;i.has(h)||(i.add(h),r.find(f=>f.id===u.sourceId)&&n.push({id:h,sourceTableId:u.sourceId,sourceFieldId:"",targetTableId:u.targetTableId,targetFieldId:"",type:"one-to-many"}))}const s=P2(r,e,n),a=r.map(u=>({...u,position:s.tables.get(u.id)})),c=e.map(u=>({...u,position:s.entryPoints.get(u.id)}));return{tables:a,entryPoints:c}}function I2(){const{isPanelOpen:r,activePanel:e,closePanel:t,selection:n}=Fn(),i=kS(),s=HS(),a=VS();return!r||e!=="details"?null:L.jsxs("div",{className:"absolute right-4 top-4 w-80 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Details"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4",children:[i&&L.jsx(N2,{table:i,paths:a}),s&&L.jsx(D2,{entryPoint:s}),!i&&!s&&L.jsx("p",{className:"text-slate-400 text-sm",children:"Select a node to view details"})]})]})}function N2({table:r,paths:e}){const t=r.fields.filter(i=>i.sensitivity!=="public"&&i.sensitivity!=="low"),n=e.filter(i=>!i.isTested);return L.jsxs("div",{className:"space-y-4",children:[L.jsxs("div",{children:[L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("h3",{className:"text-xl font-bold text-white",children:r.name}),L.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:Is[r.sensitivity]+"33",color:Is[r.sensitivity]},children:r.sensitivity})]}),r.schema&&L.jsx("p",{className:"text-slate-400 text-sm",children:r.schema})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(Ls,{label:"Fields",value:r.fields.length}),L.jsx(Ls,{label:"Accesses",value:r.accessCount}),L.jsx(Ls,{label:"Sensitive",value:t.length,color:t.length>0?"#f59e0b":void 0}),L.jsx(Ls,{label:"Untested Paths",value:n.length,color:n.length>0?"#ef4444":void 0})]}),L.jsxs("div",{children:[L.jsxs("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:["Fields (",r.fields.length,")"]}),L.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:r.fields.map(i=>L.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-800/50 text-sm",children:[L.jsxs("div",{className:"flex items-center gap-2",children:[i.isPrimaryKey&&L.jsx("span",{title:"Primary Key",children:"🔑"}),i.isForeignKey&&L.jsx("span",{title:"Foreign Key",children:"🔗"}),L.jsx("span",{className:"text-white",children:i.name}),L.jsx("span",{className:"text-slate-500",children:i.dataType})]}),L.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:Is[i.sensitivity]},title:i.sensitivity})]},i.id))})]}),e.length>0&&L.jsxs("div",{children:[L.jsxs("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:["Access Paths (",e.length,")"]}),L.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:e.slice(0,10).map(i=>L.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-800/50 text-sm",children:[L.jsx("span",{className:"text-slate-300",children:i.operation}),L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsxs("span",{className:"text-slate-500",children:["depth: ",i.depth]}),!i.isTested&&L.jsx("span",{className:"text-red-400 text-xs",children:"untested"})]})]},i.id))})]})]})}function D2({entryPoint:r}){return L.jsxs("div",{className:"space-y-4",children:[L.jsxs("div",{children:[L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold ${U2(r.method)}`,children:r.method}),L.jsx("h3",{className:"text-lg font-bold text-white truncate",children:r.path})]}),L.jsx("p",{className:"text-slate-400 text-sm mt-1",children:r.framework})]}),r.authLevel==="public"&&L.jsxs("div",{className:"p-3 rounded bg-red-500/20 border border-red-500/50",children:[L.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),L.jsx("span",{className:"font-medium",children:"Public Endpoint"})]}),L.jsx("p",{className:"text-red-300 text-sm mt-1",children:"This endpoint is accessible without authentication"})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(Ls,{label:"Auth Level",value:r.authLevel,color:Q_[r.authLevel]}),L.jsx(Ls,{label:"Security Tier",value:r.securityTier}),L.jsx(Ls,{label:"Reachable Tables",value:r.reachableTables.length})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Source"}),L.jsxs("div",{className:"p-2 rounded bg-slate-800/50 text-sm font-mono",children:[L.jsx("span",{className:"text-slate-400",children:r.file}),L.jsxs("span",{className:"text-slate-500",children:[":",r.line]})]})]}),r.reachableTables.length>0&&L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Reachable Tables"}),L.jsx("div",{className:"flex flex-wrap gap-1",children:r.reachableTables.map(e=>L.jsx("span",{className:"px-2 py-1 rounded bg-slate-800 text-slate-300 text-xs",children:e},e))})]})]})}function Ls({label:r,value:e,color:t}){return L.jsxs("div",{className:"p-3 rounded bg-slate-800/50",children:[L.jsx("p",{className:"text-slate-400 text-xs",children:r}),L.jsx("p",{className:"text-lg font-semibold",style:{color:t||"#f8fafc"},children:e})]})}function U2(r){const e={GET:"bg-green-500/20 text-green-400",POST:"bg-blue-500/20 text-blue-400",PUT:"bg-amber-500/20 text-amber-400",PATCH:"bg-purple-500/20 text-purple-400",DELETE:"bg-red-500/20 text-red-400",ALL:"bg-slate-500/20 text-slate-400"};return e[r]||e.ALL}function O2(){const{isPanelOpen:r,activePanel:e,closePanel:t,galaxyData:n,setViewMode:i,setFilters:s}=Fn(),a=W.useMemo(()=>{if(!n)return null;const c=n.entryPoints.filter(m=>m.authLevel==="public"),u=n.tables.filter(m=>m.sensitivity==="critical"||m.sensitivity==="high"),h=n.dataPaths.filter(m=>!m.isTested),d=n.entryPoints.filter(m=>m.securityTier==="P0"),f=c.filter(m=>m.reachableTables.some(g=>u.some(x=>x.id===g)));return{publicEndpoints:c,criticalTables:u,untestedPaths:h,p0Endpoints:d,publicToSensitive:f,healthScore:n.stats.healthScore}},[n]);return!r||e!=="security"||!a?null:(a.publicToSensitive.length>0||a.untestedPaths.length>0,L.jsxs("div",{className:"absolute right-4 top-4 w-80 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Security Overview"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4 space-y-4",children:[L.jsxs("div",{className:"text-center p-4 rounded-lg bg-slate-800/50",children:[L.jsx("div",{className:"text-4xl font-bold",style:{color:F2(a.healthScore)},children:a.healthScore}),L.jsx("p",{className:"text-slate-400 text-sm",children:"Security Health Score"})]}),a.publicToSensitive.length>0&&L.jsxs("div",{className:"p-3 rounded bg-red-500/20 border border-red-500/50",children:[L.jsxs("div",{className:"flex items-center gap-2 text-red-400 font-medium",children:[L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),a.publicToSensitive.length," Public → Sensitive Paths"]}),L.jsx("p",{className:"text-red-300 text-sm mt-1",children:"Public endpoints can reach sensitive data without authentication"}),L.jsx("button",{onClick:()=>{i("security"),s({publicOnly:!0})},className:"mt-2 text-sm text-red-400 hover:text-red-300 underline",children:"View in Security Mode →"})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(_u,{label:"Public Endpoints",value:a.publicEndpoints.length,color:a.publicEndpoints.length>0?"#ef4444":"#22c55e",onClick:()=>s({publicOnly:!0})}),L.jsx(_u,{label:"P0 Endpoints",value:a.p0Endpoints.length,color:K_.P0}),L.jsx(_u,{label:"Sensitive Tables",value:a.criticalTables.length,color:Is.high,onClick:()=>s({minSensitivity:"high"})}),L.jsx(_u,{label:"Untested Paths",value:a.untestedPaths.length,color:a.untestedPaths.length>0?"#f59e0b":"#22c55e",onClick:()=>s({untestedOnly:!0})})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Sensitivity Distribution"}),L.jsx("div",{className:"space-y-2",children:["critical","high","medium","low","public"].map(c=>{const u=(n==null?void 0:n.stats.sensitiveFields[c])||0,h=(n==null?void 0:n.stats.fieldCount)||1,d=Math.round(u/h*100);return L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Is[c]}}),L.jsx("span",{className:"text-slate-300 text-sm capitalize flex-1",children:c}),L.jsx("span",{className:"text-slate-400 text-sm",children:u}),L.jsx("div",{className:"w-20 h-2 bg-slate-700 rounded-full overflow-hidden",children:L.jsx("div",{className:"h-full rounded-full",style:{width:`${d}%`,backgroundColor:Is[c]}})})]},c)})})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Quick Actions"}),L.jsxs("div",{className:"space-y-2",children:[L.jsx("button",{onClick:()=>i("security"),className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"🔒 Enable Security Mode"}),L.jsx("button",{onClick:()=>i("coverage"),className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"📊 View Test Coverage"}),L.jsx("button",{onClick:()=>s({untestedOnly:!0}),className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"⚠️ Show Untested Paths"})]})]})]})]}))}function _u({label:r,value:e,color:t,onClick:n}){return L.jsxs("button",{onClick:n,className:"p-3 rounded bg-slate-800/50 hover:bg-slate-800 transition-colors text-left",children:[L.jsx("p",{className:"text-slate-400 text-xs",children:r}),L.jsx("p",{className:"text-2xl font-bold",style:{color:t},children:e})]})}function F2(r){return r>=80?"#22c55e":r>=60?"#eab308":r>=40?"#f97316":"#ef4444"}function z2(){const{isPanelOpen:r,activePanel:e,closePanel:t,viewMode:n,setViewMode:i,filters:s,setFilters:a,resetFilters:c,display:u,setDisplay:h,resetCamera:d}=Fn(),{play:f,getConfig:m,setConfig:g,toggleMute:x,setVolume:S}=fm(),[y,_]=W.useState(m),b=W.useCallback(R=>{g({enabled:R}),_(C=>({...C,enabled:R})),R&&f("powerUp")},[g,f]),M=W.useCallback(()=>{const R=x();_(C=>({...C,muted:R})),R||f("click")},[x,f]),T=W.useCallback(R=>{S(R),_(C=>({...C,volume:R}))},[S]);return!r||e!=="settings"?null:L.jsxs("div",{className:"absolute right-4 top-4 w-72 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Controls"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4 space-y-6",children:[L.jsx(Ua,{title:"View Mode",children:L.jsx("div",{className:"grid grid-cols-2 gap-2",children:B2.map(R=>L.jsxs("button",{onClick:()=>i(R.value),className:`p-2 rounded text-sm transition-colors ${n===R.value?"bg-blue-500/20 text-blue-400 border border-blue-500/50":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:[R.icon," ",R.label]},R.value))})}),L.jsx(Ua,{title:"Filters",children:L.jsxs("div",{className:"space-y-3",children:[L.jsxs("div",{children:[L.jsx("label",{className:"text-xs text-slate-400 block mb-1",children:"Min Sensitivity"}),L.jsxs("select",{value:s.minSensitivity||"",onChange:R=>a({minSensitivity:R.target.value||null}),className:"w-full p-2 rounded bg-slate-800 text-slate-300 text-sm border border-slate-700",children:[L.jsx("option",{value:"",children:"All"}),L.jsx("option",{value:"low",children:"Low+"}),L.jsx("option",{value:"medium",children:"Medium+"}),L.jsx("option",{value:"high",children:"High+"}),L.jsx("option",{value:"critical",children:"Critical"})]})]}),L.jsxs("div",{children:[L.jsx("label",{className:"text-xs text-slate-400 block mb-1",children:"Operation Type"}),L.jsxs("select",{value:s.operationType||"",onChange:R=>a({operationType:R.target.value||null}),className:"w-full p-2 rounded bg-slate-800 text-slate-300 text-sm border border-slate-700",children:[L.jsx("option",{value:"",children:"All"}),L.jsx("option",{value:"read",children:"Read"}),L.jsx("option",{value:"write",children:"Write"}),L.jsx("option",{value:"delete",children:"Delete"})]})]}),L.jsx(gr,{label:"Untested paths only",checked:s.untestedOnly,onChange:R=>a({untestedOnly:R})}),L.jsx(gr,{label:"Public endpoints only",checked:s.publicOnly,onChange:R=>a({publicOnly:R})}),L.jsx("button",{onClick:c,className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-400 text-sm transition-colors",children:"Reset Filters"})]})}),L.jsx(Ua,{title:"Display",children:L.jsxs("div",{className:"space-y-3",children:[L.jsx(gr,{label:"Show field moons",checked:u.showFields,onChange:R=>h({showFields:R})}),L.jsx(gr,{label:"Show data paths",checked:u.showPaths,onChange:R=>h({showPaths:R})}),L.jsx(gr,{label:"Show relationships",checked:u.showRelationships,onChange:R=>h({showRelationships:R})}),L.jsx(gr,{label:"Show labels",checked:u.showLabels,onChange:R=>h({showLabels:R})}),L.jsx(gr,{label:"Enable bloom effect",checked:u.enableBloom,onChange:R=>h({enableBloom:R})}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Animation Speed: ",u.animationSpeed.toFixed(1),"x"]}),L.jsx("input",{type:"range",min:"0",max:"2",step:"0.1",value:u.animationSpeed,onChange:R=>h({animationSpeed:parseFloat(R.target.value)}),className:"w-full"})]}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Path Opacity: ",Math.round(u.pathOpacity*100),"%"]}),L.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.1",value:u.pathOpacity,onChange:R=>h({pathOpacity:parseFloat(R.target.value)}),className:"w-full"})]})]})}),L.jsx(Ua,{title:"Camera",children:L.jsx("button",{onClick:d,className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-300 text-sm transition-colors",children:"🎥 Reset Camera"})}),L.jsx(Ua,{title:"Sound",children:L.jsxs("div",{className:"space-y-3",children:[L.jsx(gr,{label:"Enable sounds",checked:y.enabled,onChange:b}),L.jsx(gr,{label:"Mute",checked:y.muted,onChange:M}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Volume: ",Math.round(y.volume*100),"%"]}),L.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:y.volume,onChange:R=>T(parseFloat(R.target.value)),className:"w-full",disabled:!y.enabled||y.muted})]}),L.jsxs("div",{className:"flex gap-2",children:[L.jsx("button",{onClick:()=>f("hover"),className:"flex-1 p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",disabled:!y.enabled||y.muted,children:"🔊 Test"}),L.jsx("button",{onClick:()=>f("alertCritical"),className:"flex-1 p-2 rounded bg-red-900/50 hover:bg-red-800/50 text-red-300 text-xs transition-colors",disabled:!y.enabled||y.muted,children:"🚨 Alert"})]})]})})]})]})}const B2=[{value:"overview",label:"Overview",icon:"🌌"},{value:"security",label:"Security",icon:"🔒"},{value:"coverage",label:"Coverage",icon:"📊"},{value:"blast-radius",label:"Impact",icon:"💥"}];function Ua({title:r,children:e}){return L.jsxs("div",{children:[L.jsx("h3",{className:"text-sm font-medium text-slate-300 mb-2",children:r}),e]})}function gr({label:r,checked:e,onChange:t}){return L.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[L.jsx("span",{className:"text-sm text-slate-300",children:r}),L.jsx("button",{onClick:()=>t(!e),className:`w-10 h-5 rounded-full transition-colors ${e?"bg-blue-500":"bg-slate-700"}`,children:L.jsx("div",{className:`w-4 h-4 rounded-full bg-white transition-transform ${e?"translate-x-5":"translate-x-0.5"}`})})]})}function k2(){const[r,e]=W.useState(!1),[t,n]=W.useState(""),{galaxyData:i,selectTable:s,selectEntryPoint:a,focusOnNode:c}=Fn(),u=W.useMemo(()=>{if(!i||!t.trim())return{tables:[],entryPoints:[],fields:[]};const f=t.toLowerCase(),m=i.tables.filter(S=>S.name.toLowerCase().includes(f)).slice(0,5),g=i.entryPoints.filter(S=>S.path.toLowerCase().includes(f)).slice(0,5),x=i.tables.flatMap(S=>S.fields.map(y=>({...y,tableName:S.name}))).filter(S=>S.name.toLowerCase().includes(f)).slice(0,5);return{tables:m,entryPoints:g,fields:x}},[i,t]);W.useEffect(()=>{const f=m=>{(m.metaKey||m.ctrlKey)&&m.key==="k"&&(m.preventDefault(),e(!0)),m.key==="Escape"&&(e(!1),n(""))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[]);const h=W.useCallback((f,m)=>{f==="table"?s(m):a(m),c(m),e(!1),n("")},[s,a,c]),d=u.tables.length>0||u.entryPoints.length>0||u.fields.length>0;return L.jsxs(L.Fragment,{children:[L.jsxs("button",{onClick:()=>e(!0),className:"absolute left-4 top-4 flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-800/80 hover:bg-slate-700 text-slate-400 text-sm transition-colors",children:[L.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),"Search...",L.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-700 text-xs",children:"⌘K"})]}),r&&L.jsx("div",{className:"absolute inset-0 flex items-start justify-center pt-20 bg-black/50 backdrop-blur-sm z-50",children:L.jsxs("div",{className:"w-full max-w-lg bg-slate-900 rounded-lg border border-slate-700 shadow-2xl overflow-hidden",children:[L.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-slate-700",children:[L.jsx("svg",{className:"w-5 h-5 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),L.jsx("input",{type:"text",value:t,onChange:f=>n(f.target.value),placeholder:"Search tables, fields, endpoints...",className:"flex-1 bg-transparent text-white placeholder-slate-500 outline-none",autoFocus:!0}),L.jsx("button",{onClick:()=>{e(!1),n("")},className:"text-slate-400 hover:text-white",children:L.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-700 text-xs",children:"ESC"})})]}),t&&L.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[!d&&L.jsx("p",{className:"p-4 text-slate-400 text-center",children:"No results found"}),u.tables.length>0&&L.jsx(vf,{title:"Tables",children:u.tables.map(f=>L.jsx(xf,{icon:"🪐",label:f.name,sublabel:`${f.fields.length} fields`,onClick:()=>h("table",f.id)},f.id))}),u.entryPoints.length>0&&L.jsx(vf,{title:"Entry Points",children:u.entryPoints.map(f=>L.jsx(xf,{icon:"🛸",label:f.path,sublabel:`${f.method} • ${f.framework}`,onClick:()=>h("entryPoint",f.id)},f.id))}),u.fields.length>0&&L.jsx(vf,{title:"Fields",children:u.fields.map(f=>L.jsx(xf,{icon:"🌙",label:f.name,sublabel:`${f.tableName} • ${f.dataType}`,onClick:()=>h("table",f.tableId)},f.id))})]})]})})]})}function vf({title:r,children:e}){return L.jsxs("div",{className:"border-b border-slate-800 last:border-0",children:[L.jsx("p",{className:"px-4 py-2 text-xs text-slate-500 uppercase",children:r}),e]})}function xf({icon:r,label:e,sublabel:t,onClick:n}){return L.jsxs("button",{onClick:n,className:"w-full flex items-center gap-3 px-4 py-2 hover:bg-slate-800 text-left transition-colors",children:[L.jsx("span",{children:r}),L.jsxs("div",{className:"flex-1 min-w-0",children:[L.jsx("p",{className:"text-white truncate",children:e}),L.jsx("p",{className:"text-slate-500 text-sm truncate",children:t})]})]})}function H2(){const{galaxyData:r,viewMode:e,isLiveMode:t}=Fn();if(!r)return null;const{stats:n}=r;return L.jsxs("div",{className:"absolute left-4 bottom-4 flex items-end gap-4",children:[L.jsx("div",{className:"bg-slate-900/80 backdrop-blur-sm rounded-lg p-3 border border-slate-700",children:L.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[L.jsx(yf,{icon:"🪐",value:n.tableCount,label:"Tables"}),L.jsx(yf,{icon:"🛸",value:n.entryPointCount,label:"Endpoints"}),L.jsx(yf,{icon:"🔗",value:n.pathCount,label:"Paths"}),L.jsx("div",{className:"w-px h-8 bg-slate-700"}),L.jsxs("div",{className:"text-center",children:[L.jsx("div",{className:"text-lg font-bold",style:{color:$R(n.healthScore)},children:n.healthScore}),L.jsx("div",{className:"text-slate-500 text-xs",children:"Health"})]})]})}),L.jsx("div",{className:"bg-slate-900/80 backdrop-blur-sm rounded-lg px-3 py-2 border border-slate-700",children:L.jsx("span",{className:"text-slate-400 text-sm",children:V2[e]})}),t&&L.jsxs("div",{className:"bg-green-500/20 backdrop-blur-sm rounded-lg px-3 py-2 border border-green-500/50 flex items-center gap-2",children:[L.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),L.jsx("span",{className:"text-green-400 text-sm",children:"Live"})]})]})}function yf({icon:r,value:e,label:t}){return L.jsxs("div",{className:"text-center",children:[L.jsxs("div",{className:"flex items-center gap-1",children:[L.jsx("span",{children:r}),L.jsx("span",{className:"text-white font-medium",children:e})]}),L.jsx("div",{className:"text-slate-500 text-xs",children:t})]})}const V2={overview:"🌌 Overview",security:"🔒 Security",coverage:"📊 Coverage","blast-radius":"💥 Impact",timeline:"📅 Timeline"};function Sf(){const r=[{id:"users",name:"users",sensitivity:"high",cluster:"auth",fields:[{id:"users.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"users.email",name:"email",dataType:"varchar",sensitivity:"high"},{id:"users.password_hash",name:"password_hash",dataType:"varchar",sensitivity:"critical"},{id:"users.name",name:"name",dataType:"varchar",sensitivity:"medium"},{id:"users.created_at",name:"created_at",dataType:"timestamp",sensitivity:"low"}]},{id:"sessions",name:"sessions",sensitivity:"high",cluster:"auth",fields:[{id:"sessions.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"sessions.user_id",name:"user_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"users.id",sensitivity:"medium"},{id:"sessions.token",name:"token",dataType:"varchar",sensitivity:"critical"},{id:"sessions.expires_at",name:"expires_at",dataType:"timestamp",sensitivity:"low"}]},{id:"orders",name:"orders",sensitivity:"high",cluster:"commerce",fields:[{id:"orders.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"orders.user_id",name:"user_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"users.id",sensitivity:"medium"},{id:"orders.total",name:"total",dataType:"decimal",sensitivity:"high"},{id:"orders.status",name:"status",dataType:"varchar",sensitivity:"low"}]},{id:"products",name:"products",sensitivity:"low",cluster:"commerce",fields:[{id:"products.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"products.name",name:"name",dataType:"varchar",sensitivity:"public"},{id:"products.price",name:"price",dataType:"decimal",sensitivity:"public"},{id:"products.inventory",name:"inventory",dataType:"integer",sensitivity:"low"}]},{id:"payments",name:"payments",sensitivity:"critical",cluster:"commerce",fields:[{id:"payments.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"payments.order_id",name:"order_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"orders.id",sensitivity:"medium"},{id:"payments.card_last4",name:"card_last4",dataType:"varchar",sensitivity:"high"},{id:"payments.amount",name:"amount",dataType:"decimal",sensitivity:"high"}]},{id:"audit_logs",name:"audit_logs",sensitivity:"medium",cluster:"analytics",fields:[{id:"audit_logs.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"audit_logs.user_id",name:"user_id",dataType:"uuid",sensitivity:"medium"},{id:"audit_logs.action",name:"action",dataType:"varchar",sensitivity:"low"},{id:"audit_logs.timestamp",name:"timestamp",dataType:"timestamp",sensitivity:"low"}]}],e=[{id:"ep-login",path:"/api/auth/login",method:"POST",authLevel:"public",securityTier:"P0",file:"src/routes/auth.ts",line:15,framework:"Express",reachableTables:["users","sessions"]},{id:"ep-register",path:"/api/auth/register",method:"POST",authLevel:"public",securityTier:"P1",file:"src/routes/auth.ts",line:45,framework:"Express",reachableTables:["users"]},{id:"ep-profile",path:"/api/users/profile",method:"GET",authLevel:"authenticated",securityTier:"P2",file:"src/routes/users.ts",line:10,framework:"Express",reachableTables:["users"]},{id:"ep-orders",path:"/api/orders",method:"GET",authLevel:"authenticated",securityTier:"P2",file:"src/routes/orders.ts",line:20,framework:"Express",reachableTables:["orders","products"]},{id:"ep-checkout",path:"/api/checkout",method:"POST",authLevel:"authenticated",securityTier:"P0",file:"src/routes/checkout.ts",line:30,framework:"Express",reachableTables:["orders","payments","products"]},{id:"ep-products",path:"/api/products",method:"GET",authLevel:"public",securityTier:"P4",file:"src/routes/products.ts",line:5,framework:"Express",reachableTables:["products"]},{id:"ep-admin-users",path:"/api/admin/users",method:"GET",authLevel:"admin",securityTier:"P1",file:"src/routes/admin.ts",line:10,framework:"Express",reachableTables:["users","orders","audit_logs"]}],t=[{id:"path-1",sourceId:"ep-login",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:1e3,depth:1,isTested:!0,sensitivity:"high"},{id:"path-2",sourceId:"ep-login",sourceType:"entryPoint",targetTableId:"sessions",operation:"write",frequency:1e3,depth:2,isTested:!0,sensitivity:"critical"},{id:"path-3",sourceId:"ep-register",sourceType:"entryPoint",targetTableId:"users",operation:"write",frequency:100,depth:1,isTested:!1,sensitivity:"high"},{id:"path-4",sourceId:"ep-profile",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:500,depth:1,isTested:!0,sensitivity:"high"},{id:"path-5",sourceId:"ep-orders",sourceType:"entryPoint",targetTableId:"orders",operation:"read",frequency:300,depth:1,isTested:!0,sensitivity:"high"},{id:"path-6",sourceId:"ep-checkout",sourceType:"entryPoint",targetTableId:"orders",operation:"write",frequency:50,depth:1,isTested:!1,sensitivity:"high"},{id:"path-7",sourceId:"ep-checkout",sourceType:"entryPoint",targetTableId:"payments",operation:"write",frequency:50,depth:2,isTested:!1,sensitivity:"critical"},{id:"path-8",sourceId:"ep-products",sourceType:"entryPoint",targetTableId:"products",operation:"read",frequency:2e3,depth:1,isTested:!0,sensitivity:"public"},{id:"path-9",sourceId:"ep-admin-users",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:10,depth:1,isTested:!0,sensitivity:"high"},{id:"path-10",sourceId:"ep-admin-users",sourceType:"entryPoint",targetTableId:"audit_logs",operation:"read",frequency:10,depth:2,isTested:!1,sensitivity:"medium"}],n=[{id:"rel-1",sourceTableId:"sessions",sourceFieldId:"sessions.user_id",targetTableId:"users",targetFieldId:"users.id",type:"one-to-many"},{id:"rel-2",sourceTableId:"orders",sourceFieldId:"orders.user_id",targetTableId:"users",targetFieldId:"users.id",type:"one-to-many"},{id:"rel-3",sourceTableId:"payments",sourceFieldId:"payments.order_id",targetTableId:"orders",targetFieldId:"orders.id",type:"one-to-one"}];return{tables:r.map(i=>({...i,rowCount:Math.floor(Math.random()*1e5),accessCount:Math.floor(Math.random()*1e3)})),entryPoints:e,dataPaths:t,relationships:n}}function G2(){const{setGalaxyData:r,setLoading:e,setError:t,isLoading:n,error:i,galaxyData:s}=Fn(),[a,c]=W.useState(!1),[u,h]=W.useState("api"),d=W.useCallback(async()=>{var f;e(!0),t(null);try{let m,g="api";if(a)m=Sf(),g="mock";else try{const _=await fetch("/api/galaxy");if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);m=await _.json(),(!m.tables||m.tables.length===0)&&(console.log("No tables found in API response, falling back to mock data"),m=Sf(),g="mock")}catch(_){console.log("API fetch failed, falling back to mock data:",_),m=Sf(),g="mock"}h(g);const{tables:x,entryPoints:S}=L2(m.tables,m.entryPoints,m.dataPaths),y=m.stats??{tableCount:x.length,fieldCount:x.reduce((_,b)=>_+b.fields.length,0),entryPointCount:S.length,pathCount:m.dataPaths.length,sensitiveFields:{critical:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="critical").length,0),high:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="high").length,0),medium:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="medium").length,0),low:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="low").length,0),public:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="public").length,0)},untestedPaths:m.dataPaths.filter(_=>!_.isTested).length,deadCodeCount:0,healthScore:((f=m.stats)==null?void 0:f.healthScore)??72};r({tables:x,entryPoints:S,dataPaths:m.dataPaths,relationships:m.relationships??[],stats:y,lastUpdated:m.lastUpdated??new Date().toISOString()})}catch(m){t(m instanceof Error?m.message:"Failed to load galaxy data")}},[a,r,e,t]);return W.useEffect(()=>{d()},[d]),{isLoading:n,error:i,data:s,refetch:d,useMock:a,setUseMock:c,dataSource:u}}function W2(){const{viewMode:r,setViewMode:e,togglePanel:t,activePanel:n}=Fn();return L.jsxs("div",{className:"absolute right-4 top-4 flex items-center gap-2 z-10",children:[L.jsx("div",{className:"flex bg-slate-800/80 rounded-lg overflow-hidden",children:[{mode:"overview",icon:"🌌",label:"Overview"},{mode:"security",icon:"🔒",label:"Security"},{mode:"coverage",icon:"📊",label:"Coverage"}].map(({mode:i,icon:s,label:a})=>L.jsx("button",{onClick:()=>e(i),className:`px-3 py-2 text-sm transition-colors ${r===i?"bg-blue-500/30 text-blue-400":"text-slate-400 hover:text-white hover:bg-slate-700"}`,title:a,children:s},i))}),L.jsxs("div",{className:"flex bg-slate-800/80 rounded-lg overflow-hidden",children:[L.jsx("button",{onClick:()=>t("security"),className:`px-3 py-2 text-sm transition-colors ${n==="security"?"bg-red-500/30 text-red-400":"text-slate-400 hover:text-white"}`,title:"Security Panel",children:"🛡️"}),L.jsx("button",{onClick:()=>t("settings"),className:`px-3 py-2 text-sm transition-colors ${n==="settings"?"bg-purple-500/30 text-purple-400":"text-slate-400 hover:text-white"}`,title:"Settings",children:"⚙️"})]})]})}function j2({dataSource:r,useMock:e,setUseMock:t,tableCount:n,entryPointCount:i}){return L.jsxs("div",{className:"absolute left-4 top-4 z-10 flex flex-col gap-2",children:[L.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-400 bg-slate-800/80 px-3 py-2 rounded-lg cursor-pointer",children:[L.jsx("input",{type:"checkbox",checked:e,onChange:s=>t(s.target.checked),className:"rounded"}),"Use Mock Data"]}),L.jsxs("div",{className:`text-xs px-3 py-1.5 rounded-lg ${r==="api"?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:[r==="api"?"🔗 Live Data":"🎭 Mock Data",L.jsxs("span",{className:"ml-2 opacity-70",children:[n," tables • ",i," endpoints"]})]})]})}function $2(){const{isLoading:r,error:e,data:t,refetch:n,useMock:i,setUseMock:s,dataSource:a}=G2();return e&&!t?L.jsxs("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)] text-center",children:[L.jsx("div",{className:"text-6xl mb-4",children:"🌑"}),L.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:"Galaxy Unavailable"}),L.jsx("p",{className:"text-slate-400 mb-4",children:e}),L.jsxs("div",{className:"flex gap-3",children:[L.jsx("button",{onClick:n,className:"px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-colors",children:"Retry"}),L.jsx("button",{onClick:()=>s(!0),className:"px-4 py-2 bg-slate-600 hover:bg-slate-500 text-white rounded-lg transition-colors",children:"Use Mock Data"})]})]}):r&&!t?L.jsxs("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)]",children:[L.jsx("div",{className:"text-6xl mb-4 animate-pulse",children:"🌌"}),L.jsx("p",{className:"text-slate-400",children:"Loading galaxy..."}),L.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Scanning boundaries and call graph..."})]}):L.jsxs("div",{className:"relative h-[calc(100vh-200px)] bg-slate-950 rounded-lg overflow-hidden",children:[L.jsx(j2,{dataSource:a,useMock:i,setUseMock:s,tableCount:(t==null?void 0:t.tables.length)??0,entryPointCount:(t==null?void 0:t.entryPoints.length)??0}),L.jsx(W2,{}),L.jsx(y2,{className:"w-full h-full"}),L.jsx(k2,{}),L.jsx(H2,{}),L.jsx(I2,{}),L.jsx(O2,{}),L.jsx(z2,{})]})}export{$2 as GalaxyTab};
4177
- //# sourceMappingURL=GalaxyTab-BsAmWarF.js.map
4176
+ `)}}}const VR=W.forwardRef((r,e)=>{const[t]=W.useState(()=>new HR(null));return W.createElement("primitive",Ei({},r,{object:t,ref:e,attach:"material"}))});function GR(r,e){const t=r+"Geometry";return W.forwardRef(({args:n,children:i,...s},a)=>{const c=W.useRef(null);return W.useImperativeHandle(a,()=>c.current),W.useLayoutEffect(()=>void(e==null?void 0:e(c.current))),W.createElement("mesh",Ei({ref:c},s),W.createElement(t,{attach:"geometry",args:n}),i)})}const mp=GR("sphere");let Ss,Da;const WR=W.createContext(null),X_=new lt,q_=new U,jR=W.forwardRef(({children:r,range:e,limit:t=1e3,...n},i)=>{const s=W.useRef(null);W.useImperativeHandle(i,()=>s.current,[]);const[a,c]=W.useState([]),[[u,h,d]]=W.useState(()=>[new Float32Array(t*3),Float32Array.from({length:t*3},()=>1),Float32Array.from({length:t},()=>1)]);W.useEffect(()=>{s.current.geometry.attributes.position.needsUpdate=!0}),Bi(()=>{for(s.current.updateMatrix(),s.current.updateMatrixWorld(),X_.copy(s.current.matrixWorld).invert(),s.current.geometry.drawRange.count=Math.min(t,e!==void 0?e:t,a.length),Ss=0;Ss<a.length;Ss++)Da=a[Ss].current,Da.getWorldPosition(q_).applyMatrix4(X_),q_.toArray(u,Ss*3),s.current.geometry.attributes.position.needsUpdate=!0,Da.matrixWorldNeedsUpdate=!0,Da.color.toArray(h,Ss*3),s.current.geometry.attributes.color.needsUpdate=!0,d.set([Da.size],Ss),s.current.geometry.attributes.size.needsUpdate=!0});const f=W.useMemo(()=>({getParent:()=>s,subscribe:m=>(c(g=>[...g,m]),()=>c(g=>g.filter(x=>x.current!==m.current)))}),[]);return W.createElement("points",Ei({userData:{instances:a},matrixAutoUpdate:!1,ref:s,raycast:()=>null},n),W.createElement("bufferGeometry",null,W.createElement("bufferAttribute",{attach:"attributes-position",count:u.length/3,array:u,itemSize:3,usage:Ds}),W.createElement("bufferAttribute",{attach:"attributes-color",count:h.length/3,array:h,itemSize:3,usage:Ds}),W.createElement("bufferAttribute",{attach:"attributes-size",count:d.length,array:d,itemSize:1,usage:Ds})),W.createElement(WR.Provider,{value:f},r))}),XR=W.forwardRef(({children:r,positions:e,colors:t,sizes:n,stride:i=3,...s},a)=>{const c=W.useRef(null);return W.useImperativeHandle(a,()=>c.current,[]),Bi(()=>{const u=c.current.geometry.attributes;u.position.needsUpdate=!0,t&&(u.color.needsUpdate=!0),n&&(u.size.needsUpdate=!0)}),W.createElement("points",Ei({ref:c},s),W.createElement("bufferGeometry",null,W.createElement("bufferAttribute",{attach:"attributes-position",count:e.length/i,array:e,itemSize:i,usage:Ds}),t&&W.createElement("bufferAttribute",{attach:"attributes-color",count:t.length/i,array:t,itemSize:3,usage:Ds}),n&&W.createElement("bufferAttribute",{attach:"attributes-size",count:n.length/i,array:n,itemSize:1,usage:Ds})),r)}),qR=W.forwardRef((r,e)=>r.positions instanceof Float32Array?W.createElement(XR,Ei({},r,{ref:e})):W.createElement(jR,Ei({},r,{ref:e})));function Mi(r){return new U(r.x,r.y,r.z)}function YR(r,e){const t=e.x-r.x,n=e.y-r.y,i=e.z-r.z;return Math.sqrt(t*t+n*n+i*i)}function Uy(r,e){return{x:(r.x+e.x)/2,y:(r.y+e.y)/2,z:(r.z+e.z)/2}}function Y_(r){const e=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z);return e===0?{x:0,y:0,z:0}:{x:r.x/e,y:r.y/e,z:r.z/e}}function ZR(r,e){return{x:r.x-e.x,y:r.y-e.y,z:r.z-e.z}}function JR(r,e,t=50,n=.3){const i=Uy(r,e),s=YR(r,e),a=Y_(ZR(e,r)),c=Y_({x:-a.z,y:a.y+n*s,z:a.x}),u={x:i.x+c.x*s*n,y:i.y+c.y*s*n,z:i.z+c.z*s*n};return new Hp([Mi(r),Mi(u),Mi(e)])}function KR(r,e,t,n=0){const i=r.x+Math.cos(t)*e,s=r.y+Math.sin(n)*Math.sin(t)*e*.3,a=r.z+Math.sin(t)*e;return{x:i,y:s,z:a}}function QR(r,e,t=.5,n=3){const i=Math.log10(r+1)/6,s=Math.log10(e+1)/4,a=i*.6+s*.4;return t+a*(n-t)}function $R(r,e,t=.15){const n=Math.log10(r+1)/3,i=e?1.5:1;return t*(1+n*.5)*i}function e2(r,e=.05,t=.3){const n=Math.log10(r+1)/3;return e+n*(t-e)}function t2({enableControls:r=!0,autoRotate:e=!1,autoRotateSpeed:t=.5}){const n=W.useRef(null),{camera:i}=Pi(),{camera:s,setCameraPosition:a,setCameraTarget:c}=Fn();W.useEffect(()=>{if(s.position){const h=Mi(s.position);i.position.copy(h)}},[s.position,i]),W.useEffect(()=>{if(n.current&&s.target){const h=Mi(s.target);n.current.target.copy(h),n.current.update()}},[s.target]),W.useEffect(()=>{i.zoom=s.zoom,i.updateProjectionMatrix()},[s.zoom,i]),Bi(()=>{if(!n.current)return;const h=i.position,d=n.current.target;Math.abs(h.x-s.position.x)+Math.abs(h.y-s.position.y)+Math.abs(h.z-s.position.z)>.1&&a({x:h.x,y:h.y,z:h.z}),Math.abs(d.x-s.target.x)+Math.abs(d.y-s.target.y)+Math.abs(d.z-s.target.z)>.1&&c({x:d.x,y:d.y,z:d.z})});const u={autoRotate:e,autoRotateSpeed:t,minDistance:Vr.MIN_ZOOM*20,maxDistance:Vr.MAX_ZOOM*100,maxPolarAngle:Math.PI*.85,minPolarAngle:Math.PI*.15};return L.jsx(kR,{ref:n,...u})}function n2(){const r=W.useRef(null),e=W.useRef(null),{viewMode:t}=Fn();Bi(s=>{const a=s.clock.elapsedTime;r.current&&(r.current.position.x=Math.sin(a*.1)*30,r.current.position.z=Math.cos(a*.1)*30),e.current&&(e.current.position.x=Math.cos(a*.08)*25,e.current.position.z=Math.sin(a*.08)*25)});const n=t==="security"?.2:.3,i=t==="security"?.8:.6;return L.jsxs(L.Fragment,{children:[L.jsx("ambientLight",{intensity:n,color:"#4a5568"}),L.jsx("directionalLight",{position:[50,50,25],intensity:.5,color:"#ffffff",castShadow:!1}),L.jsx("pointLight",{ref:r,position:[30,20,30],intensity:i,color:"#60a5fa",distance:100,decay:2}),L.jsx("pointLight",{ref:e,position:[-25,-10,-25],intensity:i*.7,color:"#f472b6",distance:80,decay:2}),L.jsx("pointLight",{position:[0,0,0],intensity:.4,color:"#a78bfa",distance:50,decay:2}),t==="security"&&L.jsx("pointLight",{position:[0,30,0],intensity:.3,color:"#ef4444",distance:100,decay:2})]})}function El(r){return new ke(r)}function hm(r){return El(Is[r])}function Oy(r){return IS[r]}function i2(r){return El(K_[r])}function r2(r){return El(Q_[r])}function s2(r){return El(NS[r])}function o2(r){return jg[r]??jg.other??"#7f8c8d"}function a2(r){return El(o2(r))}function l2(r){return r>=80?"#22c55e":r>=60?"#eab308":r>=40?"#f97316":"#ef4444"}function c2({path:r,sourcePosition:e,targetPosition:t,isSelected:n=!1,isHovered:i=!1,onClick:s,onPointerOver:a,onPointerOut:c}){const u=W.useRef(null),h=W.useRef(0),{display:d,viewMode:f}=Fn(),m=W.useMemo(()=>JR(e,t,us.CURVE_SEGMENTS),[e,t]),g=W.useMemo(()=>m.getPoints(us.CURVE_SEGMENTS),[m]),x=W.useMemo(()=>e2(r.frequency,us.BASE_WIDTH,us.MAX_WIDTH),[r.frequency]),S=W.useMemo(()=>f==="security"?hm(r.sensitivity):s2(r.operation),[r.operation,r.sensitivity,f]),y=W.useMemo(()=>{let _=d.pathOpacity;return f==="coverage"&&!r.isTested&&(_=Math.min(1,_*1.5)),n?1:i?Math.min(1,_*1.3):_},[d.pathOpacity,f,r.isTested,n,i]);return Bi((_,b)=>{if(!u.current)return;h.current-=us.FLOW_SPEED*b*d.animationSpeed;const M=u.current.material;M&&"dashOffset"in M&&(M.dashOffset=h.current)}),d.showPaths?L.jsxs("group",{onClick:s,onPointerOver:a,onPointerOut:c,children:[L.jsx(Tu,{ref:u,points:g,color:S,lineWidth:n?x*2:x,transparent:!0,opacity:y,dashed:!0,dashSize:us.DASH_SIZE,gapSize:us.GAP_SIZE}),(n||i)&&L.jsx(Tu,{points:g,color:S,lineWidth:x*3,transparent:!0,opacity:y*.3}),!r.isTested&&f==="coverage"&&L.jsx(Tu,{points:g,color:"#ef4444",lineWidth:x*.5,transparent:!0,opacity:.5,dashed:!0,dashSize:.2,gapSize:.8})]}):null}const u2={"one-to-one":"#60a5fa","one-to-many":"#34d399","many-to-many":"#a78bfa"};function h2({relationship:r,sourcePosition:e,targetPosition:t,isHighlighted:n=!1}){const{display:i}=Fn(),s=W.useMemo(()=>{const c=Mi(e),u=Mi(t),h=Mi(Uy(e,t));return h.y+=1,new Ku(c,h,u).getPoints(20)},[e,t]),a=W.useMemo(()=>u2[r.type]||"#6b7280",[r.type]);return i.showRelationships?L.jsxs("group",{children:[L.jsx(Tu,{points:s,color:a,lineWidth:n?2:1,transparent:!0,opacity:n?.8:.3,dashed:!n,dashSize:.3,gapSize:.2}),n&&L.jsxs(L.Fragment,{children:[L.jsxs("mesh",{position:Mi(e),children:[L.jsx("sphereGeometry",{args:[.15,8,8]}),L.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.8})]}),L.jsxs("mesh",{position:Mi(t),children:[r.type.endsWith("many")?L.jsx("coneGeometry",{args:[.2,.3,8]}):L.jsx("sphereGeometry",{args:[.15,8,8]}),L.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.8})]})]})]}):null}function d2(){const{display:r}=Fn();return r.enableBloom,null}function f2({count:r=Xg.STAR_COUNT,radius:e=Ii.RADIUS*3,size:t=Xg.STAR_SIZE,twinkle:n=!0}){const i=W.useRef(null),s=W.useMemo(()=>{const u=new Float32Array(r*3);for(let h=0;h<r;h++){const d=Math.random()*Math.PI*2,f=Math.acos(2*Math.random()-1),m=e*(.5+Math.random()*.5);u[h*3]=m*Math.sin(f)*Math.cos(d),u[h*3+1]=m*Math.sin(f)*Math.sin(d),u[h*3+2]=m*Math.cos(f)}return u},[r,e]),a=W.useMemo(()=>{const u=new Float32Array(r);for(let h=0;h<r;h++)u[h]=t*(.5+Math.random()*1.5);return u},[r,t]),c=W.useMemo(()=>{const u=new Float32Array(r*3);for(let h=0;h<r;h++){const d=Math.random();d<.1?(u[h*3]=.7,u[h*3+1]=.8,u[h*3+2]=1):d<.2?(u[h*3]=1,u[h*3+1]=.95,u[h*3+2]=.8):(u[h*3]=1,u[h*3+1]=1,u[h*3+2]=1)}return u},[r]);return Bi(u=>{if(!n||!i.current)return;const d=i.current.geometry.getAttribute("size");if(d){const f=u.clock.elapsedTime;for(let m=0;m<r;m++){const g=.5+m%10*.1,x=Math.sin(f*g+m)*.3+.7;d.array[m]=a[m]*x}d.needsUpdate=!0}}),L.jsxs(qR,{ref:i,limit:r,children:[L.jsxs("bufferGeometry",{children:[L.jsx("bufferAttribute",{attach:"attributes-position",count:r,array:s,itemSize:3}),L.jsx("bufferAttribute",{attach:"attributes-color",count:r,array:c,itemSize:3}),L.jsx("bufferAttribute",{attach:"attributes-size",count:r,array:a,itemSize:1})]}),L.jsx(VR,{transparent:!0,vertexColors:!0,size:t,sizeAttenuation:!0,depthWrite:!1,opacity:.8})]})}const Z_={hover:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.1,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:.1,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:.5,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},select:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.1,p_env_punch:.3,p_env_decay:.2,p_base_freq:.4,p_freq_limit:0,p_freq_ramp:.2,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.5,p_arp_speed:.6,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.2,sample_rate:44100,sample_size:8},deselect:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.15,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:-.2,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.8,p_lpf_ramp:-.2,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},zoom:{oldParams:!0,wave_type:3,p_env_attack:.1,p_env_sustain:.2,p_env_punch:0,p_env_decay:.3,p_base_freq:.1,p_freq_limit:0,p_freq_ramp:.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.5,p_lpf_ramp:.2,p_lpf_resonance:.5,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.1,sample_rate:44100,sample_size:8},pathActivate:{oldParams:!0,wave_type:2,p_env_attack:0,p_env_sustain:.15,p_env_punch:.2,p_env_decay:.25,p_base_freq:.3,p_freq_limit:0,p_freq_ramp:.15,p_freq_dramp:0,p_vib_strength:.1,p_vib_speed:.3,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.7,p_lpf_ramp:0,p_lpf_resonance:.3,p_hpf_freq:.05,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},dataFlow:{oldParams:!0,wave_type:0,p_env_attack:.05,p_env_sustain:.1,p_env_punch:0,p_env_decay:.1,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:.2,p_vib_speed:.5,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.6,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.2,p_hpf_ramp:0,sound_vol:.08,sample_rate:44100,sample_size:8},alertLow:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.1,p_env_punch:0,p_env_decay:.2,p_base_freq:.35,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8},alertMedium:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.15,p_env_punch:.1,p_env_decay:.15,p_base_freq:.4,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.3,p_arp_speed:.5,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.5,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},alertHigh:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.2,p_env_punch:.2,p_env_decay:.1,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.4,p_arp_speed:.4,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.4,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.22,sample_rate:44100,sample_size:8},alertCritical:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.25,p_env_punch:.3,p_env_decay:.1,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:-.1,p_freq_dramp:0,p_vib_strength:.1,p_vib_speed:.8,p_arp_mod:.5,p_arp_speed:.3,p_duty:.5,p_duty_ramp:0,p_repeat_speed:.3,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.25,sample_rate:44100,sample_size:8},warp:{oldParams:!0,wave_type:3,p_env_attack:.1,p_env_sustain:.3,p_env_punch:.2,p_env_decay:.4,p_base_freq:.05,p_freq_limit:0,p_freq_ramp:.4,p_freq_dramp:.1,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.3,p_lpf_ramp:.3,p_lpf_resonance:.5,p_hpf_freq:0,p_hpf_ramp:.1,sound_vol:.2,sample_rate:44100,sample_size:8},scan:{oldParams:!0,wave_type:2,p_env_attack:.05,p_env_sustain:.4,p_env_punch:0,p_env_decay:.2,p_base_freq:.2,p_freq_limit:0,p_freq_ramp:.2,p_freq_dramp:-.1,p_vib_strength:.3,p_vib_speed:.6,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:.6,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.5,p_lpf_ramp:0,p_lpf_resonance:.3,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.12,sample_rate:44100,sample_size:8},powerUp:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.2,p_env_punch:.3,p_env_decay:.3,p_base_freq:.2,p_freq_limit:0,p_freq_ramp:.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:.5,p_arp_speed:.5,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.2,sample_rate:44100,sample_size:8},powerDown:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.15,p_env_punch:0,p_env_decay:.4,p_base_freq:.5,p_freq_limit:0,p_freq_ramp:-.3,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:-.3,p_arp_speed:.5,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:.8,p_lpf_ramp:-.3,p_lpf_resonance:0,p_hpf_freq:0,p_hpf_ramp:0,sound_vol:.18,sample_rate:44100,sample_size:8},click:{oldParams:!0,wave_type:1,p_env_attack:0,p_env_sustain:.02,p_env_punch:0,p_env_decay:.05,p_base_freq:.6,p_freq_limit:0,p_freq_ramp:0,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:.5,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.3,p_hpf_ramp:0,sound_vol:.12,sample_rate:44100,sample_size:8},blip:{oldParams:!0,wave_type:0,p_env_attack:0,p_env_sustain:.05,p_env_punch:0,p_env_decay:.1,p_base_freq:.55,p_freq_limit:0,p_freq_ramp:.1,p_freq_dramp:0,p_vib_strength:0,p_vib_speed:0,p_arp_mod:0,p_arp_speed:0,p_duty:0,p_duty_ramp:0,p_repeat_speed:0,p_pha_offset:0,p_pha_ramp:0,p_lpf_freq:1,p_lpf_ramp:0,p_lpf_resonance:0,p_hpf_freq:.1,p_hpf_ramp:0,sound_vol:.15,sample_rate:44100,sample_size:8}};class p2{constructor(e={}){co(this,"config");co(this,"audioCache",new Map);co(this,"sfxr",null);co(this,"initialized",!1);co(this,"initPromise",null);this.config={enabled:!0,volume:.5,muted:!1,...e}}async initialize(){if(!this.initialized)return this.initPromise?this.initPromise:(this.initPromise=this.doInitialize(),this.initPromise)}async doInitialize(){try{this.sfxr=await DS(()=>import("./sfxr-bUoNgW_R.js").then(e=>e.s),__vite__mapDeps([0,1,2]));for(const[e,t]of Object.entries(Z_)){const n=this.sfxr.sfxr.toAudio(t);this.audioCache.set(e,n)}this.initialized=!0}catch{this.config.enabled=!1}}async play(e){if(!this.config.enabled||this.config.muted)return;this.initialized||await this.initialize();const t=this.audioCache.get(e);if(t)try{const n=t.cloneNode();n.volume=this.config.volume,await n.play()}catch{}}async playWithVariation(e,t=.1){if(!this.config.enabled||this.config.muted||!this.sfxr)return;this.initialized||await this.initialize();const n={...Z_[e]},i=n.p_base_freq;n.p_base_freq=i*(1+(Math.random()-.5)*t*2);try{const s=this.sfxr.sfxr.toAudio(n);s.volume=this.config.volume,await s.play()}catch{}}async playAlert(e){const t={low:"alertLow",medium:"alertMedium",high:"alertHigh",critical:"alertCritical"};await this.play(t[e])}setConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}toggleMute(){return this.config.muted=!this.config.muted,this.config.muted}setVolume(e){this.config.volume=Math.max(0,Math.min(1,e))}setEnabled(e){this.config.enabled=e}}let J_=null;function m2(){return J_??(J_=new p2),J_}function dm(r={}){const{enabled:e=!0,volume:t=.5,debounceMs:n=50}=r,i=m2(),s=W.useRef(new Map);W.useEffect(()=>{i.setConfig({enabled:e,volume:t})},[e,t,i]);const a=W.useCallback(g=>{const x=Date.now(),S=s.current.get(g)??0;x-S<n||(s.current.set(g,x),i.play(g))},[i,n]),c=W.useCallback((g,x=.1)=>{const S=Date.now(),y=s.current.get(g)??0;S-y<n||(s.current.set(g,S),i.playWithVariation(g,x))},[i,n]),u=W.useCallback(g=>{i.playAlert(g)},[i]),h=W.useCallback(()=>i.toggleMute(),[i]),d=W.useCallback(g=>{i.setVolume(g)},[i]),f=W.useCallback(()=>i.getConfig(),[i]),m=W.useCallback(g=>{i.setConfig(g)},[i]);return{play:a,playVaried:c,playAlert:u,toggleMute:h,setVolume:d,getConfig:f,setConfig:m}}const gf={GET:"#22c55e",POST:"#3b82f6",PUT:"#f59e0b",PATCH:"#8b5cf6",DELETE:"#ef4444",ALL:"#6b7280"};function g2({entryPoint:r,isSelected:e=!1,isHovered:t=!1,onClick:n,onPointerOver:i,onPointerOut:s}){const a=W.useRef(null),[c,u]=W.useState(!1),{display:h,viewMode:d}=Fn(),{play:f,playAlert:m}=dm({debounceMs:100}),g=W.useCallback(T=>{T.stopPropagation(),u(!0),r.authLevel==="public"?m("medium"):f("hover"),i==null||i()},[r.authLevel,f,m,i]),x=W.useCallback(T=>{T.stopPropagation(),u(!1),s==null||s()},[s]),S=W.useCallback(()=>{r.securityTier==="P0"?m("critical"):r.securityTier==="P1"?m("high"):f("select"),n==null||n()},[r.securityTier,f,m,n]),y=W.useMemo(()=>{const T=r2(r.authLevel),R=i2(r.securityTier),C=new ke(gf[r.method]??gf.ALL??"#6b7280");return{auth:T,tier:R,method:C}},[r.authLevel,r.securityTier,r.method]),_=W.useMemo(()=>r.position?Mi(r.position):new U(0,0,0),[r.position]);Bi((T,R)=>{if(!a.current)return;a.current.rotation.y+=.005*h.animationSpeed;const C=e?Wr.SELECTION_SCALE:t||c?Wr.HOVER_SCALE:1;a.current.scale.lerp(new U(C,C,C),.1)});const b=d==="security"&&r.authLevel==="public",M=US.SCALE;return L.jsxs("group",{ref:a,position:_,onClick:S,onPointerOver:g,onPointerOut:x,children:[L.jsxs("mesh",{children:[L.jsx("octahedronGeometry",{args:[M,0]}),L.jsx("meshStandardMaterial",{color:y.auth,emissive:y.auth,emissiveIntensity:b?.8:.3,roughness:.3,metalness:.7})]}),L.jsxs("mesh",{children:[L.jsx("octahedronGeometry",{args:[M*.5,0]}),L.jsx("meshStandardMaterial",{color:y.method,emissive:y.method,emissiveIntensity:.5,roughness:.2,metalness:.8})]}),L.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[L.jsx("torusGeometry",{args:[M*1.5,M*.1,8,32]}),L.jsx("meshStandardMaterial",{color:y.tier,emissive:y.tier,emissiveIntensity:.4,roughness:.4,metalness:.6})]}),e&&L.jsxs("mesh",{rotation:[0,0,Math.PI/4],children:[L.jsx("torusGeometry",{args:[M*2,M*.05,8,32]}),L.jsx("meshBasicMaterial",{color:"#ffffff",transparent:!0,opacity:.8})]}),r.authLevel==="public"&&h.enableBloom&&L.jsxs("mesh",{children:[L.jsx("sphereGeometry",{args:[M*2,16,16]}),L.jsx("meshBasicMaterial",{color:"#ff3333",transparent:!0,opacity:.1,side:An})]}),h.showLabels&&(t||c||e)&&L.jsx(lm,{position:[0,M*2,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:`${Gn.FONT_SIZE}px`,fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${y.auth.getStyle()}`,maxWidth:"250px"},children:[L.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[L.jsx("span",{style:{background:gf[r.method],padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:700},children:r.method}),L.jsx("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis"},children:r.path})]}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7,marginTop:"4px"},children:[r.framework," • ",r.authLevel,r.authLevel==="public"&&L.jsx("span",{style:{color:"#ef4444",marginLeft:"4px"},children:"⚠️ PUBLIC"})]}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7},children:["Reaches ",r.reachableTables.length," tables"]})]})})]})}function _2({field:r,parentPosition:e,parentRadius:t,orbitIndex:n,totalFields:i,isSelected:s=!1,isHovered:a=!1,onClick:c,onPointerOver:u,onPointerOut:h}){const d=W.useRef(null),f=W.useRef(n/i*Math.PI*2+Math.random()*.5),{display:m,viewMode:g}=Fn(),x=W.useMemo(()=>{const M=r.sensitivity!=="public"&&r.sensitivity!=="low";return $R(r.accessCount,M,xd.RADIUS)},[r.accessCount,r.sensitivity]),S=W.useMemo(()=>{const M=hm(r.sensitivity),T=Oy(r.sensitivity);return{main:M,emissive:M,emissiveIntensity:T}},[r.sensitivity]),y=t+xd.ORBIT_RADIUS,_=W.useMemo(()=>(n%3-1)*.3,[n]);Bi((M,T)=>{if(!d.current)return;f.current+=xd.ORBIT_SPEED*T*m.animationSpeed;const R=KR(e,y,f.current,_);d.current.position.set(R.x,R.y,R.z),d.current.rotation.y+=.02*m.animationSpeed;const C=s?Wr.SELECTION_SCALE:a?Wr.HOVER_SCALE:1;d.current.scale.lerp(new U(C,C,C),.1)});const b=g==="security"&&(r.sensitivity==="critical"||r.sensitivity==="high");return m.showFields?L.jsxs("group",{children:[L.jsx(mp,{ref:d,args:[x,16,16],onClick:M=>{M.stopPropagation(),c==null||c()},onPointerOver:M=>{M.stopPropagation(),u==null||u()},onPointerOut:M=>{M.stopPropagation(),h==null||h()},children:L.jsx("meshStandardMaterial",{color:S.main,emissive:S.emissive,emissiveIntensity:b?S.emissiveIntensity*3:S.emissiveIntensity,roughness:.5,metalness:.5})}),m.showLabels&&a&&d.current&&L.jsx(lm,{position:d.current.position.clone().add(new U(0,x+.3,0)),center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:"10px",fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${S.main.getStyle()}`},children:[L.jsx("div",{style:{fontWeight:600},children:r.name}),L.jsxs("div",{style:{opacity:.7},children:[r.dataType," • ",r.sensitivity]}),r.isPrimaryKey&&L.jsx("div",{style:{color:"#fbbf24"},children:"🔑 Primary Key"}),r.isForeignKey&&L.jsx("div",{style:{color:"#60a5fa"},children:"🔗 Foreign Key"}),!r.isTested&&L.jsx("div",{style:{color:"#ef4444"},children:"⚠️ Untested"})]})})]}):null}function v2({table:r,isSelected:e=!1,isHovered:t=!1,onClick:n,onPointerOver:i,onPointerOut:s}){const a=W.useRef(null),c=W.useRef(null),[u,h]=W.useState(!1),{display:d,viewMode:f}=Fn(),{play:m,playVaried:g}=dm({debounceMs:100}),x=W.useCallback(R=>{R.stopPropagation(),h(!0);const C=r.sensitivity==="critical"?.3:.1;g("hover",C),i==null||i()},[r.sensitivity,g,i]),S=W.useCallback(R=>{R.stopPropagation(),h(!1),s==null||s()},[s]),y=W.useCallback(()=>{m("select"),n==null||n()},[m,n]),_=W.useMemo(()=>QR(r.rowCount,r.accessCount,qg.MIN_RADIUS,qg.MAX_RADIUS),[r.rowCount,r.accessCount]),b=W.useMemo(()=>{const R=hm(r.sensitivity),C=Oy(r.sensitivity),N=a2(r.cluster||"other");return{main:R,emissive:R,emissiveIntensity:C,cluster:N}},[r.sensitivity,r.cluster]),M=W.useMemo(()=>r.position?Mi(r.position):new U(0,0,0),[r.position]);Bi((R,C)=>{if(!a.current)return;a.current.rotation.y+=Wr.IDLE_ROTATION*d.animationSpeed;const N=e?Wr.SELECTION_SCALE:t||u?Wr.HOVER_SCALE:1;if(a.current.scale.lerp(new U(N,N,N),.1),c.current&&r.sensitivity!=="public"){const B=Math.sin(R.clock.elapsedTime*Wr.PULSE_FREQUENCY)*.5+.5,A=c.current.material;A.opacity=.1+B*.2*b.emissiveIntensity}});const T=f==="security"&&(r.sensitivity==="critical"||r.sensitivity==="high");return L.jsxs("group",{position:M,children:[L.jsx(mp,{ref:a,args:[_,32,32],onClick:y,onPointerOver:x,onPointerOut:S,children:L.jsx("meshStandardMaterial",{color:b.main,emissive:b.emissive,emissiveIntensity:T?b.emissiveIntensity*2:b.emissiveIntensity,roughness:.7,metalness:.3})}),r.sensitivity!=="public"&&d.enableBloom&&L.jsx(mp,{ref:c,args:[_*1.3,16,16],children:L.jsx("meshBasicMaterial",{color:b.main,transparent:!0,opacity:.15,side:An})}),e&&L.jsxs("mesh",{rotation:[Math.PI/2,0,0],children:[L.jsx("ringGeometry",{args:[_*1.5,_*1.7,32]}),L.jsx("meshBasicMaterial",{color:"#ffffff",transparent:!0,opacity:.8,side:Si})]}),d.showLabels&&(t||u||e)&&L.jsx(lm,{position:[0,_+Gn.OFFSET,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},children:L.jsxs("div",{style:{background:`rgba(15, 23, 42, ${Gn.BG_OPACITY})`,color:"#f8fafc",padding:`${Gn.PADDING}px ${Gn.PADDING*2}px`,borderRadius:"4px",fontSize:`${Gn.FONT_SIZE}px`,fontFamily:Gn.FONT_FAMILY,whiteSpace:"nowrap",border:`1px solid ${b.main.getStyle()}`},children:[L.jsx("div",{style:{fontWeight:600},children:r.name}),L.jsxs("div",{style:{fontSize:"10px",opacity:.7},children:[r.fields.length," fields • ",r.accessCount," accesses"]})]})})]})}function Fy(){return L.jsxs("mesh",{children:[L.jsx("sphereGeometry",{args:[1,16,16]}),L.jsx("meshBasicMaterial",{color:"#4a5568",wireframe:!0})]})}function x2(){const{galaxyData:r,selection:e,display:t,selectTable:n,selectEntryPoint:i,selectPath:s,setHovered:a}=Fn(),c=OS(),u=FS(),h=zS(),d=W.useMemo(()=>{const S=new Map;if(r){for(const y of r.tables)y.position&&S.set(y.id,y.position);for(const y of r.entryPoints)y.position&&S.set(y.id,y.position)}return S},[r]),f=W.useCallback(S=>{n(S)},[n]),m=W.useCallback(S=>{i(S)},[i]),g=W.useCallback(S=>{s(S)},[s]),x=W.useCallback((S,y)=>{a(S,y)},[a]);return r?L.jsxs(L.Fragment,{children:[L.jsx(f2,{}),L.jsx(n2,{}),L.jsx(t2,{}),L.jsx(d2,{}),t.showRelationships&&r.relationships.map(S=>{const y=d.get(S.sourceTableId),_=d.get(S.targetTableId);if(!y||!_)return null;const b=e.selectedTable===S.sourceTableId||e.selectedTable===S.targetTableId;return L.jsx(h2,{relationship:S,sourcePosition:y,targetPosition:_,isHighlighted:b},S.id)}),u.map(S=>{const y=d.get(S.sourceId),_=d.get(S.targetTableId);return!y||!_?null:L.jsx(c2,{path:S,sourcePosition:y,targetPosition:_,isSelected:e.selectedPath===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>{g(S.id)},onPointerOver:()=>{x(S.id,"path")},onPointerOut:()=>{x(null,null)}},S.id)}),c.map(S=>L.jsxs("group",{children:[L.jsx(v2,{table:S,isSelected:e.selectedTable===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>{f(S.id)},onPointerOver:()=>{x(S.id,"table")},onPointerOut:()=>{x(null,null)}}),t.showFields&&S.position&&S.fields.map((y,_)=>L.jsx(_2,{field:y,parentPosition:S.position,parentRadius:1,orbitIndex:_,totalFields:S.fields.length,isSelected:e.selectedField===y.id,isHovered:e.hoveredNode===y.id,onClick:()=>{n(S.id)},onPointerOver:()=>{x(y.id,"field")},onPointerOut:()=>{x(null,null)}},y.id))]},S.id)),h.map(S=>L.jsx(g2,{entryPoint:S,isSelected:e.selectedEntryPoint===S.id,isHovered:e.hoveredNode===S.id,onClick:()=>{m(S.id)},onPointerOver:()=>{x(S.id,"entryPoint")},onPointerOut:()=>{x(null,null)}},S.id))]}):L.jsx(Fy,{})}function y2({className:r="",enableControls:e=!0,autoRotate:t=!1}){return L.jsx("div",{className:`w-full h-full ${r}`,children:L.jsxs(vR,{camera:{position:[Vr.DEFAULT_POSITION.x,Vr.DEFAULT_POSITION.y,Vr.DEFAULT_POSITION.z],fov:Vr.FOV,near:Vr.NEAR,far:Vr.FAR},gl:{antialias:!0,toneMapping:Fu,toneMappingExposure:1},dpr:[1,2],children:[L.jsx("color",{attach:"background",args:["#0f172a"]}),L.jsx("fog",{attach:"fog",args:["#0f172a",50,200]}),L.jsx(W.Suspense,{fallback:L.jsx(Fy,{}),children:L.jsx(x2,{})})]})})}function fm(r){const e=r.toLowerCase();for(const[t,n]of Object.entries(BS))if(n.some(i=>e.includes(i)))return t;return"other"}function S2(r,e){for(let t=0;t<r.length;t++)for(let n=t+1;n<r.length;n++){const i=r[t],s=r[n];if(i.fixed&&s.fixed)continue;const a=s.x-i.x,c=s.y-i.y,u=s.z-i.z,h=Math.sqrt(a*a+c*c+u*u)||.1,d=i.cluster===s.cluster?.5:1,f=e*d/(h*h),m=a/h*f,g=c/h*f,x=u/h*f;i.fixed||(i.vx-=m/i.mass,i.vy-=g/i.mass,i.vz-=x/i.mass),s.fixed||(s.vx+=m/s.mass,s.vy+=g/s.mass,s.vz+=x/s.mass)}}function M2(r,e,t){const n=new Map(r.map(i=>[i.id,i]));for(const i of e){const s=n.get(i.source),a=n.get(i.target);if(!s||!a||s.fixed&&a.fixed)continue;const c=a.x-s.x,u=a.y-s.y,h=a.z-s.z,d=Math.sqrt(c*c+u*u+h*h)||.1,f=(d-t)*i.strength*.1,m=c/d*f,g=u/d*f,x=h/d*f;s.fixed||(s.vx+=m/s.mass,s.vy+=g/s.mass,s.vz+=x/s.mass),a.fixed||(a.vx-=m/a.mass,a.vy-=g/a.mass,a.vz-=x/a.mass)}}function E2(r,e,t){for(const n of r){if(n.fixed)continue;const i=e.get(n.cluster);if(!i)continue;const s=i.x-n.x,a=i.y-n.y,c=i.z-n.z;n.vx+=s*t,n.vy+=a*t,n.vz+=c*t}}function b2(r,e){for(const t of r)t.fixed||(t.x+=t.vx,t.y+=t.vy,t.z+=t.vz,t.vx*=e,t.vy*=e,t.vz*=e)}function w2(r,e,t){for(const n of r){const i=Math.sqrt(n.x*n.x+n.z*n.z);if(i>e){const s=e/i;n.x*=s,n.z*=s}n.y=Math.max(-t/2,Math.min(t/2,n.y))}}function T2(r){const e=new Map,t=2*Math.PI/r.length,n=Ii.RADIUS*.6;return r.forEach((i,s)=>{const a=s*t;e.set(i,{x:Math.cos(a)*n,y:(Math.random()-.5)*Ii.HEIGHT*.3,z:Math.sin(a)*n})}),e}function A2(r,e){return r.map(t=>{const n=t.cluster||fm(t.name),i=e.get(n)||{x:0,y:0,z:0},s=Ii.CLUSTER_SEPARATION*.3;return{id:t.id,x:i.x+(Math.random()-.5)*s,y:i.y+(Math.random()-.5)*s,z:i.z+(Math.random()-.5)*s,vx:0,vy:0,vz:0,mass:1+Math.log10(t.accessCount+1),cluster:n,fixed:!1}})}function C2(r){return r.map(e=>({source:e.sourceTableId,target:e.targetTableId,strength:e.type==="one-to-one"?1:.5}))}function R2(r,e,t){const n=new Map,i=Ii.RADIUS+15,s=new Map;for(const c of r){const u=new Map;for(const m of c.reachableTables){const g=e.find(x=>x.id===m);if(g){const x=g.cluster||fm(g.name);u.set(x,(u.get(x)||0)+1)}}let h="other",d=0;for(const[m,g]of u)g>d&&(h=m,d=g);const f=s.get(h)||[];s.set(h,[...f,c])}let a=0;for(const[c,u]of s)for(let h=0;h<u.length;h++){const d=a/r.length*2*Math.PI,f=(Math.random()-.5)*Ii.HEIGHT;n.set(u[h].id,{x:Math.cos(d)*i,y:f,z:Math.sin(d)*i}),a++}return n}function P2(r,e,t){const n=[...new Set(r.map(f=>f.cluster||fm(f.name)))],i=T2(n),s=A2(r,i),a=C2(t),c=Ii.SIMULATION_ITERATIONS,u=.9;for(let f=0;f<c;f++){const m=1-f/c;S2(s,Ii.FORCE_STRENGTH*m),M2(s,a,Ii.LINK_DISTANCE),E2(s,i,.05*m),b2(s,u),w2(s,Ii.RADIUS,Ii.HEIGHT)}const h=new Map;for(const f of s)h.set(f.id,{x:f.x,y:f.y,z:f.z});const d=R2(e,r);return{tables:h,entryPoints:d,clusters:i}}function L2(r,e,t){const n=[],i=new Set;for(const u of t){const h=`${u.sourceId}-${u.targetTableId}`;i.has(h)||(i.add(h),r.find(f=>f.id===u.sourceId)&&n.push({id:h,sourceTableId:u.sourceId,sourceFieldId:"",targetTableId:u.targetTableId,targetFieldId:"",type:"one-to-many"}))}const s=P2(r,e,n),a=r.map(u=>({...u,position:s.tables.get(u.id)})),c=e.map(u=>({...u,position:s.entryPoints.get(u.id)}));return{tables:a,entryPoints:c}}function I2(){const{isPanelOpen:r,activePanel:e,closePanel:t,selection:n}=Fn(),i=kS(),s=HS(),a=VS();return!r||e!=="details"?null:L.jsxs("div",{className:"absolute right-4 top-4 w-80 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Details"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4",children:[i&&L.jsx(N2,{table:i,paths:a}),s&&L.jsx(D2,{entryPoint:s}),!i&&!s&&L.jsx("p",{className:"text-slate-400 text-sm",children:"Select a node to view details"})]})]})}function N2({table:r,paths:e}){const t=r.fields.filter(i=>i.sensitivity!=="public"&&i.sensitivity!=="low"),n=e.filter(i=>!i.isTested);return L.jsxs("div",{className:"space-y-4",children:[L.jsxs("div",{children:[L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("h3",{className:"text-xl font-bold text-white",children:r.name}),L.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:Is[r.sensitivity]+"33",color:Is[r.sensitivity]},children:r.sensitivity})]}),r.schema&&L.jsx("p",{className:"text-slate-400 text-sm",children:r.schema})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(Ls,{label:"Fields",value:r.fields.length}),L.jsx(Ls,{label:"Accesses",value:r.accessCount}),L.jsx(Ls,{label:"Sensitive",value:t.length,color:t.length>0?"#f59e0b":void 0}),L.jsx(Ls,{label:"Untested Paths",value:n.length,color:n.length>0?"#ef4444":void 0})]}),L.jsxs("div",{children:[L.jsxs("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:["Fields (",r.fields.length,")"]}),L.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:r.fields.map(i=>L.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-800/50 text-sm",children:[L.jsxs("div",{className:"flex items-center gap-2",children:[i.isPrimaryKey&&L.jsx("span",{title:"Primary Key",children:"🔑"}),i.isForeignKey&&L.jsx("span",{title:"Foreign Key",children:"🔗"}),L.jsx("span",{className:"text-white",children:i.name}),L.jsx("span",{className:"text-slate-500",children:i.dataType})]}),L.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:Is[i.sensitivity]},title:i.sensitivity})]},i.id))})]}),e.length>0&&L.jsxs("div",{children:[L.jsxs("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:["Access Paths (",e.length,")"]}),L.jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:e.slice(0,10).map(i=>L.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-slate-800/50 text-sm",children:[L.jsx("span",{className:"text-slate-300",children:i.operation}),L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsxs("span",{className:"text-slate-500",children:["depth: ",i.depth]}),!i.isTested&&L.jsx("span",{className:"text-red-400 text-xs",children:"untested"})]})]},i.id))})]})]})}function D2({entryPoint:r}){return L.jsxs("div",{className:"space-y-4",children:[L.jsxs("div",{children:[L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-bold ${U2(r.method)}`,children:r.method}),L.jsx("h3",{className:"text-lg font-bold text-white truncate",children:r.path})]}),L.jsx("p",{className:"text-slate-400 text-sm mt-1",children:r.framework})]}),r.authLevel==="public"&&L.jsxs("div",{className:"p-3 rounded bg-red-500/20 border border-red-500/50",children:[L.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),L.jsx("span",{className:"font-medium",children:"Public Endpoint"})]}),L.jsx("p",{className:"text-red-300 text-sm mt-1",children:"This endpoint is accessible without authentication"})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(Ls,{label:"Auth Level",value:r.authLevel,color:Q_[r.authLevel]}),L.jsx(Ls,{label:"Security Tier",value:r.securityTier}),L.jsx(Ls,{label:"Reachable Tables",value:r.reachableTables.length})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Source"}),L.jsxs("div",{className:"p-2 rounded bg-slate-800/50 text-sm font-mono",children:[L.jsx("span",{className:"text-slate-400",children:r.file}),L.jsxs("span",{className:"text-slate-500",children:[":",r.line]})]})]}),r.reachableTables.length>0&&L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Reachable Tables"}),L.jsx("div",{className:"flex flex-wrap gap-1",children:r.reachableTables.map(e=>L.jsx("span",{className:"px-2 py-1 rounded bg-slate-800 text-slate-300 text-xs",children:e},e))})]})]})}function Ls({label:r,value:e,color:t}){return L.jsxs("div",{className:"p-3 rounded bg-slate-800/50",children:[L.jsx("p",{className:"text-slate-400 text-xs",children:r}),L.jsx("p",{className:"text-lg font-semibold",style:{color:t||"#f8fafc"},children:e})]})}function U2(r){const e={GET:"bg-green-500/20 text-green-400",POST:"bg-blue-500/20 text-blue-400",PUT:"bg-amber-500/20 text-amber-400",PATCH:"bg-purple-500/20 text-purple-400",DELETE:"bg-red-500/20 text-red-400",ALL:"bg-slate-500/20 text-slate-400"};return e[r]||e.ALL}function O2(){const{isPanelOpen:r,activePanel:e,closePanel:t,galaxyData:n,setViewMode:i,setFilters:s}=Fn(),a=W.useMemo(()=>{if(!n)return null;const c=n.entryPoints.filter(m=>m.authLevel==="public"),u=n.tables.filter(m=>m.sensitivity==="critical"||m.sensitivity==="high"),h=n.dataPaths.filter(m=>!m.isTested),d=n.entryPoints.filter(m=>m.securityTier==="P0"),f=c.filter(m=>m.reachableTables.some(g=>u.some(x=>x.id===g)));return{publicEndpoints:c,criticalTables:u,untestedPaths:h,p0Endpoints:d,publicToSensitive:f,healthScore:n.stats.healthScore}},[n]);return!r||e!=="security"||!a?null:(a.publicToSensitive.length>0||a.untestedPaths.length>0,L.jsxs("div",{className:"absolute right-4 top-4 w-80 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Security Overview"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4 space-y-4",children:[L.jsxs("div",{className:"text-center p-4 rounded-lg bg-slate-800/50",children:[L.jsx("div",{className:"text-4xl font-bold",style:{color:F2(a.healthScore)},children:a.healthScore}),L.jsx("p",{className:"text-slate-400 text-sm",children:"Security Health Score"})]}),a.publicToSensitive.length>0&&L.jsxs("div",{className:"p-3 rounded bg-red-500/20 border border-red-500/50",children:[L.jsxs("div",{className:"flex items-center gap-2 text-red-400 font-medium",children:[L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),a.publicToSensitive.length," Public → Sensitive Paths"]}),L.jsx("p",{className:"text-red-300 text-sm mt-1",children:"Public endpoints can reach sensitive data without authentication"}),L.jsx("button",{onClick:()=>{i("security"),s({publicOnly:!0})},className:"mt-2 text-sm text-red-400 hover:text-red-300 underline",children:"View in Security Mode →"})]}),L.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[L.jsx(_u,{label:"Public Endpoints",value:a.publicEndpoints.length,color:a.publicEndpoints.length>0?"#ef4444":"#22c55e",onClick:()=>{s({publicOnly:!0})}}),L.jsx(_u,{label:"P0 Endpoints",value:a.p0Endpoints.length,color:K_.P0}),L.jsx(_u,{label:"Sensitive Tables",value:a.criticalTables.length,color:Is.high,onClick:()=>{s({minSensitivity:"high"})}}),L.jsx(_u,{label:"Untested Paths",value:a.untestedPaths.length,color:a.untestedPaths.length>0?"#f59e0b":"#22c55e",onClick:()=>{s({untestedOnly:!0})}})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Sensitivity Distribution"}),L.jsx("div",{className:"space-y-2",children:["critical","high","medium","low","public"].map(c=>{const u=(n==null?void 0:n.stats.sensitiveFields[c])||0,h=(n==null?void 0:n.stats.fieldCount)||1,d=Math.round(u/h*100);return L.jsxs("div",{className:"flex items-center gap-2",children:[L.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Is[c]}}),L.jsx("span",{className:"text-slate-300 text-sm capitalize flex-1",children:c}),L.jsx("span",{className:"text-slate-400 text-sm",children:u}),L.jsx("div",{className:"w-20 h-2 bg-slate-700 rounded-full overflow-hidden",children:L.jsx("div",{className:"h-full rounded-full",style:{width:`${d}%`,backgroundColor:Is[c]}})})]},c)})})]}),L.jsxs("div",{children:[L.jsx("h4",{className:"text-sm font-medium text-slate-300 mb-2",children:"Quick Actions"}),L.jsxs("div",{className:"space-y-2",children:[L.jsx("button",{onClick:()=>{i("security")},className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"🔒 Enable Security Mode"}),L.jsx("button",{onClick:()=>{i("coverage")},className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"📊 View Test Coverage"}),L.jsx("button",{onClick:()=>{s({untestedOnly:!0})},className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-left text-sm text-slate-300 transition-colors",children:"⚠️ Show Untested Paths"})]})]})]})]}))}function _u({label:r,value:e,color:t,onClick:n}){return L.jsxs("button",{onClick:n,className:"p-3 rounded bg-slate-800/50 hover:bg-slate-800 transition-colors text-left",children:[L.jsx("p",{className:"text-slate-400 text-xs",children:r}),L.jsx("p",{className:"text-2xl font-bold",style:{color:t},children:e})]})}function F2(r){return r>=80?"#22c55e":r>=60?"#eab308":r>=40?"#f97316":"#ef4444"}function z2(){const{isPanelOpen:r,activePanel:e,closePanel:t,viewMode:n,setViewMode:i,filters:s,setFilters:a,resetFilters:c,display:u,setDisplay:h,resetCamera:d}=Fn(),{play:f,getConfig:m,setConfig:g,toggleMute:x,setVolume:S}=dm(),[y,_]=W.useState(m),b=W.useCallback(R=>{g({enabled:R}),_(C=>({...C,enabled:R})),R&&f("powerUp")},[g,f]),M=W.useCallback(()=>{const R=x();_(C=>({...C,muted:R})),R||f("click")},[x,f]),T=W.useCallback(R=>{S(R),_(C=>({...C,volume:R}))},[S]);return!r||e!=="settings"?null:L.jsxs("div",{className:"absolute right-4 top-4 w-72 max-h-[calc(100vh-8rem)] overflow-y-auto bg-slate-900/95 backdrop-blur-sm rounded-lg border border-slate-700 shadow-xl",children:[L.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-700",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:"Controls"}),L.jsx("button",{onClick:t,className:"text-slate-400 hover:text-white transition-colors",children:L.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),L.jsxs("div",{className:"p-4 space-y-6",children:[L.jsx(Ua,{title:"View Mode",children:L.jsx("div",{className:"grid grid-cols-2 gap-2",children:B2.map(R=>L.jsxs("button",{onClick:()=>{i(R.value)},className:`p-2 rounded text-sm transition-colors ${n===R.value?"bg-blue-500/20 text-blue-400 border border-blue-500/50":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:[R.icon," ",R.label]},R.value))})}),L.jsx(Ua,{title:"Filters",children:L.jsxs("div",{className:"space-y-3",children:[L.jsxs("div",{children:[L.jsx("label",{className:"text-xs text-slate-400 block mb-1",children:"Min Sensitivity"}),L.jsxs("select",{value:s.minSensitivity||"",onChange:R=>{a({minSensitivity:R.target.value||null})},className:"w-full p-2 rounded bg-slate-800 text-slate-300 text-sm border border-slate-700",children:[L.jsx("option",{value:"",children:"All"}),L.jsx("option",{value:"low",children:"Low+"}),L.jsx("option",{value:"medium",children:"Medium+"}),L.jsx("option",{value:"high",children:"High+"}),L.jsx("option",{value:"critical",children:"Critical"})]})]}),L.jsxs("div",{children:[L.jsx("label",{className:"text-xs text-slate-400 block mb-1",children:"Operation Type"}),L.jsxs("select",{value:s.operationType||"",onChange:R=>{a({operationType:R.target.value||null})},className:"w-full p-2 rounded bg-slate-800 text-slate-300 text-sm border border-slate-700",children:[L.jsx("option",{value:"",children:"All"}),L.jsx("option",{value:"read",children:"Read"}),L.jsx("option",{value:"write",children:"Write"}),L.jsx("option",{value:"delete",children:"Delete"})]})]}),L.jsx(gr,{label:"Untested paths only",checked:s.untestedOnly,onChange:R=>{a({untestedOnly:R})}}),L.jsx(gr,{label:"Public endpoints only",checked:s.publicOnly,onChange:R=>{a({publicOnly:R})}}),L.jsx("button",{onClick:c,className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-400 text-sm transition-colors",children:"Reset Filters"})]})}),L.jsx(Ua,{title:"Display",children:L.jsxs("div",{className:"space-y-3",children:[L.jsx(gr,{label:"Show field moons",checked:u.showFields,onChange:R=>{h({showFields:R})}}),L.jsx(gr,{label:"Show data paths",checked:u.showPaths,onChange:R=>{h({showPaths:R})}}),L.jsx(gr,{label:"Show relationships",checked:u.showRelationships,onChange:R=>{h({showRelationships:R})}}),L.jsx(gr,{label:"Show labels",checked:u.showLabels,onChange:R=>{h({showLabels:R})}}),L.jsx(gr,{label:"Enable bloom effect",checked:u.enableBloom,onChange:R=>{h({enableBloom:R})}}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Animation Speed: ",u.animationSpeed.toFixed(1),"x"]}),L.jsx("input",{type:"range",min:"0",max:"2",step:"0.1",value:u.animationSpeed,onChange:R=>{h({animationSpeed:parseFloat(R.target.value)})},className:"w-full"})]}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Path Opacity: ",Math.round(u.pathOpacity*100),"%"]}),L.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.1",value:u.pathOpacity,onChange:R=>{h({pathOpacity:parseFloat(R.target.value)})},className:"w-full"})]})]})}),L.jsx(Ua,{title:"Camera",children:L.jsx("button",{onClick:d,className:"w-full p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-300 text-sm transition-colors",children:"🎥 Reset Camera"})}),L.jsx(Ua,{title:"Sound",children:L.jsxs("div",{className:"space-y-3",children:[L.jsx(gr,{label:"Enable sounds",checked:y.enabled,onChange:b}),L.jsx(gr,{label:"Mute",checked:y.muted,onChange:M}),L.jsxs("div",{children:[L.jsxs("label",{className:"text-xs text-slate-400 block mb-1",children:["Volume: ",Math.round(y.volume*100),"%"]}),L.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:y.volume,onChange:R=>{T(parseFloat(R.target.value))},className:"w-full",disabled:!y.enabled||y.muted})]}),L.jsxs("div",{className:"flex gap-2",children:[L.jsx("button",{onClick:()=>{f("hover")},className:"flex-1 p-2 rounded bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs transition-colors",disabled:!y.enabled||y.muted,children:"🔊 Test"}),L.jsx("button",{onClick:()=>{f("alertCritical")},className:"flex-1 p-2 rounded bg-red-900/50 hover:bg-red-800/50 text-red-300 text-xs transition-colors",disabled:!y.enabled||y.muted,children:"🚨 Alert"})]})]})})]})]})}const B2=[{value:"overview",label:"Overview",icon:"🌌"},{value:"security",label:"Security",icon:"🔒"},{value:"coverage",label:"Coverage",icon:"📊"},{value:"blast-radius",label:"Impact",icon:"💥"}];function Ua({title:r,children:e}){return L.jsxs("div",{children:[L.jsx("h3",{className:"text-sm font-medium text-slate-300 mb-2",children:r}),e]})}function gr({label:r,checked:e,onChange:t}){return L.jsxs("label",{className:"flex items-center justify-between cursor-pointer",children:[L.jsx("span",{className:"text-sm text-slate-300",children:r}),L.jsx("button",{onClick:()=>{t(!e)},className:`w-10 h-5 rounded-full transition-colors ${e?"bg-blue-500":"bg-slate-700"}`,children:L.jsx("div",{className:`w-4 h-4 rounded-full bg-white transition-transform ${e?"translate-x-5":"translate-x-0.5"}`})})]})}function k2(){const[r,e]=W.useState(!1),[t,n]=W.useState(""),{galaxyData:i,selectTable:s,selectEntryPoint:a,focusOnNode:c}=Fn(),u=W.useMemo(()=>{if(!i||!t.trim())return{tables:[],entryPoints:[],fields:[]};const f=t.toLowerCase(),m=i.tables.filter(S=>S.name.toLowerCase().includes(f)).slice(0,5),g=i.entryPoints.filter(S=>S.path.toLowerCase().includes(f)).slice(0,5),x=i.tables.flatMap(S=>S.fields.map(y=>({...y,tableName:S.name}))).filter(S=>S.name.toLowerCase().includes(f)).slice(0,5);return{tables:m,entryPoints:g,fields:x}},[i,t]);W.useEffect(()=>{const f=m=>{(m.metaKey||m.ctrlKey)&&m.key==="k"&&(m.preventDefault(),e(!0)),m.key==="Escape"&&(e(!1),n(""))};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}},[]);const h=W.useCallback((f,m)=>{f==="table"?s(m):a(m),c(m),e(!1),n("")},[s,a,c]),d=u.tables.length>0||u.entryPoints.length>0||u.fields.length>0;return L.jsxs(L.Fragment,{children:[L.jsxs("button",{onClick:()=>{e(!0)},className:"absolute left-4 top-4 flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-800/80 hover:bg-slate-700 text-slate-400 text-sm transition-colors",children:[L.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),"Search...",L.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-700 text-xs",children:"⌘K"})]}),r&&L.jsx("div",{className:"absolute inset-0 flex items-start justify-center pt-20 bg-black/50 backdrop-blur-sm z-50",children:L.jsxs("div",{className:"w-full max-w-lg bg-slate-900 rounded-lg border border-slate-700 shadow-2xl overflow-hidden",children:[L.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-slate-700",children:[L.jsx("svg",{className:"w-5 h-5 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:L.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),L.jsx("input",{type:"text",value:t,onChange:f=>{n(f.target.value)},placeholder:"Search tables, fields, endpoints...",className:"flex-1 bg-transparent text-white placeholder-slate-500 outline-none",autoFocus:!0}),L.jsx("button",{onClick:()=>{e(!1),n("")},className:"text-slate-400 hover:text-white",children:L.jsx("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-700 text-xs",children:"ESC"})})]}),t&&L.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[!d&&L.jsx("p",{className:"p-4 text-slate-400 text-center",children:"No results found"}),u.tables.length>0&&L.jsx(_f,{title:"Tables",children:u.tables.map(f=>L.jsx(vf,{icon:"🪐",label:f.name,sublabel:`${f.fields.length} fields`,onClick:()=>{h("table",f.id)}},f.id))}),u.entryPoints.length>0&&L.jsx(_f,{title:"Entry Points",children:u.entryPoints.map(f=>L.jsx(vf,{icon:"🛸",label:f.path,sublabel:`${f.method} • ${f.framework}`,onClick:()=>{h("entryPoint",f.id)}},f.id))}),u.fields.length>0&&L.jsx(_f,{title:"Fields",children:u.fields.map(f=>L.jsx(vf,{icon:"🌙",label:f.name,sublabel:`${f.tableName} • ${f.dataType}`,onClick:()=>{h("table",f.tableId)}},f.id))})]})]})})]})}function _f({title:r,children:e}){return L.jsxs("div",{className:"border-b border-slate-800 last:border-0",children:[L.jsx("p",{className:"px-4 py-2 text-xs text-slate-500 uppercase",children:r}),e]})}function vf({icon:r,label:e,sublabel:t,onClick:n}){return L.jsxs("button",{onClick:n,className:"w-full flex items-center gap-3 px-4 py-2 hover:bg-slate-800 text-left transition-colors",children:[L.jsx("span",{children:r}),L.jsxs("div",{className:"flex-1 min-w-0",children:[L.jsx("p",{className:"text-white truncate",children:e}),L.jsx("p",{className:"text-slate-500 text-sm truncate",children:t})]})]})}function H2(){const{galaxyData:r,viewMode:e,isLiveMode:t}=Fn();if(!r)return null;const{stats:n}=r;return L.jsxs("div",{className:"absolute left-4 bottom-4 flex items-end gap-4",children:[L.jsx("div",{className:"bg-slate-900/80 backdrop-blur-sm rounded-lg p-3 border border-slate-700",children:L.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[L.jsx(xf,{icon:"🪐",value:n.tableCount,label:"Tables"}),L.jsx(xf,{icon:"🛸",value:n.entryPointCount,label:"Endpoints"}),L.jsx(xf,{icon:"🔗",value:n.pathCount,label:"Paths"}),L.jsx("div",{className:"w-px h-8 bg-slate-700"}),L.jsxs("div",{className:"text-center",children:[L.jsx("div",{className:"text-lg font-bold",style:{color:l2(n.healthScore)},children:n.healthScore}),L.jsx("div",{className:"text-slate-500 text-xs",children:"Health"})]})]})}),L.jsx("div",{className:"bg-slate-900/80 backdrop-blur-sm rounded-lg px-3 py-2 border border-slate-700",children:L.jsx("span",{className:"text-slate-400 text-sm",children:V2[e]})}),t&&L.jsxs("div",{className:"bg-green-500/20 backdrop-blur-sm rounded-lg px-3 py-2 border border-green-500/50 flex items-center gap-2",children:[L.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),L.jsx("span",{className:"text-green-400 text-sm",children:"Live"})]})]})}function xf({icon:r,value:e,label:t}){return L.jsxs("div",{className:"text-center",children:[L.jsxs("div",{className:"flex items-center gap-1",children:[L.jsx("span",{children:r}),L.jsx("span",{className:"text-white font-medium",children:e})]}),L.jsx("div",{className:"text-slate-500 text-xs",children:t})]})}const V2={overview:"🌌 Overview",security:"🔒 Security",coverage:"📊 Coverage","blast-radius":"💥 Impact",timeline:"📅 Timeline"};function yf(){const r=[{id:"users",name:"users",sensitivity:"high",cluster:"auth",fields:[{id:"users.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"users.email",name:"email",dataType:"varchar",sensitivity:"high"},{id:"users.password_hash",name:"password_hash",dataType:"varchar",sensitivity:"critical"},{id:"users.name",name:"name",dataType:"varchar",sensitivity:"medium"},{id:"users.created_at",name:"created_at",dataType:"timestamp",sensitivity:"low"}]},{id:"sessions",name:"sessions",sensitivity:"high",cluster:"auth",fields:[{id:"sessions.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"sessions.user_id",name:"user_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"users.id",sensitivity:"medium"},{id:"sessions.token",name:"token",dataType:"varchar",sensitivity:"critical"},{id:"sessions.expires_at",name:"expires_at",dataType:"timestamp",sensitivity:"low"}]},{id:"orders",name:"orders",sensitivity:"high",cluster:"commerce",fields:[{id:"orders.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"orders.user_id",name:"user_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"users.id",sensitivity:"medium"},{id:"orders.total",name:"total",dataType:"decimal",sensitivity:"high"},{id:"orders.status",name:"status",dataType:"varchar",sensitivity:"low"}]},{id:"products",name:"products",sensitivity:"low",cluster:"commerce",fields:[{id:"products.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"products.name",name:"name",dataType:"varchar",sensitivity:"public"},{id:"products.price",name:"price",dataType:"decimal",sensitivity:"public"},{id:"products.inventory",name:"inventory",dataType:"integer",sensitivity:"low"}]},{id:"payments",name:"payments",sensitivity:"critical",cluster:"commerce",fields:[{id:"payments.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"payments.order_id",name:"order_id",dataType:"uuid",isForeignKey:!0,foreignKeyTarget:"orders.id",sensitivity:"medium"},{id:"payments.card_last4",name:"card_last4",dataType:"varchar",sensitivity:"high"},{id:"payments.amount",name:"amount",dataType:"decimal",sensitivity:"high"}]},{id:"audit_logs",name:"audit_logs",sensitivity:"medium",cluster:"analytics",fields:[{id:"audit_logs.id",name:"id",dataType:"uuid",isPrimaryKey:!0,sensitivity:"low"},{id:"audit_logs.user_id",name:"user_id",dataType:"uuid",sensitivity:"medium"},{id:"audit_logs.action",name:"action",dataType:"varchar",sensitivity:"low"},{id:"audit_logs.timestamp",name:"timestamp",dataType:"timestamp",sensitivity:"low"}]}],e=[{id:"ep-login",path:"/api/auth/login",method:"POST",authLevel:"public",securityTier:"P0",file:"src/routes/auth.ts",line:15,framework:"Express",reachableTables:["users","sessions"]},{id:"ep-register",path:"/api/auth/register",method:"POST",authLevel:"public",securityTier:"P1",file:"src/routes/auth.ts",line:45,framework:"Express",reachableTables:["users"]},{id:"ep-profile",path:"/api/users/profile",method:"GET",authLevel:"authenticated",securityTier:"P2",file:"src/routes/users.ts",line:10,framework:"Express",reachableTables:["users"]},{id:"ep-orders",path:"/api/orders",method:"GET",authLevel:"authenticated",securityTier:"P2",file:"src/routes/orders.ts",line:20,framework:"Express",reachableTables:["orders","products"]},{id:"ep-checkout",path:"/api/checkout",method:"POST",authLevel:"authenticated",securityTier:"P0",file:"src/routes/checkout.ts",line:30,framework:"Express",reachableTables:["orders","payments","products"]},{id:"ep-products",path:"/api/products",method:"GET",authLevel:"public",securityTier:"P4",file:"src/routes/products.ts",line:5,framework:"Express",reachableTables:["products"]},{id:"ep-admin-users",path:"/api/admin/users",method:"GET",authLevel:"admin",securityTier:"P1",file:"src/routes/admin.ts",line:10,framework:"Express",reachableTables:["users","orders","audit_logs"]}],t=[{id:"path-1",sourceId:"ep-login",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:1e3,depth:1,isTested:!0,sensitivity:"high"},{id:"path-2",sourceId:"ep-login",sourceType:"entryPoint",targetTableId:"sessions",operation:"write",frequency:1e3,depth:2,isTested:!0,sensitivity:"critical"},{id:"path-3",sourceId:"ep-register",sourceType:"entryPoint",targetTableId:"users",operation:"write",frequency:100,depth:1,isTested:!1,sensitivity:"high"},{id:"path-4",sourceId:"ep-profile",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:500,depth:1,isTested:!0,sensitivity:"high"},{id:"path-5",sourceId:"ep-orders",sourceType:"entryPoint",targetTableId:"orders",operation:"read",frequency:300,depth:1,isTested:!0,sensitivity:"high"},{id:"path-6",sourceId:"ep-checkout",sourceType:"entryPoint",targetTableId:"orders",operation:"write",frequency:50,depth:1,isTested:!1,sensitivity:"high"},{id:"path-7",sourceId:"ep-checkout",sourceType:"entryPoint",targetTableId:"payments",operation:"write",frequency:50,depth:2,isTested:!1,sensitivity:"critical"},{id:"path-8",sourceId:"ep-products",sourceType:"entryPoint",targetTableId:"products",operation:"read",frequency:2e3,depth:1,isTested:!0,sensitivity:"public"},{id:"path-9",sourceId:"ep-admin-users",sourceType:"entryPoint",targetTableId:"users",operation:"read",frequency:10,depth:1,isTested:!0,sensitivity:"high"},{id:"path-10",sourceId:"ep-admin-users",sourceType:"entryPoint",targetTableId:"audit_logs",operation:"read",frequency:10,depth:2,isTested:!1,sensitivity:"medium"}],n=[{id:"rel-1",sourceTableId:"sessions",sourceFieldId:"sessions.user_id",targetTableId:"users",targetFieldId:"users.id",type:"one-to-many"},{id:"rel-2",sourceTableId:"orders",sourceFieldId:"orders.user_id",targetTableId:"users",targetFieldId:"users.id",type:"one-to-many"},{id:"rel-3",sourceTableId:"payments",sourceFieldId:"payments.order_id",targetTableId:"orders",targetFieldId:"orders.id",type:"one-to-one"}];return{tables:r.map(i=>({...i,rowCount:Math.floor(Math.random()*1e5),accessCount:Math.floor(Math.random()*1e3)})),entryPoints:e,dataPaths:t,relationships:n}}function G2(){const{setGalaxyData:r,setLoading:e,setError:t,isLoading:n,error:i,galaxyData:s}=Fn(),[a,c]=W.useState(!1),[u,h]=W.useState("api"),d=W.useCallback(async()=>{var f;e(!0),t(null);try{let m,g="api";if(a)m=yf(),g="mock";else try{const _=await fetch("/api/galaxy");if(!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);m=await _.json(),(!m.tables||m.tables.length===0)&&(console.log("No tables found in API response, falling back to mock data"),m=yf(),g="mock")}catch(_){console.log("API fetch failed, falling back to mock data:",_),m=yf(),g="mock"}h(g);const{tables:x,entryPoints:S}=L2(m.tables,m.entryPoints,m.dataPaths),y=m.stats??{tableCount:x.length,fieldCount:x.reduce((_,b)=>_+b.fields.length,0),entryPointCount:S.length,pathCount:m.dataPaths.length,sensitiveFields:{critical:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="critical").length,0),high:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="high").length,0),medium:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="medium").length,0),low:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="low").length,0),public:x.reduce((_,b)=>_+b.fields.filter(M=>M.sensitivity==="public").length,0)},untestedPaths:m.dataPaths.filter(_=>!_.isTested).length,deadCodeCount:0,healthScore:((f=m.stats)==null?void 0:f.healthScore)??72};r({tables:x,entryPoints:S,dataPaths:m.dataPaths,relationships:m.relationships??[],stats:y,lastUpdated:m.lastUpdated??new Date().toISOString()})}catch(m){t(m instanceof Error?m.message:"Failed to load galaxy data")}},[a,r,e,t]);return W.useEffect(()=>{d()},[d]),{isLoading:n,error:i,data:s,refetch:d,useMock:a,setUseMock:c,dataSource:u}}function W2(){const{viewMode:r,setViewMode:e,togglePanel:t,activePanel:n}=Fn();return L.jsxs("div",{className:"absolute right-4 top-4 flex items-center gap-2 z-10",children:[L.jsx("div",{className:"flex bg-slate-800/80 rounded-lg overflow-hidden",children:[{mode:"overview",icon:"🌌",label:"Overview"},{mode:"security",icon:"🔒",label:"Security"},{mode:"coverage",icon:"📊",label:"Coverage"}].map(({mode:i,icon:s,label:a})=>L.jsx("button",{onClick:()=>e(i),className:`px-3 py-2 text-sm transition-colors ${r===i?"bg-blue-500/30 text-blue-400":"text-slate-400 hover:text-white hover:bg-slate-700"}`,title:a,children:s},i))}),L.jsxs("div",{className:"flex bg-slate-800/80 rounded-lg overflow-hidden",children:[L.jsx("button",{onClick:()=>t("security"),className:`px-3 py-2 text-sm transition-colors ${n==="security"?"bg-red-500/30 text-red-400":"text-slate-400 hover:text-white"}`,title:"Security Panel",children:"🛡️"}),L.jsx("button",{onClick:()=>t("settings"),className:`px-3 py-2 text-sm transition-colors ${n==="settings"?"bg-purple-500/30 text-purple-400":"text-slate-400 hover:text-white"}`,title:"Settings",children:"⚙️"})]})]})}function j2({dataSource:r,useMock:e,setUseMock:t,tableCount:n,entryPointCount:i}){return L.jsxs("div",{className:"absolute left-4 top-4 z-10 flex flex-col gap-2",children:[L.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-400 bg-slate-800/80 px-3 py-2 rounded-lg cursor-pointer",children:[L.jsx("input",{type:"checkbox",checked:e,onChange:s=>t(s.target.checked),className:"rounded"}),"Use Mock Data"]}),L.jsxs("div",{className:`text-xs px-3 py-1.5 rounded-lg ${r==="api"?"bg-green-500/20 text-green-400":"bg-yellow-500/20 text-yellow-400"}`,children:[r==="api"?"🔗 Live Data":"🎭 Mock Data",L.jsxs("span",{className:"ml-2 opacity-70",children:[n," tables • ",i," endpoints"]})]})]})}function $2(){const{isLoading:r,error:e,data:t,refetch:n,useMock:i,setUseMock:s,dataSource:a}=G2();return e&&!t?L.jsxs("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)] text-center",children:[L.jsx("div",{className:"text-6xl mb-4",children:"🌑"}),L.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:"Galaxy Unavailable"}),L.jsx("p",{className:"text-slate-400 mb-4",children:e}),L.jsxs("div",{className:"flex gap-3",children:[L.jsx("button",{onClick:n,className:"px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-colors",children:"Retry"}),L.jsx("button",{onClick:()=>s(!0),className:"px-4 py-2 bg-slate-600 hover:bg-slate-500 text-white rounded-lg transition-colors",children:"Use Mock Data"})]})]}):r&&!t?L.jsxs("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)]",children:[L.jsx("div",{className:"text-6xl mb-4 animate-pulse",children:"🌌"}),L.jsx("p",{className:"text-slate-400",children:"Loading galaxy..."}),L.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Scanning boundaries and call graph..."})]}):L.jsxs("div",{className:"relative h-[calc(100vh-200px)] bg-slate-950 rounded-lg overflow-hidden",children:[L.jsx(j2,{dataSource:a,useMock:i,setUseMock:s,tableCount:(t==null?void 0:t.tables.length)??0,entryPointCount:(t==null?void 0:t.entryPoints.length)??0}),L.jsx(W2,{}),L.jsx(y2,{className:"w-full h-full"}),L.jsx(k2,{}),L.jsx(H2,{}),L.jsx(I2,{}),L.jsx(O2,{}),L.jsx(z2,{})]})}export{$2 as GalaxyTab};
4177
+ //# sourceMappingURL=GalaxyTab-CwsGBZRU.js.map