From 6f3f66b073368bb8c57dc415e84ded1643813ec9 Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Sun, 25 Feb 2024 02:42:20 +0000 Subject: [PATCH] Updates --- .../{index-OcHPceDE.js => index-nB6RXta_.js} | 793 ++++++++++++++---- index.html | 2 +- 2 files changed, 608 insertions(+), 187 deletions(-) rename assets/{index-OcHPceDE.js => index-nB6RXta_.js} (63%) diff --git a/assets/index-OcHPceDE.js b/assets/index-nB6RXta_.js similarity index 63% rename from assets/index-OcHPceDE.js rename to assets/index-nB6RXta_.js index d8831e5..a56af95 100644 --- a/assets/index-OcHPceDE.js +++ b/assets/index-nB6RXta_.js @@ -2,11 +2,11 @@ * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const $l="159",Sr={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},wr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Zf=0,bc=1,Jf=2,Wh=1,Qf=2,wi=3,Jn=0,gn=1,$n=2,Vi=0,es=1,Sc=2,wc=3,Mc=4,ed=5,ar=100,td=101,nd=102,Ec=103,Tc=104,id=200,rd=201,sd=202,od=203,wl=204,Ml=205,ad=206,ld=207,cd=208,ud=209,hd=210,fd=211,dd=212,pd=213,md=214,_d=0,gd=1,vd=2,ea=3,xd=4,yd=5,bd=6,Sd=7,Xh=0,wd=1,Md=2,Gi=0,Ed=1,Td=2,Ad=3,Rd=4,Cd=5,Ac="attached",Ld="detached",jh=300,is=301,rs=302,El=303,Tl=304,ha=306,ss=1e3,zn=1001,ta=1002,It=1003,Al=1004,Jo=1005,bn=1006,qh=1007,pr=1008,ui=1009,Rl=1010,Yh=1011,fa=1012,ks=1013,Pn=1014,_n=1015,qs=1016,$h=1017,Kh=1018,hr=1020,Pd=1021,nn=1023,Dd=1024,Id=1025,fr=1026,os=1027,Zh=1028,Kl=1029,Jh=1030,da=1031,Ys=1033,wa=33776,Ma=33777,Ea=33778,Ta=33779,Rc=35840,Cc=35841,Lc=35842,Pc=35843,Qh=36196,Dc=37492,Ic=37496,Nc=37808,Fc=37809,Oc=37810,Uc=37811,Bc=37812,zc=37813,kc=37814,Hc=37815,Vc=37816,Gc=37817,Wc=37818,Xc=37819,jc=37820,qc=37821,Aa=36492,Yc=36494,$c=36495,Nd=36283,Kc=36284,Zc=36285,Jc=36286,$s=2300,as=2301,Ra=2302,Qc=2400,eu=2401,tu=2402,Fd=2500,Od=0,ef=1,Cl=2,tf=3e3,Wi=3001,Ud=3200,Bd=3201,nf=0,zd=1,kn="",zt="srgb",sn="srgb-linear",Zl="display-p3",pa="display-p3-linear",na="linear",Tt="srgb",ia="rec709",ra="p3",Mr=7680,nu=519,kd=512,Hd=513,Vd=514,rf=515,Gd=516,Wd=517,Xd=518,jd=519,Ll=35044,iu="300 es",Pl=1035,Ei=2e3,sa=2001;class _r{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,o=i.length;s>8&255]+ln[r>>16&255]+ln[r>>24&255]+"-"+ln[e&255]+ln[e>>8&255]+"-"+ln[e>>16&15|64]+ln[e>>24&255]+"-"+ln[t&63|128]+ln[t>>8&255]+"-"+ln[t>>16&255]+ln[t>>24&255]+ln[n&255]+ln[n>>8&255]+ln[n>>16&255]+ln[n>>24&255]).toLowerCase()}function Qt(r,e,t){return Math.max(e,Math.min(t,r))}function Jl(r,e){return(r%e+e)%e}function qd(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Yd(r,e,t){return r!==e?(t-r)/(e-r):0}function Vs(r,e,t){return(1-t)*r+t*e}function $d(r,e,t,n){return Vs(r,e,1-Math.exp(-t*n))}function Kd(r,e=1){return e-Math.abs(Jl(r,e*2)-e)}function Zd(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function Jd(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Qd(r,e){return r+Math.floor(Math.random()*(e-r+1))}function ep(r,e){return r+Math.random()*(e-r)}function tp(r){return r*(.5-Math.random())}function np(r){r!==void 0&&(ru=r);let e=ru+=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 ip(r){return r*Hs}function rp(r){return r*ls}function Dl(r){return(r&r-1)===0&&r!==0}function sp(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function oa(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function op(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),f=o((e-n)/2),d=s((n-e)/2),_=o((n-e)/2);switch(i){case"XYX":r.set(a*u,l*h,l*f,a*c);break;case"YZY":r.set(l*f,a*u,l*h,a*c);break;case"ZXZ":r.set(l*h,l*f,a*u,a*c);break;case"XZX":r.set(a*u,l*_,l*d,a*c);break;case"YXY":r.set(l*d,a*u,l*_,a*c);break;case"ZYZ":r.set(l*_,l*d,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ci(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 yt(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 sf={DEG2RAD:Hs,RAD2DEG:ls,generateUUID:Kn,clamp:Qt,euclideanModulo:Jl,mapLinear:qd,inverseLerp:Yd,lerp:Vs,damp:$d,pingpong:Kd,smoothstep:Zd,smootherstep:Jd,randInt:Qd,randFloat:ep,randFloatSpread:tp,seededRandom:np,degToRad:ip,radToDeg:rp,isPowerOfTwo:Dl,ceilPowerOfTwo:sp,floorPowerOfTwo:oa,setQuaternionFromProperEuler:op,normalize:yt,denormalize:ci};class Ue{constructor(e=0,t=0){Ue.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(Qt(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,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class rt{constructor(e,t,n,i,s,o,a,l,c){rt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,l,c)}set(e,t,n,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,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,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],f=n[2],d=n[5],_=n[8],g=i[0],m=i[3],p=i[6],y=i[1],v=i[4],x=i[7],b=i[2],E=i[5],w=i[8];return s[0]=o*g+a*y+l*b,s[3]=o*m+a*v+l*E,s[6]=o*p+a*x+l*w,s[1]=c*g+u*y+h*b,s[4]=c*m+u*v+h*E,s[7]=c*p+u*x+h*w,s[2]=f*g+d*y+_*b,s[5]=f*m+d*v+_*E,s[8]=f*p+d*x+_*w,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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,f=a*l-u*s,d=c*s-o*l,_=t*h+n*f+i*d;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=h*g,e[1]=(i*c-u*n)*g,e[2]=(a*n-i*o)*g,e[3]=f*g,e[4]=(u*t-i*l)*g,e[5]=(i*s-a*t)*g,e[6]=d*g,e[7]=(n*l-c*t)*g,e[8]=(o*t-n*s)*g,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,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Ca.makeScale(e,t)),this}rotate(e){return this.premultiply(Ca.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ca.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 Ca=new rt;function of(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function Ks(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function ap(){const r=Ks("canvas");return r.style.display="block",r}const su={};function Gs(r){r in su||(su[r]=!0,console.warn(r))}const ou=new rt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),au=new rt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),io={[sn]:{transfer:na,primaries:ia,toReference:r=>r,fromReference:r=>r},[zt]:{transfer:Tt,primaries:ia,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[pa]:{transfer:na,primaries:ra,toReference:r=>r.applyMatrix3(au),fromReference:r=>r.applyMatrix3(ou)},[Zl]:{transfer:Tt,primaries:ra,toReference:r=>r.convertSRGBToLinear().applyMatrix3(au),fromReference:r=>r.applyMatrix3(ou).convertLinearToSRGB()}},lp=new Set([sn,pa]),dt={enabled:!0,_workingColorSpace:sn,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!lp.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=io[e].toReference,i=io[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 io[r].primaries},getTransfer:function(r){return r===kn?na:io[r].transfer}};function ts(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function La(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Er;class af{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Er===void 0&&(Er=Ks("canvas")),Er.width=e.width,Er.height=e.height;const n=Er.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Er}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=Ks("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 o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==jh)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ss:e.x=e.x-Math.floor(e.x);break;case zn:e.x=e.x<0?0:1;break;case ta: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 ss:e.y=e.y-Math.floor(e.y);break;case zn:e.y=e.y<0?0:1;break;case ta: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 Gs("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===zt?Wi:tf}set encoding(e){Gs("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Wi?zt:kn}}rn.DEFAULT_IMAGE=null;rn.DEFAULT_MAPPING=jh;rn.DEFAULT_ANISOTROPY=1;class pt{constructor(e=0,t=0,n=0,i=1){pt.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,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[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 l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],_=l[9],g=l[2],m=l[6],p=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-g)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+g)<.1&&Math.abs(_+m)<.1&&Math.abs(c+d+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,x=(d+1)/2,b=(p+1)/2,E=(u+f)/4,w=(h+g)/4,I=(_+m)/4;return v>x&&v>b?v<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(v),i=E/n,s=w/n):x>b?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=E/i,s=I/i):b<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(b),n=w/s,i=I/s),this.set(n,i,s,t),this}let y=Math.sqrt((m-_)*(m-_)+(h-g)*(h-g)+(f-u)*(f-u));return Math.abs(y)<.001&&(y=1),this.x=(m-_)/y,this.y=(h-g)/y,this.z=(f-u)/y,this.w=Math.acos((c+d+p-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 hp extends _r{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(Gs("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Wi?zt:kn),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:bn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new rn(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 lf(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 Xi extends hp{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class cf extends rn{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=It,this.minFilter=It,this.wrapR=zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class fp extends rn{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=It,this.minFilter=It,this.wrapR=zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class di{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,o,a){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3];const f=s[o+0],d=s[o+1],_=s[o+2],g=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=d,e[t+2]=_,e[t+3]=g;return}if(h!==g||l!==f||c!==d||u!==_){let m=1-a;const p=l*f+c*d+u*_+h*g,y=p>=0?1:-1,v=1-p*p;if(v>Number.EPSILON){const b=Math.sqrt(v),E=Math.atan2(b,p*y);m=Math.sin(m*E)/b,a=Math.sin(a*E)/b}const x=a*y;if(l=l*m+f*x,c=c*m+d*x,u=u*m+_*x,h=h*m+g*x,m===1-a){const b=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=b,c*=b,u*=b,h*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[o],f=s[o+1],d=s[o+2],_=s[o+3];return e[t]=a*_+u*h+l*d-c*f,e[t+1]=l*_+u*f+c*h-a*d,e[t+2]=c*_+u*d+a*f-l*h,e[t+3]=u*_-a*h-l*f-c*d,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){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),h=a(s/2),f=l(n/2),d=l(i/2),_=l(s/2);switch(o){case"XYZ":this._x=f*u*h+c*d*_,this._y=c*d*h-f*u*_,this._z=c*u*_+f*d*h,this._w=c*u*h-f*d*_;break;case"YXZ":this._x=f*u*h+c*d*_,this._y=c*d*h-f*u*_,this._z=c*u*_-f*d*h,this._w=c*u*h+f*d*_;break;case"ZXY":this._x=f*u*h-c*d*_,this._y=c*d*h+f*u*_,this._z=c*u*_+f*d*h,this._w=c*u*h-f*d*_;break;case"ZYX":this._x=f*u*h-c*d*_,this._y=c*d*h+f*u*_,this._z=c*u*_-f*d*h,this._w=c*u*h+f*d*_;break;case"YZX":this._x=f*u*h+c*d*_,this._y=c*d*h+f*u*_,this._z=c*u*_-f*d*h,this._w=c*u*h-f*d*_;break;case"XZY":this._x=f*u*h-c*d*_,this._y=c*d*h-f*u*_,this._z=c*u*_+f*d*h,this._w=c*u*h+f*d*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&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],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=n+a+h;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(o-i)*d}else if(n>a&&n>h){const d=2*Math.sqrt(1+n-a-h);this._w=(u-l)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+c)/d}else if(a>h){const d=2*Math.sqrt(1+a-n-h);this._w=(s-c)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(l+u)/d}else{const d=2*Math.sqrt(1+h-n-a);this._w=(o-i)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.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(Qt(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,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-s*c,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,o=this._w;let a=o*e._w+n*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*n+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=o*h+this._w*f,this._x=n*h+this._x*f,this._y=i*h+this._y*f,this._z=s*h+this._z*f,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}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 P{constructor(e=0,t=0,n=0){P.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(lu.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(lu.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,o=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])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*n),u=2*(a*t-s*i),h=2*(s*n-o*t);return this.x=t+l*c+o*h-a*u,this.y=n+l*u+a*c-s*h,this.z=i+l*h+s*u-o*c,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,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-n*l,this.z=n*a-i*o,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 Da.copy(this).projectOnVector(e),this.sub(Da)}reflect(e){return this.sub(Da.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(Qt(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 Da=new P,lu=new di;class kt{constructor(e=new P(1/0,1/0,1/0),t=new P(-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;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Xn),Xn.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(bs),so.subVectors(this.max,bs),Tr.subVectors(e.a,bs),Ar.subVectors(e.b,bs),Rr.subVectors(e.c,bs),Pi.subVectors(Ar,Tr),Di.subVectors(Rr,Ar),Ki.subVectors(Tr,Rr);let t=[0,-Pi.z,Pi.y,0,-Di.z,Di.y,0,-Ki.z,Ki.y,Pi.z,0,-Pi.x,Di.z,0,-Di.x,Ki.z,0,-Ki.x,-Pi.y,Pi.x,0,-Di.y,Di.x,0,-Ki.y,Ki.x,0];return!Ia(t,Tr,Ar,Rr,so)||(t=[1,0,0,0,1,0,0,0,1],!Ia(t,Tr,Ar,Rr,so))?!1:(oo.crossVectors(Pi,Di),t=[oo.x,oo.y,oo.z],Ia(t,Tr,Ar,Rr,so))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Xn).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:(gi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),gi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),gi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),gi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),gi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),gi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),gi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),gi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(gi),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 gi=[new P,new P,new P,new P,new P,new P,new P,new P],Xn=new P,ro=new kt,Tr=new P,Ar=new P,Rr=new P,Pi=new P,Di=new P,Ki=new P,bs=new P,so=new P,oo=new P,Zi=new P;function Ia(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Zi.fromArray(r,s);const a=i.x*Math.abs(Zi.x)+i.y*Math.abs(Zi.y)+i.z*Math.abs(Zi.z),l=e.dot(Zi),c=t.dot(Zi),u=n.dot(Zi);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const dp=new kt,Ss=new P,Na=new P;class ei{constructor(e=new P,t=-1){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):dp.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;sthis.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;Ss.subVectors(e,this.center);const t=Ss.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ss,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):(Na.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ss.copy(e.center).add(Na)),this.expandByPoint(Ss.copy(e.center).sub(Na))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const vi=new P,Fa=new P,ao=new P,Ii=new P,Oa=new P,lo=new P,Ua=new P;class Qs{constructor(e=new P,t=new P(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,vi)),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=vi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(vi.copy(this.origin).addScaledVector(this.direction,t),vi.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Fa.copy(e).add(t).multiplyScalar(.5),ao.copy(t).sub(e).normalize(),Ii.copy(this.origin).sub(Fa);const s=e.distanceTo(t)*.5,o=-this.direction.dot(ao),a=Ii.dot(this.direction),l=-Ii.dot(ao),c=Ii.lengthSq(),u=Math.abs(1-o*o);let h,f,d,_;if(u>0)if(h=o*l-a,f=o*a-l,_=s*u,h>=0)if(f>=-_)if(f<=_){const g=1/u;h*=g,f*=g,d=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f<=-_?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f<=_?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Fa).addScaledVector(ao,f),d}intersectSphere(e,t){vi.subVectors(e.center,this.origin);const n=vi.dot(this.direction),i=vi.dot(vi)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,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,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(n=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),n>l||a>i)||((a>n||n!==n)&&(n=a),(l=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,vi)!==null}intersectTriangle(e,t,n,i,s){Oa.subVectors(t,e),lo.subVectors(n,e),Ua.crossVectors(Oa,lo);let o=this.direction.dot(Ua),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ii.subVectors(this.origin,e);const l=a*this.direction.dot(lo.crossVectors(Ii,lo));if(l<0)return null;const c=a*this.direction.dot(Oa.cross(Ii));if(c<0||l+c>o)return null;const u=-a*Ii.dot(Ua);return u<0?null:this.at(u/o,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 Ge{constructor(e,t,n,i,s,o,a,l,c,u,h,f,d,_,g,m){Ge.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,o,a,l,c,u,h,f,d,_,g,m)}set(e,t,n,i,s,o,a,l,c,u,h,f,d,_,g,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=u,p[10]=h,p[14]=f,p[3]=d,p[7]=_,p[11]=g,p[15]=m,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 Ge().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/Cr.setFromMatrixColumn(e,0).length(),s=1/Cr.setFromMatrixColumn(e,1).length(),o=1/Cr.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]*o,t[9]=n[9]*o,t[10]=n[10]*o,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,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=o*u,d=o*h,_=a*u,g=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=d+_*c,t[5]=f-g*c,t[9]=-a*l,t[2]=g-f*c,t[6]=_+d*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*u,d=l*h,_=c*u,g=c*h;t[0]=f+g*a,t[4]=_*a-d,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=d*a-_,t[6]=g+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*u,d=l*h,_=c*u,g=c*h;t[0]=f-g*a,t[4]=-o*h,t[8]=_+d*a,t[1]=d+_*a,t[5]=o*u,t[9]=g-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*u,d=o*h,_=a*u,g=a*h;t[0]=l*u,t[4]=_*c-d,t[8]=f*c+g,t[1]=l*h,t[5]=g*c+f,t[9]=d*c-_,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,d=o*c,_=a*l,g=a*c;t[0]=l*u,t[4]=g-f*h,t[8]=_*h+d,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=d*h+_,t[10]=f-g*h}else if(e.order==="XZY"){const f=o*l,d=o*c,_=a*l,g=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+g,t[5]=o*u,t[9]=d*h-_,t[2]=_*h-d,t[6]=a*u,t[10]=g*h+f}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(pp,e,mp)}lookAt(e,t,n){const i=this.elements;return Rn.subVectors(e,t),Rn.lengthSq()===0&&(Rn.z=1),Rn.normalize(),Ni.crossVectors(n,Rn),Ni.lengthSq()===0&&(Math.abs(n.z)===1?Rn.x+=1e-4:Rn.z+=1e-4,Rn.normalize(),Ni.crossVectors(n,Rn)),Ni.normalize(),co.crossVectors(Rn,Ni),i[0]=Ni.x,i[4]=co.x,i[8]=Rn.x,i[1]=Ni.y,i[5]=co.y,i[9]=Rn.y,i[2]=Ni.z,i[6]=co.z,i[10]=Rn.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,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],f=n[9],d=n[13],_=n[2],g=n[6],m=n[10],p=n[14],y=n[3],v=n[7],x=n[11],b=n[15],E=i[0],w=i[4],I=i[8],S=i[12],A=i[1],z=i[5],O=i[9],G=i[13],D=i[2],H=i[6],Z=i[10],J=i[14],ce=i[3],ie=i[7],se=i[11],me=i[15];return s[0]=o*E+a*A+l*D+c*ce,s[4]=o*w+a*z+l*H+c*ie,s[8]=o*I+a*O+l*Z+c*se,s[12]=o*S+a*G+l*J+c*me,s[1]=u*E+h*A+f*D+d*ce,s[5]=u*w+h*z+f*H+d*ie,s[9]=u*I+h*O+f*Z+d*se,s[13]=u*S+h*G+f*J+d*me,s[2]=_*E+g*A+m*D+p*ce,s[6]=_*w+g*z+m*H+p*ie,s[10]=_*I+g*O+m*Z+p*se,s[14]=_*S+g*G+m*J+p*me,s[3]=y*E+v*A+x*D+b*ce,s[7]=y*w+v*z+x*H+b*ie,s[11]=y*I+v*O+x*Z+b*se,s[15]=y*S+v*G+x*J+b*me,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],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],d=e[14],_=e[3],g=e[7],m=e[11],p=e[15];return _*(+s*l*h-i*c*h-s*a*f+n*c*f+i*a*d-n*l*d)+g*(+t*l*d-t*c*f+s*o*f-i*o*d+i*c*u-s*l*u)+m*(+t*c*h-t*a*d-s*o*h+n*o*d+s*a*u-n*c*u)+p*(-i*a*u-t*l*h+t*a*f+i*o*h-n*o*f+n*l*u)}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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],_=e[12],g=e[13],m=e[14],p=e[15],y=h*m*c-g*f*c+g*l*d-a*m*d-h*l*p+a*f*p,v=_*f*c-u*m*c-_*l*d+o*m*d+u*l*p-o*f*p,x=u*g*c-_*h*c+_*a*d-o*g*d-u*a*p+o*h*p,b=_*h*l-u*g*l-_*a*f+o*g*f+u*a*m-o*h*m,E=t*y+n*v+i*x+s*b;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/E;return e[0]=y*w,e[1]=(g*f*s-h*m*s-g*i*d+n*m*d+h*i*p-n*f*p)*w,e[2]=(a*m*s-g*l*s+g*i*c-n*m*c-a*i*p+n*l*p)*w,e[3]=(h*l*s-a*f*s-h*i*c+n*f*c+a*i*d-n*l*d)*w,e[4]=v*w,e[5]=(u*m*s-_*f*s+_*i*d-t*m*d-u*i*p+t*f*p)*w,e[6]=(_*l*s-o*m*s-_*i*c+t*m*c+o*i*p-t*l*p)*w,e[7]=(o*f*s-u*l*s+u*i*c-t*f*c-o*i*d+t*l*d)*w,e[8]=x*w,e[9]=(_*h*s-u*g*s-_*n*d+t*g*d+u*n*p-t*h*p)*w,e[10]=(o*g*s-_*a*s+_*n*c-t*g*c-o*n*p+t*a*p)*w,e[11]=(u*a*s-o*h*s-u*n*c+t*h*c+o*n*d-t*a*d)*w,e[12]=b*w,e[13]=(u*g*i-_*h*i+_*n*f-t*g*f-u*n*m+t*h*m)*w,e[14]=(_*a*i-o*g*i-_*n*l+t*g*l+o*n*m-t*a*m)*w,e[15]=(o*h*i-u*a*i+u*n*l-t*h*l-o*n*f+t*a*f)*w,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,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*o,s*l*l+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,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,f=s*c,d=s*u,_=s*h,g=o*u,m=o*h,p=a*h,y=l*c,v=l*u,x=l*h,b=n.x,E=n.y,w=n.z;return i[0]=(1-(g+p))*b,i[1]=(d+x)*b,i[2]=(_-v)*b,i[3]=0,i[4]=(d-x)*E,i[5]=(1-(f+p))*E,i[6]=(m+y)*E,i[7]=0,i[8]=(_+v)*w,i[9]=(m-y)*w,i[10]=(1-(f+g))*w,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=Cr.set(i[0],i[1],i[2]).length();const o=Cr.set(i[4],i[5],i[6]).length(),a=Cr.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],jn.copy(this);const c=1/s,u=1/o,h=1/a;return jn.elements[0]*=c,jn.elements[1]*=c,jn.elements[2]*=c,jn.elements[4]*=u,jn.elements[5]*=u,jn.elements[6]*=u,jn.elements[8]*=h,jn.elements[9]*=h,jn.elements[10]*=h,t.setFromRotationMatrix(jn),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o,a=Ei){const l=this.elements,c=2*s/(t-e),u=2*s/(n-i),h=(t+e)/(t-e),f=(n+i)/(n-i);let d,_;if(a===Ei)d=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===sa)d=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=d,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,o,a=Ei){const l=this.elements,c=1/(t-e),u=1/(n-i),h=1/(o-s),f=(t+e)*c,d=(n+i)*u;let _,g;if(a===Ei)_=(o+s)*h,g=-2*h;else if(a===sa)_=s*h,g=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-d,l[2]=0,l[6]=0,l[10]=g,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[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 Cr=new P,jn=new Ge,pp=new P(0,0,0),mp=new P(1,1,1),Ni=new P,co=new P,Rn=new P,cu=new Ge,uu=new di;class ma{constructor(e=0,t=0,n=0,i=ma.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],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Qt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Qt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Qt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Qt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Qt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Qt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,d),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 cu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(cu,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return uu.setFromEuler(this),this.setFromQuaternion(uu,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}}ma.DEFAULT_ORDER="XYZ";class uf{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(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(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.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(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),_.length>0&&(n.nodes=_)}return n.object=i,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}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;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){qn.subVectors(i,t),yi.subVectors(n,t),Ba.subVectors(e,t);const o=qn.dot(qn),a=qn.dot(yi),l=qn.dot(Ba),c=yi.dot(yi),u=yi.dot(Ba),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);const f=1/h,d=(c*l-a*u)*f,_=(o*u-a*l)*f;return s.set(1-d-_,_,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,bi),bi.x>=0&&bi.y>=0&&bi.x+bi.y<=1}static getUV(e,t,n,i,s,o,a,l){return ho===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ho=!0),this.getInterpolation(e,t,n,i,s,o,a,l)}static getInterpolation(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,bi),l.setScalar(0),l.addScaledVector(s,bi.x),l.addScaledVector(o,bi.y),l.addScaledVector(a,bi.z),l}static isFrontFacing(e,t,n,i){return qn.subVectors(n,t),yi.subVectors(e,t),qn.cross(yi).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 qn.subVectors(this.c,this.b),yi.subVectors(this.a,this.b),qn.cross(yi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return un.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return un.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return ho===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ho=!0),un.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return un.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return un.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return un.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 o,a;Pr.subVectors(i,n),Dr.subVectors(s,n),za.subVectors(e,n);const l=Pr.dot(za),c=Dr.dot(za);if(l<=0&&c<=0)return t.copy(n);ka.subVectors(e,i);const u=Pr.dot(ka),h=Dr.dot(ka);if(u>=0&&h<=u)return t.copy(i);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Pr,o);Ha.subVectors(e,s);const d=Pr.dot(Ha),_=Dr.dot(Ha);if(_>=0&&d<=_)return t.copy(s);const g=d*c-l*_;if(g<=0&&c>=0&&_<=0)return a=c/(c-_),t.copy(n).addScaledVector(Dr,a);const m=u*_-d*h;if(m<=0&&h-u>=0&&d-_>=0)return mu.subVectors(s,i),a=(h-u)/(h-u+(d-_)),t.copy(i).addScaledVector(mu,a);const p=1/(m+g+f);return o=g*p,a=f*p,t.copy(n).addScaledVector(Pr,o).addScaledVector(Dr,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const hf={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},Fi={h:0,s:0,l:0},fo={h:0,s:0,l:0};function Va(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 et{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=zt){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=Jl(e,1),t=Qt(t,0,1),n=Qt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=Va(o,s,e+1/3),this.g=Va(o,s,e),this.b=Va(o,s,e-1/3)}return dt.toWorkingColorSpace(this,i),this}setStyle(e,t=zt){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 o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))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],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===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=zt){const n=hf[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=ts(e.r),this.g=ts(e.g),this.b=ts(e.b),this}copyLinearToSRGB(e){return this.r=La(e.r),this.g=La(e.g),this.b=La(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=zt){return dt.fromWorkingColorSpace(cn.copy(this),e),Math.round(Qt(cn.r*255,0,255))*65536+Math.round(Qt(cn.g*255,0,255))*256+Math.round(Qt(cn.b*255,0,255))}getHexString(e=zt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=dt.workingColorSpace){dt.fromWorkingColorSpace(cn.copy(this),t);const n=cn.r,i=cn.g,s=cn.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case n:l=(i-s)/h+(i0!=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!==es&&(n.blending=this.blending),this.side!==Jn&&(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!==wl&&(n.blendSrc=this.blendSrc),this.blendDst!==Ml&&(n.blendDst=this.blendDst),this.blendEquation!==ar&&(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!==ea&&(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!==nu&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Mr&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Mr&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Mr&&(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 o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}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 ki extends hi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new et(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=Xh,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 Wt=new P,po=new Ue;class jt{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=Ll,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=_n,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and 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;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);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 l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.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 c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,d=h.length;f0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(_u.copy(s).invert(),Ji.copy(e.ray).applyMatrix4(_u),!(n.boundingBox!==null&&Ji.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ji)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,d=s.drawRange;if(a!==null)if(Array.isArray(o))for(let _=0,g=f.length;_t.far?null:{distance:c,point:bo.clone(),object:r}}function So(r,e,t,n,i,s,o,a,l,c){r.getVertexPosition(a,Nr),r.getVertexPosition(l,Fr),r.getVertexPosition(c,Or);const u=wp(r,e,t,n,Nr,Fr,Or,yo);if(u){i&&(go.fromBufferAttribute(i,a),vo.fromBufferAttribute(i,l),xo.fromBufferAttribute(i,c),u.uv=un.getInterpolation(yo,Nr,Fr,Or,go,vo,xo,new Ue)),s&&(go.fromBufferAttribute(s,a),vo.fromBufferAttribute(s,l),xo.fromBufferAttribute(s,c),u.uv1=un.getInterpolation(yo,Nr,Fr,Or,go,vo,xo,new Ue),u.uv2=u.uv1),o&&(vu.fromBufferAttribute(o,a),xu.fromBufferAttribute(o,l),yu.fromBufferAttribute(o,c),u.normal=un.getInterpolation(yo,Nr,Fr,Or,vu,xu,yu,new P),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new P,materialIndex:0};un.getNormal(Nr,Fr,Or,h.normal),u.face=h}return u}class eo extends vn{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let f=0,d=0;_("z","y","x",-1,-1,n,t,e,o,s,0),_("z","y","x",1,-1,n,t,-e,o,s,1),_("x","z","y",1,1,e,n,t,i,o,2),_("x","z","y",1,-1,e,n,-t,i,o,3),_("x","y","z",1,-1,e,t,n,i,s,4),_("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new Zn(c,3)),this.setAttribute("normal",new Zn(u,3)),this.setAttribute("uv",new Zn(h,2));function _(g,m,p,y,v,x,b,E,w,I,S){const A=x/w,z=b/I,O=x/2,G=b/2,D=E/2,H=w+1,Z=I+1;let J=0,ce=0;const ie=new P;for(let se=0;se0?1:-1,u.push(ie.x,ie.y,ie.z),h.push(ve/w),h.push(1-se/I),J+=1}}for(let se=0;se>8&255]+un[r>>16&255]+un[r>>24&255]+"-"+un[e&255]+un[e>>8&255]+"-"+un[e>>16&15|64]+un[e>>24&255]+"-"+un[t&63|128]+un[t>>8&255]+"-"+un[t>>16&255]+un[t>>24&255]+un[n&255]+un[n>>8&255]+un[n>>16&255]+un[n>>24&255]).toLowerCase()}function tn(r,e,t){return Math.max(e,Math.min(t,r))}function Ql(r,e){return(r%e+e)%e}function $d(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Kd(r,e,t){return r!==e?(t-r)/(e-r):0}function Ws(r,e,t){return(1-t)*r+t*e}function Zd(r,e,t,n){return Ws(r,e,1-Math.exp(-t*n))}function Jd(r,e=1){return e-Math.abs(Ql(r,e*2)-e)}function Qd(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function ep(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function tp(r,e){return r+Math.floor(Math.random()*(e-r+1))}function np(r,e){return r+Math.random()*(e-r)}function ip(r){return r*(.5-Math.random())}function rp(r){r!==void 0&&(su=r);let e=su+=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 sp(r){return r*Gs}function op(r){return r*hs}function Nl(r){return(r&r-1)===0&&r!==0}function ap(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function la(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function lp(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),h=o((e-n)/2),p=s((n-e)/2),_=o((n-e)/2);switch(i){case"XYX":r.set(a*u,l*f,l*h,a*c);break;case"YZY":r.set(l*h,a*u,l*f,a*c);break;case"ZXZ":r.set(l*f,l*h,a*u,a*c);break;case"XZX":r.set(a*u,l*_,l*p,a*c);break;case"YXY":r.set(l*p,a*u,l*_,a*c);break;case"ZYZ":r.set(l*_,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ui(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 yt(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 of={DEG2RAD:Gs,RAD2DEG:hs,generateUUID:Zn,clamp:tn,euclideanModulo:Ql,mapLinear:$d,inverseLerp:Kd,lerp:Ws,damp:Zd,pingpong:Jd,smoothstep:Qd,smootherstep:ep,randInt:tp,randFloat:np,randFloatSpread:ip,seededRandom:rp,degToRad:sp,radToDeg:op,isPowerOfTwo:Nl,ceilPowerOfTwo:ap,floorPowerOfTwo:la,setQuaternionFromProperEuler:lp,normalize:yt,denormalize:ui};class Ue{constructor(e=0,t=0){Ue.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(tn(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,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class rt{constructor(e,t,n,i,s,o,a,l,c){rt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,l,c)}set(e,t,n,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,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,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],h=n[2],p=n[5],_=n[8],g=i[0],m=i[3],d=i[6],x=i[1],v=i[4],y=i[7],b=i[2],E=i[5],T=i[8];return s[0]=o*g+a*x+l*b,s[3]=o*m+a*v+l*E,s[6]=o*d+a*y+l*T,s[1]=c*g+u*x+f*b,s[4]=c*m+u*v+f*E,s[7]=c*d+u*y+f*T,s[2]=h*g+p*x+_*b,s[5]=h*m+p*v+_*E,s[8]=h*d+p*y+_*T,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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,h=a*l-u*s,p=c*s-o*l,_=t*f+n*h+i*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=f*g,e[1]=(i*c-u*n)*g,e[2]=(a*n-i*o)*g,e[3]=h*g,e[4]=(u*t-i*l)*g,e[5]=(i*s-a*t)*g,e[6]=p*g,e[7]=(n*l-c*t)*g,e[8]=(o*t-n*s)*g,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,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Pa.makeScale(e,t)),this}rotate(e){return this.premultiply(Pa.makeRotation(-e)),this}translate(e,t){return this.premultiply(Pa.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 Pa=new rt;function af(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function Js(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function cp(){const r=Js("canvas");return r.style.display="block",r}const ou={};function Xs(r){r in ou||(ou[r]=!0,console.warn(r))}const au=new rt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),lu=new rt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),so={[an]:{transfer:ra,primaries:sa,toReference:r=>r,fromReference:r=>r},[Ht]:{transfer:At,primaries:sa,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[_a]:{transfer:ra,primaries:oa,toReference:r=>r.applyMatrix3(lu),fromReference:r=>r.applyMatrix3(au)},[Jl]:{transfer:At,primaries:oa,toReference:r=>r.convertSRGBToLinear().applyMatrix3(lu),fromReference:r=>r.applyMatrix3(au).convertLinearToSRGB()}},up=new Set([an,_a]),dt={enabled:!0,_workingColorSpace:an,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!up.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=so[e].toReference,i=so[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 so[r].primaries},getTransfer:function(r){return r===Hn?ra:so[r].transfer}};function is(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Da(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Tr;class lf{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Tr===void 0&&(Tr=Js("canvas")),Tr.width=e.width,Tr.height=e.height;const n=Tr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Tr}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=Js("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 o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==jh)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ls:e.x=e.x-Math.floor(e.x);break;case kn:e.x=e.x<0?0:1;break;case ia: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 ls:e.y=e.y-Math.floor(e.y);break;case kn:e.y=e.y<0?0:1;break;case ia: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 Xs("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Ht?Xi:nf}set encoding(e){Xs("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Xi?Ht:Hn}}on.DEFAULT_IMAGE=null;on.DEFAULT_MAPPING=jh;on.DEFAULT_ANISOTROPY=1;class pt{constructor(e=0,t=0,n=0,i=1){pt.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,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[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 l=e.elements,c=l[0],u=l[4],f=l[8],h=l[1],p=l[5],_=l[9],g=l[2],m=l[6],d=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-g)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+g)<.1&&Math.abs(_+m)<.1&&Math.abs(c+p+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,y=(p+1)/2,b=(d+1)/2,E=(u+h)/4,T=(f+g)/4,I=(_+m)/4;return v>y&&v>b?v<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(v),i=E/n,s=T/n):y>b?y<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(y),n=E/i,s=I/i):b<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(b),n=T/s,i=I/s),this.set(n,i,s,t),this}let x=Math.sqrt((m-_)*(m-_)+(f-g)*(f-g)+(h-u)*(h-u));return Math.abs(x)<.001&&(x=1),this.x=(m-_)/x,this.y=(f-g)/x,this.z=(h-u)/x,this.w=Math.acos((c+p+d-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 dp extends gr{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(Xs("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Xi?Ht:Hn),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:wn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},n),this.texture=new on(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 cf(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 qi extends dp{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class uf extends on{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=Nt,this.minFilter=Nt,this.wrapR=kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class pp extends on{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=Nt,this.minFilter=Nt,this.wrapR=kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class pi{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,o,a){let l=n[i+0],c=n[i+1],u=n[i+2],f=n[i+3];const h=s[o+0],p=s[o+1],_=s[o+2],g=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f;return}if(a===1){e[t+0]=h,e[t+1]=p,e[t+2]=_,e[t+3]=g;return}if(f!==g||l!==h||c!==p||u!==_){let m=1-a;const d=l*h+c*p+u*_+f*g,x=d>=0?1:-1,v=1-d*d;if(v>Number.EPSILON){const b=Math.sqrt(v),E=Math.atan2(b,d*x);m=Math.sin(m*E)/b,a=Math.sin(a*E)/b}const y=a*x;if(l=l*m+h*y,c=c*m+p*y,u=u*m+_*y,f=f*m+g*y,m===1-a){const b=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=b,c*=b,u*=b,f*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],f=s[o],h=s[o+1],p=s[o+2],_=s[o+3];return e[t]=a*_+u*f+l*p-c*h,e[t+1]=l*_+u*h+c*f-a*p,e[t+2]=c*_+u*p+a*h-l*f,e[t+3]=u*_-a*f-l*h-c*p,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){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),f=a(s/2),h=l(n/2),p=l(i/2),_=l(s/2);switch(o){case"XYZ":this._x=h*u*f+c*p*_,this._y=c*p*f-h*u*_,this._z=c*u*_+h*p*f,this._w=c*u*f-h*p*_;break;case"YXZ":this._x=h*u*f+c*p*_,this._y=c*p*f-h*u*_,this._z=c*u*_-h*p*f,this._w=c*u*f+h*p*_;break;case"ZXY":this._x=h*u*f-c*p*_,this._y=c*p*f+h*u*_,this._z=c*u*_+h*p*f,this._w=c*u*f-h*p*_;break;case"ZYX":this._x=h*u*f-c*p*_,this._y=c*p*f+h*u*_,this._z=c*u*_-h*p*f,this._w=c*u*f+h*p*_;break;case"YZX":this._x=h*u*f+c*p*_,this._y=c*p*f+h*u*_,this._z=c*u*_-h*p*f,this._w=c*u*f-h*p*_;break;case"XZY":this._x=h*u*f-c*p*_,this._y=c*p*f-h*u*_,this._z=c*u*_+h*p*f,this._w=c*u*f+h*p*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&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],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],h=n+a+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-i)*p}else if(n>a&&n>f){const p=2*Math.sqrt(1+n-a-f);this._w=(u-l)/p,this._x=.25*p,this._y=(i+o)/p,this._z=(s+c)/p}else if(a>f){const p=2*Math.sqrt(1+a-n-f);this._w=(s-c)/p,this._x=(i+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+f-n-a);this._w=(o-i)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.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(tn(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,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-s*c,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,o=this._w;let a=o*e._w+n*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*f+this._w*h,this._x=n*f+this._x*h,this._y=i*f+this._y*h,this._z=s*f+this._z*h,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}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 L{constructor(e=0,t=0,n=0){L.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(cu.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(cu.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,o=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])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*n),u=2*(a*t-s*i),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=i+l*f+s*u-o*c,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,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-n*l,this.z=n*a-i*o,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 Na.copy(this).projectOnVector(e),this.sub(Na)}reflect(e){return this.sub(Na.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(tn(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 Na=new L,cu=new pi;class $t{constructor(e=new L(1/0,1/0,1/0),t=new L(-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;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,qn),qn.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(Ms),ao.subVectors(this.max,Ms),Ar.subVectors(e.a,Ms),Rr.subVectors(e.b,Ms),Cr.subVectors(e.c,Ms),Di.subVectors(Rr,Ar),Ii.subVectors(Cr,Rr),Zi.subVectors(Ar,Cr);let t=[0,-Di.z,Di.y,0,-Ii.z,Ii.y,0,-Zi.z,Zi.y,Di.z,0,-Di.x,Ii.z,0,-Ii.x,Zi.z,0,-Zi.x,-Di.y,Di.x,0,-Ii.y,Ii.x,0,-Zi.y,Zi.x,0];return!Fa(t,Ar,Rr,Cr,ao)||(t=[1,0,0,0,1,0,0,0,1],!Fa(t,Ar,Rr,Cr,ao))?!1:(lo.crossVectors(Di,Ii),t=[lo.x,lo.y,lo.z],Fa(t,Ar,Rr,Cr,ao))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qn).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:(vi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),vi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),vi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),vi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),vi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),vi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),vi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),vi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(vi),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 vi=[new L,new L,new L,new L,new L,new L,new L,new L],qn=new L,oo=new $t,Ar=new L,Rr=new L,Cr=new L,Di=new L,Ii=new L,Zi=new L,Ms=new L,ao=new L,lo=new L,Ji=new L;function Fa(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Ji.fromArray(r,s);const a=i.x*Math.abs(Ji.x)+i.y*Math.abs(Ji.y)+i.z*Math.abs(Ji.z),l=e.dot(Ji),c=t.dot(Ji),u=n.dot(Ji);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const mp=new $t,Es=new L,Oa=new L;class ti{constructor(e=new L,t=-1){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):mp.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;sthis.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;Es.subVectors(e,this.center);const t=Es.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Es,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):(Oa.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Es.copy(e.center).add(Oa)),this.expandByPoint(Es.copy(e.center).sub(Oa))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const xi=new L,Ua=new L,co=new L,Ni=new L,Ba=new L,uo=new L,za=new L;class to{constructor(e=new L,t=new L(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,xi)),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=xi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(xi.copy(this.origin).addScaledVector(this.direction,t),xi.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Ua.copy(e).add(t).multiplyScalar(.5),co.copy(t).sub(e).normalize(),Ni.copy(this.origin).sub(Ua);const s=e.distanceTo(t)*.5,o=-this.direction.dot(co),a=Ni.dot(this.direction),l=-Ni.dot(co),c=Ni.lengthSq(),u=Math.abs(1-o*o);let f,h,p,_;if(u>0)if(f=o*l-a,h=o*a-l,_=s*u,f>=0)if(h>=-_)if(h<=_){const g=1/u;f*=g,h*=g,p=f*(f+o*h+2*a)+h*(o*f+h+2*l)+c}else h=s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h<=-_?(f=Math.max(0,-(-o*s+a)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=_?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(o*s+a)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=o>0?-s:s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(Ua).addScaledVector(co,h),p}intersectSphere(e,t){xi.subVectors(e.center,this.origin);const n=xi.dot(this.direction),i=xi.dot(xi)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,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,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),n>l||a>i)||((a>n||n!==n)&&(n=a),(l=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,xi)!==null}intersectTriangle(e,t,n,i,s){Ba.subVectors(t,e),uo.subVectors(n,e),za.crossVectors(Ba,uo);let o=this.direction.dot(za),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ni.subVectors(this.origin,e);const l=a*this.direction.dot(uo.crossVectors(Ni,uo));if(l<0)return null;const c=a*this.direction.dot(Ba.cross(Ni));if(c<0||l+c>o)return null;const u=-a*Ni.dot(za);return u<0?null:this.at(u/o,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 Ve{constructor(e,t,n,i,s,o,a,l,c,u,f,h,p,_,g,m){Ve.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,o,a,l,c,u,f,h,p,_,g,m)}set(e,t,n,i,s,o,a,l,c,u,f,h,p,_,g,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=n,d[12]=i,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=h,d[3]=p,d[7]=_,d[11]=g,d[15]=m,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 Ve().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/Lr.setFromMatrixColumn(e,0).length(),s=1/Lr.setFromMatrixColumn(e,1).length(),o=1/Lr.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]*o,t[9]=n[9]*o,t[10]=n[10]*o,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,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=o*u,p=o*f,_=a*u,g=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=p+_*c,t[5]=h-g*c,t[9]=-a*l,t[2]=g-h*c,t[6]=_+p*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,p=l*f,_=c*u,g=c*f;t[0]=h+g*a,t[4]=_*a-p,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=p*a-_,t[6]=g+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,p=l*f,_=c*u,g=c*f;t[0]=h-g*a,t[4]=-o*f,t[8]=_+p*a,t[1]=p+_*a,t[5]=o*u,t[9]=g-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,p=o*f,_=a*u,g=a*f;t[0]=l*u,t[4]=_*c-p,t[8]=h*c+g,t[1]=l*f,t[5]=g*c+h,t[9]=p*c-_,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,p=o*c,_=a*l,g=a*c;t[0]=l*u,t[4]=g-h*f,t[8]=_*f+p,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*f+_,t[10]=h-g*f}else if(e.order==="XZY"){const h=o*l,p=o*c,_=a*l,g=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=h*f+g,t[5]=o*u,t[9]=p*f-_,t[2]=_*f-p,t[6]=a*u,t[10]=g*f+h}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(_p,e,gp)}lookAt(e,t,n){const i=this.elements;return Cn.subVectors(e,t),Cn.lengthSq()===0&&(Cn.z=1),Cn.normalize(),Fi.crossVectors(n,Cn),Fi.lengthSq()===0&&(Math.abs(n.z)===1?Cn.x+=1e-4:Cn.z+=1e-4,Cn.normalize(),Fi.crossVectors(n,Cn)),Fi.normalize(),ho.crossVectors(Cn,Fi),i[0]=Fi.x,i[4]=ho.x,i[8]=Cn.x,i[1]=Fi.y,i[5]=ho.y,i[9]=Cn.y,i[2]=Fi.z,i[6]=ho.z,i[10]=Cn.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,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],h=n[9],p=n[13],_=n[2],g=n[6],m=n[10],d=n[14],x=n[3],v=n[7],y=n[11],b=n[15],E=i[0],T=i[4],I=i[8],S=i[12],A=i[1],z=i[5],O=i[9],G=i[13],D=i[2],H=i[6],Z=i[10],J=i[14],ce=i[3],ie=i[7],se=i[11],me=i[15];return s[0]=o*E+a*A+l*D+c*ce,s[4]=o*T+a*z+l*H+c*ie,s[8]=o*I+a*O+l*Z+c*se,s[12]=o*S+a*G+l*J+c*me,s[1]=u*E+f*A+h*D+p*ce,s[5]=u*T+f*z+h*H+p*ie,s[9]=u*I+f*O+h*Z+p*se,s[13]=u*S+f*G+h*J+p*me,s[2]=_*E+g*A+m*D+d*ce,s[6]=_*T+g*z+m*H+d*ie,s[10]=_*I+g*O+m*Z+d*se,s[14]=_*S+g*G+m*J+d*me,s[3]=x*E+v*A+y*D+b*ce,s[7]=x*T+v*z+y*H+b*ie,s[11]=x*I+v*O+y*Z+b*se,s[15]=x*S+v*G+y*J+b*me,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],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],h=e[10],p=e[14],_=e[3],g=e[7],m=e[11],d=e[15];return _*(+s*l*f-i*c*f-s*a*h+n*c*h+i*a*p-n*l*p)+g*(+t*l*p-t*c*h+s*o*h-i*o*p+i*c*u-s*l*u)+m*(+t*c*f-t*a*p-s*o*f+n*o*p+s*a*u-n*c*u)+d*(-i*a*u-t*l*f+t*a*h+i*o*f-n*o*h+n*l*u)}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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],p=e[11],_=e[12],g=e[13],m=e[14],d=e[15],x=f*m*c-g*h*c+g*l*p-a*m*p-f*l*d+a*h*d,v=_*h*c-u*m*c-_*l*p+o*m*p+u*l*d-o*h*d,y=u*g*c-_*f*c+_*a*p-o*g*p-u*a*d+o*f*d,b=_*f*l-u*g*l-_*a*h+o*g*h+u*a*m-o*f*m,E=t*x+n*v+i*y+s*b;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/E;return e[0]=x*T,e[1]=(g*h*s-f*m*s-g*i*p+n*m*p+f*i*d-n*h*d)*T,e[2]=(a*m*s-g*l*s+g*i*c-n*m*c-a*i*d+n*l*d)*T,e[3]=(f*l*s-a*h*s-f*i*c+n*h*c+a*i*p-n*l*p)*T,e[4]=v*T,e[5]=(u*m*s-_*h*s+_*i*p-t*m*p-u*i*d+t*h*d)*T,e[6]=(_*l*s-o*m*s-_*i*c+t*m*c+o*i*d-t*l*d)*T,e[7]=(o*h*s-u*l*s+u*i*c-t*h*c-o*i*p+t*l*p)*T,e[8]=y*T,e[9]=(_*f*s-u*g*s-_*n*p+t*g*p+u*n*d-t*f*d)*T,e[10]=(o*g*s-_*a*s+_*n*c-t*g*c-o*n*d+t*a*d)*T,e[11]=(u*a*s-o*f*s-u*n*c+t*f*c+o*n*p-t*a*p)*T,e[12]=b*T,e[13]=(u*g*i-_*f*i+_*n*h-t*g*h-u*n*m+t*f*m)*T,e[14]=(_*a*i-o*g*i-_*n*l+t*g*l+o*n*m-t*a*m)*T,e[15]=(o*f*i-u*a*i+u*n*l-t*f*l-o*n*h+t*a*h)*T,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,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*o,s*l*l+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,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,h=s*c,p=s*u,_=s*f,g=o*u,m=o*f,d=a*f,x=l*c,v=l*u,y=l*f,b=n.x,E=n.y,T=n.z;return i[0]=(1-(g+d))*b,i[1]=(p+y)*b,i[2]=(_-v)*b,i[3]=0,i[4]=(p-y)*E,i[5]=(1-(h+d))*E,i[6]=(m+x)*E,i[7]=0,i[8]=(_+v)*T,i[9]=(m-x)*T,i[10]=(1-(h+g))*T,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=Lr.set(i[0],i[1],i[2]).length();const o=Lr.set(i[4],i[5],i[6]).length(),a=Lr.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],jn.copy(this);const c=1/s,u=1/o,f=1/a;return jn.elements[0]*=c,jn.elements[1]*=c,jn.elements[2]*=c,jn.elements[4]*=u,jn.elements[5]*=u,jn.elements[6]*=u,jn.elements[8]*=f,jn.elements[9]*=f,jn.elements[10]*=f,t.setFromRotationMatrix(jn),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o,a=Ti){const l=this.elements,c=2*s/(t-e),u=2*s/(n-i),f=(t+e)/(t-e),h=(n+i)/(n-i);let p,_;if(a===Ti)p=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===aa)p=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,o,a=Ti){const l=this.elements,c=1/(t-e),u=1/(n-i),f=1/(o-s),h=(t+e)*c,p=(n+i)*u;let _,g;if(a===Ti)_=(o+s)*f,g=-2*f;else if(a===aa)_=s*f,g=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=g,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[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 Lr=new L,jn=new Ve,_p=new L(0,0,0),gp=new L(1,1,1),Fi=new L,ho=new L,Cn=new L,uu=new Ve,hu=new pi;class ga{constructor(e=0,t=0,n=0,i=ga.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],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],f=i[2],h=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(tn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-tn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(tn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-tn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(tn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-tn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),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 uu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(uu,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return hu.setFromEuler(this),this.setFromQuaternion(hu,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}}ga.DEFAULT_ORDER="XYZ";class hf{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(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(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.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(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=i,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}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;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Yn.subVectors(i,t),bi.subVectors(n,t),ka.subVectors(e,t);const o=Yn.dot(Yn),a=Yn.dot(bi),l=Yn.dot(ka),c=bi.dot(bi),u=bi.dot(ka),f=o*c-a*a;if(f===0)return s.set(-2,-1,-1);const h=1/f,p=(c*l-a*u)*h,_=(o*u-a*l)*h;return s.set(1-p-_,_,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Si),Si.x>=0&&Si.y>=0&&Si.x+Si.y<=1}static getUV(e,t,n,i,s,o,a,l){return po===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),po=!0),this.getInterpolation(e,t,n,i,s,o,a,l)}static getInterpolation(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,Si),l.setScalar(0),l.addScaledVector(s,Si.x),l.addScaledVector(o,Si.y),l.addScaledVector(a,Si.z),l}static isFrontFacing(e,t,n,i){return Yn.subVectors(n,t),bi.subVectors(e,t),Yn.cross(bi).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 Yn.subVectors(this.c,this.b),bi.subVectors(this.a,this.b),Yn.cross(bi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return fn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return fn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return po===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),po=!0),fn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return fn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return fn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return fn.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 o,a;Dr.subVectors(i,n),Ir.subVectors(s,n),Ha.subVectors(e,n);const l=Dr.dot(Ha),c=Ir.dot(Ha);if(l<=0&&c<=0)return t.copy(n);Va.subVectors(e,i);const u=Dr.dot(Va),f=Ir.dot(Va);if(u>=0&&f<=u)return t.copy(i);const h=l*f-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Dr,o);Ga.subVectors(e,s);const p=Dr.dot(Ga),_=Ir.dot(Ga);if(_>=0&&p<=_)return t.copy(s);const g=p*c-l*_;if(g<=0&&c>=0&&_<=0)return a=c/(c-_),t.copy(n).addScaledVector(Ir,a);const m=u*_-p*f;if(m<=0&&f-u>=0&&p-_>=0)return _u.subVectors(s,i),a=(f-u)/(f-u+(p-_)),t.copy(i).addScaledVector(_u,a);const d=1/(m+g+h);return o=g*d,a=h*d,t.copy(n).addScaledVector(Dr,o).addScaledVector(Ir,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const ff={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},Oi={h:0,s:0,l:0},mo={h:0,s:0,l:0};function Wa(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 et{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=Ht){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=Ql(e,1),t=tn(t,0,1),n=tn(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=Wa(o,s,e+1/3),this.g=Wa(o,s,e),this.b=Wa(o,s,e-1/3)}return dt.toWorkingColorSpace(this,i),this}setStyle(e,t=Ht){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 o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))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],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===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=Ht){const n=ff[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=is(e.r),this.g=is(e.g),this.b=is(e.b),this}copyLinearToSRGB(e){return this.r=Da(e.r),this.g=Da(e.g),this.b=Da(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ht){return dt.fromWorkingColorSpace(hn.copy(this),e),Math.round(tn(hn.r*255,0,255))*65536+Math.round(tn(hn.g*255,0,255))*256+Math.round(tn(hn.b*255,0,255))}getHexString(e=Ht){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=dt.workingColorSpace){dt.fromWorkingColorSpace(hn.copy(this),t);const n=hn.r,i=hn.g,s=hn.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(i-s)/f+(i0!=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!==Qn&&(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!==El&&(n.blendSrc=this.blendSrc),this.blendDst!==Tl&&(n.blendDst=this.blendDst),this.blendEquation!==ar&&(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!==na&&(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!==iu&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Er&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Er&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Er&&(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 o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}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 Hi extends fi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new et(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=qh,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 Xt=new L,_o=new Ue;class Yt{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=Dl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=vn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and 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;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);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 l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,h=c.length;f0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.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 c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],f=s[c];for(let h=0,p=f.length;h0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(gu.copy(s).invert(),Qi.copy(e.ray).applyMatrix4(gu),!(n.boundingBox!==null&&Qi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Qi)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let _=0,g=h.length;_t.far?null:{distance:c,point:wo.clone(),object:r}}function Mo(r,e,t,n,i,s,o,a,l,c){r.getVertexPosition(a,Fr),r.getVertexPosition(l,Or),r.getVertexPosition(c,Ur);const u=Ep(r,e,t,n,Fr,Or,Ur,So);if(u){i&&(xo.fromBufferAttribute(i,a),yo.fromBufferAttribute(i,l),bo.fromBufferAttribute(i,c),u.uv=fn.getInterpolation(So,Fr,Or,Ur,xo,yo,bo,new Ue)),s&&(xo.fromBufferAttribute(s,a),yo.fromBufferAttribute(s,l),bo.fromBufferAttribute(s,c),u.uv1=fn.getInterpolation(So,Fr,Or,Ur,xo,yo,bo,new Ue),u.uv2=u.uv1),o&&(xu.fromBufferAttribute(o,a),yu.fromBufferAttribute(o,l),bu.fromBufferAttribute(o,c),u.normal=fn.getInterpolation(So,Fr,Or,Ur,xu,yu,bu,new L),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new L,materialIndex:0};fn.getNormal(Fr,Or,Ur,f.normal),u.face=f}return u}class no extends yn{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let h=0,p=0;_("z","y","x",-1,-1,n,t,e,o,s,0),_("z","y","x",1,-1,n,t,-e,o,s,1),_("x","z","y",1,1,e,n,t,i,o,2),_("x","z","y",1,-1,e,n,-t,i,o,3),_("x","y","z",1,-1,e,t,n,i,s,4),_("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new Jn(c,3)),this.setAttribute("normal",new Jn(u,3)),this.setAttribute("uv",new Jn(f,2));function _(g,m,d,x,v,y,b,E,T,I,S){const A=y/T,z=b/I,O=y/2,G=b/2,D=E/2,H=T+1,Z=I+1;let J=0,ce=0;const ie=new L;for(let se=0;se0?1:-1,u.push(ie.x,ie.y,ie.z),f.push(ve/T),f.push(1-se/I),J+=1}}for(let se=0;se0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class mf extends Ot{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ge,this.projectionMatrix=new Ge,this.projectionMatrixInverse=new Ge,this.coordinateSystem=Ei}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class mn extends mf{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ls*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Hs*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ls*2*Math.atan(Math.tan(Hs*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,o){this.aspect=e/t,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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Hs*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Ur=-90,Br=1;class Rp extends Ot{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new mn(Ur,Br,e,t);i.layers=this.layers,this.add(i);const s=new mn(Ur,Br,e,t);s.layers=this.layers,this.add(s);const o=new mn(Ur,Br,e,t);o.layers=this.layers,this.add(o);const a=new mn(Ur,Br,e,t);a.layers=this.layers,this.add(a);const l=new mn(Ur,Br,e,t);l.layers=this.layers,this.add(l);const c=new mn(Ur,Br,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Ei)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===sa)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,o),e.setRenderTarget(n,2,i),e.render(t,a),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=g,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(h,f,d),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class _f extends rn{constructor(e,t,n,i,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:is,super(e,t,n,i,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Cp extends Xi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];t.encoding!==void 0&&(Gs("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Wi?zt:kn),this.texture=new _f(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:bn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class ji extends fi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Rp,this.fragmentShader=Cp,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=fs(e.uniforms),this.uniformsGroups=Tp(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class _f extends Bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ve,this.projectionMatrix=new Ve,this.projectionMatrixInverse=new Ve,this.coordinateSystem=Ti}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class gn extends _f{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=hs*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Gs*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return hs*2*Math.atan(Math.tan(Gs*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,o){this.aspect=e/t,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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Gs*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Br=-90,zr=1;class Lp extends Bt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new gn(Br,zr,e,t);i.layers=this.layers,this.add(i);const s=new gn(Br,zr,e,t);s.layers=this.layers,this.add(s);const o=new gn(Br,zr,e,t);o.layers=this.layers,this.add(o);const a=new gn(Br,zr,e,t);a.layers=this.layers,this.add(a);const l=new gn(Br,zr,e,t);l.layers=this.layers,this.add(l);const c=new gn(Br,zr,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Ti)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===aa)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const g=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,o),e.setRenderTarget(n,2,i),e.render(t,a),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=g,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(f,h,p),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class gf extends on{constructor(e,t,n,i,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:os,super(e,t,n,i,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Pp extends qi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];t.encoding!==void 0&&(Xs("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Xi?Ht:Hn),this.texture=new gf(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:wn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -41,9 +41,9 @@ gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},i=new eo(5,5,5),s=new ji({name:"CubemapFromEquirect",uniforms:cs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:gn,blending:Vi});s.uniforms.tEquirect.value=t;const o=new Mn(i,s),a=t.minFilter;return t.minFilter===pr&&(t.minFilter=bn),new Rp(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}const Xa=new P,Lp=new P,Pp=new rt;class ai{constructor(e=new P(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Xa.subVectors(n,t).cross(Lp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Xa),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Pp.getNormalMatrix(e),i=this.coplanarPoint(Xa).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Qi=new ei,wo=new P;class Ql{constructor(e=new ai,t=new ai,n=new ai,i=new ai,s=new ai,o=new ai){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ei){const n=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],h=i[6],f=i[7],d=i[8],_=i[9],g=i[10],m=i[11],p=i[12],y=i[13],v=i[14],x=i[15];if(n[0].setComponents(l-s,f-c,m-d,x-p).normalize(),n[1].setComponents(l+s,f+c,m+d,x+p).normalize(),n[2].setComponents(l+o,f+u,m+_,x+y).normalize(),n[3].setComponents(l-o,f-u,m-_,x-y).normalize(),n[4].setComponents(l-a,f-h,m-g,x-v).normalize(),t===Ei)n[5].setComponents(l+a,f+h,m+g,x+v).normalize();else if(t===sa)n[5].setComponents(a,h,g,v).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Qi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Qi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Qi)}intersectsSprite(e){return Qi.center.set(0,0,0),Qi.radius=.7071067811865476,Qi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qi)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,wo.y=i.normal.y>0?e.max.y:e.min.y,wo.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(wo)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function gf(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function Dp(r,e){const t=e.isWebGL2,n=new WeakMap;function i(c,u){const h=c.array,f=c.usage,d=h.byteLength,_=r.createBuffer();r.bindBuffer(u,_),r.bufferData(u,h,f),c.onUploadCallback();let g;if(h instanceof Float32Array)g=r.FLOAT;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)g=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=r.UNSIGNED_SHORT;else if(h instanceof Int16Array)g=r.SHORT;else if(h instanceof Uint32Array)g=r.UNSIGNED_INT;else if(h instanceof Int32Array)g=r.INT;else if(h instanceof Int8Array)g=r.BYTE;else if(h instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:_,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version,size:d}}function s(c,u,h){const f=u.array,d=u._updateRange,_=u.updateRanges;if(r.bindBuffer(h,c),d.count===-1&&_.length===0&&r.bufferSubData(h,0,f),_.length!==0){for(let g=0,m=_.length;g1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Ip.getNormalMatrix(e),i=this.coplanarPoint(ja).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const er=new ti,Eo=new L;class ec{constructor(e=new li,t=new li,n=new li,i=new li,s=new li,o=new li){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ti){const n=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],f=i[6],h=i[7],p=i[8],_=i[9],g=i[10],m=i[11],d=i[12],x=i[13],v=i[14],y=i[15];if(n[0].setComponents(l-s,h-c,m-p,y-d).normalize(),n[1].setComponents(l+s,h+c,m+p,y+d).normalize(),n[2].setComponents(l+o,h+u,m+_,y+x).normalize(),n[3].setComponents(l-o,h-u,m-_,y-x).normalize(),n[4].setComponents(l-a,h-f,m-g,y-v).normalize(),t===Ti)n[5].setComponents(l+a,h+f,m+g,y+v).normalize();else if(t===aa)n[5].setComponents(a,f,g,v).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),er.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),er.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(er)}intersectsSprite(e){return er.center.set(0,0,0),er.radius=.7071067811865476,er.applyMatrix4(e.matrixWorld),this.intersectsSphere(er)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,Eo.y=i.normal.y>0?e.max.y:e.min.y,Eo.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Eo)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function vf(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function Np(r,e){const t=e.isWebGL2,n=new WeakMap;function i(c,u){const f=c.array,h=c.usage,p=f.byteLength,_=r.createBuffer();r.bindBuffer(u,_),r.bufferData(u,f,h),c.onUploadCallback();let g;if(f instanceof Float32Array)g=r.FLOAT;else if(f instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)g=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)g=r.SHORT;else if(f instanceof Uint32Array)g=r.UNSIGNED_INT;else if(f instanceof Int32Array)g=r.INT;else if(f instanceof Int8Array)g=r.BYTE;else if(f instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:_,type:g,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:p}}function s(c,u,f){const h=u.array,p=u._updateRange,_=u.updateRanges;if(r.bindBuffer(f,c),p.count===-1&&_.length===0&&r.bufferSubData(f,0,h),_.length!==0){for(let g=0,m=_.length;g 0 +#endif`,Kp=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { @@ -240,26 +240,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #pragma unroll_loop_end if ( clipped ) discard; #endif -#endif`,$p=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Zp=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,Kp=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Jp=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,Zp=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Qp=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,Jp=`#if defined( USE_COLOR_ALPHA ) +#endif`,em=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,Qp=`#if defined( USE_COLOR_ALPHA ) +#endif`,tm=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,em=`#if defined( USE_COLOR_ALPHA ) +#endif`,nm=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; -#endif`,tm=`#if defined( USE_COLOR_ALPHA ) +#endif`,im=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); @@ -269,7 +269,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; -#endif`,nm=`#define PI 3.141592653589793 +#endif`,rm=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -347,7 +347,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,im=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,sm=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -445,7 +445,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,rm=`vec3 transformedNormal = objectNormal; +#endif`,om=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -474,18 +474,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,sm=`#ifdef USE_DISPLACEMENTMAP +#endif`,am=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,om=`#ifdef USE_DISPLACEMENTMAP +#endif`,lm=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,am=`#ifdef USE_EMISSIVEMAP +#endif`,cm=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,lm=`#ifdef USE_EMISSIVEMAP +#endif`,um=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,cm="gl_FragColor = linearToOutputTexel( gl_FragColor );",um=` +#endif`,hm="gl_FragColor = linearToOutputTexel( gl_FragColor );",fm=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -513,7 +513,7 @@ vec4 LinearToLinear( in vec4 value ) { } vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); -}`,hm=`#ifdef USE_ENVMAP +}`,dm=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -542,7 +542,7 @@ vec4 LinearTosRGB( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,fm=`#ifdef USE_ENVMAP +#endif`,pm=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE @@ -551,7 +551,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,dm=`#ifdef USE_ENVMAP +#endif`,mm=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -562,7 +562,7 @@ vec4 LinearTosRGB( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,pm=`#ifdef USE_ENVMAP +#endif`,_m=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -573,7 +573,7 @@ vec4 LinearTosRGB( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,mm=`#ifdef USE_ENVMAP +#endif`,gm=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -590,18 +590,18 @@ vec4 LinearTosRGB( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,_m=`#ifdef USE_FOG +#endif`,vm=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,gm=`#ifdef USE_FOG +#endif`,xm=`#ifdef USE_FOG varying float vFogDepth; -#endif`,vm=`#ifdef USE_FOG +#endif`,ym=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,xm=`#ifdef USE_FOG +#endif`,bm=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -610,7 +610,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,ym=`#ifdef USE_GRADIENTMAP +#endif`,Sm=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -622,16 +622,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,bm=`#ifdef USE_LIGHTMAP +}`,wm=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,Sm=`#ifdef USE_LIGHTMAP +#endif`,Mm=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,wm=`LambertMaterial material; +#endif`,Em=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,Mm=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Tm=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -645,7 +645,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Em=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Am=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -768,7 +768,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,Tm=`#ifdef USE_ENVMAP +#endif`,Rm=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -801,8 +801,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,Am=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,Rm=`varying vec3 vViewPosition; +#endif`,Cm=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,Lm=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -814,11 +814,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Cm=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Pm=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,Lm=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Dm=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -835,7 +835,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Pm=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Im=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -918,7 +918,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,Dm=`struct PhysicalMaterial { +#endif`,Nm=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1218,7 +1218,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,Im=` +}`,Fm=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1333,7 +1333,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,Nm=`#if defined( RE_IndirectDiffuse ) +#endif`,Om=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1352,25 +1352,25 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,Fm=`#if defined( RE_IndirectDiffuse ) +#endif`,Um=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,Om=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,Bm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,Um=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,zm=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,Bm=`#ifdef USE_LOGDEPTHBUF +#endif`,km=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif -#endif`,zm=`#ifdef USE_LOGDEPTHBUF +#endif`,Hm=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); @@ -1380,16 +1380,16 @@ IncidentLight directLight; gl_Position.z *= gl_Position.w; } #endif -#endif`,km=`#ifdef USE_MAP +#endif`,Vm=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,Hm=`#ifdef USE_MAP +#endif`,Gm=`#ifdef USE_MAP uniform sampler2D map; -#endif`,Vm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,Wm=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1401,7 +1401,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,Gm=`#if defined( USE_POINTS_UV ) +#endif`,Xm=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1413,13 +1413,13 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,Wm=`float metalnessFactor = metalness; +#endif`,qm=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,Xm=`#ifdef USE_METALNESSMAP +#endif`,jm=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,jm=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) +#endif`,Ym=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1428,7 +1428,7 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,qm=`#ifdef USE_MORPHNORMALS +#endif`,$m=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1440,7 +1440,7 @@ IncidentLight directLight; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif -#endif`,Ym=`#ifdef USE_MORPHTARGETS +#endif`,Km=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1460,7 +1460,7 @@ IncidentLight directLight; uniform float morphTargetInfluences[ 4 ]; #endif #endif -#endif`,$m=`#ifdef USE_MORPHTARGETS +#endif`,Zm=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1478,7 +1478,7 @@ IncidentLight directLight; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif -#endif`,Km=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,Jm=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1519,7 +1519,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,Zm=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,Qm=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1534,25 +1534,25 @@ vec3 nonPerturbedNormal = normal;`,Zm=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,Jm=`#ifndef FLAT_SHADED +#endif`,e_=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Qm=`#ifndef FLAT_SHADED +#endif`,t_=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,e_=`#ifndef FLAT_SHADED +#endif`,n_=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,t_=`#ifdef USE_NORMALMAP +#endif`,i_=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1574,13 +1574,13 @@ vec3 nonPerturbedNormal = normal;`,Zm=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,n_=`#ifdef USE_CLEARCOAT +#endif`,r_=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,i_=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,s_=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,r_=`#ifdef USE_CLEARCOATMAP +#endif`,o_=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1589,18 +1589,18 @@ vec3 nonPerturbedNormal = normal;`,Zm=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,s_=`#ifdef USE_IRIDESCENCEMAP +#endif`,a_=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,o_=`#ifdef OPAQUE +#endif`,l_=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,a_=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,c_=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1641,9 +1641,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,l_=`#ifdef PREMULTIPLIED_ALPHA +}`,u_=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,c_=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,h_=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1651,22 +1651,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,u_=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,f_=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,h_=`#ifdef DITHERING +#endif`,d_=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,f_=`float roughnessFactor = roughness; +#endif`,p_=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,d_=`#ifdef USE_ROUGHNESSMAP +#endif`,m_=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,p_=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,__=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -1843,7 +1843,7 @@ gl_Position = projectionMatrix * mvPosition;`,u_=`#ifdef DITHERING return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } -#endif`,m_=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,g_=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -1881,7 +1881,7 @@ gl_Position = projectionMatrix * mvPosition;`,u_=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,__=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,v_=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -1913,7 +1913,7 @@ gl_Position = projectionMatrix * mvPosition;`,u_=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,g_=`float getShadowMask() { +#endif`,x_=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -1945,12 +1945,12 @@ gl_Position = projectionMatrix * mvPosition;`,u_=`#ifdef DITHERING #endif #endif return shadow; -}`,v_=`#ifdef USE_SKINNING +}`,y_=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,x_=`#ifdef USE_SKINNING +#endif`,b_=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -1965,7 +1965,7 @@ gl_Position = projectionMatrix * mvPosition;`,u_=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,y_=`#ifdef USE_SKINNING +#endif`,S_=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -1973,7 +1973,7 @@ gl_Position = projectionMatrix * mvPosition;`,u_=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,b_=`#ifdef USE_SKINNING +#endif`,w_=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -1984,17 +1984,17 @@ gl_Position = projectionMatrix * mvPosition;`,u_=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,S_=`float specularStrength; +#endif`,M_=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,w_=`#ifdef USE_SPECULARMAP +#endif`,E_=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,M_=`#if defined( TONE_MAPPING ) +#endif`,T_=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,E_=`#ifndef saturate +#endif`,A_=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2030,7 +2030,7 @@ vec3 ACESFilmicToneMapping( vec3 color ) { color = ACESOutputMat * color; return saturate( color ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,T_=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,R_=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2051,7 +2051,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,T_=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,A_=`#ifdef USE_TRANSMISSION +#endif`,C_=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2157,7 +2157,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,T_=`#ifdef USE_TRANSMISS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,R_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,L_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2227,7 +2227,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,T_=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,C_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,P_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2321,7 +2321,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,T_=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,L_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,D_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2392,7 +2392,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,T_=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,P_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,I_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -2401,12 +2401,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,T_=`#ifdef USE_TRANSMISS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const D_=`varying vec2 vUv; +#endif`;const N_=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,I_=`uniform sampler2D t2D; +}`,F_=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2418,14 +2418,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,N_=`varying vec3 vWorldDirection; +}`,O_=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,F_=`#ifdef ENVMAP_TYPE_CUBE +}`,U_=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2447,14 +2447,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,O_=`varying vec3 vWorldDirection; +}`,B_=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,U_=`uniform samplerCube tCube; +}`,z_=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2464,7 +2464,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,B_=`#include +}`,k_=`#include #include #include #include @@ -2490,7 +2490,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,z_=`#if DEPTH_PACKING == 3200 +}`,H_=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2520,7 +2520,7 @@ void main() { #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif -}`,k_=`#define DISTANCE +}`,V_=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2546,7 +2546,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,H_=`#define DISTANCE +}`,G_=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2570,13 +2570,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,V_=`varying vec3 vWorldDirection; +}`,W_=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,G_=`uniform sampler2D tEquirect; +}`,X_=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2585,7 +2585,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,W_=`uniform float scale; +}`,q_=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2606,7 +2606,7 @@ void main() { #include #include #include -}`,X_=`uniform vec3 diffuse; +}`,j_=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2634,7 +2634,7 @@ void main() { #include #include #include -}`,j_=`#include +}`,Y_=`#include #include #include #include @@ -2665,7 +2665,7 @@ void main() { #include #include #include -}`,q_=`uniform vec3 diffuse; +}`,$_=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2713,7 +2713,7 @@ void main() { #include #include #include -}`,Y_=`#define LAMBERT +}`,K_=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2751,7 +2751,7 @@ void main() { #include #include #include -}`,$_=`#define LAMBERT +}`,Z_=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -2808,7 +2808,7 @@ void main() { #include #include #include -}`,K_=`#define MATCAP +}`,J_=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -2841,7 +2841,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,Z_=`#define MATCAP +}`,Q_=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -2887,7 +2887,7 @@ void main() { #include #include #include -}`,J_=`#define NORMAL +}`,eg=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -2919,7 +2919,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,Q_=`#define NORMAL +}`,tg=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -2940,7 +2940,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,eg=`#define PHONG +}`,ng=`#define PHONG varying vec3 vViewPosition; #include #include @@ -2978,7 +2978,7 @@ void main() { #include #include #include -}`,tg=`#define PHONG +}`,ig=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3037,7 +3037,7 @@ void main() { #include #include #include -}`,ng=`#define STANDARD +}`,rg=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3079,7 +3079,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,ig=`#define STANDARD +}`,sg=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3201,7 +3201,7 @@ void main() { #include #include #include -}`,rg=`#define TOON +}`,og=`#define TOON varying vec3 vViewPosition; #include #include @@ -3237,7 +3237,7 @@ void main() { #include #include #include -}`,sg=`#define TOON +}`,ag=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3290,7 +3290,7 @@ void main() { #include #include #include -}`,og=`uniform float size; +}`,lg=`uniform float size; uniform float scale; #include #include @@ -3320,7 +3320,7 @@ void main() { #include #include #include -}`,ag=`uniform vec3 diffuse; +}`,cg=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3345,7 +3345,7 @@ void main() { #include #include #include -}`,lg=`#include +}`,ug=`#include #include #include #include @@ -3367,7 +3367,7 @@ void main() { #include #include #include -}`,cg=`uniform vec3 color; +}`,hg=`uniform vec3 color; uniform float opacity; #include #include @@ -3383,7 +3383,7 @@ void main() { #include #include #include -}`,ug=`uniform float rotation; +}`,fg=`uniform float rotation; uniform vec2 center; #include #include @@ -3409,7 +3409,7 @@ void main() { #include #include #include -}`,hg=`uniform vec3 diffuse; +}`,dg=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3434,7 +3434,7 @@ void main() { #include #include #include -}`,nt={alphahash_fragment:Ip,alphahash_pars_fragment:Np,alphamap_fragment:Fp,alphamap_pars_fragment:Op,alphatest_fragment:Up,alphatest_pars_fragment:Bp,aomap_fragment:zp,aomap_pars_fragment:kp,batching_pars_vertex:Hp,batching_vertex:Vp,begin_vertex:Gp,beginnormal_vertex:Wp,bsdfs:Xp,iridescence_fragment:jp,bumpmap_pars_fragment:qp,clipping_planes_fragment:Yp,clipping_planes_pars_fragment:$p,clipping_planes_pars_vertex:Kp,clipping_planes_vertex:Zp,color_fragment:Jp,color_pars_fragment:Qp,color_pars_vertex:em,color_vertex:tm,common:nm,cube_uv_reflection_fragment:im,defaultnormal_vertex:rm,displacementmap_pars_vertex:sm,displacementmap_vertex:om,emissivemap_fragment:am,emissivemap_pars_fragment:lm,colorspace_fragment:cm,colorspace_pars_fragment:um,envmap_fragment:hm,envmap_common_pars_fragment:fm,envmap_pars_fragment:dm,envmap_pars_vertex:pm,envmap_physical_pars_fragment:Tm,envmap_vertex:mm,fog_vertex:_m,fog_pars_vertex:gm,fog_fragment:vm,fog_pars_fragment:xm,gradientmap_pars_fragment:ym,lightmap_fragment:bm,lightmap_pars_fragment:Sm,lights_lambert_fragment:wm,lights_lambert_pars_fragment:Mm,lights_pars_begin:Em,lights_toon_fragment:Am,lights_toon_pars_fragment:Rm,lights_phong_fragment:Cm,lights_phong_pars_fragment:Lm,lights_physical_fragment:Pm,lights_physical_pars_fragment:Dm,lights_fragment_begin:Im,lights_fragment_maps:Nm,lights_fragment_end:Fm,logdepthbuf_fragment:Om,logdepthbuf_pars_fragment:Um,logdepthbuf_pars_vertex:Bm,logdepthbuf_vertex:zm,map_fragment:km,map_pars_fragment:Hm,map_particle_fragment:Vm,map_particle_pars_fragment:Gm,metalnessmap_fragment:Wm,metalnessmap_pars_fragment:Xm,morphcolor_vertex:jm,morphnormal_vertex:qm,morphtarget_pars_vertex:Ym,morphtarget_vertex:$m,normal_fragment_begin:Km,normal_fragment_maps:Zm,normal_pars_fragment:Jm,normal_pars_vertex:Qm,normal_vertex:e_,normalmap_pars_fragment:t_,clearcoat_normal_fragment_begin:n_,clearcoat_normal_fragment_maps:i_,clearcoat_pars_fragment:r_,iridescence_pars_fragment:s_,opaque_fragment:o_,packing:a_,premultiplied_alpha_fragment:l_,project_vertex:c_,dithering_fragment:u_,dithering_pars_fragment:h_,roughnessmap_fragment:f_,roughnessmap_pars_fragment:d_,shadowmap_pars_fragment:p_,shadowmap_pars_vertex:m_,shadowmap_vertex:__,shadowmask_pars_fragment:g_,skinbase_vertex:v_,skinning_pars_vertex:x_,skinning_vertex:y_,skinnormal_vertex:b_,specularmap_fragment:S_,specularmap_pars_fragment:w_,tonemapping_fragment:M_,tonemapping_pars_fragment:E_,transmission_fragment:T_,transmission_pars_fragment:A_,uv_pars_fragment:R_,uv_pars_vertex:C_,uv_vertex:L_,worldpos_vertex:P_,background_vert:D_,background_frag:I_,backgroundCube_vert:N_,backgroundCube_frag:F_,cube_vert:O_,cube_frag:U_,depth_vert:B_,depth_frag:z_,distanceRGBA_vert:k_,distanceRGBA_frag:H_,equirect_vert:V_,equirect_frag:G_,linedashed_vert:W_,linedashed_frag:X_,meshbasic_vert:j_,meshbasic_frag:q_,meshlambert_vert:Y_,meshlambert_frag:$_,meshmatcap_vert:K_,meshmatcap_frag:Z_,meshnormal_vert:J_,meshnormal_frag:Q_,meshphong_vert:eg,meshphong_frag:tg,meshphysical_vert:ng,meshphysical_frag:ig,meshtoon_vert:rg,meshtoon_frag:sg,points_vert:og,points_frag:ag,shadow_vert:lg,shadow_frag:cg,sprite_vert:ug,sprite_frag:hg},xe={common:{diffuse:{value:new et(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new rt}},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 rt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new rt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new rt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new rt},normalScale:{value:new Ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new rt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new rt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new rt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new rt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new et(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 et(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0},uvTransform:{value:new rt}},sprite:{diffuse:{value:new et(16777215)},opacity:{value:1},center:{value:new Ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}}},li={basic:{uniforms:dn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.fog]),vertexShader:nt.meshbasic_vert,fragmentShader:nt.meshbasic_frag},lambert:{uniforms:dn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new et(0)}}]),vertexShader:nt.meshlambert_vert,fragmentShader:nt.meshlambert_frag},phong:{uniforms:dn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new et(0)},specular:{value:new et(1118481)},shininess:{value:30}}]),vertexShader:nt.meshphong_vert,fragmentShader:nt.meshphong_frag},standard:{uniforms:dn([xe.common,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.roughnessmap,xe.metalnessmap,xe.fog,xe.lights,{emissive:{value:new et(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag},toon:{uniforms:dn([xe.common,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.gradientmap,xe.fog,xe.lights,{emissive:{value:new et(0)}}]),vertexShader:nt.meshtoon_vert,fragmentShader:nt.meshtoon_frag},matcap:{uniforms:dn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,{matcap:{value:null}}]),vertexShader:nt.meshmatcap_vert,fragmentShader:nt.meshmatcap_frag},points:{uniforms:dn([xe.points,xe.fog]),vertexShader:nt.points_vert,fragmentShader:nt.points_frag},dashed:{uniforms:dn([xe.common,xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nt.linedashed_vert,fragmentShader:nt.linedashed_frag},depth:{uniforms:dn([xe.common,xe.displacementmap]),vertexShader:nt.depth_vert,fragmentShader:nt.depth_frag},normal:{uniforms:dn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,{opacity:{value:1}}]),vertexShader:nt.meshnormal_vert,fragmentShader:nt.meshnormal_frag},sprite:{uniforms:dn([xe.sprite,xe.fog]),vertexShader:nt.sprite_vert,fragmentShader:nt.sprite_frag},background:{uniforms:{uvTransform:{value:new rt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nt.background_vert,fragmentShader:nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:nt.backgroundCube_vert,fragmentShader:nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nt.cube_vert,fragmentShader:nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nt.equirect_vert,fragmentShader:nt.equirect_frag},distanceRGBA:{uniforms:dn([xe.common,xe.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nt.distanceRGBA_vert,fragmentShader:nt.distanceRGBA_frag},shadow:{uniforms:dn([xe.lights,xe.fog,{color:{value:new et(0)},opacity:{value:1}}]),vertexShader:nt.shadow_vert,fragmentShader:nt.shadow_frag}};li.physical={uniforms:dn([li.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new rt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new rt},clearcoatNormalScale:{value:new Ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new rt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new rt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new rt},sheen:{value:0},sheenColor:{value:new et(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new rt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new rt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new rt},transmissionSamplerSize:{value:new Ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new rt},attenuationDistance:{value:0},attenuationColor:{value:new et(0)},specularColor:{value:new et(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new rt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new rt},anisotropyVector:{value:new Ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new rt}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag};const Mo={r:0,b:0,g:0};function fg(r,e,t,n,i,s,o){const a=new et(0);let l=s===!0?0:1,c,u,h=null,f=0,d=null;function _(m,p){let y=!1,v=p.isScene===!0?p.background:null;v&&v.isTexture&&(v=(p.backgroundBlurriness>0?t:e).get(v)),v===null?g(a,l):v&&v.isColor&&(g(v,1),y=!0);const x=r.xr.getEnvironmentBlendMode();x==="additive"?n.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(r.autoClear||y)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),v&&(v.isCubeTexture||v.mapping===ha)?(u===void 0&&(u=new Mn(new eo(1,1,1),new ji({name:"BackgroundCubeMaterial",uniforms:cs(li.backgroundCube.uniforms),vertexShader:li.backgroundCube.vertexShader,fragmentShader:li.backgroundCube.fragmentShader,side:gn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,E,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,u.material.toneMapped=dt.getTransfer(v.colorSpace)!==Tt,(h!==v||f!==v.version||d!==r.toneMapping)&&(u.material.needsUpdate=!0,h=v,f=v.version,d=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(c===void 0&&(c=new Mn(new ec(2,2),new ji({name:"BackgroundMaterial",uniforms:cs(li.background.uniforms),vertexShader:li.background.vertexShader,fragmentShader:li.background.fragmentShader,side:Jn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=v,c.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,c.material.toneMapped=dt.getTransfer(v.colorSpace)!==Tt,v.matrixAutoUpdate===!0&&v.updateMatrix(),c.material.uniforms.uvTransform.value.copy(v.matrix),(h!==v||f!==v.version||d!==r.toneMapping)&&(c.material.needsUpdate=!0,h=v,f=v.version,d=r.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function g(m,p){m.getRGB(Mo,pf(r)),n.buffers.color.setClear(Mo.r,Mo.g,Mo.b,p,o)}return{getClearColor:function(){return a},setClearColor:function(m,p=1){a.set(m),l=p,g(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,g(a,l)},render:_}}function dg(r,e,t,n){const i=r.getParameter(r.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},l=m(null);let c=l,u=!1;function h(D,H,Z,J,ce){let ie=!1;if(o){const se=g(J,Z,H);c!==se&&(c=se,d(c.object)),ie=p(D,J,Z,ce),ie&&y(D,J,Z,ce)}else{const se=H.wireframe===!0;(c.geometry!==J.id||c.program!==Z.id||c.wireframe!==se)&&(c.geometry=J.id,c.program=Z.id,c.wireframe=se,ie=!0)}ce!==null&&t.update(ce,r.ELEMENT_ARRAY_BUFFER),(ie||u)&&(u=!1,I(D,H,Z,J),ce!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(ce).buffer))}function f(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function d(D){return n.isWebGL2?r.bindVertexArray(D):s.bindVertexArrayOES(D)}function _(D){return n.isWebGL2?r.deleteVertexArray(D):s.deleteVertexArrayOES(D)}function g(D,H,Z){const J=Z.wireframe===!0;let ce=a[D.id];ce===void 0&&(ce={},a[D.id]=ce);let ie=ce[H.id];ie===void 0&&(ie={},ce[H.id]=ie);let se=ie[J];return se===void 0&&(se=m(f()),ie[J]=se),se}function m(D){const H=[],Z=[],J=[];for(let ce=0;ce=0){const oe=ce[ve];let Se=ie[ve];if(Se===void 0&&(ve==="instanceMatrix"&&D.instanceMatrix&&(Se=D.instanceMatrix),ve==="instanceColor"&&D.instanceColor&&(Se=D.instanceColor)),oe===void 0||oe.attribute!==Se||Se&&oe.data!==Se.data)return!0;se++}return c.attributesNum!==se||c.index!==J}function y(D,H,Z,J){const ce={},ie=H.attributes;let se=0;const me=Z.getAttributes();for(const ve in me)if(me[ve].location>=0){let oe=ie[ve];oe===void 0&&(ve==="instanceMatrix"&&D.instanceMatrix&&(oe=D.instanceMatrix),ve==="instanceColor"&&D.instanceColor&&(oe=D.instanceColor));const Se={};Se.attribute=oe,oe&&oe.data&&(Se.data=oe.data),ce[ve]=Se,se++}c.attributes=ce,c.attributesNum=se,c.index=J}function v(){const D=c.newAttributes;for(let H=0,Z=D.length;H=0){let Q=ce[me];if(Q===void 0&&(me==="instanceMatrix"&&D.instanceMatrix&&(Q=D.instanceMatrix),me==="instanceColor"&&D.instanceColor&&(Q=D.instanceColor)),Q!==void 0){const oe=Q.normalized,Se=Q.itemSize,Pe=t.get(Q);if(Pe===void 0)continue;const _e=Pe.buffer,je=Pe.type,We=Pe.bytesPerElement,Ne=n.isWebGL2===!0&&(je===r.INT||je===r.UNSIGNED_INT||Q.gpuType===ks);if(Q.isInterleavedBufferAttribute){const Ye=Q.data,W=Ye.stride,Rt=Q.offset;if(Ye.isInstancedInterleavedBuffer){for(let Ce=0;Ce0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),f=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=r.getParameter(r.MAX_TEXTURE_SIZE),_=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),m=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),p=r.getParameter(r.MAX_VARYING_VECTORS),y=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),v=f>0,x=o||e.has("OES_texture_float"),b=v&&x,E=o?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:m,maxVaryings:p,maxFragmentUniforms:y,vertexTextures:v,floatFragmentTextures:x,floatVertexTextures:b,maxSamples:E}}function _g(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new ai,a=new rt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const d=h.length!==0||f||n!==0||i;return i=f,n=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,d){const _=h.clippingPlanes,g=h.clipIntersection,m=h.clipShadows,p=r.get(h);if(!i||_===null||_.length===0||s&&!m)s?u(null):c();else{const y=s?0:n,v=y*4;let x=p.clippingState||null;l.value=x,x=u(_,f,v,d);for(let b=0;b!==v;++b)x[b]=t[b];p.clippingState=x,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,_){const g=h!==null?h.length:0;let m=null;if(g!==0){if(m=l.value,_!==!0||m===null){const p=d+g*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(m===null||m.length0){const c=new Cp(l.height/2);return c.fromEquirectangularTexture(r,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class to extends mf{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=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=o,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,o){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=o,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,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,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 Jr=4,bu=[.125,.215,.35,.446,.526,.582],lr=20,ja=new to,Su=new et;let qa=null,Ya=0,$a=0;const rr=(1+Math.sqrt(5))/2,zr=1/rr,wu=[new P(1,1,1),new P(-1,1,1),new P(1,1,-1),new P(-1,1,-1),new P(0,rr,zr),new P(0,rr,-zr),new P(zr,0,rr),new P(-zr,0,rr),new P(rr,zr,0),new P(-rr,zr,0)];class Mu{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){qa=this._renderer.getRenderTarget(),Ya=this._renderer.getActiveCubeFace(),$a=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=Au(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Tu(),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;e2?v:0,v,v),u.setRenderTarget(i),g&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===is||e.mapping===rs;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Au()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Tu());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Mn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Eo(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,ja)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;ilr&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${lr}`);const p=[];let y=0;for(let w=0;wv-Jr?i-v+Jr:0),E=4*(this._cubeSize-x);Eo(t,b,E,3*x,2*x),l.setRenderTarget(t),l.render(h,ja)}}function vg(r){const e=[],t=[],n=[];let i=r;const s=r-Jr+1+bu.length;for(let o=0;or-Jr?l=bu[o-r+Jr-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,_=6,g=3,m=2,p=1,y=new Float32Array(g*_*d),v=new Float32Array(m*_*d),x=new Float32Array(p*_*d);for(let E=0;E2?0:-1,S=[w,I,0,w+2/3,I,0,w+2/3,I+1,0,w,I,0,w+2/3,I+1,0,w,I+1,0];y.set(S,g*_*E),v.set(f,m*_*E);const A=[E,E,E,E,E,E];x.set(A,p*_*E)}const b=new vn;b.setAttribute("position",new jt(y,g)),b.setAttribute("uv",new jt(v,m)),b.setAttribute("faceIndex",new jt(x,p)),e.push(b),i>Jr&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Eu(r,e,t){const n=new Xi(r,e,t);return n.texture.mapping=ha,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Eo(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function xg(r,e,t){const n=new Float32Array(lr),i=new P(0,1,0);return new ji({name:"SphericalGaussianBlur",defines:{n:lr,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:tc(),fragmentShader:` +}`,nt={alphahash_fragment:Fp,alphahash_pars_fragment:Op,alphamap_fragment:Up,alphamap_pars_fragment:Bp,alphatest_fragment:zp,alphatest_pars_fragment:kp,aomap_fragment:Hp,aomap_pars_fragment:Vp,batching_pars_vertex:Gp,batching_vertex:Wp,begin_vertex:Xp,beginnormal_vertex:qp,bsdfs:jp,iridescence_fragment:Yp,bumpmap_pars_fragment:$p,clipping_planes_fragment:Kp,clipping_planes_pars_fragment:Zp,clipping_planes_pars_vertex:Jp,clipping_planes_vertex:Qp,color_fragment:em,color_pars_fragment:tm,color_pars_vertex:nm,color_vertex:im,common:rm,cube_uv_reflection_fragment:sm,defaultnormal_vertex:om,displacementmap_pars_vertex:am,displacementmap_vertex:lm,emissivemap_fragment:cm,emissivemap_pars_fragment:um,colorspace_fragment:hm,colorspace_pars_fragment:fm,envmap_fragment:dm,envmap_common_pars_fragment:pm,envmap_pars_fragment:mm,envmap_pars_vertex:_m,envmap_physical_pars_fragment:Rm,envmap_vertex:gm,fog_vertex:vm,fog_pars_vertex:xm,fog_fragment:ym,fog_pars_fragment:bm,gradientmap_pars_fragment:Sm,lightmap_fragment:wm,lightmap_pars_fragment:Mm,lights_lambert_fragment:Em,lights_lambert_pars_fragment:Tm,lights_pars_begin:Am,lights_toon_fragment:Cm,lights_toon_pars_fragment:Lm,lights_phong_fragment:Pm,lights_phong_pars_fragment:Dm,lights_physical_fragment:Im,lights_physical_pars_fragment:Nm,lights_fragment_begin:Fm,lights_fragment_maps:Om,lights_fragment_end:Um,logdepthbuf_fragment:Bm,logdepthbuf_pars_fragment:zm,logdepthbuf_pars_vertex:km,logdepthbuf_vertex:Hm,map_fragment:Vm,map_pars_fragment:Gm,map_particle_fragment:Wm,map_particle_pars_fragment:Xm,metalnessmap_fragment:qm,metalnessmap_pars_fragment:jm,morphcolor_vertex:Ym,morphnormal_vertex:$m,morphtarget_pars_vertex:Km,morphtarget_vertex:Zm,normal_fragment_begin:Jm,normal_fragment_maps:Qm,normal_pars_fragment:e_,normal_pars_vertex:t_,normal_vertex:n_,normalmap_pars_fragment:i_,clearcoat_normal_fragment_begin:r_,clearcoat_normal_fragment_maps:s_,clearcoat_pars_fragment:o_,iridescence_pars_fragment:a_,opaque_fragment:l_,packing:c_,premultiplied_alpha_fragment:u_,project_vertex:h_,dithering_fragment:f_,dithering_pars_fragment:d_,roughnessmap_fragment:p_,roughnessmap_pars_fragment:m_,shadowmap_pars_fragment:__,shadowmap_pars_vertex:g_,shadowmap_vertex:v_,shadowmask_pars_fragment:x_,skinbase_vertex:y_,skinning_pars_vertex:b_,skinning_vertex:S_,skinnormal_vertex:w_,specularmap_fragment:M_,specularmap_pars_fragment:E_,tonemapping_fragment:T_,tonemapping_pars_fragment:A_,transmission_fragment:R_,transmission_pars_fragment:C_,uv_pars_fragment:L_,uv_pars_vertex:P_,uv_vertex:D_,worldpos_vertex:I_,background_vert:N_,background_frag:F_,backgroundCube_vert:O_,backgroundCube_frag:U_,cube_vert:B_,cube_frag:z_,depth_vert:k_,depth_frag:H_,distanceRGBA_vert:V_,distanceRGBA_frag:G_,equirect_vert:W_,equirect_frag:X_,linedashed_vert:q_,linedashed_frag:j_,meshbasic_vert:Y_,meshbasic_frag:$_,meshlambert_vert:K_,meshlambert_frag:Z_,meshmatcap_vert:J_,meshmatcap_frag:Q_,meshnormal_vert:eg,meshnormal_frag:tg,meshphong_vert:ng,meshphong_frag:ig,meshphysical_vert:rg,meshphysical_frag:sg,meshtoon_vert:og,meshtoon_frag:ag,points_vert:lg,points_frag:cg,shadow_vert:ug,shadow_frag:hg,sprite_vert:fg,sprite_frag:dg},xe={common:{diffuse:{value:new et(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new rt}},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 rt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new rt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new rt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new rt},normalScale:{value:new Ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new rt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new rt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new rt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new rt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new et(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 et(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0},uvTransform:{value:new rt}},sprite:{diffuse:{value:new et(16777215)},opacity:{value:1},center:{value:new Ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}}},ci={basic:{uniforms:mn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.fog]),vertexShader:nt.meshbasic_vert,fragmentShader:nt.meshbasic_frag},lambert:{uniforms:mn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new et(0)}}]),vertexShader:nt.meshlambert_vert,fragmentShader:nt.meshlambert_frag},phong:{uniforms:mn([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,xe.lights,{emissive:{value:new et(0)},specular:{value:new et(1118481)},shininess:{value:30}}]),vertexShader:nt.meshphong_vert,fragmentShader:nt.meshphong_frag},standard:{uniforms:mn([xe.common,xe.envmap,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.roughnessmap,xe.metalnessmap,xe.fog,xe.lights,{emissive:{value:new et(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag},toon:{uniforms:mn([xe.common,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.gradientmap,xe.fog,xe.lights,{emissive:{value:new et(0)}}]),vertexShader:nt.meshtoon_vert,fragmentShader:nt.meshtoon_frag},matcap:{uniforms:mn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,{matcap:{value:null}}]),vertexShader:nt.meshmatcap_vert,fragmentShader:nt.meshmatcap_frag},points:{uniforms:mn([xe.points,xe.fog]),vertexShader:nt.points_vert,fragmentShader:nt.points_frag},dashed:{uniforms:mn([xe.common,xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nt.linedashed_vert,fragmentShader:nt.linedashed_frag},depth:{uniforms:mn([xe.common,xe.displacementmap]),vertexShader:nt.depth_vert,fragmentShader:nt.depth_frag},normal:{uniforms:mn([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,{opacity:{value:1}}]),vertexShader:nt.meshnormal_vert,fragmentShader:nt.meshnormal_frag},sprite:{uniforms:mn([xe.sprite,xe.fog]),vertexShader:nt.sprite_vert,fragmentShader:nt.sprite_frag},background:{uniforms:{uvTransform:{value:new rt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nt.background_vert,fragmentShader:nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:nt.backgroundCube_vert,fragmentShader:nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nt.cube_vert,fragmentShader:nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nt.equirect_vert,fragmentShader:nt.equirect_frag},distanceRGBA:{uniforms:mn([xe.common,xe.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nt.distanceRGBA_vert,fragmentShader:nt.distanceRGBA_frag},shadow:{uniforms:mn([xe.lights,xe.fog,{color:{value:new et(0)},opacity:{value:1}}]),vertexShader:nt.shadow_vert,fragmentShader:nt.shadow_frag}};ci.physical={uniforms:mn([ci.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new rt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new rt},clearcoatNormalScale:{value:new Ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new rt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new rt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new rt},sheen:{value:0},sheenColor:{value:new et(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new rt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new rt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new rt},transmissionSamplerSize:{value:new Ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new rt},attenuationDistance:{value:0},attenuationColor:{value:new et(0)},specularColor:{value:new et(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new rt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new rt},anisotropyVector:{value:new Ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new rt}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag};const To={r:0,b:0,g:0};function pg(r,e,t,n,i,s,o){const a=new et(0);let l=s===!0?0:1,c,u,f=null,h=0,p=null;function _(m,d){let x=!1,v=d.isScene===!0?d.background:null;v&&v.isTexture&&(v=(d.backgroundBlurriness>0?t:e).get(v)),v===null?g(a,l):v&&v.isColor&&(g(v,1),x=!0);const y=r.xr.getEnvironmentBlendMode();y==="additive"?n.buffers.color.setClear(0,0,0,1,o):y==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(r.autoClear||x)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),v&&(v.isCubeTexture||v.mapping===da)?(u===void 0&&(u=new En(new no(1,1,1),new ji({name:"BackgroundCubeMaterial",uniforms:fs(ci.backgroundCube.uniforms),vertexShader:ci.backgroundCube.vertexShader,fragmentShader:ci.backgroundCube.fragmentShader,side:xn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,E,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=d.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=d.backgroundIntensity,u.material.toneMapped=dt.getTransfer(v.colorSpace)!==At,(f!==v||h!==v.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,f=v,h=v.version,p=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(c===void 0&&(c=new En(new tc(2,2),new ji({name:"BackgroundMaterial",uniforms:fs(ci.background.uniforms),vertexShader:ci.background.vertexShader,fragmentShader:ci.background.fragmentShader,side:Qn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=v,c.material.uniforms.backgroundIntensity.value=d.backgroundIntensity,c.material.toneMapped=dt.getTransfer(v.colorSpace)!==At,v.matrixAutoUpdate===!0&&v.updateMatrix(),c.material.uniforms.uvTransform.value.copy(v.matrix),(f!==v||h!==v.version||p!==r.toneMapping)&&(c.material.needsUpdate=!0,f=v,h=v.version,p=r.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function g(m,d){m.getRGB(To,mf(r)),n.buffers.color.setClear(To.r,To.g,To.b,d,o)}return{getClearColor:function(){return a},setClearColor:function(m,d=1){a.set(m),l=d,g(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,g(a,l)},render:_}}function mg(r,e,t,n){const i=r.getParameter(r.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},l=m(null);let c=l,u=!1;function f(D,H,Z,J,ce){let ie=!1;if(o){const se=g(J,Z,H);c!==se&&(c=se,p(c.object)),ie=d(D,J,Z,ce),ie&&x(D,J,Z,ce)}else{const se=H.wireframe===!0;(c.geometry!==J.id||c.program!==Z.id||c.wireframe!==se)&&(c.geometry=J.id,c.program=Z.id,c.wireframe=se,ie=!0)}ce!==null&&t.update(ce,r.ELEMENT_ARRAY_BUFFER),(ie||u)&&(u=!1,I(D,H,Z,J),ce!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(ce).buffer))}function h(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function p(D){return n.isWebGL2?r.bindVertexArray(D):s.bindVertexArrayOES(D)}function _(D){return n.isWebGL2?r.deleteVertexArray(D):s.deleteVertexArrayOES(D)}function g(D,H,Z){const J=Z.wireframe===!0;let ce=a[D.id];ce===void 0&&(ce={},a[D.id]=ce);let ie=ce[H.id];ie===void 0&&(ie={},ce[H.id]=ie);let se=ie[J];return se===void 0&&(se=m(h()),ie[J]=se),se}function m(D){const H=[],Z=[],J=[];for(let ce=0;ce=0){const oe=ce[ve];let Se=ie[ve];if(Se===void 0&&(ve==="instanceMatrix"&&D.instanceMatrix&&(Se=D.instanceMatrix),ve==="instanceColor"&&D.instanceColor&&(Se=D.instanceColor)),oe===void 0||oe.attribute!==Se||Se&&oe.data!==Se.data)return!0;se++}return c.attributesNum!==se||c.index!==J}function x(D,H,Z,J){const ce={},ie=H.attributes;let se=0;const me=Z.getAttributes();for(const ve in me)if(me[ve].location>=0){let oe=ie[ve];oe===void 0&&(ve==="instanceMatrix"&&D.instanceMatrix&&(oe=D.instanceMatrix),ve==="instanceColor"&&D.instanceColor&&(oe=D.instanceColor));const Se={};Se.attribute=oe,oe&&oe.data&&(Se.data=oe.data),ce[ve]=Se,se++}c.attributes=ce,c.attributesNum=se,c.index=J}function v(){const D=c.newAttributes;for(let H=0,Z=D.length;H=0){let Q=ce[me];if(Q===void 0&&(me==="instanceMatrix"&&D.instanceMatrix&&(Q=D.instanceMatrix),me==="instanceColor"&&D.instanceColor&&(Q=D.instanceColor)),Q!==void 0){const oe=Q.normalized,Se=Q.itemSize,De=t.get(Q);if(De===void 0)continue;const _e=De.buffer,qe=De.type,We=De.bytesPerElement,Fe=n.isWebGL2===!0&&(qe===r.INT||qe===r.UNSIGNED_INT||Q.gpuType===Vs);if(Q.isInterleavedBufferAttribute){const Ye=Q.data,W=Ye.stride,Ct=Q.offset;if(Ye.isInstancedInterleavedBuffer){for(let Ce=0;Ce0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";T="mediump"}return T==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),h=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_TEXTURE_SIZE),_=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),m=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),d=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),v=h>0,y=o||e.has("OES_texture_float"),b=v&&y,E=o?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:f,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:_,maxAttributes:g,maxVertexUniforms:m,maxVaryings:d,maxFragmentUniforms:x,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:b,maxSamples:E}}function vg(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new li,a=new rt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||n!==0||i;return i=h,n=f.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=u(f,h,0)},this.setState=function(f,h,p){const _=f.clippingPlanes,g=f.clipIntersection,m=f.clipShadows,d=r.get(f);if(!i||_===null||_.length===0||s&&!m)s?u(null):c();else{const x=s?0:n,v=x*4;let y=d.clippingState||null;l.value=y,y=u(_,h,v,p);for(let b=0;b!==v;++b)y[b]=t[b];d.clippingState=y,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,h,p,_){const g=f!==null?f.length:0;let m=null;if(g!==0){if(m=l.value,_!==!0||m===null){const d=p+g*4,x=h.matrixWorldInverse;a.getNormalMatrix(x),(m===null||m.length0){const c=new Pp(l.height/2);return c.fromEquirectangularTexture(r,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class io extends _f{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=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=o,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,o){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=o,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,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,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 es=4,Su=[.125,.215,.35,.446,.526,.582],lr=20,Ya=new io,wu=new et;let $a=null,Ka=0,Za=0;const sr=(1+Math.sqrt(5))/2,kr=1/sr,Mu=[new L(1,1,1),new L(-1,1,1),new L(1,1,-1),new L(-1,1,-1),new L(0,sr,kr),new L(0,sr,-kr),new L(kr,0,sr),new L(-kr,0,sr),new L(sr,kr,0),new L(-sr,kr,0)];class Eu{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){$a=this._renderer.getRenderTarget(),Ka=this._renderer.getActiveCubeFace(),Za=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=Ru(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Au(),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;e2?v:0,v,v),u.setRenderTarget(i),g&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===os||e.mapping===as;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ru()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Au());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new En(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Ao(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Ya)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;ilr&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${lr}`);const d=[];let x=0;for(let T=0;Tv-es?i-v+es:0),E=4*(this._cubeSize-y);Ao(t,b,E,3*y,2*y),l.setRenderTarget(t),l.render(f,Ya)}}function yg(r){const e=[],t=[],n=[];let i=r;const s=r-es+1+Su.length;for(let o=0;or-es?l=Su[o-r+es-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,f=1+c,h=[u,u,f,u,f,f,u,u,f,f,u,f],p=6,_=6,g=3,m=2,d=1,x=new Float32Array(g*_*p),v=new Float32Array(m*_*p),y=new Float32Array(d*_*p);for(let E=0;E2?0:-1,S=[T,I,0,T+2/3,I,0,T+2/3,I+1,0,T,I,0,T+2/3,I+1,0,T,I+1,0];x.set(S,g*_*E),v.set(h,m*_*E);const A=[E,E,E,E,E,E];y.set(A,d*_*E)}const b=new yn;b.setAttribute("position",new Yt(x,g)),b.setAttribute("uv",new Yt(v,m)),b.setAttribute("faceIndex",new Yt(y,d)),e.push(b),i>es&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Tu(r,e,t){const n=new qi(r,e,t);return n.texture.mapping=da,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Ao(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function bg(r,e,t){const n=new Float32Array(lr),i=new L(0,1,0);return new ji({name:"SphericalGaussianBlur",defines:{n:lr,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:nc(),fragmentShader:` precision mediump float; precision mediump int; @@ -3494,7 +3494,7 @@ void main() { } } - `,blending:Vi,depthTest:!1,depthWrite:!1})}function Tu(){return new ji({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:tc(),fragmentShader:` + `,blending:Gi,depthTest:!1,depthWrite:!1})}function Au(){return new ji({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:nc(),fragmentShader:` precision mediump float; precision mediump int; @@ -3513,7 +3513,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:Vi,depthTest:!1,depthWrite:!1})}function Au(){return new ji({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:tc(),fragmentShader:` + `,blending:Gi,depthTest:!1,depthWrite:!1})}function Ru(){return new ji({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:nc(),fragmentShader:` precision mediump float; precision mediump int; @@ -3529,7 +3529,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:Vi,depthTest:!1,depthWrite:!1})}function tc(){return` + `,blending:Gi,depthTest:!1,depthWrite:!1})}function nc(){return` precision mediump float; precision mediump int; @@ -3584,39 +3584,39 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function yg(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===El||l===Tl,u=l===is||l===rs;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new Mu(r)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&i(h)){t===null&&(t=new Mu(r));const f=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(z=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const O=new Float32Array(A*z*4*g),G=new cf(O,A,z,g);G.type=_n,G.needsUpdate=!0;const D=S*4;for(let Z=0;Z0)return r;const i=e*t;let s=Ru[i];if(s===void 0&&(s=new Float32Array(i),Ru[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Yt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0||u&&f&&i(f)){t===null&&(t=new Eu(r));const h=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,h),a.addEventListener("dispose",s),h.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(z=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const O=new Float32Array(A*z*4*g),G=new uf(O,A,z,g);G.type=vn,G.needsUpdate=!0;const D=S*4;for(let Z=0;Z0)return r;const i=e*t;let s=Cu[i];if(s===void 0&&(s=new Float32Array(i),Cu[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Kt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t":" "} ${a}: ${t[o]}`)}return n.join(` -`)}function Sv(r){const e=dt.getPrimaries(dt.workingColorSpace),t=dt.getPrimaries(r);let n;switch(e===t?n="":e===ra&&t===ia?n="LinearDisplayP3ToLinearSRGB":e===ia&&t===ra&&(n="LinearSRGBToLinearDisplayP3"),r){case sn:case pa:return[n,"LinearTransferOETF"];case zt:case Zl:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function Fu(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 o=parseInt(s[1]);return t.toUpperCase()+` +`)}function Mv(r){const e=dt.getPrimaries(dt.workingColorSpace),t=dt.getPrimaries(r);let n;switch(e===t?n="":e===oa&&t===sa?n="LinearDisplayP3ToLinearSRGB":e===sa&&t===oa&&(n="LinearSRGBToLinearDisplayP3"),r){case an:case _a:return[n,"LinearTransferOETF"];case Ht:case Jl:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function Ou(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 o=parseInt(s[1]);return t.toUpperCase()+` `+i+` -`+bv(r.getShaderSource(e),o)}else return i}function wv(r,e){const t=Sv(e);return`vec4 ${r}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function Mv(r,e){let t;switch(e){case Ed:t="Linear";break;case Td:t="Reinhard";break;case Ad:t="OptimizedCineon";break;case Rd:t="ACESFilmic";break;case Cd:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Ev(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(Us).join(` -`)}function Tv(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function Av(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function Il(r){return r.replace(Rv,Lv)}const Cv=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Lv(r,e){let t=nt[e];if(t===void 0){const n=Cv.get(e);if(n!==void 0)t=nt[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 Il(t)}const Pv=/#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 Bu(r){return r.replace(Pv,Dv)}function Dv(r,e,t,n){let i="";for(let s=parseInt(e);s/gm;function Fl(r){return r.replace(Lv,Dv)}const Pv=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Dv(r,e){let t=nt[e];if(t===void 0){const n=Pv.get(e);if(n!==void 0)t=nt[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 Fl(t)}const Iv=/#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 zu(r){return r.replace(Iv,Nv)}function Nv(r,e,t,n){let i="";for(let s=parseInt(e);s0&&(m+=` -`),p=[d,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Us).join(` -`),p.length>0&&(p+=` -`)):(m=[zu(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+u:"",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 "+l:"",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",` -`].filter(Us).join(` -`),p=[d,zu(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.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 "+l:"",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!==Gi?"#define TONE_MAPPING":"",t.toneMapping!==Gi?nt.tonemapping_pars_fragment:"",t.toneMapping!==Gi?Mv("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",nt.colorspace_pars_fragment,wv("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(Us).join(` -`)),o=Il(o),o=Ou(o,t),o=Uu(o,t),a=Il(a),a=Ou(a,t),a=Uu(a,t),o=Bu(o),a=Bu(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es +`),d=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(zs).join(` +`),d.length>0&&(d+=` +`)):(m=[ku(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+u:"",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 "+l:"",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",` +`].filter(zs).join(` +`),d=[p,ku(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.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 "+l:"",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!==Wi?"#define TONE_MAPPING":"",t.toneMapping!==Wi?nt.tonemapping_pars_fragment:"",t.toneMapping!==Wi?Tv("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",nt.colorspace_pars_fragment,Ev("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(zs).join(` +`)),o=Fl(o),o=Uu(o,t),o=Bu(o,t),a=Fl(a),a=Uu(a,t),a=Bu(a,t),o=zu(o),a=zu(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(x=`#version 300 es `,m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+m,p=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===iu?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===iu?"":"#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(` +`+m,d=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===ru?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ru?"":"#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(` `)+` -`+p);const v=y+m+o,x=y+p+a,b=Nu(i,i.VERTEX_SHADER,v),E=Nu(i,i.FRAGMENT_SHADER,x);i.attachShader(g,b),i.attachShader(g,E),t.index0AttributeName!==void 0?i.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(g,0,"position"),i.linkProgram(g);function w(z){if(r.debug.checkShaderErrors){const O=i.getProgramInfoLog(g).trim(),G=i.getShaderInfoLog(b).trim(),D=i.getShaderInfoLog(E).trim();let H=!0,Z=!0;if(i.getProgramParameter(g,i.LINK_STATUS)===!1)if(H=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,g,b,E);else{const J=Fu(i,b,"vertex"),ce=Fu(i,E,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(g,i.VALIDATE_STATUS)+` +`+d);const v=x+m+o,y=x+d+a,b=Fu(i,i.VERTEX_SHADER,v),E=Fu(i,i.FRAGMENT_SHADER,y);i.attachShader(g,b),i.attachShader(g,E),t.index0AttributeName!==void 0?i.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(g,0,"position"),i.linkProgram(g);function T(z){if(r.debug.checkShaderErrors){const O=i.getProgramInfoLog(g).trim(),G=i.getShaderInfoLog(b).trim(),D=i.getShaderInfoLog(E).trim();let H=!0,Z=!0;if(i.getProgramParameter(g,i.LINK_STATUS)===!1)if(H=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,g,b,E);else{const J=Ou(i,b,"vertex"),ce=Ou(i,E,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(g,i.VALIDATE_STATUS)+` Program Info Log: `+O+` `+J+` -`+ce)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(G===""||D==="")&&(Z=!1);Z&&(z.diagnostics={runnable:H,programLog:O,vertexShader:{log:G,prefix:m},fragmentShader:{log:D,prefix:p}})}i.deleteShader(b),i.deleteShader(E),I=new Qo(i,g),S=Av(i,g)}let I;this.getUniforms=function(){return I===void 0&&w(this),I};let S;this.getAttributes=function(){return S===void 0&&w(this),S};let A=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return A===!1&&(A=i.getProgramParameter(g,xv)),A},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=yv++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=b,this.fragmentShader=E,this}let zv=0;class kv{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),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.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 Hv(e),t.set(e,n)),n}}class Hv{constructor(e){this.id=zv++,this.code=e,this.usedTimes=0}}function Vv(r,e,t,n,i,s,o){const a=new uf,l=new kv,c=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,f=i.vertexTextures;let d=i.precision;const _={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 g(S){return S===0?"uv":`uv${S}`}function m(S,A,z,O,G){const D=O.fog,H=G.geometry,Z=S.isMeshStandardMaterial?O.environment:null,J=(S.isMeshStandardMaterial?t:e).get(S.envMap||Z),ce=J&&J.mapping===ha?J.image.height:null,ie=_[S.type];S.precision!==null&&(d=i.getMaxPrecision(S.precision),d!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",d,"instead."));const se=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,me=se!==void 0?se.length:0;let ve=0;H.morphAttributes.position!==void 0&&(ve=1),H.morphAttributes.normal!==void 0&&(ve=2),H.morphAttributes.color!==void 0&&(ve=3);let Q,oe,Se,Pe;if(ie){const Ht=li[ie];Q=Ht.vertexShader,oe=Ht.fragmentShader}else Q=S.vertexShader,oe=S.fragmentShader,l.update(S),Se=l.getVertexShaderID(S),Pe=l.getFragmentShaderID(S);const _e=r.getRenderTarget(),je=G.isInstancedMesh===!0,We=G.isBatchedMesh===!0,Ne=!!S.map,Ye=!!S.matcap,W=!!J,Rt=!!S.aoMap,Ce=!!S.lightMap,$e=!!S.bumpMap,ze=!!S.normalMap,mt=!!S.displacementMap,Ke=!!S.emissiveMap,ke=!!S.metalnessMap,st=!!S.roughnessMap,Et=S.anisotropy>0,Ct=S.clearcoat>0,L=S.iridescence>0,M=S.sheen>0,X=S.transmission>0,le=Et&&!!S.anisotropyMap,re=Ct&&!!S.clearcoatMap,fe=Ct&&!!S.clearcoatNormalMap,Ee=Ct&&!!S.clearcoatRoughnessMap,pe=L&&!!S.iridescenceMap,ye=L&&!!S.iridescenceThicknessMap,N=M&&!!S.sheenColorMap,de=M&&!!S.sheenRoughnessMap,ne=!!S.specularMap,Fe=!!S.specularColorMap,Ae=!!S.specularIntensityMap,Le=X&&!!S.transmissionMap,Me=X&&!!S.thicknessMap,be=!!S.gradientMap,Ve=!!S.alphaMap,F=S.alphaTest>0,ge=!!S.alphaHash,ae=!!S.extensions,ee=!!H.attributes.uv1,he=!!H.attributes.uv2,Re=!!H.attributes.uv3;let tt=Gi;return S.toneMapped&&(_e===null||_e.isXRRenderTarget===!0)&&(tt=r.toneMapping),{isWebGL2:u,shaderID:ie,shaderType:S.type,shaderName:S.name,vertexShader:Q,fragmentShader:oe,defines:S.defines,customVertexShaderID:Se,customFragmentShaderID:Pe,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:d,batching:We,instancing:je,instancingColor:je&&G.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:_e===null?r.outputColorSpace:_e.isXRRenderTarget===!0?_e.texture.colorSpace:sn,map:Ne,matcap:Ye,envMap:W,envMapMode:W&&J.mapping,envMapCubeUVHeight:ce,aoMap:Rt,lightMap:Ce,bumpMap:$e,normalMap:ze,displacementMap:f&&mt,emissiveMap:Ke,normalMapObjectSpace:ze&&S.normalMapType===zd,normalMapTangentSpace:ze&&S.normalMapType===nf,metalnessMap:ke,roughnessMap:st,anisotropy:Et,anisotropyMap:le,clearcoat:Ct,clearcoatMap:re,clearcoatNormalMap:fe,clearcoatRoughnessMap:Ee,iridescence:L,iridescenceMap:pe,iridescenceThicknessMap:ye,sheen:M,sheenColorMap:N,sheenRoughnessMap:de,specularMap:ne,specularColorMap:Fe,specularIntensityMap:Ae,transmission:X,transmissionMap:Le,thicknessMap:Me,gradientMap:be,opaque:S.transparent===!1&&S.blending===es,alphaMap:Ve,alphaTest:F,alphaHash:ge,combine:S.combine,mapUv:Ne&&g(S.map.channel),aoMapUv:Rt&&g(S.aoMap.channel),lightMapUv:Ce&&g(S.lightMap.channel),bumpMapUv:$e&&g(S.bumpMap.channel),normalMapUv:ze&&g(S.normalMap.channel),displacementMapUv:mt&&g(S.displacementMap.channel),emissiveMapUv:Ke&&g(S.emissiveMap.channel),metalnessMapUv:ke&&g(S.metalnessMap.channel),roughnessMapUv:st&&g(S.roughnessMap.channel),anisotropyMapUv:le&&g(S.anisotropyMap.channel),clearcoatMapUv:re&&g(S.clearcoatMap.channel),clearcoatNormalMapUv:fe&&g(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ee&&g(S.clearcoatRoughnessMap.channel),iridescenceMapUv:pe&&g(S.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&g(S.iridescenceThicknessMap.channel),sheenColorMapUv:N&&g(S.sheenColorMap.channel),sheenRoughnessMapUv:de&&g(S.sheenRoughnessMap.channel),specularMapUv:ne&&g(S.specularMap.channel),specularColorMapUv:Fe&&g(S.specularColorMap.channel),specularIntensityMapUv:Ae&&g(S.specularIntensityMap.channel),transmissionMapUv:Le&&g(S.transmissionMap.channel),thicknessMapUv:Me&&g(S.thicknessMap.channel),alphaMapUv:Ve&&g(S.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(ze||Et),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,vertexUv1s:ee,vertexUv2s:he,vertexUv3s:Re,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(Ne||Ve),fog:!!D,useFog:S.fog===!0,fogExp2:D&&D.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:G.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:ve,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:S.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:tt,useLegacyLights:r._useLegacyLights,decodeVideoTexture:Ne&&S.map.isVideoTexture===!0&&dt.getTransfer(S.map.colorSpace)===Tt,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===$n,flipSided:S.side===gn,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionDerivatives:ae&&S.extensions.derivatives===!0,extensionFragDepth:ae&&S.extensions.fragDepth===!0,extensionDrawBuffers:ae&&S.extensions.drawBuffers===!0,extensionShaderTextureLOD:ae&&S.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()}}function p(S){const A=[];if(S.shaderID?A.push(S.shaderID):(A.push(S.customVertexShaderID),A.push(S.customFragmentShaderID)),S.defines!==void 0)for(const z in S.defines)A.push(z),A.push(S.defines[z]);return S.isRawShaderMaterial===!1&&(y(A,S),v(A,S),A.push(r.outputColorSpace)),A.push(S.customProgramCacheKey),A.join()}function y(S,A){S.push(A.precision),S.push(A.outputColorSpace),S.push(A.envMapMode),S.push(A.envMapCubeUVHeight),S.push(A.mapUv),S.push(A.alphaMapUv),S.push(A.lightMapUv),S.push(A.aoMapUv),S.push(A.bumpMapUv),S.push(A.normalMapUv),S.push(A.displacementMapUv),S.push(A.emissiveMapUv),S.push(A.metalnessMapUv),S.push(A.roughnessMapUv),S.push(A.anisotropyMapUv),S.push(A.clearcoatMapUv),S.push(A.clearcoatNormalMapUv),S.push(A.clearcoatRoughnessMapUv),S.push(A.iridescenceMapUv),S.push(A.iridescenceThicknessMapUv),S.push(A.sheenColorMapUv),S.push(A.sheenRoughnessMapUv),S.push(A.specularMapUv),S.push(A.specularColorMapUv),S.push(A.specularIntensityMapUv),S.push(A.transmissionMapUv),S.push(A.thicknessMapUv),S.push(A.combine),S.push(A.fogExp2),S.push(A.sizeAttenuation),S.push(A.morphTargetsCount),S.push(A.morphAttributeCount),S.push(A.numDirLights),S.push(A.numPointLights),S.push(A.numSpotLights),S.push(A.numSpotLightMaps),S.push(A.numHemiLights),S.push(A.numRectAreaLights),S.push(A.numDirLightShadows),S.push(A.numPointLightShadows),S.push(A.numSpotLightShadows),S.push(A.numSpotLightShadowsWithMaps),S.push(A.numLightProbes),S.push(A.shadowMapType),S.push(A.toneMapping),S.push(A.numClippingPlanes),S.push(A.numClipIntersection),S.push(A.depthPacking)}function v(S,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.matcap&&a.enable(4),A.envMap&&a.enable(5),A.normalMapObjectSpace&&a.enable(6),A.normalMapTangentSpace&&a.enable(7),A.clearcoat&&a.enable(8),A.iridescence&&a.enable(9),A.alphaTest&&a.enable(10),A.vertexColors&&a.enable(11),A.vertexAlphas&&a.enable(12),A.vertexUv1s&&a.enable(13),A.vertexUv2s&&a.enable(14),A.vertexUv3s&&a.enable(15),A.vertexTangents&&a.enable(16),A.anisotropy&&a.enable(17),A.alphaHash&&a.enable(18),A.batching&&a.enable(19),S.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.skinning&&a.enable(4),A.morphTargets&&a.enable(5),A.morphNormals&&a.enable(6),A.morphColors&&a.enable(7),A.premultipliedAlpha&&a.enable(8),A.shadowMapEnabled&&a.enable(9),A.useLegacyLights&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),S.push(a.mask)}function x(S){const A=_[S.type];let z;if(A){const O=li[A];z=Ep.clone(O.uniforms)}else z=S.uniforms;return z}function b(S,A){let z;for(let O=0,G=c.length;O0?n.push(p):d.transparent===!0?i.push(p):t.push(p)}function l(h,f,d,_,g,m){const p=o(h,f,d,_,g,m);d.transmission>0?n.unshift(p):d.transparent===!0?i.unshift(p):t.unshift(p)}function c(h,f){t.length>1&&t.sort(h||Wv),n.length>1&&n.sort(f||ku),i.length>1&&i.sort(f||ku)}function u(){for(let h=e,f=r.length;h=s.length?(o=new Hu,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function jv(){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 P,color:new et};break;case"SpotLight":t={position:new P,direction:new P,color:new et,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new P,color:new et,distance:0,decay:0};break;case"HemisphereLight":t={direction:new P,skyColor:new et,groundColor:new et};break;case"RectAreaLight":t={color:new et,position:new P,halfWidth:new P,halfHeight:new P};break}return r[e.id]=t,t}}}function qv(){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 Ue};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ue};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Yv=0;function $v(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function Kv(r,e){const t=new jv,n=qv(),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 u=0;u<9;u++)i.probe.push(new P);const s=new P,o=new Ge,a=new Ge;function l(u,h){let f=0,d=0,_=0;for(let O=0;O<9;O++)i.probe[O].set(0,0,0);let g=0,m=0,p=0,y=0,v=0,x=0,b=0,E=0,w=0,I=0,S=0;u.sort($v);const A=h===!0?Math.PI:1;for(let O=0,G=u.length;O0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=xe.LTC_FLOAT_1,i.rectAreaLTC2=xe.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=xe.LTC_HALF_1,i.rectAreaLTC2=xe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=f,i.ambient[1]=d,i.ambient[2]=_;const z=i.hash;(z.directionalLength!==g||z.pointLength!==m||z.spotLength!==p||z.rectAreaLength!==y||z.hemiLength!==v||z.numDirectionalShadows!==x||z.numPointShadows!==b||z.numSpotShadows!==E||z.numSpotMaps!==w||z.numLightProbes!==S)&&(i.directional.length=g,i.spot.length=p,i.rectArea.length=y,i.point.length=m,i.hemi.length=v,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=E,i.spotShadowMap.length=E,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=E+w-I,i.spotLightMap.length=w,i.numSpotLightShadowsWithMaps=I,i.numLightProbes=S,z.directionalLength=g,z.pointLength=m,z.spotLength=p,z.rectAreaLength=y,z.hemiLength=v,z.numDirectionalShadows=x,z.numPointShadows=b,z.numSpotShadows=E,z.numSpotMaps=w,z.numLightProbes=S,i.version=Yv++)}function c(u,h){let f=0,d=0,_=0,g=0,m=0;const p=h.matrixWorldInverse;for(let y=0,v=u.length;y=a.length?(l=new Vu(r,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:n,dispose:i}}class Jv extends hi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ud,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 Qv extends hi{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 e0=`void main() { +`+ce)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(G===""||D==="")&&(Z=!1);Z&&(z.diagnostics={runnable:H,programLog:O,vertexShader:{log:G,prefix:m},fragmentShader:{log:D,prefix:d}})}i.deleteShader(b),i.deleteShader(E),I=new ta(i,g),S=Cv(i,g)}let I;this.getUniforms=function(){return I===void 0&&T(this),I};let S;this.getAttributes=function(){return S===void 0&&T(this),S};let A=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return A===!1&&(A=i.getProgramParameter(g,bv)),A},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Sv++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=b,this.fragmentShader=E,this}let Hv=0;class Vv{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),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.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 Gv(e),t.set(e,n)),n}}class Gv{constructor(e){this.id=Hv++,this.code=e,this.usedTimes=0}}function Wv(r,e,t,n,i,s,o){const a=new hf,l=new Vv,c=[],u=i.isWebGL2,f=i.logarithmicDepthBuffer,h=i.vertexTextures;let p=i.precision;const _={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 g(S){return S===0?"uv":`uv${S}`}function m(S,A,z,O,G){const D=O.fog,H=G.geometry,Z=S.isMeshStandardMaterial?O.environment:null,J=(S.isMeshStandardMaterial?t:e).get(S.envMap||Z),ce=J&&J.mapping===da?J.image.height:null,ie=_[S.type];S.precision!==null&&(p=i.getMaxPrecision(S.precision),p!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",p,"instead."));const se=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,me=se!==void 0?se.length:0;let ve=0;H.morphAttributes.position!==void 0&&(ve=1),H.morphAttributes.normal!==void 0&&(ve=2),H.morphAttributes.color!==void 0&&(ve=3);let Q,oe,Se,De;if(ie){const Vt=ci[ie];Q=Vt.vertexShader,oe=Vt.fragmentShader}else Q=S.vertexShader,oe=S.fragmentShader,l.update(S),Se=l.getVertexShaderID(S),De=l.getFragmentShaderID(S);const _e=r.getRenderTarget(),qe=G.isInstancedMesh===!0,We=G.isBatchedMesh===!0,Fe=!!S.map,Ye=!!S.matcap,W=!!J,Ct=!!S.aoMap,Ce=!!S.lightMap,$e=!!S.bumpMap,ze=!!S.normalMap,mt=!!S.displacementMap,Ke=!!S.emissiveMap,ke=!!S.metalnessMap,st=!!S.roughnessMap,Tt=S.anisotropy>0,Lt=S.clearcoat>0,P=S.iridescence>0,w=S.sheen>0,X=S.transmission>0,le=Tt&&!!S.anisotropyMap,re=Lt&&!!S.clearcoatMap,fe=Lt&&!!S.clearcoatNormalMap,Ee=Lt&&!!S.clearcoatRoughnessMap,pe=P&&!!S.iridescenceMap,ye=P&&!!S.iridescenceThicknessMap,N=w&&!!S.sheenColorMap,de=w&&!!S.sheenRoughnessMap,ne=!!S.specularMap,Oe=!!S.specularColorMap,Ae=!!S.specularIntensityMap,Le=X&&!!S.transmissionMap,Me=X&&!!S.thicknessMap,be=!!S.gradientMap,Ge=!!S.alphaMap,F=S.alphaTest>0,ge=!!S.alphaHash,ae=!!S.extensions,ee=!!H.attributes.uv1,he=!!H.attributes.uv2,Re=!!H.attributes.uv3;let tt=Wi;return S.toneMapped&&(_e===null||_e.isXRRenderTarget===!0)&&(tt=r.toneMapping),{isWebGL2:u,shaderID:ie,shaderType:S.type,shaderName:S.name,vertexShader:Q,fragmentShader:oe,defines:S.defines,customVertexShaderID:Se,customFragmentShaderID:De,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:p,batching:We,instancing:qe,instancingColor:qe&&G.instanceColor!==null,supportsVertexTextures:h,outputColorSpace:_e===null?r.outputColorSpace:_e.isXRRenderTarget===!0?_e.texture.colorSpace:an,map:Fe,matcap:Ye,envMap:W,envMapMode:W&&J.mapping,envMapCubeUVHeight:ce,aoMap:Ct,lightMap:Ce,bumpMap:$e,normalMap:ze,displacementMap:h&&mt,emissiveMap:Ke,normalMapObjectSpace:ze&&S.normalMapType===Hd,normalMapTangentSpace:ze&&S.normalMapType===rf,metalnessMap:ke,roughnessMap:st,anisotropy:Tt,anisotropyMap:le,clearcoat:Lt,clearcoatMap:re,clearcoatNormalMap:fe,clearcoatRoughnessMap:Ee,iridescence:P,iridescenceMap:pe,iridescenceThicknessMap:ye,sheen:w,sheenColorMap:N,sheenRoughnessMap:de,specularMap:ne,specularColorMap:Oe,specularIntensityMap:Ae,transmission:X,transmissionMap:Le,thicknessMap:Me,gradientMap:be,opaque:S.transparent===!1&&S.blending===ns,alphaMap:Ge,alphaTest:F,alphaHash:ge,combine:S.combine,mapUv:Fe&&g(S.map.channel),aoMapUv:Ct&&g(S.aoMap.channel),lightMapUv:Ce&&g(S.lightMap.channel),bumpMapUv:$e&&g(S.bumpMap.channel),normalMapUv:ze&&g(S.normalMap.channel),displacementMapUv:mt&&g(S.displacementMap.channel),emissiveMapUv:Ke&&g(S.emissiveMap.channel),metalnessMapUv:ke&&g(S.metalnessMap.channel),roughnessMapUv:st&&g(S.roughnessMap.channel),anisotropyMapUv:le&&g(S.anisotropyMap.channel),clearcoatMapUv:re&&g(S.clearcoatMap.channel),clearcoatNormalMapUv:fe&&g(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ee&&g(S.clearcoatRoughnessMap.channel),iridescenceMapUv:pe&&g(S.iridescenceMap.channel),iridescenceThicknessMapUv:ye&&g(S.iridescenceThicknessMap.channel),sheenColorMapUv:N&&g(S.sheenColorMap.channel),sheenRoughnessMapUv:de&&g(S.sheenRoughnessMap.channel),specularMapUv:ne&&g(S.specularMap.channel),specularColorMapUv:Oe&&g(S.specularColorMap.channel),specularIntensityMapUv:Ae&&g(S.specularIntensityMap.channel),transmissionMapUv:Le&&g(S.transmissionMap.channel),thicknessMapUv:Me&&g(S.thicknessMap.channel),alphaMapUv:Ge&&g(S.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(ze||Tt),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,vertexUv1s:ee,vertexUv2s:he,vertexUv3s:Re,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(Fe||Ge),fog:!!D,useFog:S.fog===!0,fogExp2:D&&D.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:G.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:me,morphTextureStride:ve,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:S.dithering,shadowMapEnabled:r.shadowMap.enabled&&z.length>0,shadowMapType:r.shadowMap.type,toneMapping:tt,useLegacyLights:r._useLegacyLights,decodeVideoTexture:Fe&&S.map.isVideoTexture===!0&&dt.getTransfer(S.map.colorSpace)===At,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Kn,flipSided:S.side===xn,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionDerivatives:ae&&S.extensions.derivatives===!0,extensionFragDepth:ae&&S.extensions.fragDepth===!0,extensionDrawBuffers:ae&&S.extensions.drawBuffers===!0,extensionShaderTextureLOD:ae&&S.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()}}function d(S){const A=[];if(S.shaderID?A.push(S.shaderID):(A.push(S.customVertexShaderID),A.push(S.customFragmentShaderID)),S.defines!==void 0)for(const z in S.defines)A.push(z),A.push(S.defines[z]);return S.isRawShaderMaterial===!1&&(x(A,S),v(A,S),A.push(r.outputColorSpace)),A.push(S.customProgramCacheKey),A.join()}function x(S,A){S.push(A.precision),S.push(A.outputColorSpace),S.push(A.envMapMode),S.push(A.envMapCubeUVHeight),S.push(A.mapUv),S.push(A.alphaMapUv),S.push(A.lightMapUv),S.push(A.aoMapUv),S.push(A.bumpMapUv),S.push(A.normalMapUv),S.push(A.displacementMapUv),S.push(A.emissiveMapUv),S.push(A.metalnessMapUv),S.push(A.roughnessMapUv),S.push(A.anisotropyMapUv),S.push(A.clearcoatMapUv),S.push(A.clearcoatNormalMapUv),S.push(A.clearcoatRoughnessMapUv),S.push(A.iridescenceMapUv),S.push(A.iridescenceThicknessMapUv),S.push(A.sheenColorMapUv),S.push(A.sheenRoughnessMapUv),S.push(A.specularMapUv),S.push(A.specularColorMapUv),S.push(A.specularIntensityMapUv),S.push(A.transmissionMapUv),S.push(A.thicknessMapUv),S.push(A.combine),S.push(A.fogExp2),S.push(A.sizeAttenuation),S.push(A.morphTargetsCount),S.push(A.morphAttributeCount),S.push(A.numDirLights),S.push(A.numPointLights),S.push(A.numSpotLights),S.push(A.numSpotLightMaps),S.push(A.numHemiLights),S.push(A.numRectAreaLights),S.push(A.numDirLightShadows),S.push(A.numPointLightShadows),S.push(A.numSpotLightShadows),S.push(A.numSpotLightShadowsWithMaps),S.push(A.numLightProbes),S.push(A.shadowMapType),S.push(A.toneMapping),S.push(A.numClippingPlanes),S.push(A.numClipIntersection),S.push(A.depthPacking)}function v(S,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.matcap&&a.enable(4),A.envMap&&a.enable(5),A.normalMapObjectSpace&&a.enable(6),A.normalMapTangentSpace&&a.enable(7),A.clearcoat&&a.enable(8),A.iridescence&&a.enable(9),A.alphaTest&&a.enable(10),A.vertexColors&&a.enable(11),A.vertexAlphas&&a.enable(12),A.vertexUv1s&&a.enable(13),A.vertexUv2s&&a.enable(14),A.vertexUv3s&&a.enable(15),A.vertexTangents&&a.enable(16),A.anisotropy&&a.enable(17),A.alphaHash&&a.enable(18),A.batching&&a.enable(19),S.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.skinning&&a.enable(4),A.morphTargets&&a.enable(5),A.morphNormals&&a.enable(6),A.morphColors&&a.enable(7),A.premultipliedAlpha&&a.enable(8),A.shadowMapEnabled&&a.enable(9),A.useLegacyLights&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),S.push(a.mask)}function y(S){const A=_[S.type];let z;if(A){const O=ci[A];z=Ap.clone(O.uniforms)}else z=S.uniforms;return z}function b(S,A){let z;for(let O=0,G=c.length;O0?n.push(d):p.transparent===!0?i.push(d):t.push(d)}function l(f,h,p,_,g,m){const d=o(f,h,p,_,g,m);p.transmission>0?n.unshift(d):p.transparent===!0?i.unshift(d):t.unshift(d)}function c(f,h){t.length>1&&t.sort(f||qv),n.length>1&&n.sort(h||Hu),i.length>1&&i.sort(h||Hu)}function u(){for(let f=e,h=r.length;f=s.length?(o=new Vu,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function Yv(){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 L,color:new et};break;case"SpotLight":t={position:new L,direction:new L,color:new et,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new L,color:new et,distance:0,decay:0};break;case"HemisphereLight":t={direction:new L,skyColor:new et,groundColor:new et};break;case"RectAreaLight":t={color:new et,position:new L,halfWidth:new L,halfHeight:new L};break}return r[e.id]=t,t}}}function $v(){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 Ue};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ue};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let Kv=0;function Zv(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function Jv(r,e){const t=new Yv,n=$v(),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 u=0;u<9;u++)i.probe.push(new L);const s=new L,o=new Ve,a=new Ve;function l(u,f){let h=0,p=0,_=0;for(let O=0;O<9;O++)i.probe[O].set(0,0,0);let g=0,m=0,d=0,x=0,v=0,y=0,b=0,E=0,T=0,I=0,S=0;u.sort(Zv);const A=f===!0?Math.PI:1;for(let O=0,G=u.length;O0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=xe.LTC_FLOAT_1,i.rectAreaLTC2=xe.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=xe.LTC_HALF_1,i.rectAreaLTC2=xe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=h,i.ambient[1]=p,i.ambient[2]=_;const z=i.hash;(z.directionalLength!==g||z.pointLength!==m||z.spotLength!==d||z.rectAreaLength!==x||z.hemiLength!==v||z.numDirectionalShadows!==y||z.numPointShadows!==b||z.numSpotShadows!==E||z.numSpotMaps!==T||z.numLightProbes!==S)&&(i.directional.length=g,i.spot.length=d,i.rectArea.length=x,i.point.length=m,i.hemi.length=v,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=E,i.spotShadowMap.length=E,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=E+T-I,i.spotLightMap.length=T,i.numSpotLightShadowsWithMaps=I,i.numLightProbes=S,z.directionalLength=g,z.pointLength=m,z.spotLength=d,z.rectAreaLength=x,z.hemiLength=v,z.numDirectionalShadows=y,z.numPointShadows=b,z.numSpotShadows=E,z.numSpotMaps=T,z.numLightProbes=S,i.version=Kv++)}function c(u,f){let h=0,p=0,_=0,g=0,m=0;const d=f.matrixWorldInverse;for(let x=0,v=u.length;x=a.length?(l=new Gu(r,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:n,dispose:i}}class e0 extends fi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=zd,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 t0 extends fi{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 n0=`void main() { gl_Position = vec4( position, 1.0 ); -}`,t0=`uniform sampler2D shadow_pass; +}`,i0=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3642,7 +3642,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function n0(r,e,t){let n=new Ql;const i=new Ue,s=new Ue,o=new pt,a=new Jv({depthPacking:Bd}),l=new Qv,c={},u=t.maxTextureSize,h={[Jn]:gn,[gn]:Jn,[$n]:$n},f=new ji({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ue},radius:{value:4}},vertexShader:e0,fragmentShader:t0}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const _=new vn;_.setAttribute("position",new jt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new Mn(_,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Wh;let p=this.type;this.render=function(b,E,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||b.length===0)return;const I=r.getRenderTarget(),S=r.getActiveCubeFace(),A=r.getActiveMipmapLevel(),z=r.state;z.setBlending(Vi),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);const O=p!==wi&&this.type===wi,G=p===wi&&this.type!==wi;for(let D=0,H=b.length;Du||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/ce.x),i.x=s.x*ce.x,J.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/ce.y),i.y=s.y*ce.y,J.mapSize.y=s.y)),J.map===null||O===!0||G===!0){const se=this.type!==wi?{minFilter:It,magFilter:It}:{};J.map!==null&&J.map.dispose(),J.map=new Xi(i.x,i.y,se),J.map.texture.name=Z.name+".shadowMap",J.camera.updateProjectionMatrix()}r.setRenderTarget(J.map),r.clear();const ie=J.getViewportCount();for(let se=0;se0||E.map&&E.alphaTest>0){const z=S.uuid,O=E.uuid;let G=c[z];G===void 0&&(G={},c[z]=G);let D=G[O];D===void 0&&(D=S.clone(),G[O]=D),S=D}if(S.visible=E.visible,S.wireframe=E.wireframe,I===wi?S.side=E.shadowSide!==null?E.shadowSide:E.side:S.side=E.shadowSide!==null?E.shadowSide:h[E.side],S.alphaMap=E.alphaMap,S.alphaTest=E.alphaTest,S.map=E.map,S.clipShadows=E.clipShadows,S.clippingPlanes=E.clippingPlanes,S.clipIntersection=E.clipIntersection,S.displacementMap=E.displacementMap,S.displacementScale=E.displacementScale,S.displacementBias=E.displacementBias,S.wireframeLinewidth=E.wireframeLinewidth,S.linewidth=E.linewidth,w.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const z=r.properties.get(S);z.light=w}return S}function x(b,E,w,I,S){if(b.visible===!1)return;if(b.layers.test(E.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&S===wi)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,b.matrixWorld);const O=e.update(b),G=b.material;if(Array.isArray(G)){const D=O.groups;for(let H=0,Z=D.length;H=1):se.indexOf("OpenGL ES")!==-1&&(ie=parseFloat(/^OpenGL ES (\d)/.exec(se)[1]),ce=ie>=2);let me=null,ve={};const Q=r.getParameter(r.SCISSOR_BOX),oe=r.getParameter(r.VIEWPORT),Se=new pt().fromArray(Q),Pe=new pt().fromArray(oe);function _e(F,ge,ae,ee){const he=new Uint8Array(4),Re=r.createTexture();r.bindTexture(F,Re),r.texParameteri(F,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(F,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let tt=0;tt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap;let g;const m=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(L,M){return p?new OffscreenCanvas(L,M):Ks("canvas")}function v(L,M,X,le){let re=1;if((L.width>le||L.height>le)&&(re=le/Math.max(L.width,L.height)),re<1||M===!0)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap){const fe=M?oa:Math.floor,Ee=fe(re*L.width),pe=fe(re*L.height);g===void 0&&(g=y(Ee,pe));const ye=X?y(Ee,pe):g;return ye.width=Ee,ye.height=pe,ye.getContext("2d").drawImage(L,0,0,Ee,pe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+L.width+"x"+L.height+") to ("+Ee+"x"+pe+")."),ye}else return"data"in L&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+L.width+"x"+L.height+")."),L;return L}function x(L){return Dl(L.width)&&Dl(L.height)}function b(L){return a?!1:L.wrapS!==zn||L.wrapT!==zn||L.minFilter!==It&&L.minFilter!==bn}function E(L,M){return L.generateMipmaps&&M&&L.minFilter!==It&&L.minFilter!==bn}function w(L){r.generateMipmap(L)}function I(L,M,X,le,re=!1){if(a===!1)return M;if(L!==null){if(r[L]!==void 0)return r[L];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let fe=M;if(M===r.RED&&(X===r.FLOAT&&(fe=r.R32F),X===r.HALF_FLOAT&&(fe=r.R16F),X===r.UNSIGNED_BYTE&&(fe=r.R8)),M===r.RED_INTEGER&&(X===r.UNSIGNED_BYTE&&(fe=r.R8UI),X===r.UNSIGNED_SHORT&&(fe=r.R16UI),X===r.UNSIGNED_INT&&(fe=r.R32UI),X===r.BYTE&&(fe=r.R8I),X===r.SHORT&&(fe=r.R16I),X===r.INT&&(fe=r.R32I)),M===r.RG&&(X===r.FLOAT&&(fe=r.RG32F),X===r.HALF_FLOAT&&(fe=r.RG16F),X===r.UNSIGNED_BYTE&&(fe=r.RG8)),M===r.RGBA){const Ee=re?na:dt.getTransfer(le);X===r.FLOAT&&(fe=r.RGBA32F),X===r.HALF_FLOAT&&(fe=r.RGBA16F),X===r.UNSIGNED_BYTE&&(fe=Ee===Tt?r.SRGB8_ALPHA8:r.RGBA8),X===r.UNSIGNED_SHORT_4_4_4_4&&(fe=r.RGBA4),X===r.UNSIGNED_SHORT_5_5_5_1&&(fe=r.RGB5_A1)}return(fe===r.R16F||fe===r.R32F||fe===r.RG16F||fe===r.RG32F||fe===r.RGBA16F||fe===r.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function S(L,M,X){return E(L,X)===!0||L.isFramebufferTexture&&L.minFilter!==It&&L.minFilter!==bn?Math.log2(Math.max(M.width,M.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?M.mipmaps.length:1}function A(L){return L===It||L===Al||L===Jo?r.NEAREST:r.LINEAR}function z(L){const M=L.target;M.removeEventListener("dispose",z),G(M),M.isVideoTexture&&_.delete(M)}function O(L){const M=L.target;M.removeEventListener("dispose",O),H(M)}function G(L){const M=n.get(L);if(M.__webglInit===void 0)return;const X=L.source,le=m.get(X);if(le){const re=le[M.__cacheKey];re.usedTimes--,re.usedTimes===0&&D(L),Object.keys(le).length===0&&m.delete(X)}n.remove(L)}function D(L){const M=n.get(L);r.deleteTexture(M.__webglTexture);const X=L.source,le=m.get(X);delete le[M.__cacheKey],o.memory.textures--}function H(L){const M=L.texture,X=n.get(L),le=n.get(M);if(le.__webglTexture!==void 0&&(r.deleteTexture(le.__webglTexture),o.memory.textures--),L.depthTexture&&L.depthTexture.dispose(),L.isWebGLCubeRenderTarget)for(let re=0;re<6;re++){if(Array.isArray(X.__webglFramebuffer[re]))for(let fe=0;fe=l&&console.warn("THREE.WebGLTextures: Trying to use "+L+" texture units while this GPU supports only "+l),Z+=1,L}function ie(L){const M=[];return M.push(L.wrapS),M.push(L.wrapT),M.push(L.wrapR||0),M.push(L.magFilter),M.push(L.minFilter),M.push(L.anisotropy),M.push(L.internalFormat),M.push(L.format),M.push(L.type),M.push(L.generateMipmaps),M.push(L.premultiplyAlpha),M.push(L.flipY),M.push(L.unpackAlignment),M.push(L.colorSpace),M.join()}function se(L,M){const X=n.get(L);if(L.isVideoTexture&&Et(L),L.isRenderTargetTexture===!1&&L.version>0&&X.__version!==L.version){const le=L.image;if(le===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(le.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{We(X,L,M);return}}t.bindTexture(r.TEXTURE_2D,X.__webglTexture,r.TEXTURE0+M)}function me(L,M){const X=n.get(L);if(L.version>0&&X.__version!==L.version){We(X,L,M);return}t.bindTexture(r.TEXTURE_2D_ARRAY,X.__webglTexture,r.TEXTURE0+M)}function ve(L,M){const X=n.get(L);if(L.version>0&&X.__version!==L.version){We(X,L,M);return}t.bindTexture(r.TEXTURE_3D,X.__webglTexture,r.TEXTURE0+M)}function Q(L,M){const X=n.get(L);if(L.version>0&&X.__version!==L.version){Ne(X,L,M);return}t.bindTexture(r.TEXTURE_CUBE_MAP,X.__webglTexture,r.TEXTURE0+M)}const oe={[ss]:r.REPEAT,[zn]:r.CLAMP_TO_EDGE,[ta]:r.MIRRORED_REPEAT},Se={[It]:r.NEAREST,[Al]:r.NEAREST_MIPMAP_NEAREST,[Jo]:r.NEAREST_MIPMAP_LINEAR,[bn]:r.LINEAR,[qh]:r.LINEAR_MIPMAP_NEAREST,[pr]:r.LINEAR_MIPMAP_LINEAR},Pe={[kd]:r.NEVER,[jd]:r.ALWAYS,[Hd]:r.LESS,[rf]:r.LEQUAL,[Vd]:r.EQUAL,[Xd]:r.GEQUAL,[Gd]:r.GREATER,[Wd]:r.NOTEQUAL};function _e(L,M,X){if(X?(r.texParameteri(L,r.TEXTURE_WRAP_S,oe[M.wrapS]),r.texParameteri(L,r.TEXTURE_WRAP_T,oe[M.wrapT]),(L===r.TEXTURE_3D||L===r.TEXTURE_2D_ARRAY)&&r.texParameteri(L,r.TEXTURE_WRAP_R,oe[M.wrapR]),r.texParameteri(L,r.TEXTURE_MAG_FILTER,Se[M.magFilter]),r.texParameteri(L,r.TEXTURE_MIN_FILTER,Se[M.minFilter])):(r.texParameteri(L,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(L,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(L===r.TEXTURE_3D||L===r.TEXTURE_2D_ARRAY)&&r.texParameteri(L,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(M.wrapS!==zn||M.wrapT!==zn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(L,r.TEXTURE_MAG_FILTER,A(M.magFilter)),r.texParameteri(L,r.TEXTURE_MIN_FILTER,A(M.minFilter)),M.minFilter!==It&&M.minFilter!==bn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),M.compareFunction&&(r.texParameteri(L,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(L,r.TEXTURE_COMPARE_FUNC,Pe[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const le=e.get("EXT_texture_filter_anisotropic");if(M.magFilter===It||M.minFilter!==Jo&&M.minFilter!==pr||M.type===_n&&e.has("OES_texture_float_linear")===!1||a===!1&&M.type===qs&&e.has("OES_texture_half_float_linear")===!1)return;(M.anisotropy>1||n.get(M).__currentAnisotropy)&&(r.texParameterf(L,le.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,i.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy)}}function je(L,M){let X=!1;L.__webglInit===void 0&&(L.__webglInit=!0,M.addEventListener("dispose",z));const le=M.source;let re=m.get(le);re===void 0&&(re={},m.set(le,re));const fe=ie(M);if(fe!==L.__cacheKey){re[fe]===void 0&&(re[fe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,X=!0),re[fe].usedTimes++;const Ee=re[L.__cacheKey];Ee!==void 0&&(re[L.__cacheKey].usedTimes--,Ee.usedTimes===0&&D(M)),L.__cacheKey=fe,L.__webglTexture=re[fe].texture}return X}function We(L,M,X){let le=r.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(le=r.TEXTURE_2D_ARRAY),M.isData3DTexture&&(le=r.TEXTURE_3D);const re=je(L,M),fe=M.source;t.bindTexture(le,L.__webglTexture,r.TEXTURE0+X);const Ee=n.get(fe);if(fe.version!==Ee.__version||re===!0){t.activeTexture(r.TEXTURE0+X);const pe=dt.getPrimaries(dt.workingColorSpace),ye=M.colorSpace===kn?null:dt.getPrimaries(M.colorSpace),N=M.colorSpace===kn||pe===ye?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,M.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,M.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,N);const de=b(M)&&x(M.image)===!1;let ne=v(M.image,de,!1,u);ne=Ct(M,ne);const Fe=x(ne)||a,Ae=s.convert(M.format,M.colorSpace);let Le=s.convert(M.type),Me=I(M.internalFormat,Ae,Le,M.colorSpace,M.isVideoTexture);_e(le,M,Fe);let be;const Ve=M.mipmaps,F=a&&M.isVideoTexture!==!0&&Me!==Qh,ge=Ee.__version===void 0||re===!0,ae=S(M,ne,Fe);if(M.isDepthTexture)Me=r.DEPTH_COMPONENT,a?M.type===_n?Me=r.DEPTH_COMPONENT32F:M.type===Pn?Me=r.DEPTH_COMPONENT24:M.type===hr?Me=r.DEPTH24_STENCIL8:Me=r.DEPTH_COMPONENT16:M.type===_n&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),M.format===fr&&Me===r.DEPTH_COMPONENT&&M.type!==fa&&M.type!==Pn&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),M.type=Pn,Le=s.convert(M.type)),M.format===os&&Me===r.DEPTH_COMPONENT&&(Me=r.DEPTH_STENCIL,M.type!==hr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),M.type=hr,Le=s.convert(M.type))),ge&&(F?t.texStorage2D(r.TEXTURE_2D,1,Me,ne.width,ne.height):t.texImage2D(r.TEXTURE_2D,0,Me,ne.width,ne.height,0,Ae,Le,null));else if(M.isDataTexture)if(Ve.length>0&&Fe){F&&ge&&t.texStorage2D(r.TEXTURE_2D,ae,Me,Ve[0].width,Ve[0].height);for(let ee=0,he=Ve.length;ee>=1,he>>=1}}else if(Ve.length>0&&Fe){F&&ge&&t.texStorage2D(r.TEXTURE_2D,ae,Me,Ve[0].width,Ve[0].height);for(let ee=0,he=Ve.length;ee0&&ge++,t.texStorage2D(r.TEXTURE_CUBE_MAP,ge,be,ne[0].width,ne[0].height));for(let ee=0;ee<6;ee++)if(de){Ve?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,ne[ee].width,ne[ee].height,Le,Me,ne[ee].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,be,ne[ee].width,ne[ee].height,0,Le,Me,ne[ee].data);for(let he=0;he>fe),ne=Math.max(1,M.height>>fe);re===r.TEXTURE_3D||re===r.TEXTURE_2D_ARRAY?t.texImage3D(re,fe,ye,de,ne,M.depth,0,Ee,pe,null):t.texImage2D(re,fe,ye,de,ne,0,Ee,pe,null)}t.bindFramebuffer(r.FRAMEBUFFER,L),st(M)?f.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,le,re,n.get(X).__webglTexture,0,ke(M)):(re===r.TEXTURE_2D||re>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&re<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,le,re,n.get(X).__webglTexture,fe),t.bindFramebuffer(r.FRAMEBUFFER,null)}function W(L,M,X){if(r.bindRenderbuffer(r.RENDERBUFFER,L),M.depthBuffer&&!M.stencilBuffer){let le=a===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(X||st(M)){const re=M.depthTexture;re&&re.isDepthTexture&&(re.type===_n?le=r.DEPTH_COMPONENT32F:re.type===Pn&&(le=r.DEPTH_COMPONENT24));const fe=ke(M);st(M)?f.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,fe,le,M.width,M.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,fe,le,M.width,M.height)}else r.renderbufferStorage(r.RENDERBUFFER,le,M.width,M.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,L)}else if(M.depthBuffer&&M.stencilBuffer){const le=ke(M);X&&st(M)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,M.width,M.height):st(M)?f.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,M.width,M.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,M.width,M.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,L)}else{const le=M.isWebGLMultipleRenderTargets===!0?M.texture:[M.texture];for(let re=0;re0){X.__webglFramebuffer[pe]=[];for(let ye=0;ye0){X.__webglFramebuffer=[];for(let pe=0;pe0&&st(L)===!1){const pe=fe?M:[M];X.__webglMultisampledFramebuffer=r.createFramebuffer(),X.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,X.__webglMultisampledFramebuffer);for(let ye=0;ye0)for(let ye=0;ye0)for(let ye=0;ye0&&st(L)===!1){const M=L.isWebGLMultipleRenderTargets?L.texture:[L.texture],X=L.width,le=L.height;let re=r.COLOR_BUFFER_BIT;const fe=[],Ee=L.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,pe=n.get(L),ye=L.isWebGLMultipleRenderTargets===!0;if(ye)for(let N=0;N0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Et(L){const M=o.render.frame;_.get(L)!==M&&(_.set(L,M),L.update())}function Ct(L,M){const X=L.colorSpace,le=L.format,re=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||L.format===Pl||X!==sn&&X!==kn&&(dt.getTransfer(X)===Tt?a===!1?e.has("EXT_sRGB")===!0&&le===nn?(L.format=Pl,L.minFilter=bn,L.generateMipmaps=!1):M=af.sRGBToLinear(M):(le!==nn||re!==ui)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",X)),M}this.allocateTextureUnit=ce,this.resetTextureUnits=J,this.setTexture2D=se,this.setTexture2DArray=me,this.setTexture3D=ve,this.setTextureCube=Q,this.rebindTextures=$e,this.setupRenderTarget=ze,this.updateRenderTargetMipmap=mt,this.updateMultisampleRenderTarget=Ke,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=Ye,this.useMultisampledRTT=st}function s0(r,e,t){const n=t.isWebGL2;function i(s,o=kn){let a;const l=dt.getTransfer(o);if(s===ui)return r.UNSIGNED_BYTE;if(s===$h)return r.UNSIGNED_SHORT_4_4_4_4;if(s===Kh)return r.UNSIGNED_SHORT_5_5_5_1;if(s===Rl)return r.BYTE;if(s===Yh)return r.SHORT;if(s===fa)return r.UNSIGNED_SHORT;if(s===ks)return r.INT;if(s===Pn)return r.UNSIGNED_INT;if(s===_n)return r.FLOAT;if(s===qs)return n?r.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Pd)return r.ALPHA;if(s===nn)return r.RGBA;if(s===Dd)return r.LUMINANCE;if(s===Id)return r.LUMINANCE_ALPHA;if(s===fr)return r.DEPTH_COMPONENT;if(s===os)return r.DEPTH_STENCIL;if(s===Pl)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Zh)return r.RED;if(s===Kl)return r.RED_INTEGER;if(s===Jh)return r.RG;if(s===da)return r.RG_INTEGER;if(s===Ys)return r.RGBA_INTEGER;if(s===wa||s===Ma||s===Ea||s===Ta)if(l===Tt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===wa)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Ma)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Ea)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Ta)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===wa)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Ma)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Ea)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Ta)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Rc||s===Cc||s===Lc||s===Pc)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Rc)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Cc)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Lc)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Pc)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Qh)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Dc||s===Ic)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Dc)return l===Tt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Ic)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Nc||s===Fc||s===Oc||s===Uc||s===Bc||s===zc||s===kc||s===Hc||s===Vc||s===Gc||s===Wc||s===Xc||s===jc||s===qc)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Nc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Fc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Oc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Uc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Bc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===zc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===kc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Hc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Vc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Gc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Wc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Xc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===jc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===qc)return l===Tt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Aa||s===Yc||s===$c)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Aa)return l===Tt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===Yc)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===$c)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===Nd||s===Kc||s===Zc||s===Jc)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Aa)return a.COMPRESSED_RED_RGTC1_EXT;if(s===Kc)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Zc)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Jc)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===hr?n?r.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class o0 extends mn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class ur extends Ot{constructor(){super(),this.isGroup=!0,this.type="Group"}}const a0={type:"move"};class Za{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ur,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 ur,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ur,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P),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,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const g of e.hand.values()){const m=t.getJointPose(g,n),p=this._getHandJoint(c,g);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,_=.005;c.inputState.pinching&&f>d+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(a0)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new ur;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class l0 extends _r{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,f=null,d=null,_=null;const g=t.getContextAttributes();let m=null,p=null;const y=[],v=[],x=new Ue;let b=null;const E=new mn;E.layers.enable(1),E.viewport=new pt;const w=new mn;w.layers.enable(2),w.viewport=new pt;const I=[E,w],S=new o0;S.layers.enable(1),S.layers.enable(2);let A=null,z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Q){let oe=y[Q];return oe===void 0&&(oe=new Za,y[Q]=oe),oe.getTargetRaySpace()},this.getControllerGrip=function(Q){let oe=y[Q];return oe===void 0&&(oe=new Za,y[Q]=oe),oe.getGripSpace()},this.getHand=function(Q){let oe=y[Q];return oe===void 0&&(oe=new Za,y[Q]=oe),oe.getHandSpace()};function O(Q){const oe=v.indexOf(Q.inputSource);if(oe===-1)return;const Se=y[oe];Se!==void 0&&(Se.update(Q.inputSource,Q.frame,c||o),Se.dispatchEvent({type:Q.type,data:Q.inputSource}))}function G(){i.removeEventListener("select",O),i.removeEventListener("selectstart",O),i.removeEventListener("selectend",O),i.removeEventListener("squeeze",O),i.removeEventListener("squeezestart",O),i.removeEventListener("squeezeend",O),i.removeEventListener("end",G),i.removeEventListener("inputsourceschange",D);for(let Q=0;Q=0&&(v[Pe]=null,y[Pe].disconnect(Se))}for(let oe=0;oe=v.length){v.push(Se),Pe=je;break}else if(v[je]===null){v[je]=Se,Pe=je;break}if(Pe===-1)break}const _e=y[Pe];_e&&_e.connect(Se)}}const H=new P,Z=new P;function J(Q,oe,Se){H.setFromMatrixPosition(oe.matrixWorld),Z.setFromMatrixPosition(Se.matrixWorld);const Pe=H.distanceTo(Z),_e=oe.projectionMatrix.elements,je=Se.projectionMatrix.elements,We=_e[14]/(_e[10]-1),Ne=_e[14]/(_e[10]+1),Ye=(_e[9]+1)/_e[5],W=(_e[9]-1)/_e[5],Rt=(_e[8]-1)/_e[0],Ce=(je[8]+1)/je[0],$e=We*Rt,ze=We*Ce,mt=Pe/(-Rt+Ce),Ke=mt*-Rt;oe.matrixWorld.decompose(Q.position,Q.quaternion,Q.scale),Q.translateX(Ke),Q.translateZ(mt),Q.matrixWorld.compose(Q.position,Q.quaternion,Q.scale),Q.matrixWorldInverse.copy(Q.matrixWorld).invert();const ke=We+mt,st=Ne+mt,Et=$e-Ke,Ct=ze+(Pe-Ke),L=Ye*Ne/st*ke,M=W*Ne/st*ke;Q.projectionMatrix.makePerspective(Et,Ct,L,M,ke,st),Q.projectionMatrixInverse.copy(Q.projectionMatrix).invert()}function ce(Q,oe){oe===null?Q.matrixWorld.copy(Q.matrix):Q.matrixWorld.multiplyMatrices(oe.matrixWorld,Q.matrix),Q.matrixWorldInverse.copy(Q.matrixWorld).invert()}this.updateCamera=function(Q){if(i===null)return;S.near=w.near=E.near=Q.near,S.far=w.far=E.far=Q.far,(A!==S.near||z!==S.far)&&(i.updateRenderState({depthNear:S.near,depthFar:S.far}),A=S.near,z=S.far);const oe=Q.parent,Se=S.cameras;ce(S,oe);for(let Pe=0;Pe0&&(m.alphaTest.value=p.alphaTest);const y=e.get(p).envMap;if(y&&(m.envMap.value=y,m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap){m.lightMap.value=p.lightMap;const v=r._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=p.lightMapIntensity*v,t(p.lightMap,m.lightMapTransform)}p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,y,v){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*y,m.scale.value=v*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function h(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function f(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),e.get(p).envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function d(m,p,y){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===gn&&m.clearcoatNormalScale.value.negate())),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,p){p.matcap&&(m.matcap.value=p.matcap)}function g(m,p){const y=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function u0(r,e,t,n){let i={},s={},o=[];const a=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(y,v){const x=v.program;n.uniformBlockBinding(y,x)}function c(y,v){let x=i[y.id];x===void 0&&(_(y),x=u(y),i[y.id]=x,y.addEventListener("dispose",m));const b=v.program;n.updateUBOMapping(y,b);const E=e.render.frame;s[y.id]!==E&&(f(y),s[y.id]=E)}function u(y){const v=h();y.__bindingPointIndex=v;const x=r.createBuffer(),b=y.__size,E=y.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,b,E),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,v,x),x}function h(){for(let y=0;y0){E=x%b;const O=b-E;E!==0&&O-A.boundary<0&&(x+=b-E,S.__offset=x)}x+=A.storage}return E=x%b,E>0&&(x+=b-E),y.__size=x,y.__cache={},this}function g(y){const v={boundary:0,storage:0};return typeof y=="number"?(v.boundary=4,v.storage=4):y.isVector2?(v.boundary=8,v.storage=8):y.isVector3||y.isColor?(v.boundary=16,v.storage=12):y.isVector4?(v.boundary=16,v.storage=16):y.isMatrix3?(v.boundary=48,v.storage=48):y.isMatrix4?(v.boundary=64,v.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),v}function m(y){const v=y.target;v.removeEventListener("dispose",m);const x=o.indexOf(v.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(i[v.id]),delete i[v.id],delete s[v.id]}function p(){for(const y in i)r.deleteBuffer(i[y]);o=[],i={},s={}}return{bind:l,update:c,dispose:p}}class Mf{constructor(e={}){const{canvas:t=ap(),context:n=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;n!==null?f=n.getContextAttributes().alpha:f=o;const d=new Uint32Array(4),_=new Int32Array(4);let g=null,m=null;const p=[],y=[];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=zt,this._useLegacyLights=!1,this.toneMapping=Gi,this.toneMappingExposure=1;const v=this;let x=!1,b=0,E=0,w=null,I=-1,S=null;const A=new pt,z=new pt;let O=null;const G=new et(0);let D=0,H=t.width,Z=t.height,J=1,ce=null,ie=null;const se=new pt(0,0,H,Z),me=new pt(0,0,H,Z);let ve=!1;const Q=new Ql;let oe=!1,Se=!1,Pe=null;const _e=new Ge,je=new Ue,We=new P,Ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ye(){return w===null?J:1}let W=n;function Rt(R,k){for(let q=0;q{function we(){if(K.forEach(function(De){Ke.get(De).currentProgram.isReady()&&K.delete(De)}),K.size===0){Y(R);return}setTimeout(we,10)}Ce.get("KHR_parallel_shader_compile")!==null?we():setTimeout(we,10)})};let tt=null;function _t(R){tt&&tt(R)}function Ht(){ht.stop()}function ut(){ht.start()}const ht=new gf;ht.setAnimationLoop(_t),typeof self<"u"&&ht.setContext(self),this.setAnimationLoop=function(R){tt=R,be.setAnimationLoop(R),R===null?ht.stop():ht.start()},be.addEventListener("sessionstart",Ht),be.addEventListener("sessionend",ut),this.render=function(R,k){if(k!==void 0&&k.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),be.enabled===!0&&be.isPresenting===!0&&(be.cameraAutoUpdate===!0&&be.updateCamera(k),k=be.getCamera()),R.isScene===!0&&R.onBeforeRender(v,R,k,w),m=fe.get(R,y.length),m.init(),y.push(m),_e.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),Q.setFromProjectionMatrix(_e),Se=this.localClippingEnabled,oe=Ee.init(this.clippingPlanes,Se),g=re.get(R,p.length),g.init(),p.push(g),yn(R,k,0,v.sortObjects),g.finish(),v.sortObjects===!0&&g.sort(ce,ie),this.info.render.frame++,oe===!0&&Ee.beginShadows();const q=m.state.shadowsArray;if(pe.render(q,R,k),oe===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset(),ye.render(g,R),m.setupLights(v._useLegacyLights),k.isArrayCamera){const K=k.cameras;for(let Y=0,we=K.length;Y0?m=y[y.length-1]:m=null,p.pop(),p.length>0?g=p[p.length-1]:g=null};function yn(R,k,q,K){if(R.visible===!1)return;if(R.layers.test(k.layers)){if(R.isGroup)q=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(k);else if(R.isLight)m.pushLight(R),R.castShadow&&m.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||Q.intersectsSprite(R)){K&&We.setFromMatrixPosition(R.matrixWorld).applyMatrix4(_e);const De=M.update(R),He=R.material;He.visible&&g.push(R,De,He,q,We.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||Q.intersectsObject(R))){const De=M.update(R),He=R.material;if(K&&(R.boundingSphere!==void 0?(R.boundingSphere===null&&R.computeBoundingSphere(),We.copy(R.boundingSphere.center)):(De.boundingSphere===null&&De.computeBoundingSphere(),We.copy(De.boundingSphere.center)),We.applyMatrix4(R.matrixWorld).applyMatrix4(_e)),Array.isArray(He)){const Xe=De.groups;for(let Qe=0,qe=Xe.length;Qe0&&on(Y,we,k,q),K&&ze.viewport(A.copy(K)),Y.length>0&&Ci(Y,k,q),we.length>0&&Ci(we,k,q),De.length>0&&Ci(De,k,q),ze.buffers.depth.setTest(!0),ze.buffers.depth.setMask(!0),ze.buffers.color.setMask(!0),ze.setPolygonOffset(!1)}function on(R,k,q,K){if((q.isScene===!0?q.overrideMaterial:null)!==null)return;const we=$e.isWebGL2;Pe===null&&(Pe=new Xi(1,1,{generateMipmaps:!0,type:Ce.has("EXT_color_buffer_half_float")?qs:ui,minFilter:pr,samples:we?4:0})),v.getDrawingBufferSize(je),we?Pe.setSize(je.x,je.y):Pe.setSize(oa(je.x),oa(je.y));const De=v.getRenderTarget();v.setRenderTarget(Pe),v.getClearColor(G),D=v.getClearAlpha(),D<1&&v.setClearColor(16777215,.5),v.clear();const He=v.toneMapping;v.toneMapping=Gi,Ci(R,q,K),ke.updateMultisampleRenderTarget(Pe),ke.updateRenderTargetMipmap(Pe);let Xe=!1;for(let Qe=0,qe=k.length;Qe0),Ze=!!q.morphAttributes.position,vt=!!q.morphAttributes.normal,Vt=!!q.morphAttributes.color;let Ut=Gi;K.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(Ut=v.toneMapping);const an=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,ot=an!==void 0?an.length:0,Je=Ke.get(K),Yi=m.state.lights;if(oe===!0&&(Se===!0||R!==S)){const te=R===S&&K.id===I;Ee.setState(K,R,te)}let xt=!1;K.version===Je.__version?(Je.needsLights&&Je.lightsStateVersion!==Yi.state.version||Je.outputColorSpace!==He||Y.isBatchedMesh&&Je.batching===!1||!Y.isBatchedMesh&&Je.batching===!0||Y.isInstancedMesh&&Je.instancing===!1||!Y.isInstancedMesh&&Je.instancing===!0||Y.isSkinnedMesh&&Je.skinning===!1||!Y.isSkinnedMesh&&Je.skinning===!0||Y.isInstancedMesh&&Je.instancingColor===!0&&Y.instanceColor===null||Y.isInstancedMesh&&Je.instancingColor===!1&&Y.instanceColor!==null||Je.envMap!==Xe||K.fog===!0&&Je.fog!==we||Je.numClippingPlanes!==void 0&&(Je.numClippingPlanes!==Ee.numPlanes||Je.numIntersection!==Ee.numIntersection)||Je.vertexAlphas!==Qe||Je.vertexTangents!==qe||Je.morphTargets!==Ze||Je.morphNormals!==vt||Je.morphColors!==Vt||Je.toneMapping!==Ut||$e.isWebGL2===!0&&Je.morphTargetsCount!==ot)&&(xt=!0):(xt=!0,Je.__version=K.version);let Nn=Je.currentProgram;xt===!0&&(Nn=ni(K,k,Y));let yr=!1,Kt=!1,en=!1;const Gt=Nn.getUniforms(),T=Je.uniforms;if(ze.useProgram(Nn.program)&&(yr=!0,Kt=!0,en=!0),K.id!==I&&(I=K.id,Kt=!0),yr||S!==R){Gt.setValue(W,"projectionMatrix",R.projectionMatrix),Gt.setValue(W,"viewMatrix",R.matrixWorldInverse);const te=Gt.map.cameraPosition;te!==void 0&&te.setValue(W,We.setFromMatrixPosition(R.matrixWorld)),$e.logarithmicDepthBuffer&&Gt.setValue(W,"logDepthBufFC",2/(Math.log(R.far+1)/Math.LN2)),(K.isMeshPhongMaterial||K.isMeshToonMaterial||K.isMeshLambertMaterial||K.isMeshBasicMaterial||K.isMeshStandardMaterial||K.isShaderMaterial)&&Gt.setValue(W,"isOrthographic",R.isOrthographicCamera===!0),S!==R&&(S=R,Kt=!0,en=!0)}if(Y.isSkinnedMesh){Gt.setOptional(W,Y,"bindMatrix"),Gt.setOptional(W,Y,"bindMatrixInverse");const te=Y.skeleton;te&&($e.floatVertexTextures?(te.boneTexture===null&&te.computeBoneTexture(),Gt.setValue(W,"boneTexture",te.boneTexture,ke)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}Y.isBatchedMesh&&(Gt.setOptional(W,Y,"batchingTexture"),Gt.setValue(W,"batchingTexture",Y._matricesTexture,ke));const B=q.morphAttributes;if((B.position!==void 0||B.normal!==void 0||B.color!==void 0&&$e.isWebGL2===!0)&&N.update(Y,q,Nn),(Kt||Je.receiveShadow!==Y.receiveShadow)&&(Je.receiveShadow=Y.receiveShadow,Gt.setValue(W,"receiveShadow",Y.receiveShadow)),K.isMeshGouraudMaterial&&K.envMap!==null&&(T.envMap.value=Xe,T.flipEnvMap.value=Xe.isCubeTexture&&Xe.isRenderTargetTexture===!1?-1:1),Kt&&(Gt.setValue(W,"toneMappingExposure",v.toneMappingExposure),Je.needsLights&&Li(T,en),we&&K.fog===!0&&le.refreshFogUniforms(T,we),le.refreshMaterialUniforms(T,K,J,Z,Pe),Qo.upload(W,vr(Je),T,ke)),K.isShaderMaterial&&K.uniformsNeedUpdate===!0&&(Qo.upload(W,vr(Je),T,ke),K.uniformsNeedUpdate=!1),K.isSpriteMaterial&&Gt.setValue(W,"center",Y.center),Gt.setValue(W,"modelViewMatrix",Y.modelViewMatrix),Gt.setValue(W,"normalMatrix",Y.normalMatrix),Gt.setValue(W,"modelMatrix",Y.matrixWorld),K.isShaderMaterial||K.isRawShaderMaterial){const te=K.uniformsGroups;for(let V=0,ue=te.length;V0&&ke.useMultisampledRTT(R)===!1?Y=Ke.get(R).__webglMultisampledFramebuffer:Array.isArray(qe)?Y=qe[q]:Y=qe,A.copy(R.viewport),z.copy(R.scissor),O=R.scissorTest}else A.copy(se).multiplyScalar(J).floor(),z.copy(me).multiplyScalar(J).floor(),O=ve;if(ze.bindFramebuffer(W.FRAMEBUFFER,Y)&&$e.drawBuffers&&K&&ze.drawBuffers(R,Y),ze.viewport(A),ze.scissor(z),ze.setScissorTest(O),we){const Xe=Ke.get(R.texture);W.framebufferTexture2D(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_CUBE_MAP_POSITIVE_X+k,Xe.__webglTexture,q)}else if(De){const Xe=Ke.get(R.texture),Qe=k||0;W.framebufferTextureLayer(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,Xe.__webglTexture,q||0,Qe)}I=-1},this.readRenderTargetPixels=function(R,k,q,K,Y,we,De){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let He=Ke.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&De!==void 0&&(He=He[De]),He){ze.bindFramebuffer(W.FRAMEBUFFER,He);try{const Xe=R.texture,Qe=Xe.format,qe=Xe.type;if(Qe!==nn&&Fe.convert(Qe)!==W.getParameter(W.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=qe===qs&&(Ce.has("EXT_color_buffer_half_float")||$e.isWebGL2&&Ce.has("EXT_color_buffer_float"));if(qe!==ui&&Fe.convert(qe)!==W.getParameter(W.IMPLEMENTATION_COLOR_READ_TYPE)&&!(qe===_n&&($e.isWebGL2||Ce.has("OES_texture_float")||Ce.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=R.width-K&&q>=0&&q<=R.height-Y&&W.readPixels(k,q,K,Y,Fe.convert(Qe),Fe.convert(qe),we)}finally{const Xe=w!==null?Ke.get(w).__webglFramebuffer:null;ze.bindFramebuffer(W.FRAMEBUFFER,Xe)}}},this.copyFramebufferToTexture=function(R,k,q=0){const K=Math.pow(2,-q),Y=Math.floor(k.image.width*K),we=Math.floor(k.image.height*K);ke.setTexture2D(k,0),W.copyTexSubImage2D(W.TEXTURE_2D,q,0,0,R.x,R.y,Y,we),ze.unbindTexture()},this.copyTextureToTexture=function(R,k,q,K=0){const Y=k.image.width,we=k.image.height,De=Fe.convert(q.format),He=Fe.convert(q.type);ke.setTexture2D(q,0),W.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,q.flipY),W.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),W.pixelStorei(W.UNPACK_ALIGNMENT,q.unpackAlignment),k.isDataTexture?W.texSubImage2D(W.TEXTURE_2D,K,R.x,R.y,Y,we,De,He,k.image.data):k.isCompressedTexture?W.compressedTexSubImage2D(W.TEXTURE_2D,K,R.x,R.y,k.mipmaps[0].width,k.mipmaps[0].height,De,k.mipmaps[0].data):W.texSubImage2D(W.TEXTURE_2D,K,R.x,R.y,De,He,k.image),K===0&&q.generateMipmaps&&W.generateMipmap(W.TEXTURE_2D),ze.unbindTexture()},this.copyTextureToTexture3D=function(R,k,q,K,Y=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const we=R.max.x-R.min.x+1,De=R.max.y-R.min.y+1,He=R.max.z-R.min.z+1,Xe=Fe.convert(K.format),Qe=Fe.convert(K.type);let qe;if(K.isData3DTexture)ke.setTexture3D(K,0),qe=W.TEXTURE_3D;else if(K.isDataArrayTexture)ke.setTexture2DArray(K,0),qe=W.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}W.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,K.flipY),W.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,K.premultiplyAlpha),W.pixelStorei(W.UNPACK_ALIGNMENT,K.unpackAlignment);const Ze=W.getParameter(W.UNPACK_ROW_LENGTH),vt=W.getParameter(W.UNPACK_IMAGE_HEIGHT),Vt=W.getParameter(W.UNPACK_SKIP_PIXELS),Ut=W.getParameter(W.UNPACK_SKIP_ROWS),an=W.getParameter(W.UNPACK_SKIP_IMAGES),ot=q.isCompressedTexture?q.mipmaps[0]:q.image;W.pixelStorei(W.UNPACK_ROW_LENGTH,ot.width),W.pixelStorei(W.UNPACK_IMAGE_HEIGHT,ot.height),W.pixelStorei(W.UNPACK_SKIP_PIXELS,R.min.x),W.pixelStorei(W.UNPACK_SKIP_ROWS,R.min.y),W.pixelStorei(W.UNPACK_SKIP_IMAGES,R.min.z),q.isDataTexture||q.isData3DTexture?W.texSubImage3D(qe,Y,k.x,k.y,k.z,we,De,He,Xe,Qe,ot.data):q.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),W.compressedTexSubImage3D(qe,Y,k.x,k.y,k.z,we,De,He,Xe,ot.data)):W.texSubImage3D(qe,Y,k.x,k.y,k.z,we,De,He,Xe,Qe,ot),W.pixelStorei(W.UNPACK_ROW_LENGTH,Ze),W.pixelStorei(W.UNPACK_IMAGE_HEIGHT,vt),W.pixelStorei(W.UNPACK_SKIP_PIXELS,Vt),W.pixelStorei(W.UNPACK_SKIP_ROWS,Ut),W.pixelStorei(W.UNPACK_SKIP_IMAGES,an),Y===0&&K.generateMipmaps&&W.generateMipmap(qe),ze.unbindTexture()},this.initTexture=function(R){R.isCubeTexture?ke.setTextureCube(R,0):R.isData3DTexture?ke.setTexture3D(R,0):R.isDataArrayTexture||R.isCompressedArrayTexture?ke.setTexture2DArray(R,0):ke.setTexture2D(R,0),ze.unbindTexture()},this.resetState=function(){b=0,E=0,w=null,ze.reset(),Ae.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ei}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Zl?"display-p3":"srgb",t.unpackColorSpace=dt.workingColorSpace===pa?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===zt?Wi:tf}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Wi?zt:sn}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 h0 extends Mf{}h0.prototype.isWebGL1Renderer=!0;class f0 extends Ot{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 d0{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ll,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Kn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.InterleavedBuffer: "updateRange" is deprecated and 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;il)continue;f.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(f);Ie.far||t.push({distance:I,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{const p=Math.max(0,o.start),y=Math.min(m.count,o.start+o.count);for(let v=p,x=y-1;vl)continue;f.applyMatrix4(this.matrixWorld);const E=e.ray.origin.distanceTo(f);Ee.far||t.push({distance:E,point:h.clone().applyMatrix4(this.matrixWorld),index:v,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,o=i.length;s0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class sc extends hi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new et(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 et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=nf,this.normalScale=new Ue(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 Ri extends sc{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 Ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Qt(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 et(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 et(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new et(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}}function Po(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 S0(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function w0(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 rh(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i}function Rf(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 o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}class no{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];n:{e:{let o;t:{i:if(!(e=s)){const a=t[1];e=s)break e}o=n,n=0;break t}break n}for(;n>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}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 o=null;for(let a=0;a!==s;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&S0(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Ra,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*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}}pi.prototype.TimeBufferType=Float32Array;pi.prototype.ValueBufferType=Float32Array;pi.prototype.DefaultInterpolation=as;class ps extends pi{}ps.prototype.ValueTypeName="bool";ps.prototype.ValueBufferType=Array;ps.prototype.DefaultInterpolation=$s;ps.prototype.InterpolantFactoryMethodLinear=void 0;ps.prototype.InterpolantFactoryMethodSmooth=void 0;class Cf extends pi{}Cf.prototype.ValueTypeName="color";class us extends pi{}us.prototype.ValueTypeName="number";class A0 extends no{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)di.slerpFlat(s,0,o,c-a,o,c,l);return s}}class mr extends pi{InterpolantFactoryMethodLinear(e){return new A0(this.times,this.values,this.getValueSize(),e)}}mr.prototype.ValueTypeName="quaternion";mr.prototype.DefaultInterpolation=as;mr.prototype.InterpolantFactoryMethodSmooth=void 0;class ms extends pi{}ms.prototype.ValueTypeName="string";ms.prototype.ValueBufferType=Array;ms.prototype.DefaultInterpolation=$s;ms.prototype.InterpolantFactoryMethodLinear=void 0;ms.prototype.InterpolantFactoryMethodSmooth=void 0;class hs extends pi{}hs.prototype.ValueTypeName="vector";class R0{constructor(e,t=-1,n,i=Fd){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Kn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(L0(n[o]).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,o=n.length;s!==o;++s)t.push(pi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a1){const h=u[1];let f=i[h];f||(i[h]=f=[]),f.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,f,d,_,g){if(d.length!==0){const m=[],p=[];Rf(d,m,p,_),m.length!==0&&g.push(new h(f,m,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h{t&&t(s),this.manager.itemEnd(e)},0),s;if(Si[e]!==void 0){Si[e].push({onLoad:t,onProgress:n,onError:i});return}Si[e]=[],Si[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=Si[e],h=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),d=f?parseInt(f):0,_=d!==0;let g=0;const m=new ReadableStream({start(p){y();function y(){h.read().then(({done:v,value:x})=>{if(v)p.close();else{g+=x.byteLength;const b=new ProgressEvent("progress",{lengthComputable:_,loaded:g,total:d});for(let E=0,w=u.length;E{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(_=>d.decode(_))}}}).then(c=>{fs.add(e,c);const u=Si[e];delete Si[e];for(let h=0,f=u.length;h{const u=Si[e];if(u===void 0)throw this.manager.itemError(e),c;delete Si[e];for(let h=0,f=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class N0 extends _s{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,o=fs.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Ks("img");function l(){u(),fs.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),i&&i(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class F0 extends _s{constructor(e){super(e)}load(e,t,n,i){const s=new rn,o=new N0(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class ga extends Ot{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new et(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}}const tl=new Ge,sh=new P,oh=new P;class oc{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ue(512,512),this.map=null,this.mapPass=null,this.matrix=new Ge,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ql,this._frameExtents=new Ue(1,1),this._viewportCount=1,this._viewports=[new pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;sh.setFromMatrixPosition(e.matrixWorld),t.position.copy(sh),oh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(oh),t.updateMatrixWorld(),tl.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(tl),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(tl)}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 O0 extends oc{constructor(){super(new mn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=ls*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 U0 extends ga{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ot.DEFAULT_UP),this.updateMatrix(),this.target=new Ot,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new O0}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 ah=new Ge,As=new P,nl=new P;class B0 extends oc{constructor(){super(new mn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ue(4,2),this._viewportCount=6,this._viewports=[new pt(2,1,1,1),new pt(0,1,1,1),new pt(3,1,1,1),new pt(1,1,1,1),new pt(3,0,1,1),new pt(1,0,1,1)],this._cubeDirections=[new P(1,0,0),new P(-1,0,0),new P(0,0,1),new P(0,0,-1),new P(0,1,0),new P(0,-1,0)],this._cubeUps=[new P(0,1,0),new P(0,1,0),new P(0,1,0),new P(0,1,0),new P(0,0,1),new P(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()),As.setFromMatrixPosition(e.matrixWorld),n.position.copy(As),nl.copy(n.position),nl.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(nl),n.updateMatrixWorld(),i.makeTranslation(-As.x,-As.y,-As.z),ah.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ah)}}class z0 extends ga{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 B0}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 k0 extends oc{constructor(){super(new to(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Pf extends ga{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ot.DEFAULT_UP),this.updateMatrix(),this.target=new Ot,this.shadow=new k0}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class H0 extends ga{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ws{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n"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,o=fs.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){fs.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}const ac="\\[\\]\\.:\\/",G0=new RegExp("["+ac+"]","g"),lc="[^"+ac+"]",W0="[^"+ac.replace("\\.","")+"]",X0=/((?:WC+[\/:])*)/.source.replace("WC",lc),j0=/(WCOD+)?/.source.replace("WCOD",W0),q0=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",lc),Y0=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",lc),$0=new RegExp("^"+X0+j0+q0+Y0+"$"),K0=["material","materials","bones","map"];class Z0{constructor(e,t,n){const i=n||gt.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 gt{constructor(e,t,n){this.path=t,this.parsedPath=n||gt.parseTrackName(t),this.node=gt.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 gt.Composite(e,t,n):new gt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(G0,"")}static parseTrackName(e){const t=$0.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);K0.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 o=0;oMath.PI&&(ge-=Me),ae<-Math.PI?ae+=Me:ae>Math.PI&&(ae-=Me),ge<=ae?a.theta=Math.max(ge,Math.min(ae,a.theta)):a.theta=a.theta>(ge+ae)/2?Math.max(ge,a.theta):Math.min(ae,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor),n.zoomToCursor&&E||n.object.isOrthographicCamera?a.radius=ie(a.radius):a.radius=ie(a.radius*c),N.setFromSpherical(a),N.applyQuaternion(ne),F.copy(n.target).add(N),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),u.set(0,0,0));let ee=!1;if(n.zoomToCursor&&E){let he=null;if(n.object.isPerspectiveCamera){const Re=N.length();he=ie(Re*c);const tt=Re-he;n.object.position.addScaledVector(x,tt),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const Re=new P(b.x,b.y,0);Re.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),n.object.updateProjectionMatrix(),ee=!0;const tt=new P(b.x,b.y,0);tt.unproject(n.object),n.object.position.sub(tt).add(Re),n.object.updateMatrixWorld(),he=N.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;he!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(he).add(n.object.position):(Io.origin.copy(n.object.position),Io.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Io.direction))o||8*(1-Ae.dot(n.object.quaternion))>o||Le.distanceToSquared(n.target)>0?(n.dispatchEvent(uh),Fe.copy(n.object.position),Ae.copy(n.object.quaternion),Le.copy(n.target),!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",re),n.domElement.removeEventListener("pointerdown",Ke),n.domElement.removeEventListener("pointercancel",st),n.domElement.removeEventListener("wheel",L),n.domElement.removeEventListener("pointermove",ke),n.domElement.removeEventListener("pointerup",st),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",M),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=i.NONE;const o=1e-6,a=new lh,l=new lh;let c=1;const u=new P,h=new Ue,f=new Ue,d=new Ue,_=new Ue,g=new Ue,m=new Ue,p=new Ue,y=new Ue,v=new Ue,x=new P,b=new Ue;let E=!1;const w=[],I={};function S(N){return N!==null?2*Math.PI/60*n.autoRotateSpeed*N:2*Math.PI/60/60*n.autoRotateSpeed}function A(){return Math.pow(.95,n.zoomSpeed)}function z(N){l.theta-=N}function O(N){l.phi-=N}const G=function(){const N=new P;return function(ne,Fe){N.setFromMatrixColumn(Fe,0),N.multiplyScalar(-ne),u.add(N)}}(),D=function(){const N=new P;return function(ne,Fe){n.screenSpacePanning===!0?N.setFromMatrixColumn(Fe,1):(N.setFromMatrixColumn(Fe,0),N.crossVectors(n.object.up,N)),N.multiplyScalar(ne),u.add(N)}}(),H=function(){const N=new P;return function(ne,Fe){const Ae=n.domElement;if(n.object.isPerspectiveCamera){const Le=n.object.position;N.copy(Le).sub(n.target);let Me=N.length();Me*=Math.tan(n.object.fov/2*Math.PI/180),G(2*ne*Me/Ae.clientHeight,n.object.matrix),D(2*Fe*Me/Ae.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(G(ne*(n.object.right-n.object.left)/n.object.zoom/Ae.clientWidth,n.object.matrix),D(Fe*(n.object.top-n.object.bottom)/n.object.zoom/Ae.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Z(N){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=N:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function J(N){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=N:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ce(N){if(!n.zoomToCursor)return;E=!0;const de=n.domElement.getBoundingClientRect(),ne=N.clientX-de.left,Fe=N.clientY-de.top,Ae=de.width,Le=de.height;b.x=ne/Ae*2-1,b.y=-(Fe/Le)*2+1,x.set(b.x,b.y,1).unproject(n.object).sub(n.object.position).normalize()}function ie(N){return Math.max(n.minDistance,Math.min(n.maxDistance,N))}function se(N){h.set(N.clientX,N.clientY)}function me(N){ce(N),p.set(N.clientX,N.clientY)}function ve(N){_.set(N.clientX,N.clientY)}function Q(N){f.set(N.clientX,N.clientY),d.subVectors(f,h).multiplyScalar(n.rotateSpeed);const de=n.domElement;z(2*Math.PI*d.x/de.clientHeight),O(2*Math.PI*d.y/de.clientHeight),h.copy(f),n.update()}function oe(N){y.set(N.clientX,N.clientY),v.subVectors(y,p),v.y>0?Z(A()):v.y<0&&J(A()),p.copy(y),n.update()}function Se(N){g.set(N.clientX,N.clientY),m.subVectors(g,_).multiplyScalar(n.panSpeed),H(m.x,m.y),_.copy(g),n.update()}function Pe(N){ce(N),N.deltaY<0?J(A()):N.deltaY>0&&Z(A()),n.update()}function _e(N){let de=!1;switch(N.code){case n.keys.UP:N.ctrlKey||N.metaKey||N.shiftKey?O(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):H(0,n.keyPanSpeed),de=!0;break;case n.keys.BOTTOM:N.ctrlKey||N.metaKey||N.shiftKey?O(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):H(0,-n.keyPanSpeed),de=!0;break;case n.keys.LEFT:N.ctrlKey||N.metaKey||N.shiftKey?z(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):H(n.keyPanSpeed,0),de=!0;break;case n.keys.RIGHT:N.ctrlKey||N.metaKey||N.shiftKey?z(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):H(-n.keyPanSpeed,0),de=!0;break}de&&(N.preventDefault(),n.update())}function je(){if(w.length===1)h.set(w[0].pageX,w[0].pageY);else{const N=.5*(w[0].pageX+w[1].pageX),de=.5*(w[0].pageY+w[1].pageY);h.set(N,de)}}function We(){if(w.length===1)_.set(w[0].pageX,w[0].pageY);else{const N=.5*(w[0].pageX+w[1].pageX),de=.5*(w[0].pageY+w[1].pageY);_.set(N,de)}}function Ne(){const N=w[0].pageX-w[1].pageX,de=w[0].pageY-w[1].pageY,ne=Math.sqrt(N*N+de*de);p.set(0,ne)}function Ye(){n.enableZoom&&Ne(),n.enablePan&&We()}function W(){n.enableZoom&&Ne(),n.enableRotate&&je()}function Rt(N){if(w.length==1)f.set(N.pageX,N.pageY);else{const ne=ye(N),Fe=.5*(N.pageX+ne.x),Ae=.5*(N.pageY+ne.y);f.set(Fe,Ae)}d.subVectors(f,h).multiplyScalar(n.rotateSpeed);const de=n.domElement;z(2*Math.PI*d.x/de.clientHeight),O(2*Math.PI*d.y/de.clientHeight),h.copy(f)}function Ce(N){if(w.length===1)g.set(N.pageX,N.pageY);else{const de=ye(N),ne=.5*(N.pageX+de.x),Fe=.5*(N.pageY+de.y);g.set(ne,Fe)}m.subVectors(g,_).multiplyScalar(n.panSpeed),H(m.x,m.y),_.copy(g)}function $e(N){const de=ye(N),ne=N.pageX-de.x,Fe=N.pageY-de.y,Ae=Math.sqrt(ne*ne+Fe*Fe);y.set(0,Ae),v.set(0,Math.pow(y.y/p.y,n.zoomSpeed)),Z(v.y),p.copy(y)}function ze(N){n.enableZoom&&$e(N),n.enablePan&&Ce(N)}function mt(N){n.enableZoom&&$e(N),n.enableRotate&&Rt(N)}function Ke(N){n.enabled!==!1&&(w.length===0&&(n.domElement.setPointerCapture(N.pointerId),n.domElement.addEventListener("pointermove",ke),n.domElement.addEventListener("pointerup",st)),fe(N),N.pointerType==="touch"?X(N):Et(N))}function ke(N){n.enabled!==!1&&(N.pointerType==="touch"?le(N):Ct(N))}function st(N){Ee(N),w.length===0&&(n.domElement.releasePointerCapture(N.pointerId),n.domElement.removeEventListener("pointermove",ke),n.domElement.removeEventListener("pointerup",st)),n.dispatchEvent(hh),s=i.NONE}function Et(N){let de;switch(N.button){case 0:de=n.mouseButtons.LEFT;break;case 1:de=n.mouseButtons.MIDDLE;break;case 2:de=n.mouseButtons.RIGHT;break;default:de=-1}switch(de){case Sr.DOLLY:if(n.enableZoom===!1)return;me(N),s=i.DOLLY;break;case Sr.ROTATE:if(N.ctrlKey||N.metaKey||N.shiftKey){if(n.enablePan===!1)return;ve(N),s=i.PAN}else{if(n.enableRotate===!1)return;se(N),s=i.ROTATE}break;case Sr.PAN:if(N.ctrlKey||N.metaKey||N.shiftKey){if(n.enableRotate===!1)return;se(N),s=i.ROTATE}else{if(n.enablePan===!1)return;ve(N),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&n.dispatchEvent(il)}function Ct(N){switch(s){case i.ROTATE:if(n.enableRotate===!1)return;Q(N);break;case i.DOLLY:if(n.enableZoom===!1)return;oe(N);break;case i.PAN:if(n.enablePan===!1)return;Se(N);break}}function L(N){n.enabled===!1||n.enableZoom===!1||s!==i.NONE||(N.preventDefault(),n.dispatchEvent(il),Pe(N),n.dispatchEvent(hh))}function M(N){n.enabled===!1||n.enablePan===!1||_e(N)}function X(N){switch(pe(N),w.length){case 1:switch(n.touches.ONE){case wr.ROTATE:if(n.enableRotate===!1)return;je(),s=i.TOUCH_ROTATE;break;case wr.PAN:if(n.enablePan===!1)return;We(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(n.touches.TWO){case wr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ye(),s=i.TOUCH_DOLLY_PAN;break;case wr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;W(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&n.dispatchEvent(il)}function le(N){switch(pe(N),s){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;Rt(N),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;Ce(N),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;ze(N),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;mt(N),n.update();break;default:s=i.NONE}}function re(N){n.enabled!==!1&&N.preventDefault()}function fe(N){w.push(N)}function Ee(N){delete I[N.pointerId];for(let de=0;de=2.0 are supported."));return}const c=new Fx(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function rx(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const at={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class sx{constructor(e){this.parser=e,this.name=at.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class vx{constructor(e){this.parser=e,this.name=at.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class xx{constructor(e){this.parser=e,this.name=at.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class yx{constructor(e){this.name=at.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,u=i.count,h=i.byteStride,f=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,h,f,i.mode,i.filter).then(function(d){return d.buffer}):o.ready.then(function(){const d=new ArrayBuffer(u*h);return o.decodeGltfBuffer(new Uint8Array(d),u,h,f,i.mode,i.filter),d})})}else return null}}class bx{constructor(e){this.name=at.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const c of i.primitives)if(c.mode!==Bn.TRIANGLES&&c.mode!==Bn.TRIANGLE_STRIP&&c.mode!==Bn.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=n.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),h=u.isGroup?u.children:[u],f=c[0].count,d=[];for(const _ of h){const g=new Ge,m=new P,p=new di,y=new P(1,1,1),v=new v0(_.geometry,_.material,f);for(let x=0;x0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Nx=new Ge;class Fx{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new rx,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,s=-1;typeof navigator<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&s<98?this.textureLoader=new F0(this.options.manager):this.textureLoader=new V0(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Lf(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:n,userData:{}};return er(s,a,i),Bi(a,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())s(u,a.children[c])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&m.setY(S,E[w*l+1]),l>=3&&m.setZ(S,E[w*l+2]),l>=4&&m.setW(S,E[w*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=n.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const f=(s.samplers||{})[o.sampler]||{};return u.magFilter=_h[f.magFilter]||bn,u.minFilter=_h[f.minFilter]||pr,u.wrapS=gh[f.wrapS]||ss,u.wrapT=gh[f.wrapT]||ss,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=n.getDependency("bufferView",o.bufferView).then(function(h){c=!0;const f=new Blob([h],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(h){return new Promise(function(f,d){let _=f;t.isImageBitmapLoader===!0&&(_=function(g){const m=new rn(g);m.needsUpdate=!0,f(m)}),t.load(Ws.resolveURL(h,s.path),_,void 0,d)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),h.userData.mimeType=o.mimeType||Ix(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=u,u}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),s.extensions[at.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[at.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[at.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new Af,hi.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new Tf,hi.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(i||s||o){let a="ClonedMaterial:"+n.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return sc}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[at.KHR_MATERIALS_UNLIT]){const h=i[at.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{const h=s.pbrMetallicRoughness||{};if(a.color=new et(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const f=h.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],sn),a.opacity=f[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,zt)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=$n);const u=s.alphaMode||sl.OPAQUE;if(u===sl.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===sl.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==ki&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ue(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;a.normalScale.set(h,h)}if(s.occlusionTexture!==void 0&&o!==ki&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==ki){const h=s.emissiveFactor;a.emissive=new et().setRGB(h[0],h[1],h[2],sn)}return s.emissiveTexture!==void 0&&o!==ki&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,zt)),Promise.all(c).then(function(){const h=new o(a);return s.name&&(h.name=s.name),Bi(h,s),t.associations.set(h,{materials:e}),s.extensions&&er(i,h,s),h})}createUniqueName(e){const t=gt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(a){return n[at.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return vh(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Px(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),Bi(p,s),m.extensions&&er(i,p,m),t.assignFinalMaterial(p),h.push(p)}for(let d=0,_=h.length;d<_;d++)t.associations.set(h[d],{meshes:e,primitives:d});if(h.length===1)return s.extensions&&er(i,h[0],s),h[0];const f=new ur;s.extensions&&er(i,f,s),t.associations.set(f,{meshes:e});for(let d=0,_=h.length;d<_;d++)f.add(h[d]);return f})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new mn(sf.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new to(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Bi(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i1?u=new ur:c.length===1?u=c[0]:u=new Ot,u!==c[0])for(let h=0,f=c.length;h{const h=new Map;for(const[f,d]of i.associations)(f instanceof hi||f instanceof rn)&&h.set(f,d);return u.traverse(f=>{const d=i.associations.get(f);d!=null&&h.set(f,d)}),h};return i.associations=c(s),s})}_createAnimationTracks(e,t,n,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];Oi[s.path]===Oi.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let c;switch(Oi[s.path]){case Oi.weights:c=us;break;case Oi.rotation:c=mr;break;case Oi.position:case Oi.scale:c=hs;break;default:switch(n.itemSize){case 1:c=us;break;case 2:case 3:default:c=hs;break}break}const u=i.interpolation!==void 0?Rx[i.interpolation]:as,h=this._getArrayFromAccessor(n);for(let f=0,d=l.length;fl+1e3&&(u.update(1e3*c/(d-l),100),l=d,c=0,f)){var _=performance.memory;f.update(_.usedJSHeapSize/1048576,_.jsHeapSizeLimit/1048576)}return d},update:function(){a=this.end()},domElement:o,setMode:i}};return t.Panel=function(n,i,s){var o=1/0,a=0,l=Math.round,c=l(window.devicePixelRatio||1),u=80*c,h=48*c,f=3*c,d=2*c,_=3*c,g=15*c,m=74*c,p=30*c,y=document.createElement("canvas");y.width=u,y.height=h,y.style.cssText="width:80px;height:48px";var v=y.getContext("2d");return v.font="bold "+9*c+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=s,v.fillRect(0,0,u,h),v.fillStyle=i,v.fillText(n,f,d),v.fillRect(_,g,m,p),v.fillStyle=s,v.globalAlpha=.9,v.fillRect(_,g,m,p),{dom:y,update:function(x,b){o=Math.min(o,x),a=Math.max(a,x),v.fillStyle=s,v.globalAlpha=1,v.fillRect(0,0,u,g),v.fillStyle=i,v.fillText(l(x)+" "+n+" ("+l(o)+"-"+l(a)+")",f,d),v.drawImage(y,_+c,g,m-c,p,_,g,m-c,p),v.fillRect(_+m-c,g,c,p),v.fillStyle=s,v.globalAlpha=.9,v.fillRect(_+m-c,g,c,l((1-x/b)*p))}}},t})})(Nf);var Bx=Nf.exports;const zx=Ux(Bx),Ff=0,kx=1,Of=2,xh=2,al=1.25,yh=1,dr=6*4+4+4,va=65535,Hx=Math.pow(2,-24),ll=Symbol("SKIP_GENERATION");function Uf(r){return r.index?r.index.count:r.attributes.position.count}function gs(r){return Uf(r)/3}function Bf(r,e=ArrayBuffer){return r>65535?new Uint32Array(new e(4*r)):new Uint16Array(new e(2*r))}function Vx(r,e){if(!r.index){const t=r.attributes.position.count,n=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Bf(t,n);r.setIndex(new jt(i,1));for(let s=0;sa-l);for(let a=0;as.offset-o.offset),n=t[t.length-1];n.count=Math.min(e-n.offset,n.count);let i=0;return t.forEach(({count:s})=>i+=s),e!==i}function Ft(r,e,t){return t.min.x=e[r],t.min.y=e[r+1],t.min.z=e[r+2],t.max.x=e[r+3],t.max.y=e[r+4],t.max.z=e[r+5],t}function Wx(r){r[0]=r[1]=r[2]=1/0,r[3]=r[4]=r[5]=-1/0}function bh(r){let e=-1,t=-1/0;for(let n=0;n<3;n++){const i=r[n+3]-r[n];i>t&&(t=i,e=n)}return e}function Sh(r,e){e.set(r)}function wh(r,e,t){let n,i;for(let s=0;s<3;s++){const o=s+3;n=r[s],i=e[s],t[s]=ni?n:i}}function No(r,e,t){for(let n=0;n<3;n++){const i=e[r+2*n],s=e[r+2*n+1],o=i-s,a=i+s;ot[n+3]&&(t[n+3]=a)}}function Cs(r){const e=r[3]-r[0],t=r[4]-r[1],n=r[5]-r[2];return 2*(e*t+t*n+n*e)}function cl(r,e,t,n,i=null){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0,h=1/0,f=1/0,d=1/0,_=-1/0,g=-1/0,m=-1/0;const p=i!==null;for(let y=e*6,v=(e+t)*6;yl&&(l=w),p&&x_&&(_=x);const I=r[y+2],S=r[y+3],A=I-S,z=I+S;Ac&&(c=z),p&&Ig&&(g=I);const O=r[y+4],G=r[y+5],D=O-G,H=O+G;Du&&(u=H),p&&Om&&(m=O)}n[0]=s,n[1]=o,n[2]=a,n[3]=l,n[4]=c,n[5]=u,p&&(i[0]=h,i[1]=f,i[2]=d,i[3]=_,i[4]=g,i[5]=m)}function Xx(r,e,t,n){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let u=e*6,h=(e+t)*6;ua&&(a=f);const d=r[u+2];dl&&(l=d);const _=r[u+4];_c&&(c=_)}n[0]=i,n[1]=s,n[2]=o,n[3]=a,n[4]=l,n[5]=c}function jx(r,e){Wx(e);const t=r.attributes.position,n=r.index?r.index.array:null,i=gs(r),s=new Float32Array(i*6),o=t.normalized,a=t.array,l=t.offset||0;let c=3;t.isInterleavedBufferAttribute&&(c=t.data.stride);const u=["getX","getY","getZ"];for(let h=0;hE&&(E=v),x>E&&(E=x);const w=(E-b)/2,I=p*2;s[d+I+0]=b+w,s[d+I+1]=w+(Math.abs(b)+w)*Hx,be[p+3]&&(e[p+3]=E)}}return s}const Mi=32,qx=(r,e)=>r.candidate-e.candidate,Ui=new Array(Mi).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Fo=new Float32Array(6);function Yx(r,e,t,n,i,s){let o=-1,a=0;if(s===Ff)o=bh(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===kx)o=bh(r),o!==-1&&(a=$x(t,n,i,o));else if(s===Of){const l=Cs(r);let c=al*i;const u=n*6,h=(n+i)*6;for(let f=0;f<3;f++){const d=e[f],m=(e[f+3]-d)/Mi;if(i=w.candidate?No(x,t,w.rightCacheBounds):(No(x,t,w.leftCacheBounds),w.count++)}}for(let x=0;x=Mi&&(E=Mi-1);const w=Ui[E];w.count++,No(v,t,w.bounds)}const p=Ui[Mi-1];Sh(p.bounds,p.rightCacheBounds);for(let v=Mi-2;v>=0;v--){const x=Ui[v],b=Ui[v+1];wh(x.bounds,b.rightCacheBounds,x.rightCacheBounds)}let y=0;for(let v=0;v=l;)a--;if(o=l;)a--;if(o2**16,i=n?4:2,s=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),o=n?new Uint32Array(s):new Uint16Array(s);for(let a=0,l=o.length;a=i&&(h=!0,s&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),E<=o||I>=i)return y(b+E),x.offset=b,x.count=E,x;const S=Yx(x.boundingData,w,_,b,E,a);if(S.axis===-1)return y(b+E),x.offset=b,x.count=E,x;const A=g(u,n,_,b,E,S);if(A===b||A===b+E)y(b+E),x.offset=b,x.count=E;else{x.splitAxis=S.axis;const z=new Oo,O=b,G=A-b;x.left=z,z.boundingData=new Float32Array(6),cl(_,O,G,z.boundingData,d),v(z,O,G,d,I+1);const D=new Oo,H=A,Z=E-G;x.right=D,D.boundingData=new Float32Array(6),cl(_,H,Z,D.boundingData,d),v(D,H,Z,d,I+1)}return x}}function ey(r,e){const t=r.geometry;e.indirect&&(r._indirectBuffer=Jx(t,e.useSharedArrayBuffer),Gx(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),r._indirectBuffer||Vx(t,e);const n=Qx(r,e);let i,s,o;const a=[],l=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let h=0;hMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return s[d+6]=x/4,x=u(x,y),s[d+7]=v,x}}}class Ai{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let n=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=n,this.max=i}setFromPoints(e,t){let n=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=n,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}Ai.prototype.setFromBox=function(){const r=new P;return function(t,n){const i=n.min,s=n.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){r.x=i.x*l+s.x*(1-l),r.y=i.y*c+s.y*(1-c),r.z=i.z*u+s.z*(1-u);const h=t.dot(r);o=Math.min(h,o),a=Math.max(h,a)}this.min=o,this.max=a}}();const ty=function(){const r=new P,e=new P,t=new P;return function(i,s,o){const a=i.start,l=r,c=s.start,u=e;t.subVectors(a,c),r.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const h=t.dot(u),f=u.dot(l),d=u.dot(u),_=t.dot(l),m=l.dot(l)*d-f*f;let p,y;m!==0?p=(h*f-_*d)/m:p=0,y=(h+p*f)/d,o.x=p,o.y=y}}(),cc=function(){const r=new Ue,e=new P,t=new P;return function(i,s,o,a){ty(i,s,r);let l=r.x,c=r.y;if(l>=0&&l<=1&&c>=0&&c<=1){i.at(l,o),s.at(c,a);return}else if(l>=0&&l<=1){c<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(c>=0&&c<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let u;l<0?u=i.start:u=i.end;let h;c<0?h=s.start:h=s.end;const f=e,d=t;if(i.closestPointToPoint(h,!0,e),s.closestPointToPoint(u,!0,t),f.distanceToSquared(h)<=d.distanceToSquared(u)){o.copy(f),a.copy(h);return}else{o.copy(u),a.copy(d);return}}}}(),ny=function(){const r=new P,e=new P,t=new ai,n=new Ti;return function(s,o){const{radius:a,center:l}=s,{a:c,b:u,c:h}=o;if(n.start=c,n.end=u,n.closestPointToPoint(l,!0,r).distanceTo(l)<=a||(n.start=c,n.end=h,n.closestPointToPoint(l,!0,r).distanceTo(l)<=a)||(n.start=u,n.end=h,n.closestPointToPoint(l,!0,r).distanceTo(l)<=a))return!0;const g=o.getPlane(t);if(Math.abs(g.distanceToPoint(l))<=a){const p=g.projectPoint(l,e);if(o.containsPoint(p))return!0}return!1}}(),iy=1e-15;function ul(r){return Math.abs(r)new P),this.satBounds=new Array(4).fill().map(()=>new Ai),this.points=[this.a,this.b,this.c],this.sphere=new ei,this.plane=new ai,this.needsUpdate=!0}intersectsSphere(e){return ny(e,this)}update(){const e=this.a,t=this.b,n=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const c=s[1],u=o[1];c.subVectors(e,t),u.setFromPoints(c,i);const h=s[2],f=o[2];h.subVectors(t,n),f.setFromPoints(h,i);const d=s[3],_=o[3];d.subVectors(n,e),_.setFromPoints(d,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}Qn.prototype.closestPointToSegment=function(){const r=new P,e=new P,t=new Ti;return function(i,s=null,o=null){const{start:a,end:l}=i,c=this.points;let u,h=1/0;for(let f=0;f<3;f++){const d=(f+1)%3;t.start.copy(c[f]),t.end.copy(c[d]),cc(t,i,r,e),u=r.distanceToSquared(e),u=2){(x===1?p.start:p.end).copy(d),v=2;break}if(v++,v===2&&x===-1)break}}return v}return function(m,p=null,y=!1){this.needsUpdate&&this.update(),m.isExtendedTriangle?m.needsUpdate&&m.update():(r.copy(m),r.update(),m=r);const v=this.plane,x=m.plane;if(Math.abs(v.normal.dot(x.normal))>1-1e-10){const b=this.satBounds,E=this.satAxes;t[0]=m.a,t[1]=m.b,t[2]=m.c;for(let S=0;S<4;S++){const A=b[S],z=E[S];if(n.setFromPoints(z,t),A.isSeparated(n))return!1}const w=m.satBounds,I=m.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let S=0;S<4;S++){const A=w[S],z=I[S];if(n.setFromPoints(z,e),A.isSeparated(n))return!1}for(let S=0;S<4;S++){const A=E[S];for(let z=0;z<4;z++){const O=I[z];if(s.crossVectors(A,O),n.setFromPoints(s,e),i.setFromPoints(s,t),n.isSeparated(i))return!1}}return p&&(y||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{const b=_(this,x,h);if(b===1&&m.containsPoint(h.end))return p&&(p.start.copy(h.end),p.end.copy(h.end)),!0;if(b!==2)return!1;const E=_(m,v,f);if(E===1&&this.containsPoint(f.end))return p&&(p.start.copy(f.end),p.end.copy(f.end)),!0;if(E!==2)return!1;if(h.delta(a),f.delta(l),a.dot(l)<0){let G=f.start;f.start=f.end,f.end=G}const w=h.start.dot(a),I=h.end.dot(a),S=f.start.dot(a),A=f.end.dot(a),z=I0?p.start.copy(h.start):p.start.copy(f.start),c.subVectors(h.end,f.end),c.dot(a)<0?p.end.copy(h.end):p.end.copy(f.end)),!0)}}}();Qn.prototype.distanceToPoint=function(){const r=new P;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();Qn.prototype.distanceToTriangle=function(){const r=new P,e=new P,t=["a","b","c"],n=new Ti,i=new Ti;return function(o,a=null,l=null){const c=a||l?n:null;if(this.intersectsTriangle(o,c))return(a||l)&&(a&&c.getCenter(a),l&&c.getCenter(l)),0;let u=1/0;for(let h=0;h<3;h++){let f;const d=t[h],_=o[d];this.closestPointToPoint(_,r),f=_.distanceToSquared(r),fnew P),this.satAxes=new Array(3).fill().map(()=>new P),this.satBounds=new Array(3).fill().map(()=>new Ai),this.alignedSatBounds=new Array(3).fill().map(()=>new Ai),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),n&&this.matrix.copy(n)}set(e,t,n){this.min.copy(e),this.max.copy(t),this.matrix.copy(n),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}xn.prototype.update=function(){return function(){const e=this.matrix,t=this.min,n=this.max,i=this.points;for(let c=0;c<=1;c++)for(let u=0;u<=1;u++)for(let h=0;h<=1;h++){const f=1*c|2*u|4*h,d=i[f];d.x=c?n.x:t.x,d.y=u?n.y:t.y,d.z=h?n.z:t.z,d.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let c=0;c<3;c++){const u=o[c],h=s[c],f=1<new Ti),t=new Array(12).fill().map(()=>new Ti),n=new P,i=new P;return function(o,a=0,l=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||c)&&(o.getCenter(i),this.closestPointToPoint(i,n),o.closestPointToPoint(n,i),l&&l.copy(n),c&&c.copy(i)),0;const u=a*a,h=o.min,f=o.max,d=this.points;let _=1/0;for(let m=0;m<8;m++){const p=d[m];i.copy(p).clamp(h,f);const y=p.distanceToSquared(i);if(y<_&&(_=y,l&&l.copy(p),c&&c.copy(i),ynew Qn)}}const Hn=new ry;function wn(r,e){return e[r+15]===65535}function En(r,e){return e[r+6]}function Dn(r,e){return e[r+14]}function Vn(r){return r+8}function In(r,e){return e[r+6]}function hc(r,e){return e[r+7]}class sy{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=n=>{t&&e.push(t),t=n,this.float32Array=new Float32Array(n),this.uint16Array=new Uint16Array(n),this.uint32Array=new Uint32Array(n)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const At=new sy;let Hi,Qr;const Hr=[],Uo=new uc(()=>new kt);function oy(r,e,t,n,i,s){Hi=Uo.getPrimitive(),Qr=Uo.getPrimitive(),Hr.push(Hi,Qr),At.setBuffer(r._roots[e]);const o=zl(0,r.geometry,t,n,i,s);At.clearBuffer(),Uo.releasePrimitive(Hi),Uo.releasePrimitive(Qr),Hr.pop(),Hr.pop();const a=Hr.length;return a>0&&(Qr=Hr[a-1],Hi=Hr[a-2]),o}function zl(r,e,t,n,i=null,s=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:c}=At;let u=r*2;if(wn(u,l)){const _=En(r,c),g=Dn(u,l);return Ft(r,a,Hi),n(_,g,!1,o,s+r,Hi)}else{let O=function(D){const{uint16Array:H,uint32Array:Z}=At;let J=D*2;for(;!wn(J,H);)D=Vn(D),J=D*2;return En(D,Z)},G=function(D){const{uint16Array:H,uint32Array:Z}=At;let J=D*2;for(;!wn(J,H);)D=In(D,Z),J=D*2;return En(D,Z)+Dn(J,H)};var f=O,d=G;const _=Vn(r),g=In(r,c);let m=_,p=g,y,v,x,b;if(i&&(x=Hi,b=Qr,Ft(m,a,x),Ft(p,a,b),y=i(x),v=i(b),v(Ls.copy(e).clamp(u.min,u.max),Ls.distanceToSquared(e)),intersectsBounds:(u,h,f)=>f{u.closestPointToPoint(e,Ls);const f=e.distanceToSquared(Ls);return f0&&c.normal.multiplyScalar(-1));const u={a:s,b:o,c:a,normal:new P,materialIndex:0};un.getNormal(Vr,Gr,Wr,u.normal),c.face=u,c.faceIndex=s}return c}function xa(r,e,t,n,i){const s=n*3;let o=s+0,a=s+1,l=s+2;const c=r.index;r.index&&(o=c.getX(o),a=c.getX(a),l=c.getX(l));const{position:u,normal:h,uv:f,uv1:d}=r.attributes,_=cy(t,u,h,f,d,o,a,l,e);return _?(_.faceIndex=n,i&&i.push(_),_):null}function Xt(r,e,t,n){const i=r.a,s=r.b,o=r.c;let a=e,l=e+1,c=e+2;t&&(a=t.getX(a),l=t.getX(l),c=t.getX(c)),i.x=n.getX(a),i.y=n.getY(a),i.z=n.getZ(a),s.x=n.getX(l),s.y=n.getY(l),s.z=n.getZ(l),o.x=n.getX(c),o.y=n.getY(c),o.z=n.getZ(c)}function uy(r,e,t,n,i,s){const{geometry:o,_indirectBuffer:a}=r;for(let l=n,c=n+i;lE&&(E=O),Gw&&(w=G),DI&&(I=D)}return l[f+0]!==v||l[f+1]!==x||l[f+2]!==b||l[f+3]!==E||l[f+4]!==w||l[f+5]!==I?(l[f+0]=v,l[f+1]=x,l[f+2]=b,l[f+3]=E,l[f+4]=w,l[f+5]=I,!0):!1}else{const p=f+8,y=o[f+6],v=p+d,x=y+d;let b=_,E=!1,w=!1;e?b||(E=e.has(v),w=e.has(x),b=!E&&!w):(E=!0,w=!0);const I=b||E,S=b||w;let A=!1;I&&(A=h(p,d,b));let z=!1;S&&(z=h(y,d,b));const O=A||z;if(O)for(let G=0;G<3;G++){const D=p+G,H=y+G,Z=l[D],J=l[D+3],ce=l[H],ie=l[H+3];l[f+G]=Zie?J:ie}return O}}}const Ah=new kt;function qi(r,e,t,n){return Ft(r,e,Ah),t.intersectBox(Ah,n)}function py(r,e,t,n,i,s){const{geometry:o,_indirectBuffer:a}=r;for(let l=n,c=n+i;l=0;let d,_;f?(d=Vn(r),_=In(r,o)):(d=In(r,o),_=Vn(r));const m=qi(d,i,n,Ch)?Hl(d,e,t,n):null;if(m){const v=m.point[u];if(f?v<=i[_+c]:v>=i[_+c+3])return m}const y=qi(_,i,n,Ch)?Hl(_,e,t,n):null;return m&&y?m.distance<=y.distance?m:y:m||y||null}}const Vo=new kt,Xr=new Qn,jr=new Qn,Ps=new Ge,Lh=new xn,Go=new xn;function yy(r,e,t,n){At.setBuffer(r._roots[e]);const i=Vl(0,r,t,n);return At.clearBuffer(),i}function Vl(r,e,t,n,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=At;let l=r*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Lh.set(t.boundingBox.min,t.boundingBox.max,n),i=Lh),wn(l,o)){const u=e.geometry,h=u.index,f=u.attributes.position,d=t.index,_=t.attributes.position,g=En(r,a),m=Dn(l,o);if(Ps.copy(n).invert(),t.boundsTree)return Ft(r,s,Go),Go.matrix.copy(Ps),Go.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:y=>Go.intersectsBox(y),intersectsTriangle:y=>{y.a.applyMatrix4(n),y.b.applyMatrix4(n),y.c.applyMatrix4(n),y.needsUpdate=!0;for(let v=g*3,x=(m+g)*3;vfl.distanceToBox(b),intersectsBounds:(b,E,w)=>w{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:I=>Ds.distanceToBox(I),intersectsBounds:(I,S,A)=>A{for(let A=I,z=I+S;AE&&(E=D),Hw&&(w=H),ZI&&(I=Z)}}return l[f+0]!==v||l[f+1]!==x||l[f+2]!==b||l[f+3]!==E||l[f+4]!==w||l[f+5]!==I?(l[f+0]=v,l[f+1]=x,l[f+2]=b,l[f+3]=E,l[f+4]=w,l[f+5]=I,!0):!1}else{const p=f+8,y=o[f+6],v=p+d,x=y+d;let b=_,E=!1,w=!1;e?b||(E=e.has(v),w=e.has(x),b=!E&&!w):(E=!0,w=!0);const I=b||E,S=b||w;let A=!1;I&&(A=h(p,d,b));let z=!1;S&&(z=h(y,d,b));const O=A||z;if(O)for(let G=0;G<3;G++){const D=p+G,H=y+G,Z=l[D],J=l[D+3],ce=l[H],ie=l[H+3];l[f+G]=Zie?J:ie}return O}}}const Ph=new P;function Ay(r,e,t,n,i){At.setBuffer(r._roots[e]),Gl(0,r,t,n,i),At.clearBuffer()}function Gl(r,e,t,n,i){const{float32Array:s,uint16Array:o,uint32Array:a}=At,l=r*2;if(wn(l,o)){const u=En(r,a),h=Dn(l,o);py(e,t,n,u,h,i)}else{const u=Vn(r);qi(u,s,n,Ph)&&Gl(u,e,t,n,i);const h=In(r,a);qi(h,s,n,Ph)&&Gl(h,e,t,n,i)}}const Dh=new P,Ry=["x","y","z"];function Cy(r,e,t,n){At.setBuffer(r._roots[e]);const i=Wl(0,r,t,n);return At.clearBuffer(),i}function Wl(r,e,t,n){const{float32Array:i,uint16Array:s,uint32Array:o}=At;let a=r*2;if(wn(a,s)){const c=En(r,o),u=Dn(a,s);return my(e,t,n,c,u)}else{const c=hc(r,o),u=Ry[c],f=n.direction[u]>=0;let d,_;f?(d=Vn(r),_=In(r,o)):(d=In(r,o),_=Vn(r));const m=qi(d,i,n,Dh)?Wl(d,e,t,n):null;if(m){const v=m.point[u];if(f?v<=i[_+c]:v>=i[_+c+3])return m}const y=qi(_,i,n,Dh)?Wl(_,e,t,n):null;return m&&y?m.distance<=y.distance?m:y:m||y||null}}const Xo=new kt,qr=new Qn,Yr=new Qn,Is=new Ge,Ih=new xn,jo=new xn;function Ly(r,e,t,n){At.setBuffer(r._roots[e]);const i=Xl(0,r,t,n);return At.clearBuffer(),i}function Xl(r,e,t,n,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=At;let l=r*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Ih.set(t.boundingBox.min,t.boundingBox.max,n),i=Ih),wn(l,o)){const u=e.geometry,h=u.index,f=u.attributes.position,d=t.index,_=t.attributes.position,g=En(r,a),m=Dn(l,o);if(Is.copy(n).invert(),t.boundsTree)return Ft(r,s,jo),jo.matrix.copy(Is),jo.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:y=>jo.intersectsBox(y),intersectsTriangle:y=>{y.a.applyMatrix4(n),y.b.applyMatrix4(n),y.c.applyMatrix4(n),y.needsUpdate=!0;for(let v=g,x=m+g;vdl.distanceToBox(b),intersectsBounds:(b,E,w)=>w{if(e.boundsTree){const w=e.boundsTree;return w.shapecast({boundsTraverseOrder:I=>Ns.distanceToBox(I),intersectsBounds:(I,S,A)=>A{for(let A=I,z=I+S;Anew kt),$r=new kt,Kr=new kt,pl=new kt,ml=new kt;let _l=!1;function Uy(r,e,t,n){if(_l)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");_l=!0;const i=r._roots,s=e._roots;let o,a=0,l=0;const c=new Ge().copy(t).invert();for(let u=0,h=i.length;ul.slice()),index:o.array.slice(),indirectBuffer:s?s.slice():null}:a={roots:i,index:o.array,indirectBuffer:s},a}static deserialize(e,t,n={}){n={setIndex:!0,indirect:!!e.indirectBuffer,...n};const{index:i,roots:s,indirectBuffer:o}=e,a=new fc(t,{...n,[ll]:!0});if(a._roots=s,a._indirectBuffer=o||null,n.setIndex){const l=t.getIndex();if(l===null){const c=new jt(e.index,1,!1);t.setIndex(c)}else l.array!==i&&(l.array.set(i),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Ff,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[ll]:!1},t),t.useSharedArrayBuffer&&!Oy())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[ll]||(ey(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new kt)));const{_indirectBuffer:n}=this;this.resolveTriangleIndex=t.indirect?i=>n[i]:i=>i}refit(e=null){return(this.indirect?Ty:dy)(this,e)}traverse(e,t=0){const n=this._roots[t],i=new Uint32Array(n),s=new Uint16Array(n);o(0);function o(a,l=0){const c=a*2,u=s[c+15]===va;if(u){const h=i[a+6],f=s[c+14];e(l,u,new Float32Array(n,a*4,6),h,f)}else{const h=a+dr/4,f=i[a+6],d=i[a+7];e(l,u,new Float32Array(n,a*4,6),d)||(o(h,l+1),o(f,l+1))}}}raycast(e,t=Jn){const n=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,c=o?t.side:t,u=this.indirect?Ay:gy;for(let h=0,f=n.length;hh(f,d,_,g,m)?!0:n(f,d,this,a,_,g,t)}else o||(a?o=(h,f,d,_)=>n(h,f,this,a,d,_,t):o=(h,f,d)=>d);let l=!1,c=0;const u=this._roots;for(let h=0,f=u.length;h{const g=this.resolveTriangleIndex(_);Xt(o,g*3,a,l)}:_=>{Xt(o,_*3,a,l)},u=Hn.getPrimitive(),h=e.geometry.index,f=e.geometry.attributes.position,d=e.indirect?_=>{const g=e.resolveTriangleIndex(_);Xt(u,g*3,h,f)}:_=>{Xt(u,_*3,h,f)};if(s){const _=(g,m,p,y,v,x,b,E)=>{for(let w=p,I=p+y;wYo.intersectsBox(n),intersectsTriangle:n=>Yo.intersectsTriangle(n)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,n={},i={},s=0,o=1/0){return(this.indirect?Fy:Ey)(this,e,t,n,i,s,o)}closestPointToPoint(e,t={},n=0,i=1/0){return ay(this,e,t,n,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(n=>{Ft(0,new Float32Array(n),Nh),e.union(Nh)}),e}}function By(r){switch(r){case 1:return"R";case 2:return"RG";case 3:return"RGBA";case 4:return"RGBA"}throw new Error}function zy(r){switch(r){case 1:return Zh;case 2:return Jh;case 3:return nn;case 4:return nn}}function Fh(r){switch(r){case 1:return Kl;case 2:return da;case 3:return Ys;case 4:return Ys}}class Hf extends aa{constructor(){super(),this.minFilter=It,this.magFilter=It,this.generateMipmaps=!1,this.overrideItemSize=null,this._forcedType=null}updateFrom(e){const t=this.overrideItemSize,n=e.itemSize,i=e.count;if(t!==null){if(n*i%t!==0)throw new Error("VertexAttributeTexture: overrideItemSize must divide evenly into buffer length.");e.itemSize=t,e.count=i*n/t}const s=e.itemSize,o=e.count,a=e.normalized,l=e.array.constructor,c=l.BYTES_PER_ELEMENT;let u=this._forcedType,h=s;if(u===null)switch(l){case Float32Array:u=_n;break;case Uint8Array:case Uint16Array:case Uint32Array:u=Pn;break;case Int8Array:case Int16Array:case Int32Array:u=ks;break}let f,d,_,g,m=By(s);switch(u){case _n:_=1,d=zy(s),a&&c===1?(g=l,m+="8",l===Uint8Array?f=ui:(f=Rl,m+="_SNORM")):(g=Float32Array,m+="32F",f=_n);break;case ks:m+=c*8+"I",_=a?Math.pow(2,l.BYTES_PER_ELEMENT*8-1):1,d=Fh(s),c===1?(g=Int8Array,f=Rl):c===2?(g=Int16Array,f=Yh):(g=Int32Array,f=ks);break;case Pn:m+=c*8+"UI",_=a?Math.pow(2,l.BYTES_PER_ELEMENT*8-1):1,d=Fh(s),c===1?(g=Uint8Array,f=ui):c===2?(g=Uint16Array,f=fa):(g=Uint32Array,f=Pn);break}h===3&&(d===nn||d===Ys)&&(h=4);const p=Math.ceil(Math.sqrt(o)),y=h*p*p,v=new g(y),x=e.normalized;e.normalized=!1;for(let b=0;b=2&&(v[E+1]=e.getY(b)/_),s>=3&&(v[E+2]=e.getZ(b)/_,h===4&&(v[E+3]=1)),s>=4&&(v[E+3]=e.getW(b)/_)}e.normalized=x,this.internalFormat=m,this.format=d,this.type=f,this.image.width=p,this.image.height=p,this.image.data=v,this.needsUpdate=!0,this.dispose(),e.itemSize=n,e.count=i}}class ky extends Hf{constructor(){super(),this._forcedType=Pn}}class Bs extends Hf{constructor(){super(),this._forcedType=_n}}class Oh{constructor(){this.index=new ky,this.position=new Bs,this.bvhBounds=new aa,this.bvhContents=new aa,this._cachedIndexAttr=null,this.index.overrideItemSize=3}updateFrom(e){const{geometry:t}=e;if(Vy(e,this.bvhBounds,this.bvhContents),this.position.updateFrom(t.attributes.position),e.indirect){const n=e._indirectBuffer;if(this._cachedIndexAttr===null||this._cachedIndexAttr.count!==n.length)if(t.index)this._cachedIndexAttr=t.index.clone();else{const i=Bf(Uf(t));this._cachedIndexAttr=new jt(i,1,!1)}Hy(t,n,this._cachedIndexAttr),this.index.updateFrom(this._cachedIndexAttr)}else this.index.updateFrom(t.index)}dispose(){const{index:e,position:t,bvhBounds:n,bvhContents:i}=this;e&&e.dispose(),t&&t.dispose(),n&&n.dispose(),i&&i.dispose()}}function Hy(r,e,t){const n=t.array,i=r.index?r.index.array:null;for(let s=0,o=e.length;su||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/ce.x),i.x=s.x*ce.x,J.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/ce.y),i.y=s.y*ce.y,J.mapSize.y=s.y)),J.map===null||O===!0||G===!0){const se=this.type!==Mi?{minFilter:Nt,magFilter:Nt}:{};J.map!==null&&J.map.dispose(),J.map=new qi(i.x,i.y,se),J.map.texture.name=Z.name+".shadowMap",J.camera.updateProjectionMatrix()}r.setRenderTarget(J.map),r.clear();const ie=J.getViewportCount();for(let se=0;se0||E.map&&E.alphaTest>0){const z=S.uuid,O=E.uuid;let G=c[z];G===void 0&&(G={},c[z]=G);let D=G[O];D===void 0&&(D=S.clone(),G[O]=D),S=D}if(S.visible=E.visible,S.wireframe=E.wireframe,I===Mi?S.side=E.shadowSide!==null?E.shadowSide:E.side:S.side=E.shadowSide!==null?E.shadowSide:f[E.side],S.alphaMap=E.alphaMap,S.alphaTest=E.alphaTest,S.map=E.map,S.clipShadows=E.clipShadows,S.clippingPlanes=E.clippingPlanes,S.clipIntersection=E.clipIntersection,S.displacementMap=E.displacementMap,S.displacementScale=E.displacementScale,S.displacementBias=E.displacementBias,S.wireframeLinewidth=E.wireframeLinewidth,S.linewidth=E.linewidth,T.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const z=r.properties.get(S);z.light=T}return S}function y(b,E,T,I,S){if(b.visible===!1)return;if(b.layers.test(E.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&S===Mi)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,b.matrixWorld);const O=e.update(b),G=b.material;if(Array.isArray(G)){const D=O.groups;for(let H=0,Z=D.length;H=1):se.indexOf("OpenGL ES")!==-1&&(ie=parseFloat(/^OpenGL ES (\d)/.exec(se)[1]),ce=ie>=2);let me=null,ve={};const Q=r.getParameter(r.SCISSOR_BOX),oe=r.getParameter(r.VIEWPORT),Se=new pt().fromArray(Q),De=new pt().fromArray(oe);function _e(F,ge,ae,ee){const he=new Uint8Array(4),Re=r.createTexture();r.bindTexture(F,Re),r.texParameteri(F,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(F,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let tt=0;tt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap;let g;const m=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(P,w){return d?new OffscreenCanvas(P,w):Js("canvas")}function v(P,w,X,le){let re=1;if((P.width>le||P.height>le)&&(re=le/Math.max(P.width,P.height)),re<1||w===!0)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap){const fe=w?la:Math.floor,Ee=fe(re*P.width),pe=fe(re*P.height);g===void 0&&(g=x(Ee,pe));const ye=X?x(Ee,pe):g;return ye.width=Ee,ye.height=pe,ye.getContext("2d").drawImage(P,0,0,Ee,pe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Ee+"x"+pe+")."),ye}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function y(P){return Nl(P.width)&&Nl(P.height)}function b(P){return a?!1:P.wrapS!==kn||P.wrapT!==kn||P.minFilter!==Nt&&P.minFilter!==wn}function E(P,w){return P.generateMipmaps&&w&&P.minFilter!==Nt&&P.minFilter!==wn}function T(P){r.generateMipmap(P)}function I(P,w,X,le,re=!1){if(a===!1)return w;if(P!==null){if(r[P]!==void 0)return r[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let fe=w;if(w===r.RED&&(X===r.FLOAT&&(fe=r.R32F),X===r.HALF_FLOAT&&(fe=r.R16F),X===r.UNSIGNED_BYTE&&(fe=r.R8)),w===r.RED_INTEGER&&(X===r.UNSIGNED_BYTE&&(fe=r.R8UI),X===r.UNSIGNED_SHORT&&(fe=r.R16UI),X===r.UNSIGNED_INT&&(fe=r.R32UI),X===r.BYTE&&(fe=r.R8I),X===r.SHORT&&(fe=r.R16I),X===r.INT&&(fe=r.R32I)),w===r.RG&&(X===r.FLOAT&&(fe=r.RG32F),X===r.HALF_FLOAT&&(fe=r.RG16F),X===r.UNSIGNED_BYTE&&(fe=r.RG8)),w===r.RGBA){const Ee=re?ra:dt.getTransfer(le);X===r.FLOAT&&(fe=r.RGBA32F),X===r.HALF_FLOAT&&(fe=r.RGBA16F),X===r.UNSIGNED_BYTE&&(fe=Ee===At?r.SRGB8_ALPHA8:r.RGBA8),X===r.UNSIGNED_SHORT_4_4_4_4&&(fe=r.RGBA4),X===r.UNSIGNED_SHORT_5_5_5_1&&(fe=r.RGB5_A1)}return(fe===r.R16F||fe===r.R32F||fe===r.RG16F||fe===r.RG32F||fe===r.RGBA16F||fe===r.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function S(P,w,X){return E(P,X)===!0||P.isFramebufferTexture&&P.minFilter!==Nt&&P.minFilter!==wn?Math.log2(Math.max(w.width,w.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?w.mipmaps.length:1}function A(P){return P===Nt||P===Cl||P===ea?r.NEAREST:r.LINEAR}function z(P){const w=P.target;w.removeEventListener("dispose",z),G(w),w.isVideoTexture&&_.delete(w)}function O(P){const w=P.target;w.removeEventListener("dispose",O),H(w)}function G(P){const w=n.get(P);if(w.__webglInit===void 0)return;const X=P.source,le=m.get(X);if(le){const re=le[w.__cacheKey];re.usedTimes--,re.usedTimes===0&&D(P),Object.keys(le).length===0&&m.delete(X)}n.remove(P)}function D(P){const w=n.get(P);r.deleteTexture(w.__webglTexture);const X=P.source,le=m.get(X);delete le[w.__cacheKey],o.memory.textures--}function H(P){const w=P.texture,X=n.get(P),le=n.get(w);if(le.__webglTexture!==void 0&&(r.deleteTexture(le.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let re=0;re<6;re++){if(Array.isArray(X.__webglFramebuffer[re]))for(let fe=0;fe=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),Z+=1,P}function ie(P){const w=[];return w.push(P.wrapS),w.push(P.wrapT),w.push(P.wrapR||0),w.push(P.magFilter),w.push(P.minFilter),w.push(P.anisotropy),w.push(P.internalFormat),w.push(P.format),w.push(P.type),w.push(P.generateMipmaps),w.push(P.premultiplyAlpha),w.push(P.flipY),w.push(P.unpackAlignment),w.push(P.colorSpace),w.join()}function se(P,w){const X=n.get(P);if(P.isVideoTexture&&Tt(P),P.isRenderTargetTexture===!1&&P.version>0&&X.__version!==P.version){const le=P.image;if(le===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(le.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{We(X,P,w);return}}t.bindTexture(r.TEXTURE_2D,X.__webglTexture,r.TEXTURE0+w)}function me(P,w){const X=n.get(P);if(P.version>0&&X.__version!==P.version){We(X,P,w);return}t.bindTexture(r.TEXTURE_2D_ARRAY,X.__webglTexture,r.TEXTURE0+w)}function ve(P,w){const X=n.get(P);if(P.version>0&&X.__version!==P.version){We(X,P,w);return}t.bindTexture(r.TEXTURE_3D,X.__webglTexture,r.TEXTURE0+w)}function Q(P,w){const X=n.get(P);if(P.version>0&&X.__version!==P.version){Fe(X,P,w);return}t.bindTexture(r.TEXTURE_CUBE_MAP,X.__webglTexture,r.TEXTURE0+w)}const oe={[ls]:r.REPEAT,[kn]:r.CLAMP_TO_EDGE,[ia]:r.MIRRORED_REPEAT},Se={[Nt]:r.NEAREST,[Cl]:r.NEAREST_MIPMAP_NEAREST,[ea]:r.NEAREST_MIPMAP_LINEAR,[wn]:r.LINEAR,[Yh]:r.LINEAR_MIPMAP_NEAREST,[mr]:r.LINEAR_MIPMAP_LINEAR},De={[Vd]:r.NEVER,[Yd]:r.ALWAYS,[Gd]:r.LESS,[sf]:r.LEQUAL,[Wd]:r.EQUAL,[jd]:r.GEQUAL,[Xd]:r.GREATER,[qd]:r.NOTEQUAL};function _e(P,w,X){if(X?(r.texParameteri(P,r.TEXTURE_WRAP_S,oe[w.wrapS]),r.texParameteri(P,r.TEXTURE_WRAP_T,oe[w.wrapT]),(P===r.TEXTURE_3D||P===r.TEXTURE_2D_ARRAY)&&r.texParameteri(P,r.TEXTURE_WRAP_R,oe[w.wrapR]),r.texParameteri(P,r.TEXTURE_MAG_FILTER,Se[w.magFilter]),r.texParameteri(P,r.TEXTURE_MIN_FILTER,Se[w.minFilter])):(r.texParameteri(P,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(P,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(P===r.TEXTURE_3D||P===r.TEXTURE_2D_ARRAY)&&r.texParameteri(P,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(w.wrapS!==kn||w.wrapT!==kn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(P,r.TEXTURE_MAG_FILTER,A(w.magFilter)),r.texParameteri(P,r.TEXTURE_MIN_FILTER,A(w.minFilter)),w.minFilter!==Nt&&w.minFilter!==wn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),w.compareFunction&&(r.texParameteri(P,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(P,r.TEXTURE_COMPARE_FUNC,De[w.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const le=e.get("EXT_texture_filter_anisotropic");if(w.magFilter===Nt||w.minFilter!==ea&&w.minFilter!==mr||w.type===vn&&e.has("OES_texture_float_linear")===!1||a===!1&&w.type===$s&&e.has("OES_texture_half_float_linear")===!1)return;(w.anisotropy>1||n.get(w).__currentAnisotropy)&&(r.texParameterf(P,le.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(w.anisotropy,i.getMaxAnisotropy())),n.get(w).__currentAnisotropy=w.anisotropy)}}function qe(P,w){let X=!1;P.__webglInit===void 0&&(P.__webglInit=!0,w.addEventListener("dispose",z));const le=w.source;let re=m.get(le);re===void 0&&(re={},m.set(le,re));const fe=ie(w);if(fe!==P.__cacheKey){re[fe]===void 0&&(re[fe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,X=!0),re[fe].usedTimes++;const Ee=re[P.__cacheKey];Ee!==void 0&&(re[P.__cacheKey].usedTimes--,Ee.usedTimes===0&&D(w)),P.__cacheKey=fe,P.__webglTexture=re[fe].texture}return X}function We(P,w,X){let le=r.TEXTURE_2D;(w.isDataArrayTexture||w.isCompressedArrayTexture)&&(le=r.TEXTURE_2D_ARRAY),w.isData3DTexture&&(le=r.TEXTURE_3D);const re=qe(P,w),fe=w.source;t.bindTexture(le,P.__webglTexture,r.TEXTURE0+X);const Ee=n.get(fe);if(fe.version!==Ee.__version||re===!0){t.activeTexture(r.TEXTURE0+X);const pe=dt.getPrimaries(dt.workingColorSpace),ye=w.colorSpace===Hn?null:dt.getPrimaries(w.colorSpace),N=w.colorSpace===Hn||pe===ye?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,w.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,w.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,N);const de=b(w)&&y(w.image)===!1;let ne=v(w.image,de,!1,u);ne=Lt(w,ne);const Oe=y(ne)||a,Ae=s.convert(w.format,w.colorSpace);let Le=s.convert(w.type),Me=I(w.internalFormat,Ae,Le,w.colorSpace,w.isVideoTexture);_e(le,w,Oe);let be;const Ge=w.mipmaps,F=a&&w.isVideoTexture!==!0&&Me!==ef,ge=Ee.__version===void 0||re===!0,ae=S(w,ne,Oe);if(w.isDepthTexture)Me=r.DEPTH_COMPONENT,a?w.type===vn?Me=r.DEPTH_COMPONENT32F:w.type===Dn?Me=r.DEPTH_COMPONENT24:w.type===fr?Me=r.DEPTH24_STENCIL8:Me=r.DEPTH_COMPONENT16:w.type===vn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),w.format===dr&&Me===r.DEPTH_COMPONENT&&w.type!==pa&&w.type!==Dn&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),w.type=Dn,Le=s.convert(w.type)),w.format===cs&&Me===r.DEPTH_COMPONENT&&(Me=r.DEPTH_STENCIL,w.type!==fr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),w.type=fr,Le=s.convert(w.type))),ge&&(F?t.texStorage2D(r.TEXTURE_2D,1,Me,ne.width,ne.height):t.texImage2D(r.TEXTURE_2D,0,Me,ne.width,ne.height,0,Ae,Le,null));else if(w.isDataTexture)if(Ge.length>0&&Oe){F&&ge&&t.texStorage2D(r.TEXTURE_2D,ae,Me,Ge[0].width,Ge[0].height);for(let ee=0,he=Ge.length;ee>=1,he>>=1}}else if(Ge.length>0&&Oe){F&&ge&&t.texStorage2D(r.TEXTURE_2D,ae,Me,Ge[0].width,Ge[0].height);for(let ee=0,he=Ge.length;ee0&&ge++,t.texStorage2D(r.TEXTURE_CUBE_MAP,ge,be,ne[0].width,ne[0].height));for(let ee=0;ee<6;ee++)if(de){Ge?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,ne[ee].width,ne[ee].height,Le,Me,ne[ee].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,be,ne[ee].width,ne[ee].height,0,Le,Me,ne[ee].data);for(let he=0;he>fe),ne=Math.max(1,w.height>>fe);re===r.TEXTURE_3D||re===r.TEXTURE_2D_ARRAY?t.texImage3D(re,fe,ye,de,ne,w.depth,0,Ee,pe,null):t.texImage2D(re,fe,ye,de,ne,0,Ee,pe,null)}t.bindFramebuffer(r.FRAMEBUFFER,P),st(w)?h.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,le,re,n.get(X).__webglTexture,0,ke(w)):(re===r.TEXTURE_2D||re>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&re<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,le,re,n.get(X).__webglTexture,fe),t.bindFramebuffer(r.FRAMEBUFFER,null)}function W(P,w,X){if(r.bindRenderbuffer(r.RENDERBUFFER,P),w.depthBuffer&&!w.stencilBuffer){let le=a===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(X||st(w)){const re=w.depthTexture;re&&re.isDepthTexture&&(re.type===vn?le=r.DEPTH_COMPONENT32F:re.type===Dn&&(le=r.DEPTH_COMPONENT24));const fe=ke(w);st(w)?h.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,fe,le,w.width,w.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,fe,le,w.width,w.height)}else r.renderbufferStorage(r.RENDERBUFFER,le,w.width,w.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,P)}else if(w.depthBuffer&&w.stencilBuffer){const le=ke(w);X&&st(w)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,w.width,w.height):st(w)?h.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,le,r.DEPTH24_STENCIL8,w.width,w.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,w.width,w.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,P)}else{const le=w.isWebGLMultipleRenderTargets===!0?w.texture:[w.texture];for(let re=0;re0){X.__webglFramebuffer[pe]=[];for(let ye=0;ye0){X.__webglFramebuffer=[];for(let pe=0;pe0&&st(P)===!1){const pe=fe?w:[w];X.__webglMultisampledFramebuffer=r.createFramebuffer(),X.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,X.__webglMultisampledFramebuffer);for(let ye=0;ye0)for(let ye=0;ye0)for(let ye=0;ye0&&st(P)===!1){const w=P.isWebGLMultipleRenderTargets?P.texture:[P.texture],X=P.width,le=P.height;let re=r.COLOR_BUFFER_BIT;const fe=[],Ee=P.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,pe=n.get(P),ye=P.isWebGLMultipleRenderTargets===!0;if(ye)for(let N=0;N0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&w.__useRenderToTexture!==!1}function Tt(P){const w=o.render.frame;_.get(P)!==w&&(_.set(P,w),P.update())}function Lt(P,w){const X=P.colorSpace,le=P.format,re=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||P.format===Il||X!==an&&X!==Hn&&(dt.getTransfer(X)===At?a===!1?e.has("EXT_sRGB")===!0&&le===sn?(P.format=Il,P.minFilter=wn,P.generateMipmaps=!1):w=lf.sRGBToLinear(w):(le!==sn||re!==hi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",X)),w}this.allocateTextureUnit=ce,this.resetTextureUnits=J,this.setTexture2D=se,this.setTexture2DArray=me,this.setTexture3D=ve,this.setTextureCube=Q,this.rebindTextures=$e,this.setupRenderTarget=ze,this.updateRenderTargetMipmap=mt,this.updateMultisampleRenderTarget=Ke,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=Ye,this.useMultisampledRTT=st}function a0(r,e,t){const n=t.isWebGL2;function i(s,o=Hn){let a;const l=dt.getTransfer(o);if(s===hi)return r.UNSIGNED_BYTE;if(s===Kh)return r.UNSIGNED_SHORT_4_4_4_4;if(s===Zh)return r.UNSIGNED_SHORT_5_5_5_1;if(s===Ll)return r.BYTE;if(s===$h)return r.SHORT;if(s===pa)return r.UNSIGNED_SHORT;if(s===Vs)return r.INT;if(s===Dn)return r.UNSIGNED_INT;if(s===vn)return r.FLOAT;if(s===$s)return n?r.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Id)return r.ALPHA;if(s===sn)return r.RGBA;if(s===Nd)return r.LUMINANCE;if(s===Fd)return r.LUMINANCE_ALPHA;if(s===dr)return r.DEPTH_COMPONENT;if(s===cs)return r.DEPTH_STENCIL;if(s===Il)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Jh)return r.RED;if(s===Zl)return r.RED_INTEGER;if(s===Qh)return r.RG;if(s===ma)return r.RG_INTEGER;if(s===Ks)return r.RGBA_INTEGER;if(s===Ea||s===Ta||s===Aa||s===Ra)if(l===At)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===Ea)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Ta)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Aa)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Ra)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Ea)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Ta)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Aa)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Ra)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Cc||s===Lc||s===Pc||s===Dc)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Cc)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Lc)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Pc)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Dc)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===ef)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Ic||s===Nc)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Ic)return l===At?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Nc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Fc||s===Oc||s===Uc||s===Bc||s===zc||s===kc||s===Hc||s===Vc||s===Gc||s===Wc||s===Xc||s===qc||s===jc||s===Yc)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Fc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Oc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Uc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Bc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===zc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===kc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Hc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Vc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Gc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Wc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Xc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===qc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===jc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Yc)return l===At?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Ca||s===$c||s===Kc)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Ca)return l===At?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===$c)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Kc)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===Od||s===Zc||s===Jc||s===Qc)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Ca)return a.COMPRESSED_RED_RGTC1_EXT;if(s===Zc)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Jc)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Qc)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===fr?n?r.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class l0 extends gn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class hr extends Bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const c0={type:"move"};class Qa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new hr,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 hr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new hr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),this._grip}dispatchEvent(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,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const g of e.hand.values()){const m=t.getJointPose(g,n),d=this._getHandJoint(c,g);m!==null&&(d.matrix.fromArray(m.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,d.jointRadius=m.radius),d.visible=m!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),p=.02,_=.005;c.inputState.pinching&&h>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(c0)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new hr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class u0 extends gr{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,h=null,p=null,_=null;const g=t.getContextAttributes();let m=null,d=null;const x=[],v=[],y=new Ue;let b=null;const E=new gn;E.layers.enable(1),E.viewport=new pt;const T=new gn;T.layers.enable(2),T.viewport=new pt;const I=[E,T],S=new l0;S.layers.enable(1),S.layers.enable(2);let A=null,z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Q){let oe=x[Q];return oe===void 0&&(oe=new Qa,x[Q]=oe),oe.getTargetRaySpace()},this.getControllerGrip=function(Q){let oe=x[Q];return oe===void 0&&(oe=new Qa,x[Q]=oe),oe.getGripSpace()},this.getHand=function(Q){let oe=x[Q];return oe===void 0&&(oe=new Qa,x[Q]=oe),oe.getHandSpace()};function O(Q){const oe=v.indexOf(Q.inputSource);if(oe===-1)return;const Se=x[oe];Se!==void 0&&(Se.update(Q.inputSource,Q.frame,c||o),Se.dispatchEvent({type:Q.type,data:Q.inputSource}))}function G(){i.removeEventListener("select",O),i.removeEventListener("selectstart",O),i.removeEventListener("selectend",O),i.removeEventListener("squeeze",O),i.removeEventListener("squeezestart",O),i.removeEventListener("squeezeend",O),i.removeEventListener("end",G),i.removeEventListener("inputsourceschange",D);for(let Q=0;Q=0&&(v[De]=null,x[De].disconnect(Se))}for(let oe=0;oe=v.length){v.push(Se),De=qe;break}else if(v[qe]===null){v[qe]=Se,De=qe;break}if(De===-1)break}const _e=x[De];_e&&_e.connect(Se)}}const H=new L,Z=new L;function J(Q,oe,Se){H.setFromMatrixPosition(oe.matrixWorld),Z.setFromMatrixPosition(Se.matrixWorld);const De=H.distanceTo(Z),_e=oe.projectionMatrix.elements,qe=Se.projectionMatrix.elements,We=_e[14]/(_e[10]-1),Fe=_e[14]/(_e[10]+1),Ye=(_e[9]+1)/_e[5],W=(_e[9]-1)/_e[5],Ct=(_e[8]-1)/_e[0],Ce=(qe[8]+1)/qe[0],$e=We*Ct,ze=We*Ce,mt=De/(-Ct+Ce),Ke=mt*-Ct;oe.matrixWorld.decompose(Q.position,Q.quaternion,Q.scale),Q.translateX(Ke),Q.translateZ(mt),Q.matrixWorld.compose(Q.position,Q.quaternion,Q.scale),Q.matrixWorldInverse.copy(Q.matrixWorld).invert();const ke=We+mt,st=Fe+mt,Tt=$e-Ke,Lt=ze+(De-Ke),P=Ye*Fe/st*ke,w=W*Fe/st*ke;Q.projectionMatrix.makePerspective(Tt,Lt,P,w,ke,st),Q.projectionMatrixInverse.copy(Q.projectionMatrix).invert()}function ce(Q,oe){oe===null?Q.matrixWorld.copy(Q.matrix):Q.matrixWorld.multiplyMatrices(oe.matrixWorld,Q.matrix),Q.matrixWorldInverse.copy(Q.matrixWorld).invert()}this.updateCamera=function(Q){if(i===null)return;S.near=T.near=E.near=Q.near,S.far=T.far=E.far=Q.far,(A!==S.near||z!==S.far)&&(i.updateRenderState({depthNear:S.near,depthFar:S.far}),A=S.near,z=S.far);const oe=Q.parent,Se=S.cameras;ce(S,oe);for(let De=0;De0&&(m.alphaTest.value=d.alphaTest);const x=e.get(d).envMap;if(x&&(m.envMap.value=x,m.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap){m.lightMap.value=d.lightMap;const v=r._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=d.lightMapIntensity*v,t(d.lightMap,m.lightMapTransform)}d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,m.aoMapTransform))}function o(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform))}function a(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,x,v){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*x,m.scale.value=v*.5,d.map&&(m.map.value=d.map,t(d.map,m.uvTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function c(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function u(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function f(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function h(m,d){m.metalness.value=d.metalness,d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,m.metalnessMapTransform)),m.roughness.value=d.roughness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,m.roughnessMapTransform)),e.get(d).envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function p(m,d,x){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,m.sheenColorMapTransform)),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,m.sheenRoughnessMapTransform))),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,m.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(m.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===xn&&m.clearcoatNormalScale.value.negate())),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,m.iridescenceMapTransform)),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=x.texture,m.transmissionSamplerSize.value.set(x.width,x.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,m.transmissionMapTransform)),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(m.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(m.anisotropyMap.value=d.anisotropyMap,t(d.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,m.specularColorMapTransform)),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,d){d.matcap&&(m.matcap.value=d.matcap)}function g(m,d){const x=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(x.matrixWorld),m.nearDistance.value=x.shadow.camera.near,m.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function f0(r,e,t,n){let i={},s={},o=[];const a=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(x,v){const y=v.program;n.uniformBlockBinding(x,y)}function c(x,v){let y=i[x.id];y===void 0&&(_(x),y=u(x),i[x.id]=y,x.addEventListener("dispose",m));const b=v.program;n.updateUBOMapping(x,b);const E=e.render.frame;s[x.id]!==E&&(h(x),s[x.id]=E)}function u(x){const v=f();x.__bindingPointIndex=v;const y=r.createBuffer(),b=x.__size,E=x.usage;return r.bindBuffer(r.UNIFORM_BUFFER,y),r.bufferData(r.UNIFORM_BUFFER,b,E),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,v,y),y}function f(){for(let x=0;x0){E=y%b;const O=b-E;E!==0&&O-A.boundary<0&&(y+=b-E,S.__offset=y)}y+=A.storage}return E=y%b,E>0&&(y+=b-E),x.__size=y,x.__cache={},this}function g(x){const v={boundary:0,storage:0};return typeof x=="number"?(v.boundary=4,v.storage=4):x.isVector2?(v.boundary=8,v.storage=8):x.isVector3||x.isColor?(v.boundary=16,v.storage=12):x.isVector4?(v.boundary=16,v.storage=16):x.isMatrix3?(v.boundary=48,v.storage=48):x.isMatrix4?(v.boundary=64,v.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),v}function m(x){const v=x.target;v.removeEventListener("dispose",m);const y=o.indexOf(v.__bindingPointIndex);o.splice(y,1),r.deleteBuffer(i[v.id]),delete i[v.id],delete s[v.id]}function d(){for(const x in i)r.deleteBuffer(i[x]);o=[],i={},s={}}return{bind:l,update:c,dispose:d}}class Ef{constructor(e={}){const{canvas:t=cp(),context:n=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;n!==null?h=n.getContextAttributes().alpha:h=o;const p=new Uint32Array(4),_=new Int32Array(4);let g=null,m=null;const d=[],x=[];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=Ht,this._useLegacyLights=!1,this.toneMapping=Wi,this.toneMappingExposure=1;const v=this;let y=!1,b=0,E=0,T=null,I=-1,S=null;const A=new pt,z=new pt;let O=null;const G=new et(0);let D=0,H=t.width,Z=t.height,J=1,ce=null,ie=null;const se=new pt(0,0,H,Z),me=new pt(0,0,H,Z);let ve=!1;const Q=new ec;let oe=!1,Se=!1,De=null;const _e=new Ve,qe=new Ue,We=new L,Fe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ye(){return T===null?J:1}let W=n;function Ct(R,k){for(let j=0;j{function we(){if(K.forEach(function(Ie){Ke.get(Ie).currentProgram.isReady()&&K.delete(Ie)}),K.size===0){Y(R);return}setTimeout(we,10)}Ce.get("KHR_parallel_shader_compile")!==null?we():setTimeout(we,10)})};let tt=null;function _t(R){tt&&tt(R)}function Vt(){ht.stop()}function ut(){ht.start()}const ht=new vf;ht.setAnimationLoop(_t),typeof self<"u"&&ht.setContext(self),this.setAnimationLoop=function(R){tt=R,be.setAnimationLoop(R),R===null?ht.stop():ht.start()},be.addEventListener("sessionstart",Vt),be.addEventListener("sessionend",ut),this.render=function(R,k){if(k!==void 0&&k.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),k.parent===null&&k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),be.enabled===!0&&be.isPresenting===!0&&(be.cameraAutoUpdate===!0&&be.updateCamera(k),k=be.getCamera()),R.isScene===!0&&R.onBeforeRender(v,R,k,T),m=fe.get(R,x.length),m.init(),x.push(m),_e.multiplyMatrices(k.projectionMatrix,k.matrixWorldInverse),Q.setFromProjectionMatrix(_e),Se=this.localClippingEnabled,oe=Ee.init(this.clippingPlanes,Se),g=re.get(R,d.length),g.init(),d.push(g),Sn(R,k,0,v.sortObjects),g.finish(),v.sortObjects===!0&&g.sort(ce,ie),this.info.render.frame++,oe===!0&&Ee.beginShadows();const j=m.state.shadowsArray;if(pe.render(j,R,k),oe===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset(),ye.render(g,R),m.setupLights(v._useLegacyLights),k.isArrayCamera){const K=k.cameras;for(let Y=0,we=K.length;Y0?m=x[x.length-1]:m=null,d.pop(),d.length>0?g=d[d.length-1]:g=null};function Sn(R,k,j,K){if(R.visible===!1)return;if(R.layers.test(k.layers)){if(R.isGroup)j=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(k);else if(R.isLight)m.pushLight(R),R.castShadow&&m.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||Q.intersectsSprite(R)){K&&We.setFromMatrixPosition(R.matrixWorld).applyMatrix4(_e);const Ie=w.update(R),He=R.material;He.visible&&g.push(R,Ie,He,j,We.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||Q.intersectsObject(R))){const Ie=w.update(R),He=R.material;if(K&&(R.boundingSphere!==void 0?(R.boundingSphere===null&&R.computeBoundingSphere(),We.copy(R.boundingSphere.center)):(Ie.boundingSphere===null&&Ie.computeBoundingSphere(),We.copy(Ie.boundingSphere.center)),We.applyMatrix4(R.matrixWorld).applyMatrix4(_e)),Array.isArray(He)){const Xe=Ie.groups;for(let Qe=0,je=Xe.length;Qe0&&ln(Y,we,k,j),K&&ze.viewport(A.copy(K)),Y.length>0&&Li(Y,k,j),we.length>0&&Li(we,k,j),Ie.length>0&&Li(Ie,k,j),ze.buffers.depth.setTest(!0),ze.buffers.depth.setMask(!0),ze.buffers.color.setMask(!0),ze.setPolygonOffset(!1)}function ln(R,k,j,K){if((j.isScene===!0?j.overrideMaterial:null)!==null)return;const we=$e.isWebGL2;De===null&&(De=new qi(1,1,{generateMipmaps:!0,type:Ce.has("EXT_color_buffer_half_float")?$s:hi,minFilter:mr,samples:we?4:0})),v.getDrawingBufferSize(qe),we?De.setSize(qe.x,qe.y):De.setSize(la(qe.x),la(qe.y));const Ie=v.getRenderTarget();v.setRenderTarget(De),v.getClearColor(G),D=v.getClearAlpha(),D<1&&v.setClearColor(16777215,.5),v.clear();const He=v.toneMapping;v.toneMapping=Wi,Li(R,j,K),ke.updateMultisampleRenderTarget(De),ke.updateRenderTargetMipmap(De);let Xe=!1;for(let Qe=0,je=k.length;Qe0),Ze=!!j.morphAttributes.position,vt=!!j.morphAttributes.normal,Gt=!!j.morphAttributes.color;let zt=Wi;K.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(zt=v.toneMapping);const cn=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,ot=cn!==void 0?cn.length:0,Je=Ke.get(K),$i=m.state.lights;if(oe===!0&&(Se===!0||R!==S)){const te=R===S&&K.id===I;Ee.setState(K,R,te)}let xt=!1;K.version===Je.__version?(Je.needsLights&&Je.lightsStateVersion!==$i.state.version||Je.outputColorSpace!==He||Y.isBatchedMesh&&Je.batching===!1||!Y.isBatchedMesh&&Je.batching===!0||Y.isInstancedMesh&&Je.instancing===!1||!Y.isInstancedMesh&&Je.instancing===!0||Y.isSkinnedMesh&&Je.skinning===!1||!Y.isSkinnedMesh&&Je.skinning===!0||Y.isInstancedMesh&&Je.instancingColor===!0&&Y.instanceColor===null||Y.isInstancedMesh&&Je.instancingColor===!1&&Y.instanceColor!==null||Je.envMap!==Xe||K.fog===!0&&Je.fog!==we||Je.numClippingPlanes!==void 0&&(Je.numClippingPlanes!==Ee.numPlanes||Je.numIntersection!==Ee.numIntersection)||Je.vertexAlphas!==Qe||Je.vertexTangents!==je||Je.morphTargets!==Ze||Je.morphNormals!==vt||Je.morphColors!==Gt||Je.toneMapping!==zt||$e.isWebGL2===!0&&Je.morphTargetsCount!==ot)&&(xt=!0):(xt=!0,Je.__version=K.version);let Fn=Je.currentProgram;xt===!0&&(Fn=ii(K,k,Y));let br=!1,Jt=!1,nn=!1;const Wt=Fn.getUniforms(),M=Je.uniforms;if(ze.useProgram(Fn.program)&&(br=!0,Jt=!0,nn=!0),K.id!==I&&(I=K.id,Jt=!0),br||S!==R){Wt.setValue(W,"projectionMatrix",R.projectionMatrix),Wt.setValue(W,"viewMatrix",R.matrixWorldInverse);const te=Wt.map.cameraPosition;te!==void 0&&te.setValue(W,We.setFromMatrixPosition(R.matrixWorld)),$e.logarithmicDepthBuffer&&Wt.setValue(W,"logDepthBufFC",2/(Math.log(R.far+1)/Math.LN2)),(K.isMeshPhongMaterial||K.isMeshToonMaterial||K.isMeshLambertMaterial||K.isMeshBasicMaterial||K.isMeshStandardMaterial||K.isShaderMaterial)&&Wt.setValue(W,"isOrthographic",R.isOrthographicCamera===!0),S!==R&&(S=R,Jt=!0,nn=!0)}if(Y.isSkinnedMesh){Wt.setOptional(W,Y,"bindMatrix"),Wt.setOptional(W,Y,"bindMatrixInverse");const te=Y.skeleton;te&&($e.floatVertexTextures?(te.boneTexture===null&&te.computeBoneTexture(),Wt.setValue(W,"boneTexture",te.boneTexture,ke)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}Y.isBatchedMesh&&(Wt.setOptional(W,Y,"batchingTexture"),Wt.setValue(W,"batchingTexture",Y._matricesTexture,ke));const B=j.morphAttributes;if((B.position!==void 0||B.normal!==void 0||B.color!==void 0&&$e.isWebGL2===!0)&&N.update(Y,j,Fn),(Jt||Je.receiveShadow!==Y.receiveShadow)&&(Je.receiveShadow=Y.receiveShadow,Wt.setValue(W,"receiveShadow",Y.receiveShadow)),K.isMeshGouraudMaterial&&K.envMap!==null&&(M.envMap.value=Xe,M.flipEnvMap.value=Xe.isCubeTexture&&Xe.isRenderTargetTexture===!1?-1:1),Jt&&(Wt.setValue(W,"toneMappingExposure",v.toneMappingExposure),Je.needsLights&&Pi(M,nn),we&&K.fog===!0&&le.refreshFogUniforms(M,we),le.refreshMaterialUniforms(M,K,J,Z,De),ta.upload(W,xr(Je),M,ke)),K.isShaderMaterial&&K.uniformsNeedUpdate===!0&&(ta.upload(W,xr(Je),M,ke),K.uniformsNeedUpdate=!1),K.isSpriteMaterial&&Wt.setValue(W,"center",Y.center),Wt.setValue(W,"modelViewMatrix",Y.modelViewMatrix),Wt.setValue(W,"normalMatrix",Y.normalMatrix),Wt.setValue(W,"modelMatrix",Y.matrixWorld),K.isShaderMaterial||K.isRawShaderMaterial){const te=K.uniformsGroups;for(let V=0,ue=te.length;V0&&ke.useMultisampledRTT(R)===!1?Y=Ke.get(R).__webglMultisampledFramebuffer:Array.isArray(je)?Y=je[j]:Y=je,A.copy(R.viewport),z.copy(R.scissor),O=R.scissorTest}else A.copy(se).multiplyScalar(J).floor(),z.copy(me).multiplyScalar(J).floor(),O=ve;if(ze.bindFramebuffer(W.FRAMEBUFFER,Y)&&$e.drawBuffers&&K&&ze.drawBuffers(R,Y),ze.viewport(A),ze.scissor(z),ze.setScissorTest(O),we){const Xe=Ke.get(R.texture);W.framebufferTexture2D(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_CUBE_MAP_POSITIVE_X+k,Xe.__webglTexture,j)}else if(Ie){const Xe=Ke.get(R.texture),Qe=k||0;W.framebufferTextureLayer(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,Xe.__webglTexture,j||0,Qe)}I=-1},this.readRenderTargetPixels=function(R,k,j,K,Y,we,Ie){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let He=Ke.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&Ie!==void 0&&(He=He[Ie]),He){ze.bindFramebuffer(W.FRAMEBUFFER,He);try{const Xe=R.texture,Qe=Xe.format,je=Xe.type;if(Qe!==sn&&Oe.convert(Qe)!==W.getParameter(W.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=je===$s&&(Ce.has("EXT_color_buffer_half_float")||$e.isWebGL2&&Ce.has("EXT_color_buffer_float"));if(je!==hi&&Oe.convert(je)!==W.getParameter(W.IMPLEMENTATION_COLOR_READ_TYPE)&&!(je===vn&&($e.isWebGL2||Ce.has("OES_texture_float")||Ce.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k>=0&&k<=R.width-K&&j>=0&&j<=R.height-Y&&W.readPixels(k,j,K,Y,Oe.convert(Qe),Oe.convert(je),we)}finally{const Xe=T!==null?Ke.get(T).__webglFramebuffer:null;ze.bindFramebuffer(W.FRAMEBUFFER,Xe)}}},this.copyFramebufferToTexture=function(R,k,j=0){const K=Math.pow(2,-j),Y=Math.floor(k.image.width*K),we=Math.floor(k.image.height*K);ke.setTexture2D(k,0),W.copyTexSubImage2D(W.TEXTURE_2D,j,0,0,R.x,R.y,Y,we),ze.unbindTexture()},this.copyTextureToTexture=function(R,k,j,K=0){const Y=k.image.width,we=k.image.height,Ie=Oe.convert(j.format),He=Oe.convert(j.type);ke.setTexture2D(j,0),W.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,j.flipY),W.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),W.pixelStorei(W.UNPACK_ALIGNMENT,j.unpackAlignment),k.isDataTexture?W.texSubImage2D(W.TEXTURE_2D,K,R.x,R.y,Y,we,Ie,He,k.image.data):k.isCompressedTexture?W.compressedTexSubImage2D(W.TEXTURE_2D,K,R.x,R.y,k.mipmaps[0].width,k.mipmaps[0].height,Ie,k.mipmaps[0].data):W.texSubImage2D(W.TEXTURE_2D,K,R.x,R.y,Ie,He,k.image),K===0&&j.generateMipmaps&&W.generateMipmap(W.TEXTURE_2D),ze.unbindTexture()},this.copyTextureToTexture3D=function(R,k,j,K,Y=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const we=R.max.x-R.min.x+1,Ie=R.max.y-R.min.y+1,He=R.max.z-R.min.z+1,Xe=Oe.convert(K.format),Qe=Oe.convert(K.type);let je;if(K.isData3DTexture)ke.setTexture3D(K,0),je=W.TEXTURE_3D;else if(K.isDataArrayTexture)ke.setTexture2DArray(K,0),je=W.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}W.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,K.flipY),W.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,K.premultiplyAlpha),W.pixelStorei(W.UNPACK_ALIGNMENT,K.unpackAlignment);const Ze=W.getParameter(W.UNPACK_ROW_LENGTH),vt=W.getParameter(W.UNPACK_IMAGE_HEIGHT),Gt=W.getParameter(W.UNPACK_SKIP_PIXELS),zt=W.getParameter(W.UNPACK_SKIP_ROWS),cn=W.getParameter(W.UNPACK_SKIP_IMAGES),ot=j.isCompressedTexture?j.mipmaps[0]:j.image;W.pixelStorei(W.UNPACK_ROW_LENGTH,ot.width),W.pixelStorei(W.UNPACK_IMAGE_HEIGHT,ot.height),W.pixelStorei(W.UNPACK_SKIP_PIXELS,R.min.x),W.pixelStorei(W.UNPACK_SKIP_ROWS,R.min.y),W.pixelStorei(W.UNPACK_SKIP_IMAGES,R.min.z),j.isDataTexture||j.isData3DTexture?W.texSubImage3D(je,Y,k.x,k.y,k.z,we,Ie,He,Xe,Qe,ot.data):j.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),W.compressedTexSubImage3D(je,Y,k.x,k.y,k.z,we,Ie,He,Xe,ot.data)):W.texSubImage3D(je,Y,k.x,k.y,k.z,we,Ie,He,Xe,Qe,ot),W.pixelStorei(W.UNPACK_ROW_LENGTH,Ze),W.pixelStorei(W.UNPACK_IMAGE_HEIGHT,vt),W.pixelStorei(W.UNPACK_SKIP_PIXELS,Gt),W.pixelStorei(W.UNPACK_SKIP_ROWS,zt),W.pixelStorei(W.UNPACK_SKIP_IMAGES,cn),Y===0&&K.generateMipmaps&&W.generateMipmap(je),ze.unbindTexture()},this.initTexture=function(R){R.isCubeTexture?ke.setTextureCube(R,0):R.isData3DTexture?ke.setTexture3D(R,0):R.isDataArrayTexture||R.isCompressedArrayTexture?ke.setTexture2DArray(R,0):ke.setTexture2D(R,0),ze.unbindTexture()},this.resetState=function(){b=0,E=0,T=null,ze.reset(),Ae.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ti}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Jl?"display-p3":"srgb",t.unpackColorSpace=dt.workingColorSpace===_a?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Ht?Xi:nf}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Xi?Ht:an}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 d0 extends Ef{}d0.prototype.isWebGL1Renderer=!0;class p0 extends Bt{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 m0{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Dl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Zn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.InterleavedBuffer: "updateRange" is deprecated and 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;il)continue;h.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(h);Ie.far||t.push({distance:I,point:f.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{const d=Math.max(0,o.start),x=Math.min(m.count,o.start+o.count);for(let v=d,y=x-1;vl)continue;h.applyMatrix4(this.matrixWorld);const E=e.ray.origin.distanceTo(h);Ee.far||t.push({distance:E,point:f.clone().applyMatrix4(this.matrixWorld),index:v,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,o=i.length;s0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class oc extends fi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new et(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 et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rf,this.normalScale=new Ue(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 Ci extends oc{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 Ue(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return tn(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 et(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 et(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new et(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}}function Io(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 M0(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function E0(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 sh(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i}function Cf(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 o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}class ro{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];n:{e:{let o;t:{i:if(!(e=s)){const a=t[1];e=s)break e}o=n,n=0;break t}break n}for(;n>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}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 o=null;for(let a=0;a!==s;a++){const l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&M0(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===La,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*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}}mi.prototype.TimeBufferType=Float32Array;mi.prototype.ValueBufferType=Float32Array;mi.prototype.DefaultInterpolation=us;class gs extends mi{}gs.prototype.ValueTypeName="bool";gs.prototype.ValueBufferType=Array;gs.prototype.DefaultInterpolation=Zs;gs.prototype.InterpolantFactoryMethodLinear=void 0;gs.prototype.InterpolantFactoryMethodSmooth=void 0;class Lf extends mi{}Lf.prototype.ValueTypeName="color";class ds extends mi{}ds.prototype.ValueTypeName="number";class C0 extends ro{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)pi.slerpFlat(s,0,o,c-a,o,c,l);return s}}class _r extends mi{InterpolantFactoryMethodLinear(e){return new C0(this.times,this.values,this.getValueSize(),e)}}_r.prototype.ValueTypeName="quaternion";_r.prototype.DefaultInterpolation=us;_r.prototype.InterpolantFactoryMethodSmooth=void 0;class vs extends mi{}vs.prototype.ValueTypeName="string";vs.prototype.ValueBufferType=Array;vs.prototype.DefaultInterpolation=Zs;vs.prototype.InterpolantFactoryMethodLinear=void 0;vs.prototype.InterpolantFactoryMethodSmooth=void 0;class ps extends mi{}ps.prototype.ValueTypeName="vector";class L0{constructor(e,t=-1,n,i=Ud){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Zn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(D0(n[o]).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,o=n.length;s!==o;++s)t.push(mi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a1){const f=u[1];let h=i[f];h||(i[f]=h=[]),h.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(f,h,p,_,g){if(p.length!==0){const m=[],d=[];Cf(p,m,d,_),m.length!==0&&g.push(new f(h,m,d))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{t&&t(s),this.manager.itemEnd(e)},0),s;if(wi[e]!==void 0){wi[e].push({onLoad:t,onProgress:n,onError:i});return}wi[e]=[],wi[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=wi[e],f=c.body.getReader(),h=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),p=h?parseInt(h):0,_=p!==0;let g=0;const m=new ReadableStream({start(d){x();function x(){f.read().then(({done:v,value:y})=>{if(v)d.close();else{g+=y.byteLength;const b=new ProgressEvent("progress",{lengthComputable:_,loaded:g,total:p});for(let E=0,T=u.length;E{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),h=f&&f[1]?f[1].toLowerCase():void 0,p=new TextDecoder(h);return c.arrayBuffer().then(_=>p.decode(_))}}}).then(c=>{ms.add(e,c);const u=wi[e];delete wi[e];for(let f=0,h=u.length;f{const u=wi[e];if(u===void 0)throw this.manager.itemError(e),c;delete wi[e];for(let f=0,h=u.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class O0 extends xs{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,o=ms.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Js("img");function l(){u(),ms.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(f){u(),i&&i(f),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class U0 extends xs{constructor(e){super(e)}load(e,t,n,i){const s=new on,o=new O0(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class xa extends Bt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new et(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}}const il=new Ve,oh=new L,ah=new L;class ac{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ue(512,512),this.map=null,this.mapPass=null,this.matrix=new Ve,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ec,this._frameExtents=new Ue(1,1),this._viewportCount=1,this._viewports=[new pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;oh.setFromMatrixPosition(e.matrixWorld),t.position.copy(oh),ah.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ah),t.updateMatrixWorld(),il.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(il),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(il)}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 B0 extends ac{constructor(){super(new gn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=hs*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 z0 extends xa{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Bt.DEFAULT_UP),this.updateMatrix(),this.target=new Bt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new B0}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 lh=new Ve,Ls=new L,rl=new L;class k0 extends ac{constructor(){super(new gn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ue(4,2),this._viewportCount=6,this._viewports=[new pt(2,1,1,1),new pt(0,1,1,1),new pt(3,1,1,1),new pt(1,1,1,1),new pt(3,0,1,1),new pt(1,0,1,1)],this._cubeDirections=[new L(1,0,0),new L(-1,0,0),new L(0,0,1),new L(0,0,-1),new L(0,1,0),new L(0,-1,0)],this._cubeUps=[new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,1,0),new L(0,0,1),new L(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Ls.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ls),rl.copy(n.position),rl.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(rl),n.updateMatrixWorld(),i.makeTranslation(-Ls.x,-Ls.y,-Ls.z),lh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(lh)}}class H0 extends xa{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 k0}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 V0 extends ac{constructor(){super(new io(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Df extends xa{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Bt.DEFAULT_UP),this.updateMatrix(),this.target=new Bt,this.shadow=new V0}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class G0 extends xa{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class qs{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n"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,o=ms.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){ms.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}const lc="\\[\\]\\.:\\/",X0=new RegExp("["+lc+"]","g"),cc="[^"+lc+"]",q0="[^"+lc.replace("\\.","")+"]",j0=/((?:WC+[\/:])*)/.source.replace("WC",cc),Y0=/(WCOD+)?/.source.replace("WCOD",q0),$0=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",cc),K0=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",cc),Z0=new RegExp("^"+j0+Y0+$0+K0+"$"),J0=["material","materials","bones","map"];class Q0{constructor(e,t,n){const i=n||gt.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 gt{constructor(e,t,n){this.path=t,this.parsedPath=n||gt.parseTrackName(t),this.node=gt.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 gt.Composite(e,t,n):new gt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(X0,"")}static parseTrackName(e){const t=Z0.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);J0.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 o=0;oMath.PI&&(ge-=Me),ae<-Math.PI?ae+=Me:ae>Math.PI&&(ae-=Me),ge<=ae?a.theta=Math.max(ge,Math.min(ae,a.theta)):a.theta=a.theta>(ge+ae)/2?Math.max(ge,a.theta):Math.min(ae,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor),n.zoomToCursor&&E||n.object.isOrthographicCamera?a.radius=ie(a.radius):a.radius=ie(a.radius*c),N.setFromSpherical(a),N.applyQuaternion(ne),F.copy(n.target).add(N),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),u.set(0,0,0));let ee=!1;if(n.zoomToCursor&&E){let he=null;if(n.object.isPerspectiveCamera){const Re=N.length();he=ie(Re*c);const tt=Re-he;n.object.position.addScaledVector(y,tt),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const Re=new L(b.x,b.y,0);Re.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),n.object.updateProjectionMatrix(),ee=!0;const tt=new L(b.x,b.y,0);tt.unproject(n.object),n.object.position.sub(tt).add(Re),n.object.updateMatrixWorld(),he=N.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;he!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(he).add(n.object.position):(Fo.origin.copy(n.object.position),Fo.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Fo.direction))o||8*(1-Ae.dot(n.object.quaternion))>o||Le.distanceToSquared(n.target)>0?(n.dispatchEvent(hh),Oe.copy(n.object.position),Ae.copy(n.object.quaternion),Le.copy(n.target),!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",re),n.domElement.removeEventListener("pointerdown",Ke),n.domElement.removeEventListener("pointercancel",st),n.domElement.removeEventListener("wheel",P),n.domElement.removeEventListener("pointermove",ke),n.domElement.removeEventListener("pointerup",st),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",w),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=i.NONE;const o=1e-6,a=new ch,l=new ch;let c=1;const u=new L,f=new Ue,h=new Ue,p=new Ue,_=new Ue,g=new Ue,m=new Ue,d=new Ue,x=new Ue,v=new Ue,y=new L,b=new Ue;let E=!1;const T=[],I={};function S(N){return N!==null?2*Math.PI/60*n.autoRotateSpeed*N:2*Math.PI/60/60*n.autoRotateSpeed}function A(){return Math.pow(.95,n.zoomSpeed)}function z(N){l.theta-=N}function O(N){l.phi-=N}const G=function(){const N=new L;return function(ne,Oe){N.setFromMatrixColumn(Oe,0),N.multiplyScalar(-ne),u.add(N)}}(),D=function(){const N=new L;return function(ne,Oe){n.screenSpacePanning===!0?N.setFromMatrixColumn(Oe,1):(N.setFromMatrixColumn(Oe,0),N.crossVectors(n.object.up,N)),N.multiplyScalar(ne),u.add(N)}}(),H=function(){const N=new L;return function(ne,Oe){const Ae=n.domElement;if(n.object.isPerspectiveCamera){const Le=n.object.position;N.copy(Le).sub(n.target);let Me=N.length();Me*=Math.tan(n.object.fov/2*Math.PI/180),G(2*ne*Me/Ae.clientHeight,n.object.matrix),D(2*Oe*Me/Ae.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(G(ne*(n.object.right-n.object.left)/n.object.zoom/Ae.clientWidth,n.object.matrix),D(Oe*(n.object.top-n.object.bottom)/n.object.zoom/Ae.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Z(N){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=N:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function J(N){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=N:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ce(N){if(!n.zoomToCursor)return;E=!0;const de=n.domElement.getBoundingClientRect(),ne=N.clientX-de.left,Oe=N.clientY-de.top,Ae=de.width,Le=de.height;b.x=ne/Ae*2-1,b.y=-(Oe/Le)*2+1,y.set(b.x,b.y,1).unproject(n.object).sub(n.object.position).normalize()}function ie(N){return Math.max(n.minDistance,Math.min(n.maxDistance,N))}function se(N){f.set(N.clientX,N.clientY)}function me(N){ce(N),d.set(N.clientX,N.clientY)}function ve(N){_.set(N.clientX,N.clientY)}function Q(N){h.set(N.clientX,N.clientY),p.subVectors(h,f).multiplyScalar(n.rotateSpeed);const de=n.domElement;z(2*Math.PI*p.x/de.clientHeight),O(2*Math.PI*p.y/de.clientHeight),f.copy(h),n.update()}function oe(N){x.set(N.clientX,N.clientY),v.subVectors(x,d),v.y>0?Z(A()):v.y<0&&J(A()),d.copy(x),n.update()}function Se(N){g.set(N.clientX,N.clientY),m.subVectors(g,_).multiplyScalar(n.panSpeed),H(m.x,m.y),_.copy(g),n.update()}function De(N){ce(N),N.deltaY<0?J(A()):N.deltaY>0&&Z(A()),n.update()}function _e(N){let de=!1;switch(N.code){case n.keys.UP:N.ctrlKey||N.metaKey||N.shiftKey?O(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):H(0,n.keyPanSpeed),de=!0;break;case n.keys.BOTTOM:N.ctrlKey||N.metaKey||N.shiftKey?O(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):H(0,-n.keyPanSpeed),de=!0;break;case n.keys.LEFT:N.ctrlKey||N.metaKey||N.shiftKey?z(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):H(n.keyPanSpeed,0),de=!0;break;case n.keys.RIGHT:N.ctrlKey||N.metaKey||N.shiftKey?z(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):H(-n.keyPanSpeed,0),de=!0;break}de&&(N.preventDefault(),n.update())}function qe(){if(T.length===1)f.set(T[0].pageX,T[0].pageY);else{const N=.5*(T[0].pageX+T[1].pageX),de=.5*(T[0].pageY+T[1].pageY);f.set(N,de)}}function We(){if(T.length===1)_.set(T[0].pageX,T[0].pageY);else{const N=.5*(T[0].pageX+T[1].pageX),de=.5*(T[0].pageY+T[1].pageY);_.set(N,de)}}function Fe(){const N=T[0].pageX-T[1].pageX,de=T[0].pageY-T[1].pageY,ne=Math.sqrt(N*N+de*de);d.set(0,ne)}function Ye(){n.enableZoom&&Fe(),n.enablePan&&We()}function W(){n.enableZoom&&Fe(),n.enableRotate&&qe()}function Ct(N){if(T.length==1)h.set(N.pageX,N.pageY);else{const ne=ye(N),Oe=.5*(N.pageX+ne.x),Ae=.5*(N.pageY+ne.y);h.set(Oe,Ae)}p.subVectors(h,f).multiplyScalar(n.rotateSpeed);const de=n.domElement;z(2*Math.PI*p.x/de.clientHeight),O(2*Math.PI*p.y/de.clientHeight),f.copy(h)}function Ce(N){if(T.length===1)g.set(N.pageX,N.pageY);else{const de=ye(N),ne=.5*(N.pageX+de.x),Oe=.5*(N.pageY+de.y);g.set(ne,Oe)}m.subVectors(g,_).multiplyScalar(n.panSpeed),H(m.x,m.y),_.copy(g)}function $e(N){const de=ye(N),ne=N.pageX-de.x,Oe=N.pageY-de.y,Ae=Math.sqrt(ne*ne+Oe*Oe);x.set(0,Ae),v.set(0,Math.pow(x.y/d.y,n.zoomSpeed)),Z(v.y),d.copy(x)}function ze(N){n.enableZoom&&$e(N),n.enablePan&&Ce(N)}function mt(N){n.enableZoom&&$e(N),n.enableRotate&&Ct(N)}function Ke(N){n.enabled!==!1&&(T.length===0&&(n.domElement.setPointerCapture(N.pointerId),n.domElement.addEventListener("pointermove",ke),n.domElement.addEventListener("pointerup",st)),fe(N),N.pointerType==="touch"?X(N):Tt(N))}function ke(N){n.enabled!==!1&&(N.pointerType==="touch"?le(N):Lt(N))}function st(N){Ee(N),T.length===0&&(n.domElement.releasePointerCapture(N.pointerId),n.domElement.removeEventListener("pointermove",ke),n.domElement.removeEventListener("pointerup",st)),n.dispatchEvent(fh),s=i.NONE}function Tt(N){let de;switch(N.button){case 0:de=n.mouseButtons.LEFT;break;case 1:de=n.mouseButtons.MIDDLE;break;case 2:de=n.mouseButtons.RIGHT;break;default:de=-1}switch(de){case wr.DOLLY:if(n.enableZoom===!1)return;me(N),s=i.DOLLY;break;case wr.ROTATE:if(N.ctrlKey||N.metaKey||N.shiftKey){if(n.enablePan===!1)return;ve(N),s=i.PAN}else{if(n.enableRotate===!1)return;se(N),s=i.ROTATE}break;case wr.PAN:if(N.ctrlKey||N.metaKey||N.shiftKey){if(n.enableRotate===!1)return;se(N),s=i.ROTATE}else{if(n.enablePan===!1)return;ve(N),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&n.dispatchEvent(sl)}function Lt(N){switch(s){case i.ROTATE:if(n.enableRotate===!1)return;Q(N);break;case i.DOLLY:if(n.enableZoom===!1)return;oe(N);break;case i.PAN:if(n.enablePan===!1)return;Se(N);break}}function P(N){n.enabled===!1||n.enableZoom===!1||s!==i.NONE||(N.preventDefault(),n.dispatchEvent(sl),De(N),n.dispatchEvent(fh))}function w(N){n.enabled===!1||n.enablePan===!1||_e(N)}function X(N){switch(pe(N),T.length){case 1:switch(n.touches.ONE){case Mr.ROTATE:if(n.enableRotate===!1)return;qe(),s=i.TOUCH_ROTATE;break;case Mr.PAN:if(n.enablePan===!1)return;We(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(n.touches.TWO){case Mr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ye(),s=i.TOUCH_DOLLY_PAN;break;case Mr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;W(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&n.dispatchEvent(sl)}function le(N){switch(pe(N),s){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ct(N),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;Ce(N),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;ze(N),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;mt(N),n.update();break;default:s=i.NONE}}function re(N){n.enabled!==!1&&N.preventDefault()}function fe(N){T.push(N)}function Ee(N){delete I[N.pointerId];for(let de=0;de=2.0 are supported."));return}const c=new Ux(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function ox(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const at={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ax{constructor(e){this.parser=e,this.name=at.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class yx{constructor(e){this.parser=e,this.name=at.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class bx{constructor(e){this.parser=e,this.name=at.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Sx{constructor(e){this.name=at.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,u=i.count,f=i.byteStride,h=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,f,h,i.mode,i.filter).then(function(p){return p.buffer}):o.ready.then(function(){const p=new ArrayBuffer(u*f);return o.decodeGltfBuffer(new Uint8Array(p),u,f,h,i.mode,i.filter),p})})}else return null}}class wx{constructor(e){this.name=at.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const c of i.primitives)if(c.mode!==zn.TRIANGLES&&c.mode!==zn.TRIANGLE_STRIP&&c.mode!==zn.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=n.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),f=u.isGroup?u.children:[u],h=c[0].count,p=[];for(const _ of f){const g=new Ve,m=new L,d=new pi,x=new L(1,1,1),v=new y0(_.geometry,_.material,h);for(let y=0;y0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ox=new Ve;class Ux{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ox,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,s=-1;typeof navigator<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&s<98?this.textureLoader=new U0(this.options.manager):this.textureLoader=new W0(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Pf(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:n,userData:{}};return tr(s,a,i),zi(a,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())s(u,a.children[c])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&m.setY(S,E[T*l+1]),l>=3&&m.setZ(S,E[T*l+2]),l>=4&&m.setW(S,E[T*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=n.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(s.samplers||{})[o.sampler]||{};return u.magFilter=gh[h.magFilter]||wn,u.minFilter=gh[h.minFilter]||mr,u.wrapS=vh[h.wrapS]||ls,u.wrapT=vh[h.wrapT]||ls,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=n.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const h=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(h),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(f){return new Promise(function(h,p){let _=h;t.isImageBitmapLoader===!0&&(_=function(g){const m=new on(g);m.needsUpdate=!0,h(m)}),t.load(qs.resolveURL(f,s.path),_,void 0,p)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),f.userData.mimeType=o.mimeType||Fx(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=u,u}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),s.extensions[at.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[at.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[at.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new Rf,fi.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new Af,fi.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(i||s||o){let a="ClonedMaterial:"+n.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return oc}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[at.KHR_MATERIALS_UNLIT]){const f=i[at.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,t))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new et(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const h=f.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],an),a.opacity=h[3]}f.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",f.baseColorTexture,Ht)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=Kn);const u=s.alphaMode||al.OPAQUE;if(u===al.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===al.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Hi&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ue(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==Hi&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Hi){const f=s.emissiveFactor;a.emissive=new et().setRGB(f[0],f[1],f[2],an)}return s.emissiveTexture!==void 0&&o!==Hi&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,Ht)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),zi(f,s),t.associations.set(f,{materials:e}),s.extensions&&tr(i,f,s),f})}createUniqueName(e){const t=gt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(a){return n[at.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return xh(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Ix(d,s),d.name=t.createUniqueName(s.name||"mesh_"+e),zi(d,s),m.extensions&&tr(i,d,m),t.assignFinalMaterial(d),f.push(d)}for(let p=0,_=f.length;p<_;p++)t.associations.set(f[p],{meshes:e,primitives:p});if(f.length===1)return s.extensions&&tr(i,f[0],s),f[0];const h=new hr;s.extensions&&tr(i,h,s),t.associations.set(h,{meshes:e});for(let p=0,_=f.length;p<_;p++)h.add(f[p]);return h})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new gn(of.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new io(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),zi(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i1?u=new hr:c.length===1?u=c[0]:u=new Bt,u!==c[0])for(let f=0,h=c.length;f{const f=new Map;for(const[h,p]of i.associations)(h instanceof fi||h instanceof on)&&f.set(h,p);return u.traverse(h=>{const p=i.associations.get(h);p!=null&&f.set(h,p)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,t,n,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];Ui[s.path]===Ui.weights?e.traverse(function(h){h.morphTargetInfluences&&l.push(h.name?h.name:h.uuid)}):l.push(a);let c;switch(Ui[s.path]){case Ui.weights:c=ds;break;case Ui.rotation:c=_r;break;case Ui.position:case Ui.scale:c=ps;break;default:switch(n.itemSize){case 1:c=ds;break;case 2:case 3:default:c=ps;break}break}const u=i.interpolation!==void 0?Lx[i.interpolation]:us,f=this._getArrayFromAccessor(n);for(let h=0,p=l.length;hl+1e3&&(u.update(1e3*c/(p-l),100),l=p,c=0,h)){var _=performance.memory;h.update(_.usedJSHeapSize/1048576,_.jsHeapSizeLimit/1048576)}return p},update:function(){a=this.end()},domElement:o,setMode:i}};return t.Panel=function(n,i,s){var o=1/0,a=0,l=Math.round,c=l(window.devicePixelRatio||1),u=80*c,f=48*c,h=3*c,p=2*c,_=3*c,g=15*c,m=74*c,d=30*c,x=document.createElement("canvas");x.width=u,x.height=f,x.style.cssText="width:80px;height:48px";var v=x.getContext("2d");return v.font="bold "+9*c+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=s,v.fillRect(0,0,u,f),v.fillStyle=i,v.fillText(n,h,p),v.fillRect(_,g,m,d),v.fillStyle=s,v.globalAlpha=.9,v.fillRect(_,g,m,d),{dom:x,update:function(y,b){o=Math.min(o,y),a=Math.max(a,y),v.fillStyle=s,v.globalAlpha=1,v.fillRect(0,0,u,g),v.fillStyle=i,v.fillText(l(y)+" "+n+" ("+l(o)+"-"+l(a)+")",h,p),v.drawImage(x,_+c,g,m-c,d,_,g,m-c,d),v.fillRect(_+m-c,g,c,d),v.fillStyle=s,v.globalAlpha=.9,v.fillRect(_+m-c,g,c,l((1-y/b)*d))}}},t})})(Ff);var kx=Ff.exports;const Hx=zx(kx),Of=0,Vx=1,Uf=2,yh=2,cl=1.25,bh=1,pr=6*4+4+4,ya=65535,Gx=Math.pow(2,-24),ul=Symbol("SKIP_GENERATION");function Bf(r){return r.index?r.index.count:r.attributes.position.count}function ys(r){return Bf(r)/3}function zf(r,e=ArrayBuffer){return r>65535?new Uint32Array(new e(4*r)):new Uint16Array(new e(2*r))}function Wx(r,e){if(!r.index){const t=r.attributes.position.count,n=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=zf(t,n);r.setIndex(new Yt(i,1));for(let s=0;sa-l);for(let a=0;as.offset-o.offset),n=t[t.length-1];n.count=Math.min(e-n.offset,n.count);let i=0;return t.forEach(({count:s})=>i+=s),e!==i}function Ut(r,e,t){return t.min.x=e[r],t.min.y=e[r+1],t.min.z=e[r+2],t.max.x=e[r+3],t.max.y=e[r+4],t.max.z=e[r+5],t}function qx(r){r[0]=r[1]=r[2]=1/0,r[3]=r[4]=r[5]=-1/0}function Sh(r){let e=-1,t=-1/0;for(let n=0;n<3;n++){const i=r[n+3]-r[n];i>t&&(t=i,e=n)}return e}function wh(r,e){e.set(r)}function Mh(r,e,t){let n,i;for(let s=0;s<3;s++){const o=s+3;n=r[s],i=e[s],t[s]=ni?n:i}}function Oo(r,e,t){for(let n=0;n<3;n++){const i=e[r+2*n],s=e[r+2*n+1],o=i-s,a=i+s;ot[n+3]&&(t[n+3]=a)}}function Ds(r){const e=r[3]-r[0],t=r[4]-r[1],n=r[5]-r[2];return 2*(e*t+t*n+n*e)}function hl(r,e,t,n,i=null){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0,f=1/0,h=1/0,p=1/0,_=-1/0,g=-1/0,m=-1/0;const d=i!==null;for(let x=e*6,v=(e+t)*6;xl&&(l=T),d&&y_&&(_=y);const I=r[x+2],S=r[x+3],A=I-S,z=I+S;Ac&&(c=z),d&&Ig&&(g=I);const O=r[x+4],G=r[x+5],D=O-G,H=O+G;Du&&(u=H),d&&Om&&(m=O)}n[0]=s,n[1]=o,n[2]=a,n[3]=l,n[4]=c,n[5]=u,d&&(i[0]=f,i[1]=h,i[2]=p,i[3]=_,i[4]=g,i[5]=m)}function jx(r,e,t,n){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let u=e*6,f=(e+t)*6;ua&&(a=h);const p=r[u+2];pl&&(l=p);const _=r[u+4];_c&&(c=_)}n[0]=i,n[1]=s,n[2]=o,n[3]=a,n[4]=l,n[5]=c}function Yx(r,e){qx(e);const t=r.attributes.position,n=r.index?r.index.array:null,i=ys(r),s=new Float32Array(i*6),o=t.normalized,a=t.array,l=t.offset||0;let c=3;t.isInterleavedBufferAttribute&&(c=t.data.stride);const u=["getX","getY","getZ"];for(let f=0;fE&&(E=v),y>E&&(E=y);const T=(E-b)/2,I=d*2;s[p+I+0]=b+T,s[p+I+1]=T+(Math.abs(b)+T)*Gx,be[d+3]&&(e[d+3]=E)}}return s}const Ei=32,$x=(r,e)=>r.candidate-e.candidate,Bi=new Array(Ei).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Uo=new Float32Array(6);function Kx(r,e,t,n,i,s){let o=-1,a=0;if(s===Of)o=Sh(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Vx)o=Sh(r),o!==-1&&(a=Zx(t,n,i,o));else if(s===Uf){const l=Ds(r);let c=cl*i;const u=n*6,f=(n+i)*6;for(let h=0;h<3;h++){const p=e[h],m=(e[h+3]-p)/Ei;if(i=T.candidate?Oo(y,t,T.rightCacheBounds):(Oo(y,t,T.leftCacheBounds),T.count++)}}for(let y=0;y=Ei&&(E=Ei-1);const T=Bi[E];T.count++,Oo(v,t,T.bounds)}const d=Bi[Ei-1];wh(d.bounds,d.rightCacheBounds);for(let v=Ei-2;v>=0;v--){const y=Bi[v],b=Bi[v+1];Mh(y.bounds,b.rightCacheBounds,y.rightCacheBounds)}let x=0;for(let v=0;v=l;)a--;if(o=l;)a--;if(o2**16,i=n?4:2,s=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),o=n?new Uint32Array(s):new Uint16Array(s);for(let a=0,l=o.length;a=i&&(f=!0,s&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),E<=o||I>=i)return x(b+E),y.offset=b,y.count=E,y;const S=Kx(y.boundingData,T,_,b,E,a);if(S.axis===-1)return x(b+E),y.offset=b,y.count=E,y;const A=g(u,n,_,b,E,S);if(A===b||A===b+E)x(b+E),y.offset=b,y.count=E;else{y.splitAxis=S.axis;const z=new Bo,O=b,G=A-b;y.left=z,z.boundingData=new Float32Array(6),hl(_,O,G,z.boundingData,p),v(z,O,G,p,I+1);const D=new Bo,H=A,Z=E-G;y.right=D,D.boundingData=new Float32Array(6),hl(_,H,Z,D.boundingData,p),v(D,H,Z,p,I+1)}return y}}function ny(r,e){const t=r.geometry;e.indirect&&(r._indirectBuffer=ey(t,e.useSharedArrayBuffer),Xx(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),r._indirectBuffer||Wx(t,e);const n=ty(r,e);let i,s,o;const a=[],l=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let f=0;fMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return s[p+6]=y/4,y=u(y,x),s[p+7]=v,y}}}class Ri{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let n=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=n,this.max=i}setFromPoints(e,t){let n=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=n,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}Ri.prototype.setFromBox=function(){const r=new L;return function(t,n){const i=n.min,s=n.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){r.x=i.x*l+s.x*(1-l),r.y=i.y*c+s.y*(1-c),r.z=i.z*u+s.z*(1-u);const f=t.dot(r);o=Math.min(f,o),a=Math.max(f,a)}this.min=o,this.max=a}}();const iy=function(){const r=new L,e=new L,t=new L;return function(i,s,o){const a=i.start,l=r,c=s.start,u=e;t.subVectors(a,c),r.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const f=t.dot(u),h=u.dot(l),p=u.dot(u),_=t.dot(l),m=l.dot(l)*p-h*h;let d,x;m!==0?d=(f*h-_*p)/m:d=0,x=(f+d*h)/p,o.x=d,o.y=x}}(),uc=function(){const r=new Ue,e=new L,t=new L;return function(i,s,o,a){iy(i,s,r);let l=r.x,c=r.y;if(l>=0&&l<=1&&c>=0&&c<=1){i.at(l,o),s.at(c,a);return}else if(l>=0&&l<=1){c<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(c>=0&&c<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let u;l<0?u=i.start:u=i.end;let f;c<0?f=s.start:f=s.end;const h=e,p=t;if(i.closestPointToPoint(f,!0,e),s.closestPointToPoint(u,!0,t),h.distanceToSquared(f)<=p.distanceToSquared(u)){o.copy(h),a.copy(f);return}else{o.copy(u),a.copy(p);return}}}}(),ry=function(){const r=new L,e=new L,t=new li,n=new Ai;return function(s,o){const{radius:a,center:l}=s,{a:c,b:u,c:f}=o;if(n.start=c,n.end=u,n.closestPointToPoint(l,!0,r).distanceTo(l)<=a||(n.start=c,n.end=f,n.closestPointToPoint(l,!0,r).distanceTo(l)<=a)||(n.start=u,n.end=f,n.closestPointToPoint(l,!0,r).distanceTo(l)<=a))return!0;const g=o.getPlane(t);if(Math.abs(g.distanceToPoint(l))<=a){const d=g.projectPoint(l,e);if(o.containsPoint(d))return!0}return!1}}(),sy=1e-15;function fl(r){return Math.abs(r)new L),this.satBounds=new Array(4).fill().map(()=>new Ri),this.points=[this.a,this.b,this.c],this.sphere=new ti,this.plane=new li,this.needsUpdate=!0}intersectsSphere(e){return ry(e,this)}update(){const e=this.a,t=this.b,n=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const c=s[1],u=o[1];c.subVectors(e,t),u.setFromPoints(c,i);const f=s[2],h=o[2];f.subVectors(t,n),h.setFromPoints(f,i);const p=s[3],_=o[3];p.subVectors(n,e),_.setFromPoints(p,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}ei.prototype.closestPointToSegment=function(){const r=new L,e=new L,t=new Ai;return function(i,s=null,o=null){const{start:a,end:l}=i,c=this.points;let u,f=1/0;for(let h=0;h<3;h++){const p=(h+1)%3;t.start.copy(c[h]),t.end.copy(c[p]),uc(t,i,r,e),u=r.distanceToSquared(e),u=2){(y===1?d.start:d.end).copy(p),v=2;break}if(v++,v===2&&y===-1)break}}return v}return function(m,d=null,x=!1){this.needsUpdate&&this.update(),m.isExtendedTriangle?m.needsUpdate&&m.update():(r.copy(m),r.update(),m=r);const v=this.plane,y=m.plane;if(Math.abs(v.normal.dot(y.normal))>1-1e-10){const b=this.satBounds,E=this.satAxes;t[0]=m.a,t[1]=m.b,t[2]=m.c;for(let S=0;S<4;S++){const A=b[S],z=E[S];if(n.setFromPoints(z,t),A.isSeparated(n))return!1}const T=m.satBounds,I=m.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let S=0;S<4;S++){const A=T[S],z=I[S];if(n.setFromPoints(z,e),A.isSeparated(n))return!1}for(let S=0;S<4;S++){const A=E[S];for(let z=0;z<4;z++){const O=I[z];if(s.crossVectors(A,O),n.setFromPoints(s,e),i.setFromPoints(s,t),n.isSeparated(i))return!1}}return d&&(x||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),d.start.set(0,0,0),d.end.set(0,0,0)),!0}else{const b=_(this,y,f);if(b===1&&m.containsPoint(f.end))return d&&(d.start.copy(f.end),d.end.copy(f.end)),!0;if(b!==2)return!1;const E=_(m,v,h);if(E===1&&this.containsPoint(h.end))return d&&(d.start.copy(h.end),d.end.copy(h.end)),!0;if(E!==2)return!1;if(f.delta(a),h.delta(l),a.dot(l)<0){let G=h.start;h.start=h.end,h.end=G}const T=f.start.dot(a),I=f.end.dot(a),S=h.start.dot(a),A=h.end.dot(a),z=I0?d.start.copy(f.start):d.start.copy(h.start),c.subVectors(f.end,h.end),c.dot(a)<0?d.end.copy(f.end):d.end.copy(h.end)),!0)}}}();ei.prototype.distanceToPoint=function(){const r=new L;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();ei.prototype.distanceToTriangle=function(){const r=new L,e=new L,t=["a","b","c"],n=new Ai,i=new Ai;return function(o,a=null,l=null){const c=a||l?n:null;if(this.intersectsTriangle(o,c))return(a||l)&&(a&&c.getCenter(a),l&&c.getCenter(l)),0;let u=1/0;for(let f=0;f<3;f++){let h;const p=t[f],_=o[p];this.closestPointToPoint(_,r),h=_.distanceToSquared(r),hnew L),this.satAxes=new Array(3).fill().map(()=>new L),this.satBounds=new Array(3).fill().map(()=>new Ri),this.alignedSatBounds=new Array(3).fill().map(()=>new Ri),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),n&&this.matrix.copy(n)}set(e,t,n){this.min.copy(e),this.max.copy(t),this.matrix.copy(n),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}bn.prototype.update=function(){return function(){const e=this.matrix,t=this.min,n=this.max,i=this.points;for(let c=0;c<=1;c++)for(let u=0;u<=1;u++)for(let f=0;f<=1;f++){const h=1*c|2*u|4*f,p=i[h];p.x=c?n.x:t.x,p.y=u?n.y:t.y,p.z=f?n.z:t.z,p.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let c=0;c<3;c++){const u=o[c],f=s[c],h=1<new Ai),t=new Array(12).fill().map(()=>new Ai),n=new L,i=new L;return function(o,a=0,l=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||c)&&(o.getCenter(i),this.closestPointToPoint(i,n),o.closestPointToPoint(n,i),l&&l.copy(n),c&&c.copy(i)),0;const u=a*a,f=o.min,h=o.max,p=this.points;let _=1/0;for(let m=0;m<8;m++){const d=p[m];i.copy(d).clamp(f,h);const x=d.distanceToSquared(i);if(x<_&&(_=x,l&&l.copy(d),c&&c.copy(i),xnew ei)}}const Vn=new oy;function Mn(r,e){return e[r+15]===65535}function Tn(r,e){return e[r+6]}function In(r,e){return e[r+14]}function Gn(r){return r+8}function Nn(r,e){return e[r+6]}function fc(r,e){return e[r+7]}class ay{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=n=>{t&&e.push(t),t=n,this.float32Array=new Float32Array(n),this.uint16Array=new Uint16Array(n),this.uint32Array=new Uint32Array(n)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const Rt=new ay;let Vi,ts;const Vr=[],zo=new hc(()=>new $t);function ly(r,e,t,n,i,s){Vi=zo.getPrimitive(),ts=zo.getPrimitive(),Vr.push(Vi,ts),Rt.setBuffer(r._roots[e]);const o=Hl(0,r.geometry,t,n,i,s);Rt.clearBuffer(),zo.releasePrimitive(Vi),zo.releasePrimitive(ts),Vr.pop(),Vr.pop();const a=Vr.length;return a>0&&(ts=Vr[a-1],Vi=Vr[a-2]),o}function Hl(r,e,t,n,i=null,s=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:c}=Rt;let u=r*2;if(Mn(u,l)){const _=Tn(r,c),g=In(u,l);return Ut(r,a,Vi),n(_,g,!1,o,s+r,Vi)}else{let O=function(D){const{uint16Array:H,uint32Array:Z}=Rt;let J=D*2;for(;!Mn(J,H);)D=Gn(D),J=D*2;return Tn(D,Z)},G=function(D){const{uint16Array:H,uint32Array:Z}=Rt;let J=D*2;for(;!Mn(J,H);)D=Nn(D,Z),J=D*2;return Tn(D,Z)+In(J,H)};var h=O,p=G;const _=Gn(r),g=Nn(r,c);let m=_,d=g,x,v,y,b;if(i&&(y=Vi,b=ts,Ut(m,a,y),Ut(d,a,b),x=i(y),v=i(b),v(Is.copy(e).clamp(u.min,u.max),Is.distanceToSquared(e)),intersectsBounds:(u,f,h)=>h{u.closestPointToPoint(e,Is);const h=e.distanceToSquared(Is);return h0&&c.normal.multiplyScalar(-1));const u={a:s,b:o,c:a,normal:new L,materialIndex:0};fn.getNormal(Gr,Wr,Xr,u.normal),c.face=u,c.faceIndex=s}return c}function ba(r,e,t,n,i){const s=n*3;let o=s+0,a=s+1,l=s+2;const c=r.index;r.index&&(o=c.getX(o),a=c.getX(a),l=c.getX(l));const{position:u,normal:f,uv:h,uv1:p}=r.attributes,_=hy(t,u,f,h,p,o,a,l,e);return _?(_.faceIndex=n,i&&i.push(_),_):null}function jt(r,e,t,n){const i=r.a,s=r.b,o=r.c;let a=e,l=e+1,c=e+2;t&&(a=t.getX(a),l=t.getX(l),c=t.getX(c)),i.x=n.getX(a),i.y=n.getY(a),i.z=n.getZ(a),s.x=n.getX(l),s.y=n.getY(l),s.z=n.getZ(l),o.x=n.getX(c),o.y=n.getY(c),o.z=n.getZ(c)}function fy(r,e,t,n,i,s){const{geometry:o,_indirectBuffer:a}=r;for(let l=n,c=n+i;lE&&(E=O),GT&&(T=G),DI&&(I=D)}return l[h+0]!==v||l[h+1]!==y||l[h+2]!==b||l[h+3]!==E||l[h+4]!==T||l[h+5]!==I?(l[h+0]=v,l[h+1]=y,l[h+2]=b,l[h+3]=E,l[h+4]=T,l[h+5]=I,!0):!1}else{const d=h+8,x=o[h+6],v=d+p,y=x+p;let b=_,E=!1,T=!1;e?b||(E=e.has(v),T=e.has(y),b=!E&&!T):(E=!0,T=!0);const I=b||E,S=b||T;let A=!1;I&&(A=f(d,p,b));let z=!1;S&&(z=f(x,p,b));const O=A||z;if(O)for(let G=0;G<3;G++){const D=d+G,H=x+G,Z=l[D],J=l[D+3],ce=l[H],ie=l[H+3];l[h+G]=Zie?J:ie}return O}}}const Rh=new $t;function Yi(r,e,t,n){return Ut(r,e,Rh),t.intersectBox(Rh,n)}function _y(r,e,t,n,i,s){const{geometry:o,_indirectBuffer:a}=r;for(let l=n,c=n+i;l=0;let p,_;h?(p=Gn(r),_=Nn(r,o)):(p=Nn(r,o),_=Gn(r));const m=Yi(p,i,n,Lh)?Gl(p,e,t,n):null;if(m){const v=m.point[u];if(h?v<=i[_+c]:v>=i[_+c+3])return m}const x=Yi(_,i,n,Lh)?Gl(_,e,t,n):null;return m&&x?m.distance<=x.distance?m:x:m||x||null}}const Wo=new $t,qr=new ei,jr=new ei,Ns=new Ve,Ph=new bn,Xo=new bn;function Sy(r,e,t,n){Rt.setBuffer(r._roots[e]);const i=Wl(0,r,t,n);return Rt.clearBuffer(),i}function Wl(r,e,t,n,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Rt;let l=r*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Ph.set(t.boundingBox.min,t.boundingBox.max,n),i=Ph),Mn(l,o)){const u=e.geometry,f=u.index,h=u.attributes.position,p=t.index,_=t.attributes.position,g=Tn(r,a),m=In(l,o);if(Ns.copy(n).invert(),t.boundsTree)return Ut(r,s,Xo),Xo.matrix.copy(Ns),Xo.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:x=>Xo.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(n),x.b.applyMatrix4(n),x.c.applyMatrix4(n),x.needsUpdate=!0;for(let v=g*3,y=(m+g)*3;vpl.distanceToBox(b),intersectsBounds:(b,E,T)=>T{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:I=>Fs.distanceToBox(I),intersectsBounds:(I,S,A)=>A{for(let A=I,z=I+S;AE&&(E=D),HT&&(T=H),ZI&&(I=Z)}}return l[h+0]!==v||l[h+1]!==y||l[h+2]!==b||l[h+3]!==E||l[h+4]!==T||l[h+5]!==I?(l[h+0]=v,l[h+1]=y,l[h+2]=b,l[h+3]=E,l[h+4]=T,l[h+5]=I,!0):!1}else{const d=h+8,x=o[h+6],v=d+p,y=x+p;let b=_,E=!1,T=!1;e?b||(E=e.has(v),T=e.has(y),b=!E&&!T):(E=!0,T=!0);const I=b||E,S=b||T;let A=!1;I&&(A=f(d,p,b));let z=!1;S&&(z=f(x,p,b));const O=A||z;if(O)for(let G=0;G<3;G++){const D=d+G,H=x+G,Z=l[D],J=l[D+3],ce=l[H],ie=l[H+3];l[h+G]=Zie?J:ie}return O}}}const Dh=new L;function Cy(r,e,t,n,i){Rt.setBuffer(r._roots[e]),Xl(0,r,t,n,i),Rt.clearBuffer()}function Xl(r,e,t,n,i){const{float32Array:s,uint16Array:o,uint32Array:a}=Rt,l=r*2;if(Mn(l,o)){const u=Tn(r,a),f=In(l,o);_y(e,t,n,u,f,i)}else{const u=Gn(r);Yi(u,s,n,Dh)&&Xl(u,e,t,n,i);const f=Nn(r,a);Yi(f,s,n,Dh)&&Xl(f,e,t,n,i)}}const Ih=new L,Ly=["x","y","z"];function Py(r,e,t,n){Rt.setBuffer(r._roots[e]);const i=ql(0,r,t,n);return Rt.clearBuffer(),i}function ql(r,e,t,n){const{float32Array:i,uint16Array:s,uint32Array:o}=Rt;let a=r*2;if(Mn(a,s)){const c=Tn(r,o),u=In(a,s);return gy(e,t,n,c,u)}else{const c=fc(r,o),u=Ly[c],h=n.direction[u]>=0;let p,_;h?(p=Gn(r),_=Nn(r,o)):(p=Nn(r,o),_=Gn(r));const m=Yi(p,i,n,Ih)?ql(p,e,t,n):null;if(m){const v=m.point[u];if(h?v<=i[_+c]:v>=i[_+c+3])return m}const x=Yi(_,i,n,Ih)?ql(_,e,t,n):null;return m&&x?m.distance<=x.distance?m:x:m||x||null}}const jo=new $t,Yr=new ei,$r=new ei,Os=new Ve,Nh=new bn,Yo=new bn;function Dy(r,e,t,n){Rt.setBuffer(r._roots[e]);const i=jl(0,r,t,n);return Rt.clearBuffer(),i}function jl(r,e,t,n,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Rt;let l=r*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Nh.set(t.boundingBox.min,t.boundingBox.max,n),i=Nh),Mn(l,o)){const u=e.geometry,f=u.index,h=u.attributes.position,p=t.index,_=t.attributes.position,g=Tn(r,a),m=In(l,o);if(Os.copy(n).invert(),t.boundsTree)return Ut(r,s,Yo),Yo.matrix.copy(Os),Yo.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:x=>Yo.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(n),x.b.applyMatrix4(n),x.c.applyMatrix4(n),x.needsUpdate=!0;for(let v=g,y=m+g;vml.distanceToBox(b),intersectsBounds:(b,E,T)=>T{if(e.boundsTree){const T=e.boundsTree;return T.shapecast({boundsTraverseOrder:I=>Us.distanceToBox(I),intersectsBounds:(I,S,A)=>A{for(let A=I,z=I+S;Anew $t),Kr=new $t,Zr=new $t,_l=new $t,gl=new $t;let vl=!1;function zy(r,e,t,n){if(vl)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");vl=!0;const i=r._roots,s=e._roots;let o,a=0,l=0;const c=new Ve().copy(t).invert();for(let u=0,f=i.length;ul.slice()),index:o.array.slice(),indirectBuffer:s?s.slice():null}:a={roots:i,index:o.array,indirectBuffer:s},a}static deserialize(e,t,n={}){n={setIndex:!0,indirect:!!e.indirectBuffer,...n};const{index:i,roots:s,indirectBuffer:o}=e,a=new dc(t,{...n,[ul]:!0});if(a._roots=s,a._indirectBuffer=o||null,n.setIndex){const l=t.getIndex();if(l===null){const c=new Yt(e.index,1,!1);t.setIndex(c)}else l.array!==i&&(l.array.set(i),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Of,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[ul]:!1},t),t.useSharedArrayBuffer&&!By())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[ul]||(ny(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new $t)));const{_indirectBuffer:n}=this;this.resolveTriangleIndex=t.indirect?i=>n[i]:i=>i}refit(e=null){return(this.indirect?Ry:my)(this,e)}traverse(e,t=0){const n=this._roots[t],i=new Uint32Array(n),s=new Uint16Array(n);o(0);function o(a,l=0){const c=a*2,u=s[c+15]===ya;if(u){const f=i[a+6],h=s[c+14];e(l,u,new Float32Array(n,a*4,6),f,h)}else{const f=a+pr/4,h=i[a+6],p=i[a+7];e(l,u,new Float32Array(n,a*4,6),p)||(o(f,l+1),o(h,l+1))}}}raycast(e,t=Qn){const n=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,c=o?t.side:t,u=this.indirect?Cy:xy;for(let f=0,h=n.length;ff(h,p,_,g,m)?!0:n(h,p,this,a,_,g,t)}else o||(a?o=(f,h,p,_)=>n(f,h,this,a,p,_,t):o=(f,h,p)=>p);let l=!1,c=0;const u=this._roots;for(let f=0,h=u.length;f{const g=this.resolveTriangleIndex(_);jt(o,g*3,a,l)}:_=>{jt(o,_*3,a,l)},u=Vn.getPrimitive(),f=e.geometry.index,h=e.geometry.attributes.position,p=e.indirect?_=>{const g=e.resolveTriangleIndex(_);jt(u,g*3,f,h)}:_=>{jt(u,_*3,f,h)};if(s){const _=(g,m,d,x,v,y,b,E)=>{for(let T=d,I=d+x;TKo.intersectsBox(n),intersectsTriangle:n=>Ko.intersectsTriangle(n)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,n={},i={},s=0,o=1/0){return(this.indirect?Uy:Ay)(this,e,t,n,i,s,o)}closestPointToPoint(e,t={},n=0,i=1/0){return cy(this,e,t,n,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(n=>{Ut(0,new Float32Array(n),Fh),e.union(Fh)}),e}}function ky(r){switch(r){case 1:return"R";case 2:return"RG";case 3:return"RGBA";case 4:return"RGBA"}throw new Error}function Hy(r){switch(r){case 1:return Jh;case 2:return Qh;case 3:return sn;case 4:return sn}}function Oh(r){switch(r){case 1:return Zl;case 2:return ma;case 3:return Ks;case 4:return Ks}}class Vf extends ca{constructor(){super(),this.minFilter=Nt,this.magFilter=Nt,this.generateMipmaps=!1,this.overrideItemSize=null,this._forcedType=null}updateFrom(e){const t=this.overrideItemSize,n=e.itemSize,i=e.count;if(t!==null){if(n*i%t!==0)throw new Error("VertexAttributeTexture: overrideItemSize must divide evenly into buffer length.");e.itemSize=t,e.count=i*n/t}const s=e.itemSize,o=e.count,a=e.normalized,l=e.array.constructor,c=l.BYTES_PER_ELEMENT;let u=this._forcedType,f=s;if(u===null)switch(l){case Float32Array:u=vn;break;case Uint8Array:case Uint16Array:case Uint32Array:u=Dn;break;case Int8Array:case Int16Array:case Int32Array:u=Vs;break}let h,p,_,g,m=ky(s);switch(u){case vn:_=1,p=Hy(s),a&&c===1?(g=l,m+="8",l===Uint8Array?h=hi:(h=Ll,m+="_SNORM")):(g=Float32Array,m+="32F",h=vn);break;case Vs:m+=c*8+"I",_=a?Math.pow(2,l.BYTES_PER_ELEMENT*8-1):1,p=Oh(s),c===1?(g=Int8Array,h=Ll):c===2?(g=Int16Array,h=$h):(g=Int32Array,h=Vs);break;case Dn:m+=c*8+"UI",_=a?Math.pow(2,l.BYTES_PER_ELEMENT*8-1):1,p=Oh(s),c===1?(g=Uint8Array,h=hi):c===2?(g=Uint16Array,h=pa):(g=Uint32Array,h=Dn);break}f===3&&(p===sn||p===Ks)&&(f=4);const d=Math.ceil(Math.sqrt(o)),x=f*d*d,v=new g(x),y=e.normalized;e.normalized=!1;for(let b=0;b=2&&(v[E+1]=e.getY(b)/_),s>=3&&(v[E+2]=e.getZ(b)/_,f===4&&(v[E+3]=1)),s>=4&&(v[E+3]=e.getW(b)/_)}e.normalized=y,this.internalFormat=m,this.format=p,this.type=h,this.image.width=d,this.image.height=d,this.image.data=v,this.needsUpdate=!0,this.dispose(),e.itemSize=n,e.count=i}}class Vy extends Vf{constructor(){super(),this._forcedType=Dn}}class ks extends Vf{constructor(){super(),this._forcedType=vn}}class Uh{constructor(){this.index=new Vy,this.position=new ks,this.bvhBounds=new ca,this.bvhContents=new ca,this._cachedIndexAttr=null,this.index.overrideItemSize=3}updateFrom(e){const{geometry:t}=e;if(Wy(e,this.bvhBounds,this.bvhContents),this.position.updateFrom(t.attributes.position),e.indirect){const n=e._indirectBuffer;if(this._cachedIndexAttr===null||this._cachedIndexAttr.count!==n.length)if(t.index)this._cachedIndexAttr=t.index.clone();else{const i=zf(Bf(t));this._cachedIndexAttr=new Yt(i,1,!1)}Gy(t,n,this._cachedIndexAttr),this.index.updateFrom(this._cachedIndexAttr)}else this.index.updateFrom(t.index)}dispose(){const{index:e,position:t,bvhBounds:n,bvhContents:i}=this;e&&e.dispose(),t&&t.dispose(),n&&n.dispose(),i&&i.dispose()}}function Gy(r,e,t){const n=t.array,i=r.index?r.index.array:null;for(let s=0,o=e.length;s=2&&e.setY(o,r.getY(i)),n>=3&&e.setZ(o,r.getZ(i)),n>=4&&e.setW(o,r.getW(i))}}else{const n=e.array,i=n.constructor,s=n.BYTES_PER_ELEMENT*r.itemSize*t;new i(n.buffer,s,r.array.length).set(r.array)}}function Xy(r,e,t){const n=r.elements,i=e.elements;for(let s=0,o=i.length;s{n.traverseVisible(i=>{i.isMesh&&t.push(i)})}),this.meshes=t,this.useGroups=!0,this.applyWorldTransforms=!0,this.attributes=["position","normal","color","tangent","uv","uv2"],this._intermediateGeometry=new Array(t.length).fill().map(()=>new vn),this._diffMap=new WeakMap}getMaterials(){const e=[];return this.meshes.forEach(t=>{Array.isArray(t.material)?e.push(...t.material):e.push(t.material)}),e}generate(e=new vn){let t=[];const{meshes:n,useGroups:i,_intermediateGeometry:s,_diffMap:o}=this;for(let a=0,l=n.length;a=2&&e.setY(o,r.getY(i)),n>=3&&e.setZ(o,r.getZ(i)),n>=4&&e.setW(o,r.getW(i))}}else{const n=e.array,i=n.constructor,s=n.BYTES_PER_ELEMENT*r.itemSize*t;new i(n.buffer,s,r.array.length).set(r.array)}}function jy(r,e,t){const n=r.elements,i=e.elements;for(let s=0,o=i.length;s{n.traverseVisible(i=>{i.isMesh&&t.push(i)})}),this.meshes=t,this.useGroups=!0,this.applyWorldTransforms=!0,this.attributes=["position","normal","color","tangent","uv","uv2"],this._intermediateGeometry=new Array(t.length).fill().map(()=>new yn),this._diffMap=new WeakMap}getMaterials(){const e=[];return this.meshes.forEach(t=>{Array.isArray(t.material)?e.push(...t.material):e.push(t.material)}),e}generate(e=new yn){let t=[];const{meshes:n,useGroups:i,_intermediateGeometry:s,_diffMap:o}=this;for(let a=0,l=n.length;a{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function jl(r){let e,t;return(e=r.match(/(#|0x)?([a-f0-9]{6})/i))?t=e[2]:(e=r.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?t=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=r.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(t=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),!!t&&"#"+t}const Zy={isPrimitive:!0,match:r=>typeof r=="string",fromHexString:jl,toHexString:jl},Zs={isPrimitive:!0,match:r=>typeof r=="number",fromHexString:r=>parseInt(r.substring(1),16),toHexString:r=>"#"+r.toString(16).padStart(6,0)},Jy={isPrimitive:!1,match:Array.isArray,fromHexString(r,e,t=1){const n=Zs.fromHexString(r);e[0]=(n>>16&255)/255*t,e[1]=(n>>8&255)/255*t,e[2]=(255&n)/255*t},toHexString:([r,e,t],n=1)=>Zs.toHexString(r*(n=255/n)<<16^e*n<<8^t*n<<0)},Qy={isPrimitive:!1,match:r=>Object(r)===r,fromHexString(r,e,t=1){const n=Zs.fromHexString(r);e.r=(n>>16&255)/255*t,e.g=(n>>8&255)/255*t,e.b=(255&n)/255*t},toHexString:({r,g:e,b:t},n=1)=>Zs.toHexString(r*(n=255/n)<<16^e*n<<8^t*n<<0)},eb=[Zy,Zs,Jy,Qy];class tb extends fi{constructor(e,t,n,i){var s;super(e,t,n,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(s=this.initialValue,eb.find(o=>o.match(s))),this._rgbScale=i,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const o=jl(this.$text.value);o&&this._setValueFromHexString(o)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(e){if(this._format.isPrimitive){const t=this._format.fromHexString(e);this.setValue(t)}else this._format.fromHexString(e,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(e){return this._setValueFromHexString(e),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class xl extends fi{constructor(e,t,n){super(e,t,n,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",i=>{i.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class nb extends fi{constructor(e,t,n,i,s,o){super(e,t,n,"number"),this._initInput(),this.min(i),this.max(s);const a=o!==void 0;this.step(a?o:this._getImplicitStep(),a),this.updateDisplay()}decimals(e){return this._decimals=e,this.updateDisplay(),this}min(e){return this._min=e,this._onUpdateMinMax(),this}max(e){return this._max=e,this._onUpdateMinMax(),this}step(e,t=!0){return this._step=e,this._stepExplicit=t,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let t=(e-this._min)/(this._max-this._min);t=Math.max(0,Math.min(t,1)),this.$fill.style.width=100*t+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?e:e.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const e=u=>{const h=parseFloat(this.$input.value);isNaN(h)||(this._snapClampSetValue(h+u),this.$input.value=this.getValue())};let t,n,i,s,o,a=!1;const l=u=>{if(a){const h=u.clientX-t,f=u.clientY-n;Math.abs(f)>5?(u.preventDefault(),this.$input.blur(),a=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(h)>5&&c()}if(!a){const h=u.clientY-i;o-=h*this._step*this._arrowKeyMultiplier(u),s+o>this._max?o=this._max-s:s+o{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",c)};this.$input.addEventListener("input",()=>{let u=parseFloat(this.$input.value);isNaN(u)||(this._stepExplicit&&(u=this._snap(u)),this.setValue(this._clamp(u)))}),this.$input.addEventListener("keydown",u=>{u.code==="Enter"&&this.$input.blur(),u.code==="ArrowUp"&&(u.preventDefault(),e(this._step*this._arrowKeyMultiplier(u))),u.code==="ArrowDown"&&(u.preventDefault(),e(this._step*this._arrowKeyMultiplier(u)*-1))}),this.$input.addEventListener("wheel",u=>{this._inputFocused&&(u.preventDefault(),e(this._step*this._normalizeMouseWheel(u)))},{passive:!1}),this.$input.addEventListener("mousedown",u=>{t=u.clientX,n=i=u.clientY,a=!0,s=this.getValue(),o=0,window.addEventListener("mousemove",l),window.addEventListener("mouseup",c)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const e=f=>{const d=this.$slider.getBoundingClientRect();let _=(g=f,m=d.left,p=d.right,y=this._min,v=this._max,(g-m)/(p-m)*(v-y)+y);var g,m,p,y,v;this._snapClampSetValue(_)},t=f=>{e(f.clientX)},n=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)};let i,s,o=!1;const a=f=>{f.preventDefault(),this._setDraggingStyle(!0),e(f.touches[0].clientX),o=!1},l=f=>{if(o){const d=f.touches[0].clientX-i,_=f.touches[0].clientY-s;Math.abs(d)>Math.abs(_)?a(f):(window.removeEventListener("touchmove",l),window.removeEventListener("touchend",c))}else f.preventDefault(),e(f.touches[0].clientX)},c=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",l),window.removeEventListener("touchend",c)},u=this._callOnFinishChange.bind(this);let h;this.$slider.addEventListener("mousedown",f=>{this._setDraggingStyle(!0),e(f.clientX),window.addEventListener("mousemove",t),window.addEventListener("mouseup",n)}),this.$slider.addEventListener("touchstart",f=>{f.touches.length>1||(this._hasScrollBar?(i=f.touches[0].clientX,s=f.touches[0].clientY,o=!0):a(f),window.addEventListener("touchmove",l,{passive:!1}),window.addEventListener("touchend",c))},{passive:!1}),this.$slider.addEventListener("wheel",f=>{if(Math.abs(f.deltaX)this._max&&(e=this._max),e}_snapClampSetValue(e){this.setValue(this._clamp(this._snap(e)))}get _hasScrollBar(){const e=this.parent.root.$children;return e.scrollHeight>e.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}class ib extends fi{constructor(e,t,n,i){super(e,t,n,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(i)?i:Object.values(i),this._names=Array.isArray(i)?i:Object.keys(i),this._names.forEach(s=>{const o=document.createElement("option");o.innerHTML=s,this.$select.appendChild(o)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const e=this.getValue(),t=this._values.indexOf(e);return this.$select.selectedIndex=t,this.$display.innerHTML=t===-1?e:this._names[t],this}}class rb extends fi{constructor(e,t,n){super(e,t,n,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",i=>{i.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let Vh=!1;class dc{constructor({parent:e,autoPlace:t=e===void 0,container:n,width:i,title:s="Controls",injectStyles:o=!0,touchStyles:a=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",l=>{l.code!=="Enter"&&l.code!=="Space"||(l.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(s),a&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!Vh&&o&&(function(l){const c=document.createElement("style");c.innerHTML=l;const u=document.querySelector("head link[rel=stylesheet], head style");u?document.head.insertBefore(c,u):document.head.appendChild(c)}('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"↕";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"▾";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"▸"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"✓";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),Vh=!0),n?n.appendChild(this.domElement):t&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),i&&this.domElement.style.setProperty("--width",i+"px"),this.domElement.addEventListener("keydown",l=>l.stopPropagation()),this.domElement.addEventListener("keyup",l=>l.stopPropagation())}add(e,t,n,i,s){if(Object(n)===n)return new ib(this,e,t,n);const o=e[t];switch(typeof o){case"number":return new nb(this,e,t,n,i,s);case"boolean":return new Ky(this,e,t);case"string":return new rb(this,e,t);case"function":return new xl(this,e,t)}console.error(`gui.add failed + */class di{constructor(e,t,n,i,s="div"){this.parent=e,this.object=t,this.property=n,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement(s),this.domElement.classList.add("controller"),this.domElement.classList.add(i),this.$name=document.createElement("div"),this.$name.classList.add("name"),di.nextNameID=di.nextNameID||0,this.$name.id=`lil-gui-name-${++di.nextNameID}`,this.$widget=document.createElement("div"),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.domElement.addEventListener("keydown",o=>o.stopPropagation()),this.domElement.addEventListener("keyup",o=>o.stopPropagation()),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(n)}name(e){return this._name=e,this.$name.innerHTML=e,this}onChange(e){return this._onChange=e,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(e=!0){return this.disable(!e)}disable(e=!0){return e===this._disabled?this:(this._disabled=e,this.domElement.classList.toggle("disabled",e),this.$disable.toggleAttribute("disabled",e),this)}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(e){const t=this.parent.add(this.object,this.property,e);return t.name(this._name),this.destroy(),t}min(e){return this}max(e){return this}step(e){return this}decimals(e){return this}listen(e=!0){return this._listening=e,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const e=this.save();e!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=e}getValue(){return this.object[this.property]}setValue(e){return this.object[this.property]=e,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(e){return this.setValue(e),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class Jy extends di{constructor(e,t,n){super(e,t,n,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function Yl(r){let e,t;return(e=r.match(/(#|0x)?([a-f0-9]{6})/i))?t=e[2]:(e=r.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?t=parseInt(e[1]).toString(16).padStart(2,0)+parseInt(e[2]).toString(16).padStart(2,0)+parseInt(e[3]).toString(16).padStart(2,0):(e=r.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(t=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),t?"#"+t:!1}const Qy={isPrimitive:!0,match:r=>typeof r=="string",fromHexString:Yl,toHexString:Yl},Qs={isPrimitive:!0,match:r=>typeof r=="number",fromHexString:r=>parseInt(r.substring(1),16),toHexString:r=>"#"+r.toString(16).padStart(6,0)},eb={isPrimitive:!1,match:r=>Array.isArray(r),fromHexString(r,e,t=1){const n=Qs.fromHexString(r);e[0]=(n>>16&255)/255*t,e[1]=(n>>8&255)/255*t,e[2]=(n&255)/255*t},toHexString([r,e,t],n=1){n=255/n;const i=r*n<<16^e*n<<8^t*n<<0;return Qs.toHexString(i)}},tb={isPrimitive:!1,match:r=>Object(r)===r,fromHexString(r,e,t=1){const n=Qs.fromHexString(r);e.r=(n>>16&255)/255*t,e.g=(n>>8&255)/255*t,e.b=(n&255)/255*t},toHexString({r,g:e,b:t},n=1){n=255/n;const i=r*n<<16^e*n<<8^t*n<<0;return Qs.toHexString(i)}},nb=[Qy,Qs,eb,tb];function ib(r){return nb.find(e=>e.match(r))}class rb extends di{constructor(e,t,n,i){super(e,t,n,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=ib(this.initialValue),this._rgbScale=i,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const s=Yl(this.$text.value);s&&this._setValueFromHexString(s)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(e){if(this._format.isPrimitive){const t=this._format.fromHexString(e);this.setValue(t)}else this._format.fromHexString(e,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(e){return this._setValueFromHexString(e),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class bl extends di{constructor(e,t,n){super(e,t,n,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",i=>{i.preventDefault(),this.getValue().call(this.object),this._callOnChange()}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class sb extends di{constructor(e,t,n,i,s,o){super(e,t,n,"number"),this._initInput(),this.min(i),this.max(s);const a=o!==void 0;this.step(a?o:this._getImplicitStep(),a),this.updateDisplay()}decimals(e){return this._decimals=e,this.updateDisplay(),this}min(e){return this._min=e,this._onUpdateMinMax(),this}max(e){return this._max=e,this._onUpdateMinMax(),this}step(e,t=!0){return this._step=e,this._stepExplicit=t,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let t=(e-this._min)/(this._max-this._min);t=Math.max(0,Math.min(t,1)),this.$fill.style.width=t*100+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?e:e.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),window.matchMedia("(pointer: coarse)").matches&&(this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any")),this.$widget.appendChild(this.$input),this.$disable=this.$input;const t=()=>{let x=parseFloat(this.$input.value);isNaN(x)||(this._stepExplicit&&(x=this._snap(x)),this.setValue(this._clamp(x)))},n=x=>{const v=parseFloat(this.$input.value);isNaN(v)||(this._snapClampSetValue(v+x),this.$input.value=this.getValue())},i=x=>{x.key==="Enter"&&this.$input.blur(),x.code==="ArrowUp"&&(x.preventDefault(),n(this._step*this._arrowKeyMultiplier(x))),x.code==="ArrowDown"&&(x.preventDefault(),n(this._step*this._arrowKeyMultiplier(x)*-1))},s=x=>{this._inputFocused&&(x.preventDefault(),n(this._step*this._normalizeMouseWheel(x)))};let o=!1,a,l,c,u,f;const h=5,p=x=>{a=x.clientX,l=c=x.clientY,o=!0,u=this.getValue(),f=0,window.addEventListener("mousemove",_),window.addEventListener("mouseup",g)},_=x=>{if(o){const v=x.clientX-a,y=x.clientY-l;Math.abs(y)>h?(x.preventDefault(),this.$input.blur(),o=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(v)>h&&g()}if(!o){const v=x.clientY-c;f-=v*this._step*this._arrowKeyMultiplier(x),u+f>this._max?f=this._max-u:u+f{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",g)},m=()=>{this._inputFocused=!0},d=()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()};this.$input.addEventListener("input",t),this.$input.addEventListener("keydown",i),this.$input.addEventListener("wheel",s,{passive:!1}),this.$input.addEventListener("mousedown",p),this.$input.addEventListener("focus",m),this.$input.addEventListener("blur",d)}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const e=(d,x,v,y,b)=>(d-x)/(v-x)*(b-y)+y,t=d=>{const x=this.$slider.getBoundingClientRect();let v=e(d,x.left,x.right,this._min,this._max);this._snapClampSetValue(v)},n=d=>{this._setDraggingStyle(!0),t(d.clientX),window.addEventListener("mousemove",i),window.addEventListener("mouseup",s)},i=d=>{t(d.clientX)},s=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",s)};let o=!1,a,l;const c=d=>{d.preventDefault(),this._setDraggingStyle(!0),t(d.touches[0].clientX),o=!1},u=d=>{d.touches.length>1||(this._hasScrollBar?(a=d.touches[0].clientX,l=d.touches[0].clientY,o=!0):c(d),window.addEventListener("touchmove",f,{passive:!1}),window.addEventListener("touchend",h))},f=d=>{if(o){const x=d.touches[0].clientX-a,v=d.touches[0].clientY-l;Math.abs(x)>Math.abs(v)?c(d):(window.removeEventListener("touchmove",f),window.removeEventListener("touchend",h))}else d.preventDefault(),t(d.touches[0].clientX)},h=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",f),window.removeEventListener("touchend",h)},p=this._callOnFinishChange.bind(this),_=400;let g;const m=d=>{if(Math.abs(d.deltaX)this._max&&(e=this._max),e}_snapClampSetValue(e){this.setValue(this._clamp(this._snap(e)))}get _hasScrollBar(){const e=this.parent.root.$children;return e.scrollHeight>e.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}class ob extends di{constructor(e,t,n,i){super(e,t,n,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.options(i)}options(e){return this._values=Array.isArray(e)?e:Object.values(e),this._names=Array.isArray(e)?e:Object.keys(e),this.$select.replaceChildren(),this._names.forEach(t=>{const n=document.createElement("option");n.innerHTML=t,this.$select.appendChild(n)}),this.updateDisplay(),this}updateDisplay(){const e=this.getValue(),t=this._values.indexOf(e);return this.$select.selectedIndex=t,this.$display.innerHTML=t===-1?e:this._names[t],this}}class ab extends di{constructor(e,t,n){super(e,t,n,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",i=>{i.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}const lb=`.lil-gui { + font-family: var(--font-family); + font-size: var(--font-size); + line-height: 1; + font-weight: normal; + font-style: normal; + text-align: left; + color: var(--text-color); + user-select: none; + -webkit-user-select: none; + touch-action: manipulation; + --background-color: #1f1f1f; + --text-color: #ebebeb; + --title-background-color: #111111; + --title-text-color: #ebebeb; + --widget-color: #424242; + --hover-color: #4f4f4f; + --focus-color: #595959; + --number-color: #2cc9ff; + --string-color: #a2db3c; + --font-size: 11px; + --input-font-size: 11px; + --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; + --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace; + --padding: 4px; + --spacing: 4px; + --widget-height: 20px; + --title-height: calc(var(--widget-height) + var(--spacing) * 1.25); + --name-width: 45%; + --slider-knob-width: 2px; + --slider-input-width: 27%; + --color-input-width: 27%; + --slider-input-min-width: 45px; + --color-input-min-width: 45px; + --folder-indent: 7px; + --widget-padding: 0 0 0 3px; + --widget-border-radius: 2px; + --checkbox-size: calc(0.75 * var(--widget-height)); + --scrollbar-width: 5px; +} +.lil-gui, .lil-gui * { + box-sizing: border-box; + margin: 0; + padding: 0; +} +.lil-gui.root { + width: var(--width, 245px); + display: flex; + flex-direction: column; + background: var(--background-color); +} +.lil-gui.root > .title { + background: var(--title-background-color); + color: var(--title-text-color); +} +.lil-gui.root > .children { + overflow-x: hidden; + overflow-y: auto; +} +.lil-gui.root > .children::-webkit-scrollbar { + width: var(--scrollbar-width); + height: var(--scrollbar-width); + background: var(--background-color); +} +.lil-gui.root > .children::-webkit-scrollbar-thumb { + border-radius: var(--scrollbar-width); + background: var(--focus-color); +} +@media (pointer: coarse) { + .lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui { + --widget-height: 28px; + --padding: 6px; + --spacing: 6px; + --font-size: 13px; + --input-font-size: 16px; + --folder-indent: 10px; + --scrollbar-width: 7px; + --slider-input-min-width: 50px; + --color-input-min-width: 65px; + } +} +.lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui { + --widget-height: 28px; + --padding: 6px; + --spacing: 6px; + --font-size: 13px; + --input-font-size: 16px; + --folder-indent: 10px; + --scrollbar-width: 7px; + --slider-input-min-width: 50px; + --color-input-min-width: 65px; +} +.lil-gui.autoPlace { + max-height: 100%; + position: fixed; + top: 0; + right: 15px; + z-index: 1001; +} + +.lil-gui .controller { + display: flex; + align-items: center; + padding: 0 var(--padding); + margin: var(--spacing) 0; +} +.lil-gui .controller.disabled { + opacity: 0.5; +} +.lil-gui .controller.disabled, .lil-gui .controller.disabled * { + pointer-events: none !important; +} +.lil-gui .controller > .name { + min-width: var(--name-width); + flex-shrink: 0; + white-space: pre; + padding-right: var(--spacing); + line-height: var(--widget-height); +} +.lil-gui .controller .widget { + position: relative; + display: flex; + align-items: center; + width: 100%; + min-height: var(--widget-height); +} +.lil-gui .controller.string input { + color: var(--string-color); +} +.lil-gui .controller.boolean { + cursor: pointer; +} +.lil-gui .controller.color .display { + width: 100%; + height: var(--widget-height); + border-radius: var(--widget-border-radius); + position: relative; +} +@media (hover: hover) { + .lil-gui .controller.color .display:hover:before { + content: " "; + display: block; + position: absolute; + border-radius: var(--widget-border-radius); + border: 1px solid #fff9; + top: 0; + right: 0; + bottom: 0; + left: 0; + } +} +.lil-gui .controller.color input[type=color] { + opacity: 0; + width: 100%; + height: 100%; + cursor: pointer; +} +.lil-gui .controller.color input[type=text] { + margin-left: var(--spacing); + font-family: var(--font-family-mono); + min-width: var(--color-input-min-width); + width: var(--color-input-width); + flex-shrink: 0; +} +.lil-gui .controller.option select { + opacity: 0; + position: absolute; + width: 100%; + max-width: 100%; +} +.lil-gui .controller.option .display { + position: relative; + pointer-events: none; + border-radius: var(--widget-border-radius); + height: var(--widget-height); + line-height: var(--widget-height); + max-width: 100%; + overflow: hidden; + word-break: break-all; + padding-left: 0.55em; + padding-right: 1.75em; + background: var(--widget-color); +} +@media (hover: hover) { + .lil-gui .controller.option .display.focus { + background: var(--focus-color); + } +} +.lil-gui .controller.option .display.active { + background: var(--focus-color); +} +.lil-gui .controller.option .display:after { + font-family: "lil-gui"; + content: "↕"; + position: absolute; + top: 0; + right: 0; + bottom: 0; + padding-right: 0.375em; +} +.lil-gui .controller.option .widget, +.lil-gui .controller.option select { + cursor: pointer; +} +@media (hover: hover) { + .lil-gui .controller.option .widget:hover .display { + background: var(--hover-color); + } +} +.lil-gui .controller.number input { + color: var(--number-color); +} +.lil-gui .controller.number.hasSlider input { + margin-left: var(--spacing); + width: var(--slider-input-width); + min-width: var(--slider-input-min-width); + flex-shrink: 0; +} +.lil-gui .controller.number .slider { + width: 100%; + height: var(--widget-height); + background: var(--widget-color); + border-radius: var(--widget-border-radius); + padding-right: var(--slider-knob-width); + overflow: hidden; + cursor: ew-resize; + touch-action: pan-y; +} +@media (hover: hover) { + .lil-gui .controller.number .slider:hover { + background: var(--hover-color); + } +} +.lil-gui .controller.number .slider.active { + background: var(--focus-color); +} +.lil-gui .controller.number .slider.active .fill { + opacity: 0.95; +} +.lil-gui .controller.number .fill { + height: 100%; + border-right: var(--slider-knob-width) solid var(--number-color); + box-sizing: content-box; +} + +.lil-gui-dragging .lil-gui { + --hover-color: var(--widget-color); +} +.lil-gui-dragging * { + cursor: ew-resize !important; +} + +.lil-gui-dragging.lil-gui-vertical * { + cursor: ns-resize !important; +} + +.lil-gui .title { + height: var(--title-height); + line-height: calc(var(--title-height) - 4px); + font-weight: 600; + padding: 0 var(--padding); + -webkit-tap-highlight-color: transparent; + cursor: pointer; + outline: none; + text-decoration-skip: objects; +} +.lil-gui .title:before { + font-family: "lil-gui"; + content: "▾"; + padding-right: 2px; + display: inline-block; +} +.lil-gui .title:active { + background: var(--title-background-color); + opacity: 0.75; +} +@media (hover: hover) { + body:not(.lil-gui-dragging) .lil-gui .title:hover { + background: var(--title-background-color); + opacity: 0.85; + } + .lil-gui .title:focus { + text-decoration: underline var(--focus-color); + } +} +.lil-gui.root > .title:focus { + text-decoration: none !important; +} +.lil-gui.closed > .title:before { + content: "▸"; +} +.lil-gui.closed > .children { + transform: translateY(-7px); + opacity: 0; +} +.lil-gui.closed:not(.transition) > .children { + display: none; +} +.lil-gui.transition > .children { + transition-duration: 300ms; + transition-property: height, opacity, transform; + transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1); + overflow: hidden; + pointer-events: none; +} +.lil-gui .children:empty:before { + content: "Empty"; + padding: 0 var(--padding); + margin: var(--spacing) 0; + display: block; + height: var(--widget-height); + font-style: italic; + line-height: var(--widget-height); + opacity: 0.5; +} +.lil-gui.root > .children > .lil-gui > .title { + border: 0 solid var(--widget-color); + border-width: 1px 0; + transition: border-color 300ms; +} +.lil-gui.root > .children > .lil-gui.closed > .title { + border-bottom-color: transparent; +} +.lil-gui + .controller { + border-top: 1px solid var(--widget-color); + margin-top: 0; + padding-top: var(--spacing); +} +.lil-gui .lil-gui .lil-gui > .title { + border: none; +} +.lil-gui .lil-gui .lil-gui > .children { + border: none; + margin-left: var(--folder-indent); + border-left: 2px solid var(--widget-color); +} +.lil-gui .lil-gui .controller { + border: none; +} + +.lil-gui label, .lil-gui input, .lil-gui button { + -webkit-tap-highlight-color: transparent; +} +.lil-gui input { + border: 0; + outline: none; + font-family: var(--font-family); + font-size: var(--input-font-size); + border-radius: var(--widget-border-radius); + height: var(--widget-height); + background: var(--widget-color); + color: var(--text-color); + width: 100%; +} +@media (hover: hover) { + .lil-gui input:hover { + background: var(--hover-color); + } + .lil-gui input:active { + background: var(--focus-color); + } +} +.lil-gui input:disabled { + opacity: 1; +} +.lil-gui input[type=text], +.lil-gui input[type=number] { + padding: var(--widget-padding); + -moz-appearance: textfield; +} +.lil-gui input[type=text]:focus, +.lil-gui input[type=number]:focus { + background: var(--focus-color); +} +.lil-gui input[type=checkbox] { + appearance: none; + width: var(--checkbox-size); + height: var(--checkbox-size); + border-radius: var(--widget-border-radius); + text-align: center; + cursor: pointer; +} +.lil-gui input[type=checkbox]:checked:before { + font-family: "lil-gui"; + content: "✓"; + font-size: var(--checkbox-size); + line-height: var(--checkbox-size); +} +@media (hover: hover) { + .lil-gui input[type=checkbox]:focus { + box-shadow: inset 0 0 0 1px var(--focus-color); + } +} +.lil-gui button { + outline: none; + cursor: pointer; + font-family: var(--font-family); + font-size: var(--font-size); + color: var(--text-color); + width: 100%; + height: var(--widget-height); + text-transform: none; + background: var(--widget-color); + border-radius: var(--widget-border-radius); + border: none; +} +@media (hover: hover) { + .lil-gui button:hover { + background: var(--hover-color); + } + .lil-gui button:focus { + box-shadow: inset 0 0 0 1px var(--focus-color); + } +} +.lil-gui button:active { + background: var(--focus-color); +} + +@font-face { + font-family: "lil-gui"; + src: url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff"); +}`;function cb(r){const e=document.createElement("style");e.innerHTML=r;const t=document.querySelector("head link[rel=stylesheet], head style");t?document.head.insertBefore(e,t):document.head.appendChild(e)}let Gh=!1;class pc{constructor({parent:e,autoPlace:t=e===void 0,container:n,width:i,title:s="Controls",closeFolders:o=!1,injectStyles:a=!0,touchStyles:l=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",c=>{(c.code==="Enter"||c.code==="Space")&&(c.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(s),this.parent){this.parent.children.push(this),this.parent.folders.push(this),this.parent.$children.appendChild(this.domElement);return}this.domElement.classList.add("root"),l&&this.domElement.classList.add("allow-touch-styles"),!Gh&&a&&(cb(lb),Gh=!0),n?n.appendChild(this.domElement):t&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),i&&this.domElement.style.setProperty("--width",i+"px"),this._closeFolders=o}add(e,t,n,i,s){if(Object(n)===n)return new ob(this,e,t,n);const o=e[t];switch(typeof o){case"number":return new sb(this,e,t,n,i,s);case"boolean":return new Jy(this,e,t);case"string":return new ab(this,e,t);case"function":return new bl(this,e,t)}console.error(`gui.add failed property:`,t,` object:`,e,` - value:`,o)}addColor(e,t,n=1){return new tb(this,e,t,n)}addFolder(e){return new dc({parent:this,title:e})}load(e,t=!0){return e.controllers&&this.controllers.forEach(n=>{n instanceof xl||n._name in e.controllers&&n.load(e.controllers[n._name])}),t&&e.folders&&this.folders.forEach(n=>{n._title in e.folders&&n.load(e.folders[n._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(n=>{if(!(n instanceof xl)){if(n._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${n._name}"`);t.controllers[n._name]=n.save()}}),e&&this.folders.forEach(n=>{if(n._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${n._title}"`);t.folders[n._title]=n.save()}),t}open(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._closed=!e,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const n=s=>{s.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",n))};this.$children.addEventListener("transitionend",n);const i=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=i+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}const sb=`\r + value:`,o)}addColor(e,t,n=1){return new rb(this,e,t,n)}addFolder(e){const t=new pc({parent:this,title:e});return this.root._closeFolders&&t.close(),t}load(e,t=!0){return e.controllers&&this.controllers.forEach(n=>{n instanceof bl||n._name in e.controllers&&n.load(e.controllers[n._name])}),t&&e.folders&&this.folders.forEach(n=>{n._title in e.folders&&n.load(e.folders[n._title])}),this}save(e=!0){const t={controllers:{},folders:{}};return this.controllers.forEach(n=>{if(!(n instanceof bl)){if(n._name in t.controllers)throw new Error(`Cannot save GUI with duplicate property "${n._name}"`);t.controllers[n._name]=n.save()}}),e&&this.folders.forEach(n=>{if(n._title in t.folders)throw new Error(`Cannot save GUI with duplicate folder "${n._title}"`);t.folders[n._title]=n.save()}),t}open(e=!0){return this._setClosed(!e),this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}_setClosed(e){this._closed!==e&&(this._closed=e,this._callOnOpenClose(this))}show(e=!0){return this._hidden=!e,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(e=!0){return this._setClosed(!e),this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const t=this.$children.clientHeight;this.$children.style.height=t+"px",this.domElement.classList.add("transition");const n=s=>{s.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",n))};this.$children.addEventListener("transitionend",n);const i=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=i+"px"})}),this}title(e){return this._title=e,this.$title.innerHTML=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(n=>n.reset()),this}onChange(e){return this._onChange=e,this}_callOnChange(e){this.parent&&this.parent._callOnChange(e),this._onChange!==void 0&&this._onChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onFinishChange(e){return this._onFinishChange=e,this}_callOnFinishChange(e){this.parent&&this.parent._callOnFinishChange(e),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:e.object,property:e.property,value:e.getValue(),controller:e})}onOpenClose(e){return this._onOpenClose=e,this}_callOnOpenClose(e){this.parent&&this.parent._callOnOpenClose(e),this._onOpenClose!==void 0&&this._onOpenClose.call(this,e)}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(e=>e.destroy())}controllersRecursive(){let e=Array.from(this.controllers);return this.folders.forEach(t=>{e=e.concat(t.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(t=>{e=e.concat(t.foldersRecursive())}),e}}const ub=`\r //////////////////////////////////////////////////////\r // camera uniforms\r //////////////////////////////////////////////////////\r @@ -4427,7 +4848,7 @@ vec3 xyzToRgb(vec3 XYZ)\r -0.969256 , 1.875991, 0.041556,\r 0.055648, -0.204043, 1.057311);\r }\r -`,ob=`\r +`,hb=`\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r // "Coat" dielectric microfacet BSDF\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r @@ -4578,7 +4999,7 @@ vec3 coat_brdf_albedo(in vec3 pW, in Basis basis, in vec3 winputL, inout uint rn albedo /= float(num_samples);\r return albedo;\r }\r -`,ab=`\r +`,fb=`\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r // "Metal" conductor microfacet BSDF\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r @@ -4708,7 +5129,7 @@ vec3 metal_brdf_albedo(in vec3 pW, in Basis basis, in vec3 winputL, inout uint r \r \r \r -`,lb=`\r +`,db=`\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r // "Specular" dielectric microfacet BRDF\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r @@ -4927,7 +5348,7 @@ vec3 specular_brdf_albedo(in vec3 pW, in Basis basis, in vec3 winputL, inout uin albedo /= float(num_samples);\r return albedo;\r }\r -`,cb=`\r +`,pb=`\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r // "Specular" dielectric microfacet BTDF\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r @@ -5134,7 +5555,7 @@ vec3 specular_btdf_albedo(in vec3 pW, in Basis basis, in vec3 winputL, inout uin albedo /= float(num_samples);\r return albedo;\r }\r -`,ub=`\r +`,mb=`\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r // "diffuse" - Oren-Nayar BRDF\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r @@ -5194,7 +5615,7 @@ vec3 diffuse_brdf_albedo(in vec3 pW, in Basis basis, in vec3 winputL, inout uint if (winputL.z < DENOM_TOLERANCE) return vec3(0.0);\r return base_weight * base_color;\r }\r -`,hb=`\r +`,_b=`\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r // OpenPBR BSDF\r //////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r @@ -5500,7 +5921,7 @@ void fill_subsurface_medium(inout Volume internal_medium)\r vec3 openpbr_bsdf_sample(in vec3 pW, in Basis basis, in vec3 winputL, inout uint rndSeed,\r out vec3 woutputL, out float pdf_woutputL, out Volume internal_medium)\r {\r - // Sample a lobe according to the precomptuted lobe_probs.\r + // Sample a lobe according to the precomputed lobe_probs.\r // Also compute PDF of all other lobes in the sampled direction.\r float X = rand(rndSeed);\r float CDF = 0.0;\r @@ -5553,7 +5974,7 @@ vec3 openpbr_bsdf_sample(in vec3 pW, in Basis basis, in vec3 winputL, inout uint }\r \r \r -`,fb=`\r +`,gb=`\r /////////////////////////////////////////////////////////////////////////\r // Raytracing routines\r /////////////////////////////////////////////////////////////////////////\r @@ -6071,7 +6492,7 @@ void main()\r // If the surface is opaque, but the incident ray lies below the hemisphere of the normal,\r // which can occur due to shading normals, apply the "Flipping hack" to prevent artifacts\r // (see Schüßler, "Microfacet-based Normal Mapping for Robust Monte Carlo Path Tracing")\r - if (material != MATERIAL_OPENPBR || (openpbr_is_opaque() && dot(NsW, dW) > 0.0))\r + if (material == MATERIAL_OPENPBR && openpbr_is_opaque() && dot(NsW, dW) > 0.0)\r NsW = 2.0*NgW*dot(NgW, NsW) - NsW;\r basis = makeBasis(NsW, TsW_next, baryCoord);\r }\r @@ -6154,9 +6575,9 @@ void main()\r gl_FragColor.rgb = L;\r gl_FragColor.a = accumulation_weight; // Implements Monte-Carlo accumulation via alpha blending\r }\r -`;function Zo(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Gf={exports:{}};(function(r,e){(function(t){r.exports=t()})(function(){return function(){function t(n,i,s){function o(c,u){if(!i[c]){if(!n[c]){var h=typeof Zo=="function"&&Zo;if(!u&&h)return h(c,!0);if(a)return a(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[c]={exports:{}};n[c][0].call(d.exports,function(_){var g=n[c][1][_];return o(g||_)},d,d.exports,t,n,i,s)}return i[c].exports}for(var a=typeof Zo=="function"&&Zo,l=0;l-1}function xr(C,U){var $=this.__data__,Te=vt($,C);return Te<0?(++this.size,$.push([C,U])):$[Te][1]=U,this}on.prototype.clear=Ci,on.prototype.delete=gr,on.prototype.get=ni,on.prototype.has=vr,on.prototype.set=xr;function Gn(C){var U=-1,$=C==null?0:C.length;for(this.clear();++U<$;){var Te=C[U];this.set(Te[0],Te[1])}}function Li(){this.size=0,this.__data__={hash:new _t,map:new(he||on),string:new _t}}function vs(C){var U=Be(this,C).delete(C);return this.size-=U?1:0,U}function R(C){return Be(this,C).get(C)}function k(C){return Be(this,C).has(C)}function q(C,U){var $=Be(this,C),Te=$.size;return $.set(C,U),this.size+=$.size==Te?0:1,this}Gn.prototype.clear=Li,Gn.prototype.delete=vs,Gn.prototype.get=R,Gn.prototype.has=k,Gn.prototype.set=q;function K(C){var U=this.__data__=new on(C);this.size=U.size}function Y(){this.__data__=new on,this.size=0}function we(C){var U=this.__data__,$=U.delete(C);return this.size=U.size,$}function De(C){return this.__data__.get(C)}function He(C){return this.__data__.has(C)}function Xe(C,U){var $=this.__data__;if($ instanceof on){var Te=$.__data__;if(!he||Te.length1?$[ct-1]:void 0,Pt=ct>2?$[2]:void 0;for(wt=C.length>3&&typeof wt=="function"?(ct--,wt):void 0,Pt&&Lt($[0],$[1],Pt)&&(wt=ct<3?void 0:wt,ct=1),U=Object(U);++Te-1&&C%1==0&&C0){if(++U>=l)return arguments[0]}else U=0;return C.apply(void 0,arguments)}}function Zt(C){if(C!=null){try{return le.call(C)}catch{}try{return C+""}catch{}}return""}function hn(C,U){return C===U||C!==C&&U!==U}var Tn=ot(function(){return arguments}())?ot:function(C){return xs(C)&&re.call(C,"callee")&&!Me.call(C,"callee")},Wn=Array.isArray;function br(C){return C!=null&&_c(C.length)&&!ya(C)}function Xf(C){return xs(C)&&br(C)}var mc=ge||Kf;function ya(C){if(!$i(C))return!1;var U=an(C);return U==p||U==y||U==d||U==w}function _c(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=u}function $i(C){var U=typeof C;return C!=null&&(U=="object"||U=="function")}function xs(C){return C!=null&&typeof C=="object"}function jf(C){if(!xs(C)||an(C)!=E)return!1;var U=Ae(C);if(U===null)return!0;var $=re.call(U,"constructor")&&U.constructor;return typeof $=="function"&&$ instanceof $&&le.call($)==pe}var gc=ze?ke(ze):Yi;function qf(C){return V(C,vc(C))}function vc(C){return br(C)?Qe(C,!0):xt(C)}var Yf=ue(function(C,U,$){Nn(C,U,$)});function $f(C){return function(){return C}}function xc(C){return C}function Kf(){return!1}n.exports=Yf}).call(this)}).call(this,typeof Bl<"u"?Bl:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(t,n,i){/*! For license information please see shifty.js.LICENSE.txt */(function(s,o){typeof i=="object"&&typeof n=="object"?n.exports=o():typeof i=="object"?i.shifty=o():s.shifty=o()})(self,function(){return function(){var s={720:function(l,c,u){u.r(c),u.d(c,{Scene:function(){return Gt},Tweenable:function(){return ht},interpolate:function(){return Yi},processTweens:function(){return ae},setBezierFunction:function(){return $e},shouldScheduleUpdate:function(){return Re},tween:function(){return yn},unsetBezierFunction:function(){return ze}});var h={};u.r(h),u.d(h,{bounce:function(){return _e},bouncePast:function(){return je},easeFrom:function(){return Ne},easeFromTo:function(){return We},easeInBack:function(){return se},easeInCirc:function(){return Z},easeInCubic:function(){return p},easeInExpo:function(){return G},easeInOutBack:function(){return ve},easeInOutCirc:function(){return ce},easeInOutCubic:function(){return v},easeInOutExpo:function(){return H},easeInOutQuad:function(){return m},easeInOutQuart:function(){return E},easeInOutQuint:function(){return S},easeInOutSine:function(){return O},easeInQuad:function(){return _},easeInQuart:function(){return x},easeInQuint:function(){return w},easeInSine:function(){return A},easeOutBack:function(){return me},easeOutBounce:function(){return ie},easeOutCirc:function(){return J},easeOutCubic:function(){return y},easeOutExpo:function(){return D},easeOutQuad:function(){return g},easeOutQuart:function(){return b},easeOutQuint:function(){return I},easeOutSine:function(){return z},easeTo:function(){return Ye},elastic:function(){return Q},linear:function(){return d},swingFrom:function(){return Se},swingFromTo:function(){return oe},swingTo:function(){return Pe}});var f={};u.r(f),u.d(f,{afterTween:function(){return vt},beforeTween:function(){return Ze},doesApply:function(){return Qe},tweenCreated:function(){return qe}});var d=function(T){return T},_=function(T){return Math.pow(T,2)},g=function(T){return-(Math.pow(T-1,2)-1)},m=function(T){return(T/=.5)<1?.5*Math.pow(T,2):-.5*((T-=2)*T-2)},p=function(T){return Math.pow(T,3)},y=function(T){return Math.pow(T-1,3)+1},v=function(T){return(T/=.5)<1?.5*Math.pow(T,3):.5*(Math.pow(T-2,3)+2)},x=function(T){return Math.pow(T,4)},b=function(T){return-(Math.pow(T-1,4)-1)},E=function(T){return(T/=.5)<1?.5*Math.pow(T,4):-.5*((T-=2)*Math.pow(T,3)-2)},w=function(T){return Math.pow(T,5)},I=function(T){return Math.pow(T-1,5)+1},S=function(T){return(T/=.5)<1?.5*Math.pow(T,5):.5*(Math.pow(T-2,5)+2)},A=function(T){return 1-Math.cos(T*(Math.PI/2))},z=function(T){return Math.sin(T*(Math.PI/2))},O=function(T){return-.5*(Math.cos(Math.PI*T)-1)},G=function(T){return T===0?0:Math.pow(2,10*(T-1))},D=function(T){return T===1?1:1-Math.pow(2,-10*T)},H=function(T){return T===0?0:T===1?1:(T/=.5)<1?.5*Math.pow(2,10*(T-1)):.5*(2-Math.pow(2,-10*--T))},Z=function(T){return-(Math.sqrt(1-T*T)-1)},J=function(T){return Math.sqrt(1-Math.pow(T-1,2))},ce=function(T){return(T/=.5)<1?-.5*(Math.sqrt(1-T*T)-1):.5*(Math.sqrt(1-(T-=2)*T)+1)},ie=function(T){return T<1/2.75?7.5625*T*T:T<2/2.75?7.5625*(T-=1.5/2.75)*T+.75:T<2.5/2.75?7.5625*(T-=2.25/2.75)*T+.9375:7.5625*(T-=2.625/2.75)*T+.984375},se=function(T){var B=1.70158;return T*T*((B+1)*T-B)},me=function(T){var B=1.70158;return(T-=1)*T*((B+1)*T+B)+1},ve=function(T){var B=1.70158;return(T/=.5)<1?T*T*((1+(B*=1.525))*T-B)*.5:.5*((T-=2)*T*((1+(B*=1.525))*T+B)+2)},Q=function(T){return-1*Math.pow(4,-8*T)*Math.sin((6*T-1)*(2*Math.PI)/2)+1},oe=function(T){var B=1.70158;return(T/=.5)<1?T*T*((1+(B*=1.525))*T-B)*.5:.5*((T-=2)*T*((1+(B*=1.525))*T+B)+2)},Se=function(T){var B=1.70158;return T*T*((B+1)*T-B)},Pe=function(T){var B=1.70158;return(T-=1)*T*((B+1)*T+B)+1},_e=function(T){return T<1/2.75?7.5625*T*T:T<2/2.75?7.5625*(T-=1.5/2.75)*T+.75:T<2.5/2.75?7.5625*(T-=2.25/2.75)*T+.9375:7.5625*(T-=2.625/2.75)*T+.984375},je=function(T){return T<1/2.75?7.5625*T*T:T<2/2.75?2-(7.5625*(T-=1.5/2.75)*T+.75):T<2.5/2.75?2-(7.5625*(T-=2.25/2.75)*T+.9375):2-(7.5625*(T-=2.625/2.75)*T+.984375)},We=function(T){return(T/=.5)<1?.5*Math.pow(T,4):-.5*((T-=2)*Math.pow(T,3)-2)},Ne=function(T){return Math.pow(T,4)},Ye=function(T){return Math.pow(T,.25)};function W(T,B,te,V,ue,Ie){var Be,it,ft,Nt,bt,Lt=0,Bt=0,tn=0,mi=function(St){return((Lt*St+Bt)*St+tn)*St},ii=function(St){return(3*Lt*St+2*Bt)*St+tn},ri=function(St){return St>=0?St:0-St};return Lt=1-(tn=3*B)-(Bt=3*(V-B)-tn),ft=1-(bt=3*te)-(Nt=3*(ue-te)-bt),Be=T,it=function(St){return 1/(200*St)}(Ie),function(St){return((ft*St+Nt)*St+bt)*St}(function(St,si){var oi,_i,Zt,hn,Tn,Wn;for(Zt=St,Wn=0;Wn<8;Wn++){if(hn=mi(Zt)-St,ri(hn)(_i=1))return _i;for(;oi<_i;){if(hn=mi(Zt),ri(hn-St)hn?oi=Zt:_i=Zt,Zt=.5*(_i-oi)+oi}return Zt}(Be,it))}var Rt,Ce=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:.25,B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.25,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:.75,V=arguments.length>3&&arguments[3]!==void 0?arguments[3]:.75;return function(ue){return W(ue,T,B,te,V,1)}},$e=function(T,B,te,V,ue){var Ie=Ce(B,te,V,ue);return Ie.displayName=T,Ie.x1=B,Ie.y1=te,Ie.x2=V,Ie.y2=ue,ht.formulas[T]=Ie},ze=function(T){return delete ht.formulas[T]};function mt(T,B){if(!(T instanceof B))throw new TypeError("Cannot call a class as a function")}function Ke(T,B){for(var te=0;teT.length)&&(B=T.length);for(var te=0,V=new Array(B);teit?it:B;T._hasEnded=ft>=it;var Nt=Ie-(it-ft),bt=T._filters.length>0;if(T._hasEnded)return T._render(Be,T._data,Nt),T.stop(!0);bt&&T._applyFilter(N),ft1&&arguments[1]!==void 0?arguments[1]:fe,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Array.isArray(B)){var V=Ce.apply(void 0,st(B));return V}var ue=ke(B);if(Ve[B])return Ve[B];if(ue===Fe||ue===ne)for(var Ie in T)te[Ie]=B;else for(var Be in T)te[Be]=B[Be]||fe;return te},Ht=function(T){T===Me?(Me=T._next)?Me._previous=null:be=null:T===be?(be=T._previous)?be._next=null:Me=null:(le=T._previous,re=T._next,le._next=re,re._previous=le),T._previous=T._next=null},ut=typeof Promise=="function"?Promise:null;Rt=Symbol.toStringTag;var ht=function(){function T(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;mt(this,T),M(this,Rt,"Promise"),this._config={},this._data={},this._delay=0,this._filters=[],this._next=null,this._previous=null,this._timestamp=null,this._hasEnded=!1,this._resolve=null,this._reject=null,this._currentState=V||{},this._originalState={},this._targetState={},this._start=Le,this._render=Le,this._promiseCtor=ut,ue&&this.setConfig(ue)}var B,te;return B=T,te=[{key:"_applyFilter",value:function(V){for(var ue=this._filters.length;ue>0;ue--){var Ie=this._filters[ue-ue][V];Ie&&Ie(this)}}},{key:"tween",value:function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return this._isPlaying&&this.stop(),!V&&this._config||this.setConfig(V),this._pausedAtTime=null,this._timestamp=T.now(),this._start(this.get(),this._data),this._delay&&this._render(this._currentState,this._data,0),this._resume(this._timestamp)}},{key:"setConfig",value:function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ue=this._config;for(var Ie in V)ue[Ie]=V[Ie];var Be=ue.promise,it=Be===void 0?this._promiseCtor:Be,ft=ue.start,Nt=ft===void 0?Le:ft,bt=ue.finish,Lt=ue.render,Bt=Lt===void 0?this._config.step||Le:Lt,tn=ue.step,mi=tn===void 0?Le:tn;this._data=ue.data||ue.attachment||this._data,this._isPlaying=!1,this._pausedAtTime=null,this._scheduleId=null,this._delay=V.delay||0,this._start=Nt,this._render=Bt||mi,this._duration=ue.duration||500,this._promiseCtor=it,bt&&(this._resolve=bt);var ii=V.from,ri=V.to,St=ri===void 0?{}:ri,si=this._currentState,oi=this._originalState,_i=this._targetState;for(var Zt in ii)si[Zt]=ii[Zt];var hn=!1;for(var Tn in si){var Wn=si[Tn];hn||ke(Wn)!==Fe||(hn=!0),oi[Tn]=Wn,_i[Tn]=St.hasOwnProperty(Tn)?St[Tn]:Wn}if(this._easing=_t(this._currentState,ue.easing,this._easing),this._filters.length=0,hn){for(var br in T.filters)T.filters[br].doesApply(this)&&this._filters.push(T.filters[br]);this._applyFilter(de)}return this}},{key:"then",value:function(V,ue){var Ie=this;return this._promise=new this._promiseCtor(function(Be,it){Ie._resolve=Be,Ie._reject=it}),this._promise.then(V,ue)}},{key:"catch",value:function(V){return this.then().catch(V)}},{key:"finally",value:function(V){return this.then().finally(V)}},{key:"get",value:function(){return L({},this._currentState)}},{key:"set",value:function(V){this._currentState=V}},{key:"pause",value:function(){if(this._isPlaying)return this._pausedAtTime=T.now(),this._isPlaying=!1,Ht(this),this}},{key:"resume",value:function(){return this._resume()}},{key:"_resume",value:function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:T.now();return this._timestamp===null?this.tween():this._isPlaying?this._promise:(this._pausedAtTime&&(this._timestamp+=V-this._pausedAtTime,this._pausedAtTime=null),this._isPlaying=!0,Me===null?(Me=this,be=this):(this._previous=be,be._next=this,be=this),this)}},{key:"seek",value:function(V){V=Math.max(V,0);var ue=T.now();return this._timestamp+V===0||(this._timestamp=ue-V,ge(this,ue)),this}},{key:"stop",value:function(){var V=arguments.length>0&&arguments[0]!==void 0&&arguments[0];if(!this._isPlaying)return this;this._isPlaying=!1,Ht(this);var ue=this._filters.length>0;return V&&(ue&&this._applyFilter(N),F(1,this._currentState,this._originalState,this._targetState,1,0,this._easing),ue&&(this._applyFilter(pe),this._applyFilter(ye))),this._resolve&&this._resolve({data:this._data,state:this._currentState,tweenable:this}),this._resolve=null,this._reject=null,this}},{key:"cancel",value:function(){var V=arguments.length>0&&arguments[0]!==void 0&&arguments[0],ue=this._currentState,Ie=this._data,Be=this._isPlaying;return Be?(this._reject&&this._reject({data:Ie,state:ue,tweenable:this}),this._resolve=null,this._reject=null,this.stop(V)):this}},{key:"isPlaying",value:function(){return this._isPlaying}},{key:"hasEnded",value:function(){return this._hasEnded}},{key:"setScheduleFunction",value:function(V){T.setScheduleFunction(V)}},{key:"data",value:function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return V&&(this._data=L({},V)),this._data}},{key:"dispose",value:function(){for(var V in this)delete this[V]}}],te&&Ke(B.prototype,te),T}();function yn(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},B=new ht;return B.tween(T),B.tweenable=B,B}M(ht,"now",function(){return X}),M(ht,"setScheduleFunction",function(T){return Ae=T}),M(ht,"filters",{}),M(ht,"formulas",Ve),Re(!0);var ti,on,Ci=/(\d|-|\.)/,gr=/([^\-0-9.]+)/g,ni=/[0-9.-]+/g,vr=(ti=ni.source,on=/,\s*/.source,new RegExp("rgba?\\(".concat(ti).concat(on).concat(ti).concat(on).concat(ti,"(").concat(on).concat(ti,")?\\)"),"g")),xr=/^.*\(/,Gn=/#([0-9]|[a-f]){3,6}/gi,Li="VAL",vs=function(T,B){return T.map(function(te,V){return"_".concat(B,"_").concat(V)})};function R(T){return parseInt(T,16)}var k=function(T){return"rgb(".concat((B=T,(B=B.replace(/#/,"")).length===3&&(B=(B=B.split(""))[0]+B[0]+B[1]+B[1]+B[2]+B[2]),[R(B.substr(0,2)),R(B.substr(2,2)),R(B.substr(4,2))]).join(","),")");var B},q=function(T,B,te){var V=B.match(T),ue=B.replace(T,Li);return V&&V.forEach(function(Ie){return ue=ue.replace(Li,te(Ie))}),ue},K=function(T){for(var B in T){var te=T[B];typeof te=="string"&&te.match(Gn)&&(T[B]=q(Gn,te,k))}},Y=function(T){var B=T.match(ni),te=B.slice(0,3).map(Math.floor),V=T.match(xr)[0];if(B.length===3)return"".concat(V).concat(te.join(","),")");if(B.length===4)return"".concat(V).concat(te.join(","),",").concat(B[3],")");throw new Error("Invalid rgbChunk: ".concat(T))},we=function(T){return T.match(ni)},De=function(T,B){var te={};return B.forEach(function(V){te[V]=T[V],delete T[V]}),te},He=function(T,B){return B.map(function(te){return T[te]})},Xe=function(T,B){return B.forEach(function(te){return T=T.replace(Li,+te.toFixed(4))}),T},Qe=function(T){for(var B in T._currentState)if(typeof T._currentState[B]=="string")return!0;return!1};function qe(T){var B=T._currentState;[B,T._originalState,T._targetState].forEach(K),T._tokenData=function(te){var V,ue,Ie={};for(var Be in te){var it=te[Be];typeof it=="string"&&(Ie[Be]={formatString:(V=it,ue=void 0,ue=V.match(gr),ue?(ue.length===1||V.charAt(0).match(Ci))&&ue.unshift(""):ue=["",""],ue.join(Li)),chunkNames:vs(we(it),Be)})}return Ie}(B)}function Ze(T){var B=T._currentState,te=T._originalState,V=T._targetState,ue=T._easing,Ie=T._tokenData;(function(Be,it){var ft=function(bt){var Lt=it[bt].chunkNames,Bt=Be[bt];if(typeof Bt=="string"){var tn=Bt.split(" "),mi=tn[tn.length-1];Lt.forEach(function(ii,ri){return Be[ii]=tn[ri]||mi})}else Lt.forEach(function(ii){return Be[ii]=Bt});delete Be[bt]};for(var Nt in it)ft(Nt)})(ue,Ie),[B,te,V].forEach(function(Be){return function(it,ft){var Nt=function(Lt){we(it[Lt]).forEach(function(Bt,tn){return it[ft[Lt].chunkNames[tn]]=+Bt}),delete it[Lt]};for(var bt in ft)Nt(bt)}(Be,Ie)})}function vt(T){var B=T._currentState,te=T._originalState,V=T._targetState,ue=T._easing,Ie=T._tokenData;[B,te,V].forEach(function(Be){return function(it,ft){for(var Nt in ft){var bt=ft[Nt],Lt=bt.chunkNames,Bt=bt.formatString,tn=Xe(Bt,He(De(it,Lt),Lt));it[Nt]=q(vr,tn,Y)}}(Be,Ie)}),function(Be,it){for(var ft in it){var Nt=it[ft].chunkNames,bt=Be[Nt[0]];Be[ft]=typeof bt=="string"?Nt.map(function(Lt){var Bt=Be[Lt];return delete Be[Lt],Bt}).join(" "):bt}}(ue,Ie)}function Vt(T,B){var te=Object.keys(T);if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(T);B&&(V=V.filter(function(ue){return Object.getOwnPropertyDescriptor(T,ue).enumerable})),te.push.apply(te,V)}return te}function Ut(T){for(var B=1;B4&&arguments[4]!==void 0?arguments[4]:0,Ie=Ut({},T),Be=_t(T,V);for(var it in ot._filters.length=0,ot.set({}),ot._currentState=Ie,ot._originalState=T,ot._targetState=B,ot._easing=Be,Je)Je[it].doesApply(ot)&&ot._filters.push(Je[it]);ot._applyFilter("tweenCreated"),ot._applyFilter("beforeTween");var ft=F(te,Ie,T,B,1,ue,Be);return ot._applyFilter("afterTween"),ft};function xt(T,B){(B==null||B>T.length)&&(B=T.length);for(var te=0,V=new Array(B);tec.strokeWidth&&(u=c.trailWidth);var h=50-u/2;return o.render(this._pathTemplate,{radius:h,"2radius":h*2})},a.prototype._trailString=function(c){return this._pathString(c)},n.exports=a},{"./shape":8,"./utils":10}],4:[function(t,n,i){var s=t("./shape"),o=t("./utils"),a=function(c,u){this._pathTemplate=u.vertical?"M {center},100 L {center},0":"M 0,{center} L 100,{center}",s.apply(this,arguments)};a.prototype=new s,a.prototype.constructor=a,a.prototype._initializeSvg=function(c,u){var h=u.vertical?"0 0 "+u.strokeWidth+" 100":"0 0 100 "+u.strokeWidth;c.setAttribute("viewBox",h),c.setAttribute("preserveAspectRatio","none")},a.prototype._pathString=function(c){return o.render(this._pathTemplate,{center:c.strokeWidth/2})},a.prototype._trailString=function(c){return this._pathString(c)},n.exports=a},{"./shape":8,"./utils":10}],5:[function(t,n,i){n.exports={Line:t("./line"),Circle:t("./circle"),SemiCircle:t("./semicircle"),Square:t("./square"),Path:t("./path"),Shape:t("./shape"),utils:t("./utils")}},{"./circle":3,"./line":4,"./path":6,"./semicircle":7,"./shape":8,"./square":9,"./utils":10}],6:[function(t,n,i){var s=t("shifty"),o=t("./utils"),a=s.Tweenable,l={easeIn:"easeInCubic",easeOut:"easeOutCubic",easeInOut:"easeInOutCubic"},c=function u(h,f){if(!(this instanceof u))throw new Error("Constructor was called without new keyword");f=o.extend({delay:0,duration:800,easing:"linear",from:{},to:{},step:function(){}},f);var d;o.isString(h)?d=document.querySelector(h):d=h,this.path=d,this._opts=f,this._tweenable=null;var _=this.path.getTotalLength();this.path.style.strokeDasharray=_+" "+_,this.set(0)};c.prototype.value=function(){var h=this._getComputedDashOffset(),f=this.path.getTotalLength(),d=1-h/f;return parseFloat(d.toFixed(6),10)},c.prototype.set=function(h){this.stop(),this.path.style.strokeDashoffset=this._progressToOffset(h);var f=this._opts.step;if(o.isFunction(f)){var d=this._easing(this._opts.easing),_=this._calculateTo(h,d),g=this._opts.shape||this;f(_,g,this._opts.attachment)}},c.prototype.stop=function(){this._stopTween(),this.path.style.strokeDashoffset=this._getComputedDashOffset()},c.prototype.animate=function(h,f,d){f=f||{},o.isFunction(f)&&(d=f,f={});var _=o.extend({},f),g=o.extend({},this._opts);f=o.extend(g,f);var m=this._easing(f.easing),p=this._resolveFromAndTo(h,m,_);this.stop(),this.path.getBoundingClientRect();var y=this._getComputedDashOffset(),v=this._progressToOffset(h),x=this;this._tweenable=new a,this._tweenable.tween({from:o.extend({offset:y},p.from),to:o.extend({offset:v},p.to),duration:f.duration,delay:f.delay,easing:m,step:function(b){x.path.style.strokeDashoffset=b.offset;var E=f.shape||x;f.step(b,E,f.attachment)}}).then(function(b){o.isFunction(d)&&d()}).catch(function(b){throw console.error("Error in tweening:",b),b})},c.prototype._getComputedDashOffset=function(){var h=window.getComputedStyle(this.path,null);return parseFloat(h.getPropertyValue("stroke-dashoffset"),10)},c.prototype._progressToOffset=function(h){var f=this.path.getTotalLength();return f-h*f},c.prototype._resolveFromAndTo=function(h,f,d){return d.from&&d.to?{from:d.from,to:d.to}:{from:this._calculateFrom(f),to:this._calculateTo(h,f)}},c.prototype._calculateFrom=function(h){return s.interpolate(this._opts.from,this._opts.to,this.value(),h)},c.prototype._calculateTo=function(h,f){return s.interpolate(this._opts.from,this._opts.to,h,f)},c.prototype._stopTween=function(){this._tweenable!==null&&(this._tweenable.stop(!0),this._tweenable=null)},c.prototype._easing=function(h){return l.hasOwnProperty(h)?l[h]:h},n.exports=c},{"./utils":10,shifty:2}],7:[function(t,n,i){var s=t("./shape"),o=t("./circle"),a=t("./utils"),l=function(u,h){this._pathTemplate="M 50,50 m -{radius},0 a {radius},{radius} 0 1 1 {2radius},0",this.containerAspectRatio=2,s.apply(this,arguments)};l.prototype=new s,l.prototype.constructor=l,l.prototype._initializeSvg=function(u,h){u.setAttribute("viewBox","0 0 100 50")},l.prototype._initializeTextContainer=function(u,h,f){u.text.style&&(f.style.top="auto",f.style.bottom="0",u.text.alignToBottom?a.setStyle(f,"transform","translate(-50%, 0)"):a.setStyle(f,"transform","translate(-50%, 50%)"))},l.prototype._pathString=o.prototype._pathString,l.prototype._trailString=o.prototype._trailString,n.exports=l},{"./circle":3,"./shape":8,"./utils":10}],8:[function(t,n,i){var s=t("./path"),o=t("./utils"),a="Object is destroyed",l=function c(u,h){if(!(this instanceof c))throw new Error("Constructor was called without new keyword");if(arguments.length!==0){this._opts=o.extend({color:"#555",strokeWidth:1,trailColor:null,trailWidth:null,fill:null,text:{style:{color:null,position:"absolute",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0,value:null,className:"progressbar-text"},svgStyle:{display:"block",width:"100%"},warnings:!1},h,!0),o.isObject(h)&&h.svgStyle!==void 0&&(this._opts.svgStyle=h.svgStyle),o.isObject(h)&&o.isObject(h.text)&&h.text.style!==void 0&&(this._opts.text.style=h.text.style);var f=this._createSvgView(this._opts),d;if(o.isString(u)?d=document.querySelector(u):d=u,!d)throw new Error("Container does not exist: "+u);this._container=d,this._container.appendChild(f.svg),this._opts.warnings&&this._warnContainerAspectRatio(this._container),this._opts.svgStyle&&o.setStyles(f.svg,this._opts.svgStyle),this.svg=f.svg,this.path=f.path,this.trail=f.trail,this.text=null;var _=o.extend({attachment:void 0,shape:this},this._opts);this._progressPath=new s(f.path,_),o.isObject(this._opts.text)&&this._opts.text.value!==null&&this.setText(this._opts.text.value)}};l.prototype.animate=function(u,h,f){if(this._progressPath===null)throw new Error(a);this._progressPath.animate(u,h,f)},l.prototype.stop=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath.stop()},l.prototype.pause=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath._tweenable&&this._progressPath._tweenable.pause()},l.prototype.resume=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath._tweenable&&this._progressPath._tweenable.resume()},l.prototype.destroy=function(){if(this._progressPath===null)throw new Error(a);this.stop(),this.svg.parentNode.removeChild(this.svg),this.svg=null,this.path=null,this.trail=null,this._progressPath=null,this.text!==null&&(this.text.parentNode.removeChild(this.text),this.text=null)},l.prototype.set=function(u){if(this._progressPath===null)throw new Error(a);this._progressPath.set(u)},l.prototype.value=function(){if(this._progressPath===null)throw new Error(a);return this._progressPath===void 0?0:this._progressPath.value()},l.prototype.setText=function(u){if(this._progressPath===null)throw new Error(a);this.text===null&&(this.text=this._createTextContainer(this._opts,this._container),this._container.appendChild(this.text)),o.isObject(u)?(o.removeChildren(this.text),this.text.appendChild(u)):this.text.innerHTML=u},l.prototype._createSvgView=function(u){var h=document.createElementNS("http://www.w3.org/2000/svg","svg");this._initializeSvg(h,u);var f=null;(u.trailColor||u.trailWidth)&&(f=this._createTrail(u),h.appendChild(f));var d=this._createPath(u);return h.appendChild(d),{svg:h,path:d,trail:f}},l.prototype._initializeSvg=function(u,h){u.setAttribute("viewBox","0 0 100 100")},l.prototype._createPath=function(u){var h=this._pathString(u);return this._createPathElement(h,u)},l.prototype._createTrail=function(u){var h=this._trailString(u),f=o.extend({},u);return f.trailColor||(f.trailColor="#eee"),f.trailWidth||(f.trailWidth=f.strokeWidth),f.color=f.trailColor,f.strokeWidth=f.trailWidth,f.fill=null,this._createPathElement(h,f)},l.prototype._createPathElement=function(u,h){var f=document.createElementNS("http://www.w3.org/2000/svg","path");return f.setAttribute("d",u),f.setAttribute("stroke",h.color),f.setAttribute("stroke-width",h.strokeWidth),h.fill?f.setAttribute("fill",h.fill):f.setAttribute("fill-opacity","0"),f},l.prototype._createTextContainer=function(u,h){var f=document.createElement("div");f.className=u.text.className;var d=u.text.style;return d&&(u.text.autoStyleContainer&&(h.style.position="relative"),o.setStyles(f,d),d.color||(f.style.color=u.color)),this._initializeTextContainer(u,h,f),f},l.prototype._initializeTextContainer=function(c,u,h){},l.prototype._pathString=function(u){throw new Error("Override this function for each progress bar")},l.prototype._trailString=function(u){throw new Error("Override this function for each progress bar")},l.prototype._warnContainerAspectRatio=function(u){if(this.containerAspectRatio){var h=window.getComputedStyle(u,null),f=parseFloat(h.getPropertyValue("width"),10),d=parseFloat(h.getPropertyValue("height"),10);o.floatEquals(this.containerAspectRatio,f/d)||(console.warn("Incorrect aspect ratio of container","#"+u.id,"detected:",h.getPropertyValue("width")+"(width)","/",h.getPropertyValue("height")+"(height)","=",f/d),console.warn("Aspect ratio of should be",this.containerAspectRatio))}},n.exports=l},{"./path":6,"./utils":10}],9:[function(t,n,i){var s=t("./shape"),o=t("./utils"),a=function(c,u){this._pathTemplate="M 0,{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{strokeWidth}",this._trailTemplate="M {startMargin},{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{halfOfStrokeWidth}",s.apply(this,arguments)};a.prototype=new s,a.prototype.constructor=a,a.prototype._pathString=function(c){var u=100-c.strokeWidth/2;return o.render(this._pathTemplate,{width:u,strokeWidth:c.strokeWidth,halfOfStrokeWidth:c.strokeWidth/2})},a.prototype._trailString=function(c){var u=100-c.strokeWidth/2;return o.render(this._trailTemplate,{width:u,strokeWidth:c.strokeWidth,halfOfStrokeWidth:c.strokeWidth/2,startMargin:c.strokeWidth/2-c.trailWidth/2})},n.exports=a},{"./shape":8,"./utils":10}],10:[function(t,n,i){var s=t("lodash.merge"),o="Webkit Moz O ms".split(" "),a=.001;function l(v,x){var b=v;for(var E in x)if(x.hasOwnProperty(E)){var w=x[E],I="\\{"+E+"\\}",S=new RegExp(I,"g");b=b.replace(S,w)}return b}function c(v,x,b){for(var E=v.style,w=0;w{if(o.isMesh){const a=new $y(o);a.attributes=["position","color","normal","tangent","uv","uv2"],a.applyWorldTransforms=!1;const l={strategy:Of,maxLeafTris:1};let c=new fc(a.generate(),l);return new Mn(a.generate(),o.material),this.result={scene:t.scene,bvh:c,mesh:o},console.log("==> loaded mesh ",e),this.result}});return this.result}}function Un(r){return new P(r[0],r[1],r[2])}const j={smooth_normals:!0,bounces:6,max_volume_steps:8,wireframe:!0,neutral_color:[.5,.5,.5],skyPower:.5,skyColor:[.8,.8,1],sunPower:.35,sunAngularSize:40,sunLatitude:40,sunLongitude:180,sunColor:[1,1,.8],base_weight:1,base_color:[.8,.8,.8],base_roughness:0,base_metalness:0,specular_weight:1,specular_color:[1,1,1],specular_roughness:.1,specular_anisotropy:0,specular_rotation:0,specular_ior:1.5,transmission_weight:0,transmission_color:[1,1,1],transmission_depth:0,transmission_scatter:[0,0,0],transmission_scatter_anisotropy:0,transmission_dispersion_abbe_number:20,transmission_dispersion_scale:0,subsurface_weight:0,subsurface_color:[.8,.8,.8],subsurface_radius:.2,subsurface_radius_scale:[1,.5,.25],subsurface_anisotropy:0,subsurface_mode:0,coat_weight:0,coat_color:[1,1,1],coat_roughness:0,coat_anisotropy:0,coat_rotation:0,coat_ior:1.6,coat_darkening:1,fuzz_weight:0,fuzz_color:[1,1,1],fuzz_roughness:.5,emission_luminance:0,emission_color:[1,1,1],thin_film_thickness:0,thin_film_ior:1.5,geometry_opacity:1,geometry_thin_walled:!1};let qt,Sn,cr,Os,ql,ca,Mt,Wf,Js,sr=0,or,Zr,yl,bl;var pn,pc,ua,js,mb={"OpenPBR (orig, 3-float)":0,"OpenPBR (luminace)":1,"OpenPBR (average)":2,"OpenPBR (max value)":3,"OpenPBR (weighted average)":4,"SPI / Arnold v1":5,"Arnold v2":6};gb();Yl();function _b(){let r=(90-j.sunLatitude)*Math.PI/180,e=j.sunLongitude*Math.PI/180,t=Math.cos(r),n=Math.sin(r),i=Math.cos(e),s=Math.sin(e),o=n*i,a=n*s,l=t;j.sunDir=[o,l,a]}function gb(){console.log("init"),pn=new db.Circle("#progress_overlay",{color:"rgba(255, 128, 64, 0.75)",strokeWidth:5,trailColor:"rgba(255, 128, 64, 0.333)",trailWidth:3,svgStyle:{display:"block",width:"100%"},text:{value:"",className:"progressbar__label",style:{color:"rgba(169, 85, 42, 1.0)",position:"absolute",fontWeight:"bold",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0},fill:null,duration:2e3,easing:"linear",from:{color:"rgba( 0, 0, 0, 0.0)"},to:{color:"rgba(32, 255, 32, 1.0)"},warnings:!0}),pn.set(0),pn.setText(""),ua=!1,or=null,Zr=null,yl=null,bl=null,qt=new Mf({antialias:!1}),qt.setPixelRatio(window.devicePixelRatio),qt.setClearColor(594970),qt.setSize(window.innerWidth,window.innerHeight),qt.outputEncoding=Wi,document.body.appendChild(qt.domElement),cr=new f0,Sn=new mn(75,window.innerWidth/window.innerHeight,.1,50),Sn.position.set(4,4,4),Sn.far=100,Sn.updateProjectionMatrix();const r=new Pf(16777215,1);r.position.set(1,1,1),cr.add(r),cr.add(new H0(11583173,.5)),ql=new zx,document.body.appendChild(ql.dom),Mt=new ji({defines:{BOUNCES:j.bounces,MAX_VOLUME_STEPS:j.max_volume_steps},uniforms:{bvh_surface:{value:new Oh},normalAttribute_surface:{value:new Bs},tangentAttribute_surface:{value:new Bs},has_normals_surface:{value:1},has_tangents_surface:{value:0},bvh_props:{value:new Oh},normalAttribute_props:{value:new Bs},tangentAttribute_props:{value:new Bs},has_normals_props:{value:1},has_tangents_props:{value:0},cameraWorldMatrix:{value:new Ge},invProjectionMatrix:{value:new Ge},invModelMatrix:{value:new Ge},resolution:{value:new Ue},samples:{value:0},accumulation_weight:{value:1},wireframe:{value:j.wireframe},neutral_color:{value:new P().fromArray(j.neutral_color)},smooth_normals:{value:j.smooth_normals},skyPower:{value:j.skyPower},skyColor:{value:Un(j.skyColor)},sunPower:{value:Math.pow(10,j.sunPower)},sunAngularSize:{value:j.sunAngularSize},sunColor:{value:Un(j.sunColor)},sunDir:{value:Un([0,0,0])},base_weight:{value:j.base_weight},base_color:{value:Un(j.base_color)},base_roughness:{value:j.base_roughness},base_metalness:{value:j.base_metalness},specular_weight:{value:j.specular_weight},specular_color:{value:Un(j.specular_color)},specular_roughness:{value:j.specular_roughness},specular_anisotropy:{value:j.specular_anisotropy},specular_rotation:{value:j.specular_rotation},specular_ior:{value:j.specular_ior},transmission_weight:{value:j.transmission_weight},transmission_color:{value:Un(j.transmission_color)},transmission_depth:{value:j.transmission_depth},transmission_scatter:{value:Un(j.transmission_scatter)},transmission_scatter_anisotropy:{value:j.transmission_scatter_anisotropy},transmission_dispersion_abbe_number:{value:j.transmission_dispersion_abbe_number},transmission_dispersion_scale:{value:j.transmission_dispersion_scale},subsurface_weight:{value:j.subsurface_weight},subsurface_color:{value:Un(j.subsurface_color)},subsurface_radius:{value:j.subsurface_radius},subsurface_radius_scale:{value:Un(j.subsurface_radius_scale)},subsurface_anisotropy:{value:j.subsurface_anisotropy},subsurface_mode:{value:j.subsurface_mode},coat_weight:{value:j.coat_weight},coat_color:{value:Un(j.coat_color)},coat_roughness:{value:j.coat_roughness},coat_anisotropy:{value:j.coat_anisotropy},coat_rotation:{value:j.coat_rotation},coat_ior:{value:j.coat_ior},coat_darkening:{value:j.coat_darkening},fuzz_weight:{value:j.fuzz_weight},fuzz_color:{value:Un(j.fuzz_color)},fuzz_roughness:{value:j.fuzz_roughness},emission_luminance:{value:j.emission_luminance},emission_color:{value:Un(j.emission_color)},geometry_opacity:{value:j.geometry_opacity},geometry_thin_walled:{value:j.geometry_thin_walled}},vertexShader:` +`;function Qo(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Wf={exports:{}};(function(r,e){(function(t){r.exports=t()})(function(){return function(){function t(n,i,s){function o(c,u){if(!i[c]){if(!n[c]){var f=typeof Qo=="function"&&Qo;if(!u&&f)return f(c,!0);if(a)return a(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var p=i[c]={exports:{}};n[c][0].call(p.exports,function(_){var g=n[c][1][_];return o(g||_)},p,p.exports,t,n,i,s)}return i[c].exports}for(var a=typeof Qo=="function"&&Qo,l=0;l-1}function yr(C,U){var $=this.__data__,Te=vt($,C);return Te<0?(++this.size,$.push([C,U])):$[Te][1]=U,this}ln.prototype.clear=Li,ln.prototype.delete=vr,ln.prototype.get=ii,ln.prototype.has=xr,ln.prototype.set=yr;function Wn(C){var U=-1,$=C==null?0:C.length;for(this.clear();++U<$;){var Te=C[U];this.set(Te[0],Te[1])}}function Pi(){this.size=0,this.__data__={hash:new _t,map:new(he||ln),string:new _t}}function bs(C){var U=Be(this,C).delete(C);return this.size-=U?1:0,U}function R(C){return Be(this,C).get(C)}function k(C){return Be(this,C).has(C)}function j(C,U){var $=Be(this,C),Te=$.size;return $.set(C,U),this.size+=$.size==Te?0:1,this}Wn.prototype.clear=Pi,Wn.prototype.delete=bs,Wn.prototype.get=R,Wn.prototype.has=k,Wn.prototype.set=j;function K(C){var U=this.__data__=new ln(C);this.size=U.size}function Y(){this.__data__=new ln,this.size=0}function we(C){var U=this.__data__,$=U.delete(C);return this.size=U.size,$}function Ie(C){return this.__data__.get(C)}function He(C){return this.__data__.has(C)}function Xe(C,U){var $=this.__data__;if($ instanceof ln){var Te=$.__data__;if(!he||Te.length1?$[ct-1]:void 0,Dt=ct>2?$[2]:void 0;for(wt=C.length>3&&typeof wt=="function"?(ct--,wt):void 0,Dt&&Pt($[0],$[1],Dt)&&(wt=ct<3?void 0:wt,ct=1),U=Object(U);++Te-1&&C%1==0&&C0){if(++U>=l)return arguments[0]}else U=0;return C.apply(void 0,arguments)}}function Qt(C){if(C!=null){try{return le.call(C)}catch{}try{return C+""}catch{}}return""}function dn(C,U){return C===U||C!==C&&U!==U}var An=ot(function(){return arguments}())?ot:function(C){return Ss(C)&&re.call(C,"callee")&&!Me.call(C,"callee")},Xn=Array.isArray;function Sr(C){return C!=null&&gc(C.length)&&!Sa(C)}function jf(C){return Ss(C)&&Sr(C)}var _c=ge||Jf;function Sa(C){if(!Ki(C))return!1;var U=cn(C);return U==d||U==x||U==p||U==T}function gc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=u}function Ki(C){var U=typeof C;return C!=null&&(U=="object"||U=="function")}function Ss(C){return C!=null&&typeof C=="object"}function Yf(C){if(!Ss(C)||cn(C)!=E)return!1;var U=Ae(C);if(U===null)return!0;var $=re.call(U,"constructor")&&U.constructor;return typeof $=="function"&&$ instanceof $&&le.call($)==pe}var vc=ze?ke(ze):$i;function $f(C){return V(C,xc(C))}function xc(C){return Sr(C)?Qe(C,!0):xt(C)}var Kf=ue(function(C,U,$){Fn(C,U,$)});function Zf(C){return function(){return C}}function yc(C){return C}function Jf(){return!1}n.exports=Kf}).call(this)}).call(this,typeof kl<"u"?kl:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(t,n,i){/*! For license information please see shifty.js.LICENSE.txt */(function(s,o){typeof i=="object"&&typeof n=="object"?n.exports=o():typeof i=="object"?i.shifty=o():s.shifty=o()})(self,function(){return function(){var s={720:function(l,c,u){u.r(c),u.d(c,{Scene:function(){return Wt},Tweenable:function(){return ht},interpolate:function(){return $i},processTweens:function(){return ae},setBezierFunction:function(){return $e},shouldScheduleUpdate:function(){return Re},tween:function(){return Sn},unsetBezierFunction:function(){return ze}});var f={};u.r(f),u.d(f,{bounce:function(){return _e},bouncePast:function(){return qe},easeFrom:function(){return Fe},easeFromTo:function(){return We},easeInBack:function(){return se},easeInCirc:function(){return Z},easeInCubic:function(){return d},easeInExpo:function(){return G},easeInOutBack:function(){return ve},easeInOutCirc:function(){return ce},easeInOutCubic:function(){return v},easeInOutExpo:function(){return H},easeInOutQuad:function(){return m},easeInOutQuart:function(){return E},easeInOutQuint:function(){return S},easeInOutSine:function(){return O},easeInQuad:function(){return _},easeInQuart:function(){return y},easeInQuint:function(){return T},easeInSine:function(){return A},easeOutBack:function(){return me},easeOutBounce:function(){return ie},easeOutCirc:function(){return J},easeOutCubic:function(){return x},easeOutExpo:function(){return D},easeOutQuad:function(){return g},easeOutQuart:function(){return b},easeOutQuint:function(){return I},easeOutSine:function(){return z},easeTo:function(){return Ye},elastic:function(){return Q},linear:function(){return p},swingFrom:function(){return Se},swingFromTo:function(){return oe},swingTo:function(){return De}});var h={};u.r(h),u.d(h,{afterTween:function(){return vt},beforeTween:function(){return Ze},doesApply:function(){return Qe},tweenCreated:function(){return je}});var p=function(M){return M},_=function(M){return Math.pow(M,2)},g=function(M){return-(Math.pow(M-1,2)-1)},m=function(M){return(M/=.5)<1?.5*Math.pow(M,2):-.5*((M-=2)*M-2)},d=function(M){return Math.pow(M,3)},x=function(M){return Math.pow(M-1,3)+1},v=function(M){return(M/=.5)<1?.5*Math.pow(M,3):.5*(Math.pow(M-2,3)+2)},y=function(M){return Math.pow(M,4)},b=function(M){return-(Math.pow(M-1,4)-1)},E=function(M){return(M/=.5)<1?.5*Math.pow(M,4):-.5*((M-=2)*Math.pow(M,3)-2)},T=function(M){return Math.pow(M,5)},I=function(M){return Math.pow(M-1,5)+1},S=function(M){return(M/=.5)<1?.5*Math.pow(M,5):.5*(Math.pow(M-2,5)+2)},A=function(M){return 1-Math.cos(M*(Math.PI/2))},z=function(M){return Math.sin(M*(Math.PI/2))},O=function(M){return-.5*(Math.cos(Math.PI*M)-1)},G=function(M){return M===0?0:Math.pow(2,10*(M-1))},D=function(M){return M===1?1:1-Math.pow(2,-10*M)},H=function(M){return M===0?0:M===1?1:(M/=.5)<1?.5*Math.pow(2,10*(M-1)):.5*(2-Math.pow(2,-10*--M))},Z=function(M){return-(Math.sqrt(1-M*M)-1)},J=function(M){return Math.sqrt(1-Math.pow(M-1,2))},ce=function(M){return(M/=.5)<1?-.5*(Math.sqrt(1-M*M)-1):.5*(Math.sqrt(1-(M-=2)*M)+1)},ie=function(M){return M<1/2.75?7.5625*M*M:M<2/2.75?7.5625*(M-=1.5/2.75)*M+.75:M<2.5/2.75?7.5625*(M-=2.25/2.75)*M+.9375:7.5625*(M-=2.625/2.75)*M+.984375},se=function(M){var B=1.70158;return M*M*((B+1)*M-B)},me=function(M){var B=1.70158;return(M-=1)*M*((B+1)*M+B)+1},ve=function(M){var B=1.70158;return(M/=.5)<1?M*M*((1+(B*=1.525))*M-B)*.5:.5*((M-=2)*M*((1+(B*=1.525))*M+B)+2)},Q=function(M){return-1*Math.pow(4,-8*M)*Math.sin((6*M-1)*(2*Math.PI)/2)+1},oe=function(M){var B=1.70158;return(M/=.5)<1?M*M*((1+(B*=1.525))*M-B)*.5:.5*((M-=2)*M*((1+(B*=1.525))*M+B)+2)},Se=function(M){var B=1.70158;return M*M*((B+1)*M-B)},De=function(M){var B=1.70158;return(M-=1)*M*((B+1)*M+B)+1},_e=function(M){return M<1/2.75?7.5625*M*M:M<2/2.75?7.5625*(M-=1.5/2.75)*M+.75:M<2.5/2.75?7.5625*(M-=2.25/2.75)*M+.9375:7.5625*(M-=2.625/2.75)*M+.984375},qe=function(M){return M<1/2.75?7.5625*M*M:M<2/2.75?2-(7.5625*(M-=1.5/2.75)*M+.75):M<2.5/2.75?2-(7.5625*(M-=2.25/2.75)*M+.9375):2-(7.5625*(M-=2.625/2.75)*M+.984375)},We=function(M){return(M/=.5)<1?.5*Math.pow(M,4):-.5*((M-=2)*Math.pow(M,3)-2)},Fe=function(M){return Math.pow(M,4)},Ye=function(M){return Math.pow(M,.25)};function W(M,B,te,V,ue,Ne){var Be,it,ft,Ft,bt,Pt=0,kt=0,rn=0,_i=function(St){return((Pt*St+kt)*St+rn)*St},ri=function(St){return(3*Pt*St+2*kt)*St+rn},si=function(St){return St>=0?St:0-St};return Pt=1-(rn=3*B)-(kt=3*(V-B)-rn),ft=1-(bt=3*te)-(Ft=3*(ue-te)-bt),Be=M,it=function(St){return 1/(200*St)}(Ne),function(St){return((ft*St+Ft)*St+bt)*St}(function(St,oi){var ai,gi,Qt,dn,An,Xn;for(Qt=St,Xn=0;Xn<8;Xn++){if(dn=_i(Qt)-St,si(dn)(gi=1))return gi;for(;aidn?ai=Qt:gi=Qt,Qt=.5*(gi-ai)+ai}return Qt}(Be,it))}var Ct,Ce=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:.25,B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.25,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:.75,V=arguments.length>3&&arguments[3]!==void 0?arguments[3]:.75;return function(ue){return W(ue,M,B,te,V,1)}},$e=function(M,B,te,V,ue){var Ne=Ce(B,te,V,ue);return Ne.displayName=M,Ne.x1=B,Ne.y1=te,Ne.x2=V,Ne.y2=ue,ht.formulas[M]=Ne},ze=function(M){return delete ht.formulas[M]};function mt(M,B){if(!(M instanceof B))throw new TypeError("Cannot call a class as a function")}function Ke(M,B){for(var te=0;teM.length)&&(B=M.length);for(var te=0,V=new Array(B);teit?it:B;M._hasEnded=ft>=it;var Ft=Ne-(it-ft),bt=M._filters.length>0;if(M._hasEnded)return M._render(Be,M._data,Ft),M.stop(!0);bt&&M._applyFilter(N),ft1&&arguments[1]!==void 0?arguments[1]:fe,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Array.isArray(B)){var V=Ce.apply(void 0,st(B));return V}var ue=ke(B);if(Ge[B])return Ge[B];if(ue===Oe||ue===ne)for(var Ne in M)te[Ne]=B;else for(var Be in M)te[Be]=B[Be]||fe;return te},Vt=function(M){M===Me?(Me=M._next)?Me._previous=null:be=null:M===be?(be=M._previous)?be._next=null:Me=null:(le=M._previous,re=M._next,le._next=re,re._previous=le),M._previous=M._next=null},ut=typeof Promise=="function"?Promise:null;Ct=Symbol.toStringTag;var ht=function(){function M(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;mt(this,M),w(this,Ct,"Promise"),this._config={},this._data={},this._delay=0,this._filters=[],this._next=null,this._previous=null,this._timestamp=null,this._hasEnded=!1,this._resolve=null,this._reject=null,this._currentState=V||{},this._originalState={},this._targetState={},this._start=Le,this._render=Le,this._promiseCtor=ut,ue&&this.setConfig(ue)}var B,te;return B=M,te=[{key:"_applyFilter",value:function(V){for(var ue=this._filters.length;ue>0;ue--){var Ne=this._filters[ue-ue][V];Ne&&Ne(this)}}},{key:"tween",value:function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return this._isPlaying&&this.stop(),!V&&this._config||this.setConfig(V),this._pausedAtTime=null,this._timestamp=M.now(),this._start(this.get(),this._data),this._delay&&this._render(this._currentState,this._data,0),this._resume(this._timestamp)}},{key:"setConfig",value:function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ue=this._config;for(var Ne in V)ue[Ne]=V[Ne];var Be=ue.promise,it=Be===void 0?this._promiseCtor:Be,ft=ue.start,Ft=ft===void 0?Le:ft,bt=ue.finish,Pt=ue.render,kt=Pt===void 0?this._config.step||Le:Pt,rn=ue.step,_i=rn===void 0?Le:rn;this._data=ue.data||ue.attachment||this._data,this._isPlaying=!1,this._pausedAtTime=null,this._scheduleId=null,this._delay=V.delay||0,this._start=Ft,this._render=kt||_i,this._duration=ue.duration||500,this._promiseCtor=it,bt&&(this._resolve=bt);var ri=V.from,si=V.to,St=si===void 0?{}:si,oi=this._currentState,ai=this._originalState,gi=this._targetState;for(var Qt in ri)oi[Qt]=ri[Qt];var dn=!1;for(var An in oi){var Xn=oi[An];dn||ke(Xn)!==Oe||(dn=!0),ai[An]=Xn,gi[An]=St.hasOwnProperty(An)?St[An]:Xn}if(this._easing=_t(this._currentState,ue.easing,this._easing),this._filters.length=0,dn){for(var Sr in M.filters)M.filters[Sr].doesApply(this)&&this._filters.push(M.filters[Sr]);this._applyFilter(de)}return this}},{key:"then",value:function(V,ue){var Ne=this;return this._promise=new this._promiseCtor(function(Be,it){Ne._resolve=Be,Ne._reject=it}),this._promise.then(V,ue)}},{key:"catch",value:function(V){return this.then().catch(V)}},{key:"finally",value:function(V){return this.then().finally(V)}},{key:"get",value:function(){return P({},this._currentState)}},{key:"set",value:function(V){this._currentState=V}},{key:"pause",value:function(){if(this._isPlaying)return this._pausedAtTime=M.now(),this._isPlaying=!1,Vt(this),this}},{key:"resume",value:function(){return this._resume()}},{key:"_resume",value:function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M.now();return this._timestamp===null?this.tween():this._isPlaying?this._promise:(this._pausedAtTime&&(this._timestamp+=V-this._pausedAtTime,this._pausedAtTime=null),this._isPlaying=!0,Me===null?(Me=this,be=this):(this._previous=be,be._next=this,be=this),this)}},{key:"seek",value:function(V){V=Math.max(V,0);var ue=M.now();return this._timestamp+V===0||(this._timestamp=ue-V,ge(this,ue)),this}},{key:"stop",value:function(){var V=arguments.length>0&&arguments[0]!==void 0&&arguments[0];if(!this._isPlaying)return this;this._isPlaying=!1,Vt(this);var ue=this._filters.length>0;return V&&(ue&&this._applyFilter(N),F(1,this._currentState,this._originalState,this._targetState,1,0,this._easing),ue&&(this._applyFilter(pe),this._applyFilter(ye))),this._resolve&&this._resolve({data:this._data,state:this._currentState,tweenable:this}),this._resolve=null,this._reject=null,this}},{key:"cancel",value:function(){var V=arguments.length>0&&arguments[0]!==void 0&&arguments[0],ue=this._currentState,Ne=this._data,Be=this._isPlaying;return Be?(this._reject&&this._reject({data:Ne,state:ue,tweenable:this}),this._resolve=null,this._reject=null,this.stop(V)):this}},{key:"isPlaying",value:function(){return this._isPlaying}},{key:"hasEnded",value:function(){return this._hasEnded}},{key:"setScheduleFunction",value:function(V){M.setScheduleFunction(V)}},{key:"data",value:function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return V&&(this._data=P({},V)),this._data}},{key:"dispose",value:function(){for(var V in this)delete this[V]}}],te&&Ke(B.prototype,te),M}();function Sn(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},B=new ht;return B.tween(M),B.tweenable=B,B}w(ht,"now",function(){return X}),w(ht,"setScheduleFunction",function(M){return Ae=M}),w(ht,"filters",{}),w(ht,"formulas",Ge),Re(!0);var ni,ln,Li=/(\d|-|\.)/,vr=/([^\-0-9.]+)/g,ii=/[0-9.-]+/g,xr=(ni=ii.source,ln=/,\s*/.source,new RegExp("rgba?\\(".concat(ni).concat(ln).concat(ni).concat(ln).concat(ni,"(").concat(ln).concat(ni,")?\\)"),"g")),yr=/^.*\(/,Wn=/#([0-9]|[a-f]){3,6}/gi,Pi="VAL",bs=function(M,B){return M.map(function(te,V){return"_".concat(B,"_").concat(V)})};function R(M){return parseInt(M,16)}var k=function(M){return"rgb(".concat((B=M,(B=B.replace(/#/,"")).length===3&&(B=(B=B.split(""))[0]+B[0]+B[1]+B[1]+B[2]+B[2]),[R(B.substr(0,2)),R(B.substr(2,2)),R(B.substr(4,2))]).join(","),")");var B},j=function(M,B,te){var V=B.match(M),ue=B.replace(M,Pi);return V&&V.forEach(function(Ne){return ue=ue.replace(Pi,te(Ne))}),ue},K=function(M){for(var B in M){var te=M[B];typeof te=="string"&&te.match(Wn)&&(M[B]=j(Wn,te,k))}},Y=function(M){var B=M.match(ii),te=B.slice(0,3).map(Math.floor),V=M.match(yr)[0];if(B.length===3)return"".concat(V).concat(te.join(","),")");if(B.length===4)return"".concat(V).concat(te.join(","),",").concat(B[3],")");throw new Error("Invalid rgbChunk: ".concat(M))},we=function(M){return M.match(ii)},Ie=function(M,B){var te={};return B.forEach(function(V){te[V]=M[V],delete M[V]}),te},He=function(M,B){return B.map(function(te){return M[te]})},Xe=function(M,B){return B.forEach(function(te){return M=M.replace(Pi,+te.toFixed(4))}),M},Qe=function(M){for(var B in M._currentState)if(typeof M._currentState[B]=="string")return!0;return!1};function je(M){var B=M._currentState;[B,M._originalState,M._targetState].forEach(K),M._tokenData=function(te){var V,ue,Ne={};for(var Be in te){var it=te[Be];typeof it=="string"&&(Ne[Be]={formatString:(V=it,ue=void 0,ue=V.match(vr),ue?(ue.length===1||V.charAt(0).match(Li))&&ue.unshift(""):ue=["",""],ue.join(Pi)),chunkNames:bs(we(it),Be)})}return Ne}(B)}function Ze(M){var B=M._currentState,te=M._originalState,V=M._targetState,ue=M._easing,Ne=M._tokenData;(function(Be,it){var ft=function(bt){var Pt=it[bt].chunkNames,kt=Be[bt];if(typeof kt=="string"){var rn=kt.split(" "),_i=rn[rn.length-1];Pt.forEach(function(ri,si){return Be[ri]=rn[si]||_i})}else Pt.forEach(function(ri){return Be[ri]=kt});delete Be[bt]};for(var Ft in it)ft(Ft)})(ue,Ne),[B,te,V].forEach(function(Be){return function(it,ft){var Ft=function(Pt){we(it[Pt]).forEach(function(kt,rn){return it[ft[Pt].chunkNames[rn]]=+kt}),delete it[Pt]};for(var bt in ft)Ft(bt)}(Be,Ne)})}function vt(M){var B=M._currentState,te=M._originalState,V=M._targetState,ue=M._easing,Ne=M._tokenData;[B,te,V].forEach(function(Be){return function(it,ft){for(var Ft in ft){var bt=ft[Ft],Pt=bt.chunkNames,kt=bt.formatString,rn=Xe(kt,He(Ie(it,Pt),Pt));it[Ft]=j(xr,rn,Y)}}(Be,Ne)}),function(Be,it){for(var ft in it){var Ft=it[ft].chunkNames,bt=Be[Ft[0]];Be[ft]=typeof bt=="string"?Ft.map(function(Pt){var kt=Be[Pt];return delete Be[Pt],kt}).join(" "):bt}}(ue,Ne)}function Gt(M,B){var te=Object.keys(M);if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(M);B&&(V=V.filter(function(ue){return Object.getOwnPropertyDescriptor(M,ue).enumerable})),te.push.apply(te,V)}return te}function zt(M){for(var B=1;B4&&arguments[4]!==void 0?arguments[4]:0,Ne=zt({},M),Be=_t(M,V);for(var it in ot._filters.length=0,ot.set({}),ot._currentState=Ne,ot._originalState=M,ot._targetState=B,ot._easing=Be,Je)Je[it].doesApply(ot)&&ot._filters.push(Je[it]);ot._applyFilter("tweenCreated"),ot._applyFilter("beforeTween");var ft=F(te,Ne,M,B,1,ue,Be);return ot._applyFilter("afterTween"),ft};function xt(M,B){(B==null||B>M.length)&&(B=M.length);for(var te=0,V=new Array(B);tec.strokeWidth&&(u=c.trailWidth);var f=50-u/2;return o.render(this._pathTemplate,{radius:f,"2radius":f*2})},a.prototype._trailString=function(c){return this._pathString(c)},n.exports=a},{"./shape":8,"./utils":10}],4:[function(t,n,i){var s=t("./shape"),o=t("./utils"),a=function(c,u){this._pathTemplate=u.vertical?"M {center},100 L {center},0":"M 0,{center} L 100,{center}",s.apply(this,arguments)};a.prototype=new s,a.prototype.constructor=a,a.prototype._initializeSvg=function(c,u){var f=u.vertical?"0 0 "+u.strokeWidth+" 100":"0 0 100 "+u.strokeWidth;c.setAttribute("viewBox",f),c.setAttribute("preserveAspectRatio","none")},a.prototype._pathString=function(c){return o.render(this._pathTemplate,{center:c.strokeWidth/2})},a.prototype._trailString=function(c){return this._pathString(c)},n.exports=a},{"./shape":8,"./utils":10}],5:[function(t,n,i){n.exports={Line:t("./line"),Circle:t("./circle"),SemiCircle:t("./semicircle"),Square:t("./square"),Path:t("./path"),Shape:t("./shape"),utils:t("./utils")}},{"./circle":3,"./line":4,"./path":6,"./semicircle":7,"./shape":8,"./square":9,"./utils":10}],6:[function(t,n,i){var s=t("shifty"),o=t("./utils"),a=s.Tweenable,l={easeIn:"easeInCubic",easeOut:"easeOutCubic",easeInOut:"easeInOutCubic"},c=function u(f,h){if(!(this instanceof u))throw new Error("Constructor was called without new keyword");h=o.extend({delay:0,duration:800,easing:"linear",from:{},to:{},step:function(){}},h);var p;o.isString(f)?p=document.querySelector(f):p=f,this.path=p,this._opts=h,this._tweenable=null;var _=this.path.getTotalLength();this.path.style.strokeDasharray=_+" "+_,this.set(0)};c.prototype.value=function(){var f=this._getComputedDashOffset(),h=this.path.getTotalLength(),p=1-f/h;return parseFloat(p.toFixed(6),10)},c.prototype.set=function(f){this.stop(),this.path.style.strokeDashoffset=this._progressToOffset(f);var h=this._opts.step;if(o.isFunction(h)){var p=this._easing(this._opts.easing),_=this._calculateTo(f,p),g=this._opts.shape||this;h(_,g,this._opts.attachment)}},c.prototype.stop=function(){this._stopTween(),this.path.style.strokeDashoffset=this._getComputedDashOffset()},c.prototype.animate=function(f,h,p){h=h||{},o.isFunction(h)&&(p=h,h={});var _=o.extend({},h),g=o.extend({},this._opts);h=o.extend(g,h);var m=this._easing(h.easing),d=this._resolveFromAndTo(f,m,_);this.stop(),this.path.getBoundingClientRect();var x=this._getComputedDashOffset(),v=this._progressToOffset(f),y=this;this._tweenable=new a,this._tweenable.tween({from:o.extend({offset:x},d.from),to:o.extend({offset:v},d.to),duration:h.duration,delay:h.delay,easing:m,step:function(b){y.path.style.strokeDashoffset=b.offset;var E=h.shape||y;h.step(b,E,h.attachment)}}).then(function(b){o.isFunction(p)&&p()}).catch(function(b){throw console.error("Error in tweening:",b),b})},c.prototype._getComputedDashOffset=function(){var f=window.getComputedStyle(this.path,null);return parseFloat(f.getPropertyValue("stroke-dashoffset"),10)},c.prototype._progressToOffset=function(f){var h=this.path.getTotalLength();return h-f*h},c.prototype._resolveFromAndTo=function(f,h,p){return p.from&&p.to?{from:p.from,to:p.to}:{from:this._calculateFrom(h),to:this._calculateTo(f,h)}},c.prototype._calculateFrom=function(f){return s.interpolate(this._opts.from,this._opts.to,this.value(),f)},c.prototype._calculateTo=function(f,h){return s.interpolate(this._opts.from,this._opts.to,f,h)},c.prototype._stopTween=function(){this._tweenable!==null&&(this._tweenable.stop(!0),this._tweenable=null)},c.prototype._easing=function(f){return l.hasOwnProperty(f)?l[f]:f},n.exports=c},{"./utils":10,shifty:2}],7:[function(t,n,i){var s=t("./shape"),o=t("./circle"),a=t("./utils"),l=function(u,f){this._pathTemplate="M 50,50 m -{radius},0 a {radius},{radius} 0 1 1 {2radius},0",this.containerAspectRatio=2,s.apply(this,arguments)};l.prototype=new s,l.prototype.constructor=l,l.prototype._initializeSvg=function(u,f){u.setAttribute("viewBox","0 0 100 50")},l.prototype._initializeTextContainer=function(u,f,h){u.text.style&&(h.style.top="auto",h.style.bottom="0",u.text.alignToBottom?a.setStyle(h,"transform","translate(-50%, 0)"):a.setStyle(h,"transform","translate(-50%, 50%)"))},l.prototype._pathString=o.prototype._pathString,l.prototype._trailString=o.prototype._trailString,n.exports=l},{"./circle":3,"./shape":8,"./utils":10}],8:[function(t,n,i){var s=t("./path"),o=t("./utils"),a="Object is destroyed",l=function c(u,f){if(!(this instanceof c))throw new Error("Constructor was called without new keyword");if(arguments.length!==0){this._opts=o.extend({color:"#555",strokeWidth:1,trailColor:null,trailWidth:null,fill:null,text:{style:{color:null,position:"absolute",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0,value:null,className:"progressbar-text"},svgStyle:{display:"block",width:"100%"},warnings:!1},f,!0),o.isObject(f)&&f.svgStyle!==void 0&&(this._opts.svgStyle=f.svgStyle),o.isObject(f)&&o.isObject(f.text)&&f.text.style!==void 0&&(this._opts.text.style=f.text.style);var h=this._createSvgView(this._opts),p;if(o.isString(u)?p=document.querySelector(u):p=u,!p)throw new Error("Container does not exist: "+u);this._container=p,this._container.appendChild(h.svg),this._opts.warnings&&this._warnContainerAspectRatio(this._container),this._opts.svgStyle&&o.setStyles(h.svg,this._opts.svgStyle),this.svg=h.svg,this.path=h.path,this.trail=h.trail,this.text=null;var _=o.extend({attachment:void 0,shape:this},this._opts);this._progressPath=new s(h.path,_),o.isObject(this._opts.text)&&this._opts.text.value!==null&&this.setText(this._opts.text.value)}};l.prototype.animate=function(u,f,h){if(this._progressPath===null)throw new Error(a);this._progressPath.animate(u,f,h)},l.prototype.stop=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath.stop()},l.prototype.pause=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath._tweenable&&this._progressPath._tweenable.pause()},l.prototype.resume=function(){if(this._progressPath===null)throw new Error(a);this._progressPath!==void 0&&this._progressPath._tweenable&&this._progressPath._tweenable.resume()},l.prototype.destroy=function(){if(this._progressPath===null)throw new Error(a);this.stop(),this.svg.parentNode.removeChild(this.svg),this.svg=null,this.path=null,this.trail=null,this._progressPath=null,this.text!==null&&(this.text.parentNode.removeChild(this.text),this.text=null)},l.prototype.set=function(u){if(this._progressPath===null)throw new Error(a);this._progressPath.set(u)},l.prototype.value=function(){if(this._progressPath===null)throw new Error(a);return this._progressPath===void 0?0:this._progressPath.value()},l.prototype.setText=function(u){if(this._progressPath===null)throw new Error(a);this.text===null&&(this.text=this._createTextContainer(this._opts,this._container),this._container.appendChild(this.text)),o.isObject(u)?(o.removeChildren(this.text),this.text.appendChild(u)):this.text.innerHTML=u},l.prototype._createSvgView=function(u){var f=document.createElementNS("http://www.w3.org/2000/svg","svg");this._initializeSvg(f,u);var h=null;(u.trailColor||u.trailWidth)&&(h=this._createTrail(u),f.appendChild(h));var p=this._createPath(u);return f.appendChild(p),{svg:f,path:p,trail:h}},l.prototype._initializeSvg=function(u,f){u.setAttribute("viewBox","0 0 100 100")},l.prototype._createPath=function(u){var f=this._pathString(u);return this._createPathElement(f,u)},l.prototype._createTrail=function(u){var f=this._trailString(u),h=o.extend({},u);return h.trailColor||(h.trailColor="#eee"),h.trailWidth||(h.trailWidth=h.strokeWidth),h.color=h.trailColor,h.strokeWidth=h.trailWidth,h.fill=null,this._createPathElement(f,h)},l.prototype._createPathElement=function(u,f){var h=document.createElementNS("http://www.w3.org/2000/svg","path");return h.setAttribute("d",u),h.setAttribute("stroke",f.color),h.setAttribute("stroke-width",f.strokeWidth),f.fill?h.setAttribute("fill",f.fill):h.setAttribute("fill-opacity","0"),h},l.prototype._createTextContainer=function(u,f){var h=document.createElement("div");h.className=u.text.className;var p=u.text.style;return p&&(u.text.autoStyleContainer&&(f.style.position="relative"),o.setStyles(h,p),p.color||(h.style.color=u.color)),this._initializeTextContainer(u,f,h),h},l.prototype._initializeTextContainer=function(c,u,f){},l.prototype._pathString=function(u){throw new Error("Override this function for each progress bar")},l.prototype._trailString=function(u){throw new Error("Override this function for each progress bar")},l.prototype._warnContainerAspectRatio=function(u){if(this.containerAspectRatio){var f=window.getComputedStyle(u,null),h=parseFloat(f.getPropertyValue("width"),10),p=parseFloat(f.getPropertyValue("height"),10);o.floatEquals(this.containerAspectRatio,h/p)||(console.warn("Incorrect aspect ratio of container","#"+u.id,"detected:",f.getPropertyValue("width")+"(width)","/",f.getPropertyValue("height")+"(height)","=",h/p),console.warn("Aspect ratio of should be",this.containerAspectRatio))}},n.exports=l},{"./path":6,"./utils":10}],9:[function(t,n,i){var s=t("./shape"),o=t("./utils"),a=function(c,u){this._pathTemplate="M 0,{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{strokeWidth}",this._trailTemplate="M {startMargin},{halfOfStrokeWidth} L {width},{halfOfStrokeWidth} L {width},{width} L {halfOfStrokeWidth},{width} L {halfOfStrokeWidth},{halfOfStrokeWidth}",s.apply(this,arguments)};a.prototype=new s,a.prototype.constructor=a,a.prototype._pathString=function(c){var u=100-c.strokeWidth/2;return o.render(this._pathTemplate,{width:u,strokeWidth:c.strokeWidth,halfOfStrokeWidth:c.strokeWidth/2})},a.prototype._trailString=function(c){var u=100-c.strokeWidth/2;return o.render(this._trailTemplate,{width:u,strokeWidth:c.strokeWidth,halfOfStrokeWidth:c.strokeWidth/2,startMargin:c.strokeWidth/2-c.trailWidth/2})},n.exports=a},{"./shape":8,"./utils":10}],10:[function(t,n,i){var s=t("lodash.merge"),o="Webkit Moz O ms".split(" "),a=.001;function l(v,y){var b=v;for(var E in y)if(y.hasOwnProperty(E)){var T=y[E],I="\\{"+E+"\\}",S=new RegExp(I,"g");b=b.replace(S,T)}return b}function c(v,y,b){for(var E=v.style,T=0;T{if(o.isMesh){const a=new Zy(o);a.attributes=["position","color","normal","tangent","uv","uv2"],a.applyWorldTransforms=!1;const l={strategy:Uf,maxLeafTris:1};let c=new dc(a.generate(),l);return new En(a.generate(),o.material),this.result={scene:t.scene,bvh:c,mesh:o},console.log("==> loaded mesh ",e),this.result}});return this.result}}function Bn(r){return new L(r[0],r[1],r[2])}const q={smooth_normals:!0,bounces:6,max_samples:1024,max_volume_steps:8,wireframe:!0,neutral_color:[.5,.5,.5],skyPower:.5,skyColor:[.8,.8,1],sunPower:.35,sunAngularSize:40,sunLatitude:40,sunLongitude:180,sunColor:[1,1,.8],base_weight:1,base_color:[.8,.8,.8],base_roughness:0,base_metalness:0,specular_weight:1,specular_color:[1,1,1],specular_roughness:.1,specular_anisotropy:0,specular_rotation:0,specular_ior:1.5,transmission_weight:0,transmission_color:[1,1,1],transmission_depth:0,transmission_scatter:[0,0,0],transmission_scatter_anisotropy:0,transmission_dispersion_abbe_number:20,transmission_dispersion_scale:0,subsurface_weight:0,subsurface_color:[.8,.8,.8],subsurface_radius:.2,subsurface_radius_scale:[1,.5,.25],subsurface_anisotropy:0,subsurface_mode:0,coat_weight:0,coat_color:[1,1,1],coat_roughness:0,coat_anisotropy:0,coat_rotation:0,coat_ior:1.6,coat_darkening:1,fuzz_weight:0,fuzz_color:[1,1,1],fuzz_roughness:.5,emission_luminance:0,emission_color:[1,1,1],thin_film_thickness:0,thin_film_ior:1.5,geometry_opacity:1,geometry_thin_walled:!1};let qt,Et,Ot,cr,ur,ss,ha,Mt,Xf,eo,or=0,Jr,Qr,Sl,wl;var _n,mc,fa,Ys,yb={"OpenPBR (orig, 3-float)":0,"OpenPBR (luminace)":1,"OpenPBR (average)":2,"OpenPBR (max value)":3,"OpenPBR (weighted average)":4,"SPI / Arnold v1":5,"Arnold v2":6};Sb();$l();function bb(){let r=(90-q.sunLatitude)*Math.PI/180,e=q.sunLongitude*Math.PI/180,t=Math.cos(r),n=Math.sin(r),i=Math.cos(e),s=Math.sin(e),o=n*i,a=n*s,l=t;q.sunDir=[o,l,a]}function Sb(){_n=new vb.Circle("#progress_overlay",{color:"rgba(255, 128, 64, 0.75)",strokeWidth:5,trailColor:"rgba(255, 128, 64, 0.333)",trailWidth:3,svgStyle:{display:"block",width:"100%"},text:{value:"",className:"progressbar__label",style:{color:"rgba(169, 85, 42, 1.0)",position:"absolute",fontWeight:"bold",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0},fill:null,duration:2e3,easing:"linear",from:{color:"rgba( 0, 0, 0, 0.0)"},to:{color:"rgba(32, 255, 32, 1.0)"},warnings:!0}),_n.set(0),_n.setText(""),fa=!1,Jr=null,Qr=null,Sl=null,wl=null,qt=new Ef({antialias:!0,preserveDrawingBuffer:!0}),qt.setPixelRatio(window.devicePixelRatio),qt.setClearColor(594970),qt.setSize(window.innerWidth,window.innerHeight),qt.outputEncoding=Xi,document.body.appendChild(qt.domElement),cr=new p0;const r=new Df(16777215,1);r.position.set(1,1,1),cr.add(r),cr.add(new G0(11583173,.5)),ss=new Hx,document.body.appendChild(ss.dom);let e=document.getElementById("samples");e.style.visibility="visible";let t=document.getElementById("info");t.style.visibility="visible",Mt=new ji({defines:{BOUNCES:q.bounces,MAX_VOLUME_STEPS:q.max_volume_steps},uniforms:{bvh_surface:{value:new Uh},normalAttribute_surface:{value:new ks},tangentAttribute_surface:{value:new ks},has_normals_surface:{value:1},has_tangents_surface:{value:0},bvh_props:{value:new Uh},normalAttribute_props:{value:new ks},tangentAttribute_props:{value:new ks},has_normals_props:{value:1},has_tangents_props:{value:0},cameraWorldMatrix:{value:new Ve},invProjectionMatrix:{value:new Ve},invModelMatrix:{value:new Ve},resolution:{value:new Ue},samples:{value:0},accumulation_weight:{value:1},wireframe:{value:q.wireframe},neutral_color:{value:new L().fromArray(q.neutral_color)},smooth_normals:{value:q.smooth_normals},skyPower:{value:q.skyPower},skyColor:{value:Bn(q.skyColor)},sunPower:{value:Math.pow(10,q.sunPower)},sunAngularSize:{value:q.sunAngularSize},sunColor:{value:Bn(q.sunColor)},sunDir:{value:Bn([0,0,0])},base_weight:{value:q.base_weight},base_color:{value:Bn(q.base_color)},base_roughness:{value:q.base_roughness},base_metalness:{value:q.base_metalness},specular_weight:{value:q.specular_weight},specular_color:{value:Bn(q.specular_color)},specular_roughness:{value:q.specular_roughness},specular_anisotropy:{value:q.specular_anisotropy},specular_rotation:{value:q.specular_rotation},specular_ior:{value:q.specular_ior},transmission_weight:{value:q.transmission_weight},transmission_color:{value:Bn(q.transmission_color)},transmission_depth:{value:q.transmission_depth},transmission_scatter:{value:Bn(q.transmission_scatter)},transmission_scatter_anisotropy:{value:q.transmission_scatter_anisotropy},transmission_dispersion_abbe_number:{value:q.transmission_dispersion_abbe_number},transmission_dispersion_scale:{value:q.transmission_dispersion_scale},subsurface_weight:{value:q.subsurface_weight},subsurface_color:{value:Bn(q.subsurface_color)},subsurface_radius:{value:q.subsurface_radius},subsurface_radius_scale:{value:Bn(q.subsurface_radius_scale)},subsurface_anisotropy:{value:q.subsurface_anisotropy},subsurface_mode:{value:q.subsurface_mode},coat_weight:{value:q.coat_weight},coat_color:{value:Bn(q.coat_color)},coat_roughness:{value:q.coat_roughness},coat_anisotropy:{value:q.coat_anisotropy},coat_rotation:{value:q.coat_rotation},coat_ior:{value:q.coat_ior},coat_darkening:{value:q.coat_darkening},fuzz_weight:{value:q.fuzz_weight},fuzz_color:{value:Bn(q.fuzz_color)},fuzz_roughness:{value:q.fuzz_roughness},emission_luminance:{value:q.emission_luminance},emission_color:{value:Bn(q.emission_color)},geometry_opacity:{value:q.geometry_opacity},geometry_thin_walled:{value:q.geometry_thin_walled}},vertexShader:` varying vec2 vUv; void main() { @@ -6168,6 +6589,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `,fragmentShader:`precision highp isampler2D; precision highp usampler2D; precision highp int; - ${Gy} - ${Wy} - `+sb+ob+lb+cb+ab+ub+hb+fb}),pn.setText("loading meshes..."),pn.animate(.5);const e=new pb;e.load("standard-shader-ball/neutral_objects.gltf").then(()=>{cr.add(e.result.scene),Zr=e.result.mesh,bl=e.result.bvh,Mt.uniforms.bvh_props.value.updateFrom(bl),Mt.uniforms.has_normals_props.value=!1,Mt.uniforms.has_tangents_props.value=!1,Zr.geometry.attributes.normal&&(Mt.uniforms.normalAttribute_props.value.updateFrom(Zr.geometry.attributes.normal),Mt.uniforms.has_normals_props.value=!0),Zr.geometry.attributes.tangent&&(Mt.uniforms.tangentAttribute_props.value.updateFrom(Zr.geometry.attributes.tangent),Mt.uniforms.has_tangents_props.value=!0),console.log(" has_normals_scene: ",Mt.uniforms.has_normals_props),console.log(" has_tangents_scene: ",Mt.uniforms.has_tangents_props),pn.animate(.75),e.reset(),e.load("standard-shader-ball/shaderball.gltf").then(()=>{cr.add(e.result.scene),or=e.result.mesh,yl=e.result.bvh,Mt.uniforms.bvh_surface.value.updateFrom(yl),Mt.uniforms.has_normals_surface.value=!1,Mt.uniforms.has_tangents_surface.value=!1,or.geometry.attributes.normal&&(Mt.uniforms.normalAttribute_surface.value.updateFrom(or.geometry.attributes.normal),Mt.uniforms.has_normals_surface.value=!0),or.geometry.attributes.tangent&&(Mt.uniforms.tangentAttribute_surface.value.updateFrom(or.geometry.attributes.tangent),Mt.uniforms.has_tangents_surface.value=!0),console.log(" has_normals_surface: ",Mt.uniforms.has_normals_surface),console.log(" has_tangents_surface: ",Mt.uniforms.has_tangents_surface),console.log("===> LOADED"),ua=!0,vb(),pn.animate(1),document.getElementById("progress_overlay"),pc=performance.now()})})}function vb(){let r=new Q0(Sn,qt.domElement);r.addEventListener("change",()=>{Oe()});let e=new kt;e.setFromObject(or);let t=e.min,n=e.max,i=Math.max(n.x-t.x,n.y-t.y,n.z-t.z),s=[t.x,t.y,t.z],o=[n.x-t.x,n.y-t.y,n.z-t.z],a=new P(s[0]+.5*o[0],s[1]+.5*o[1],s[2]+.5*o[2]),l=new P(s[0]+o[0],s[1]+o[1],s[2]+o[2]),c=a.clone();c.sub(l),c.normalize();let u=a.clone();u.addScaledVector(c,-2*i),Sn.position.copy(u),r.target.copy(a),r.zoomSpeed=1.5,r.update(),ca=new dh(Mt),Mt.transparent=!0,Mt.depthWrite=!1,Js=new Xi(1,1,{format:nn,type:_n}),Wf=new dh(new ki({map:Js.texture})),Sl(),Os=new dc({width:300});const h=Os.addFolder("Material"),f=h.addFolder("Base");f.add(j,"base_weight",0,1).onChange(w=>{Oe()}),f.addColor(j,"base_color").onChange(w=>{Oe()}),f.add(j,"base_roughness",0,1).onChange(w=>{Oe()}),f.add(j,"base_metalness",0,1).onChange(w=>{Oe()});const d=h.addFolder("Specular");d.add(j,"specular_weight",0,1).onChange(w=>{Oe()}),d.addColor(j,"specular_color").onChange(w=>{Oe()}),d.add(j,"specular_roughness",0,1).onChange(w=>{Oe()}),d.add(j,"specular_ior",1,5).onChange(w=>{Oe()}),d.add(j,"specular_anisotropy",0,1).onChange(w=>{Oe()}),d.add(j,"specular_rotation",0,1).onChange(w=>{Oe()});const _=h.addFolder("Transmission");_.add(j,"transmission_weight",0,1).onChange(w=>{Oe()}),_.addColor(j,"transmission_color").onChange(w=>{Oe()}),_.add(j,"transmission_depth",0,1).onChange(w=>{Oe()}),_.addColor(j,"transmission_scatter").onChange(w=>{Oe()}),_.add(j,"transmission_scatter_anisotropy",-1,1).onChange(w=>{Oe()}),_.add(j,"transmission_dispersion_abbe_number",9,91).onChange(w=>{Oe()}),_.add(j,"transmission_dispersion_scale",0,1).onChange(w=>{Oe()}),_.close();const g=h.addFolder("Subsurface");g.add(j,"subsurface_weight",0,1).onChange(w=>{Oe()}),g.addColor(j,"subsurface_color").onChange(w=>{Oe()}),g.add(j,"subsurface_radius",0,1).onChange(w=>{Oe()}),g.addColor(j,"subsurface_radius_scale").onChange(w=>{Oe()}),g.add(j,"subsurface_anisotropy",-1,1).onChange(w=>{Oe()}),g.add(j,"subsurface_mode",mb).onChange(w=>{Oe()}),g.close();const m=h.addFolder("Coat");m.add(j,"coat_weight",0,1).onChange(w=>{Oe()}),m.addColor(j,"coat_color").onChange(w=>{Oe()}),m.add(j,"coat_roughness",0,1).onChange(w=>{Oe()}),m.add(j,"coat_ior",1,3).onChange(w=>{Oe()}),m.add(j,"coat_anisotropy",0,1).onChange(w=>{Oe()}),m.add(j,"coat_rotation",0,1).onChange(w=>{Oe()}),m.add(j,"coat_darkening",0,1).onChange(w=>{Oe()}),m.close();const p=h.addFolder("Fuzz");p.add(j,"fuzz_weight",0,1).onChange(w=>{Oe()}),p.addColor(j,"fuzz_color").onChange(w=>{Oe()}),p.add(j,"fuzz_roughness",0,1).onChange(w=>{Oe()}),p.close();const y=h.addFolder("Emission");y.add(j,"emission_luminance",0,10).onChange(w=>{Oe()}),y.addColor(j,"emission_color").onChange(w=>{Oe()}),y.close();const v=h.addFolder("Thin Film");v.add(j,"thin_film_thickness",0,2e3).onChange(w=>{Oe()}),v.add(j,"thin_film_ior",1,3).onChange(w=>{Oe()}),v.close();const x=h.addFolder("Geometry");x.add(j,"geometry_opacity",0,1).onChange(w=>{Oe()}),x.add(j,"geometry_thin_walled").onChange(w=>{Oe()}),x.close();const b=Os.addFolder("Lighting");b.add(j,"skyPower",0,2).onChange(w=>{Oe()}),b.addColor(j,"skyColor").onChange(w=>{Oe()}),b.add(j,"sunPower",-4,4).onChange(w=>{Oe()}),b.add(j,"sunAngularSize",0,40).onChange(w=>{Oe()}),b.add(j,"sunLatitude",0,90).onChange(w=>{Oe()}),b.add(j,"sunLongitude",0,360).onChange(w=>{Oe()}),b.addColor(j,"sunColor").onChange(w=>{Oe()}),b.close();const E=Os.addFolder("Renderer");E.add(j,"smooth_normals").onChange(w=>{Oe()}),E.add(j,"wireframe").onChange(w=>{Oe()}),E.addColor(j,"neutral_color").onChange(w=>{Oe()}),E.add(j,"bounces",1,16,1).onChange(w=>{Mt.defines.BOUNCES=parseInt(w),Oe(),Sl()}),E.add(j,"max_volume_steps",1,256,1).onChange(w=>{Mt.defines.MAX_VOLUME_STEPS=parseInt(w),Oe(),Sl()}),E.close(),Os.open(),window.addEventListener("resize",Gh,!1),Gh()}function Sl(){qt.setRenderTarget(Js);let r=new to(-1,1,1,-1,0,1);xb(),qt.compileAsync(ca._mesh,r).then(t=>{console.log("shaders successfully compiled."),yb()}).catch(t=>{console.log("shader compilation error: "+t)}).finally(()=>{})}function xb(){let r=document.getElementById("progress_overlay");r.style.display="block",r.style.opacity=1,pn.set(0),pn.setText("shaders compiling..."),js=!0}function yb(){pn.set(1),pc=performance.now(),js=!1}function Gh(){Sn.aspect=window.innerWidth/window.innerHeight,Sn.updateProjectionMatrix();const r=window.innerWidth,e=window.innerHeight;qt.setSize(r,e),qt.setPixelRatio(1),Js.setSize(r,e),Oe()}function Ln(r){return new P(r[0],r[1],r[2])}function Oe(){Mt&&(Mt.needsUpdate=!0),sr=0}function bb(r){let e=document.getElementById("progress_overlay");var t=setInterval(function(){e.style.opacity||(e.style.opacity=1),e.style.opacity>0?e.style.opacity-=.025:(e.style.display="none",e.style.opacity=0,clearInterval(t))},r)}function Yl(){if(!ua){console.log("not LOADED"),requestAnimationFrame(Yl);return}if(ql.update(),requestAnimationFrame(Yl),qt.domElement.style.imageRendering="auto",!(sr>=8192)){if(!js&&ua){Sn.updateMatrixWorld();const e=ca.material.uniforms,t=window.innerWidth,n=window.innerHeight;e.cameraWorldMatrix.value.copy(Sn.matrixWorld),e.invProjectionMatrix.value.copy(Sn.projectionMatrixInverse),e.invModelMatrix.value.copy(cr.matrixWorld).invert();let i=new Ue(t,n);e.resolution.value.copy(i),e.accumulation_weight.value=1/(sr+1),e.samples.value=sr,e.wireframe.value=j.wireframe,e.neutral_color.value.copy(Ln(j.neutral_color)),e.smooth_normals.value=j.smooth_normals,e.base_weight.value=j.base_weight,e.base_color.value.copy(Ln(j.base_color)),e.base_roughness.value=j.base_roughness,e.base_metalness.value=j.base_metalness,e.specular_weight.value=j.specular_weight,e.specular_color.value.copy(Ln(j.specular_color)),e.specular_roughness.value=j.specular_roughness,e.specular_anisotropy.value=j.specular_anisotropy,e.specular_rotation.value=j.specular_rotation,e.specular_ior.value=j.specular_ior,e.transmission_weight.value=j.transmission_weight,e.transmission_color.value.copy(Ln(j.transmission_color)),e.transmission_depth.value=j.transmission_depth,e.transmission_scatter.value.copy(Ln(j.transmission_scatter)),e.transmission_scatter_anisotropy.value=j.transmission_scatter_anisotropy,e.transmission_dispersion_abbe_number.value=j.transmission_dispersion_abbe_number,e.transmission_dispersion_scale.value=j.transmission_dispersion_scale,e.subsurface_weight.value=j.subsurface_weight,e.subsurface_color.value.copy(Ln(j.subsurface_color)),e.subsurface_radius.value=j.subsurface_radius,e.subsurface_radius_scale.value.copy(Ln(j.subsurface_radius_scale)),e.subsurface_anisotropy.value=j.subsurface_anisotropy,e.subsurface_mode.value=j.subsurface_mode,e.coat_weight.value=j.coat_weight,e.coat_color.value.copy(Ln(j.coat_color)),e.coat_roughness.value=j.coat_roughness,e.coat_anisotropy.value=j.coat_anisotropy,e.coat_rotation.value=j.coat_rotation,e.coat_ior.value=j.coat_ior,e.coat_darkening.value=j.coat_darkening,e.fuzz_weight.value=j.fuzz_weight,e.fuzz_color.value.copy(Ln(j.fuzz_color)),e.fuzz_roughness.value=j.fuzz_roughness,e.emission_luminance.value=j.emission_luminance,e.emission_color.value.copy(Ln(j.emission_color)),e.geometry_opacity.value=j.geometry_opacity,e.geometry_thin_walled.value=j.geometry_thin_walled,e.skyPower.value=j.skyPower,e.skyColor.value.copy(Ln(j.skyColor)),e.sunPower.value=Math.pow(10,j.sunPower),e.sunAngularSize.value=j.sunAngularSize,e.sunColor.value.copy(Ln(j.sunColor)),_b(),e.sunDir.value.copy(Ln(j.sunDir)),qt.autoClear=sr===0,qt.setRenderTarget(Js),ca.render(qt),qt.setRenderTarget(null),Wf.render(qt),qt.autoClear=!0,sr++}else Oe(),Sn.updateProjectionMatrix(),Sn.clearViewOffset(),qt.render(cr,Sn);document.getElementById("samples").innerText=`samples: ${sr}`,js||document.getElementById("progress_overlay").style.display!="none"&&performance.now()-pc>400&&bb(400),js&&(pn.value()<.01?pn.animate(1):pn.value()>.99&&(pn.set(0),pn.animate(1)))}} + ${Xy} + ${qy} + `+ub+hb+db+pb+fb+mb+_b+gb}),_n.setText("loading meshes..."),_n.animate(.5);const n=new xb;n.load("standard-shader-ball/neutral_objects.gltf").then(()=>{cr.add(n.result.scene),Qr=n.result.mesh,wl=n.result.bvh,Mt.uniforms.bvh_props.value.updateFrom(wl),Mt.uniforms.has_normals_props.value=!1,Mt.uniforms.has_tangents_props.value=!1,Qr.geometry.attributes.normal&&(Mt.uniforms.normalAttribute_props.value.updateFrom(Qr.geometry.attributes.normal),Mt.uniforms.has_normals_props.value=!0),Qr.geometry.attributes.tangent&&(Mt.uniforms.tangentAttribute_props.value.updateFrom(Qr.geometry.attributes.tangent),Mt.uniforms.has_tangents_props.value=!0),console.log(" has_normals_scene: ",Mt.uniforms.has_normals_props),console.log(" has_tangents_scene: ",Mt.uniforms.has_tangents_props),_n.animate(.75),n.reset(),n.load("standard-shader-ball/shaderball.gltf").then(()=>{cr.add(n.result.scene),Jr=n.result.mesh,Sl=n.result.bvh,Mt.uniforms.bvh_surface.value.updateFrom(Sl),Mt.uniforms.has_normals_surface.value=!1,Mt.uniforms.has_tangents_surface.value=!1,Jr.geometry.attributes.normal&&(Mt.uniforms.normalAttribute_surface.value.updateFrom(Jr.geometry.attributes.normal),Mt.uniforms.has_normals_surface.value=!0),Jr.geometry.attributes.tangent&&(Mt.uniforms.tangentAttribute_surface.value.updateFrom(Jr.geometry.attributes.tangent),Mt.uniforms.has_tangents_surface.value=!0),console.log(" has_normals_surface: ",Mt.uniforms.has_normals_surface),console.log(" has_tangents_surface: ",Mt.uniforms.has_tangents_surface),console.log("===> LOADED"),fa=!0,wb(),_n.animate(1),document.getElementById("progress_overlay"),mc=performance.now()})})}function qf(){let r=23.6701655,e=.01,t=1e3;Et=new gn(r,window.innerWidth/window.innerHeight,e,t),Ot=new tx(Et,qt.domElement),Ot.addEventListener("change",()=>{Pe()});let n=new Ve;n.set(.9396926207859084,0,-.3420201433256687,0,-.2203032561704394,.7649214009184319,-.6052782217606094,0,.26161852717499334,.6441236297613865,.7187909959242699,0,6.531538924716362,19.5,17.948521838355774,1),n.transpose(),Et.matrixAutoUpdate=!1,Et.applyMatrix4(n),Et.matrixAutoUpdate=!0,Et.updateMatrixWorld();let i=new L;Et.getWorldDirection(i);let s=Et.position.clone();s.addScaledVector(i,23.39613),Ot.target.copy(s),Ot.zoomSpeed=1.5,Ot.flySpeed=.01,Ot.update()}function wb(){ha=new ph(Mt),Mt.transparent=!0,Mt.depthWrite=!1,eo=new qi(1,1,{format:sn,type:vn}),Xf=new ph(new Hi({map:eo.texture})),Ml(),qf(),ur=new pc({width:300});const r=ur.addFolder("Material"),e=r.addFolder("Base");e.add(q,"base_weight",0,1).onChange(h=>{Pe()}),e.addColor(q,"base_color").onChange(h=>{Pe()}),e.add(q,"base_roughness",0,1).onChange(h=>{Pe()}),e.add(q,"base_metalness",0,1).onChange(h=>{Pe()});const t=r.addFolder("Specular");t.add(q,"specular_weight",0,1).onChange(h=>{Pe()}),t.addColor(q,"specular_color").onChange(h=>{Pe()}),t.add(q,"specular_roughness",0,1).onChange(h=>{Pe()}),t.add(q,"specular_ior",1,5).onChange(h=>{Pe()}),t.add(q,"specular_anisotropy",0,1).onChange(h=>{Pe()}),t.add(q,"specular_rotation",0,1).onChange(h=>{Pe()});const n=r.addFolder("Transmission");n.add(q,"transmission_weight",0,1).onChange(h=>{Pe()}),n.addColor(q,"transmission_color").onChange(h=>{Pe()}),n.add(q,"transmission_depth",0,1).onChange(h=>{Pe()}),n.addColor(q,"transmission_scatter").onChange(h=>{Pe()}),n.add(q,"transmission_scatter_anisotropy",-1,1).onChange(h=>{Pe()}),n.add(q,"transmission_dispersion_abbe_number",9,91).onChange(h=>{Pe()}),n.add(q,"transmission_dispersion_scale",0,1).onChange(h=>{Pe()}),n.close();const i=r.addFolder("Subsurface");i.add(q,"subsurface_weight",0,1).onChange(h=>{Pe()}),i.addColor(q,"subsurface_color").onChange(h=>{Pe()}),i.add(q,"subsurface_radius",0,1).onChange(h=>{Pe()}),i.addColor(q,"subsurface_radius_scale").onChange(h=>{Pe()}),i.add(q,"subsurface_anisotropy",-1,1).onChange(h=>{Pe()}),i.add(q,"subsurface_mode",yb).onChange(h=>{Pe()}),i.close();const s=r.addFolder("Coat");s.add(q,"coat_weight",0,1).onChange(h=>{Pe()}),s.addColor(q,"coat_color").onChange(h=>{Pe()}),s.add(q,"coat_roughness",0,1).onChange(h=>{Pe()}),s.add(q,"coat_ior",1,3).onChange(h=>{Pe()}),s.add(q,"coat_anisotropy",0,1).onChange(h=>{Pe()}),s.add(q,"coat_rotation",0,1).onChange(h=>{Pe()}),s.add(q,"coat_darkening",0,1).onChange(h=>{Pe()}),s.close();const o=r.addFolder("Fuzz");o.add(q,"fuzz_weight",0,1).onChange(h=>{Pe()}),o.addColor(q,"fuzz_color").onChange(h=>{Pe()}),o.add(q,"fuzz_roughness",0,1).onChange(h=>{Pe()}),o.close();const a=r.addFolder("Emission");a.add(q,"emission_luminance",0,10).onChange(h=>{Pe()}),a.addColor(q,"emission_color").onChange(h=>{Pe()}),a.close();const l=r.addFolder("Thin Film");l.add(q,"thin_film_thickness",0,2e3).onChange(h=>{Pe()}),l.add(q,"thin_film_ior",1,3).onChange(h=>{Pe()}),l.close();const c=r.addFolder("Geometry");c.add(q,"geometry_opacity",0,1).onChange(h=>{Pe()}),c.add(q,"geometry_thin_walled").onChange(h=>{Pe()}),c.close();const u=ur.addFolder("Lighting");u.add(q,"skyPower",0,2).onChange(h=>{Pe()}),u.addColor(q,"skyColor").onChange(h=>{Pe()}),u.add(q,"sunPower",-4,4).onChange(h=>{Pe()}),u.add(q,"sunAngularSize",0,40).onChange(h=>{Pe()}),u.add(q,"sunLatitude",0,90).onChange(h=>{Pe()}),u.add(q,"sunLongitude",0,360).onChange(h=>{Pe()}),u.addColor(q,"sunColor").onChange(h=>{Pe()}),u.close();const f=ur.addFolder("Renderer");f.add(q,"smooth_normals").onChange(h=>{Pe()}),f.add(q,"wireframe").onChange(h=>{Pe()}),f.addColor(q,"neutral_color").onChange(h=>{Pe()}),f.add(q,"bounces",1,16,1).onChange(h=>{Mt.defines.BOUNCES=parseInt(h),Pe(),Ml()}),f.add(q,"max_samples").onChange(h=>{Pe()}),f.add(q,"max_volume_steps",1,256,1).onChange(h=>{Mt.defines.MAX_VOLUME_STEPS=parseInt(h),Pe(),Ml()}),f.close(),ur.open(),window.addEventListener("resize",Wh,!1),Wh()}function Ml(){qt.setRenderTarget(eo);let r=new io(-1,1,1,-1,0,1);Mb(),qt.compileAsync(ha._mesh,r).then(t=>{console.log("shaders successfully compiled."),Eb()}).catch(t=>{console.log("shader compilation error: "+t)}).finally(()=>{})}function Mb(){let r=document.getElementById("progress_overlay");r.style.display="block",r.style.opacity=1,_n.set(0),_n.setText("shaders compiling..."),Ys=!0}function Eb(){_n.set(1),mc=performance.now(),Ys=!1}function Wh(){Et.aspect=window.innerWidth/window.innerHeight,Et.updateProjectionMatrix();const r=window.innerWidth,e=window.innerHeight;qt.setSize(r,e),qt.setPixelRatio(1),eo.setSize(r,e),Pe()}function Pn(r){return new L(r[0],r[1],r[2])}function Pe(){Mt&&(Mt.needsUpdate=!0),or=0}function Tb(r){let e=document.getElementById("progress_overlay");var t=setInterval(function(){e.style.opacity||(e.style.opacity=1),e.style.opacity>0?e.style.opacity-=.025:(e.style.display="none",e.style.opacity=0,clearInterval(t))},r)}function $l(){if(!fa){console.log("not LOADED"),requestAnimationFrame($l);return}if(qt.domElement.style.imageRendering="auto",!(or>=q.max_samples)){if(!Ys&&fa){Et.updateMatrixWorld();const r=ha.material.uniforms,e=window.innerWidth,t=window.innerHeight;r.cameraWorldMatrix.value.copy(Et.matrixWorld),r.invProjectionMatrix.value.copy(Et.projectionMatrixInverse),r.invModelMatrix.value.copy(cr.matrixWorld).invert();let n=new Ue(e,t);r.resolution.value.copy(n),r.accumulation_weight.value=1/(or+1),r.samples.value=or,r.wireframe.value=q.wireframe,r.neutral_color.value.copy(Pn(q.neutral_color)),r.smooth_normals.value=q.smooth_normals,r.base_weight.value=q.base_weight,r.base_color.value.copy(Pn(q.base_color)),r.base_roughness.value=q.base_roughness,r.base_metalness.value=q.base_metalness,r.specular_weight.value=q.specular_weight,r.specular_color.value.copy(Pn(q.specular_color)),r.specular_roughness.value=q.specular_roughness,r.specular_anisotropy.value=q.specular_anisotropy,r.specular_rotation.value=q.specular_rotation,r.specular_ior.value=q.specular_ior,r.transmission_weight.value=q.transmission_weight,r.transmission_color.value.copy(Pn(q.transmission_color)),r.transmission_depth.value=q.transmission_depth,r.transmission_scatter.value.copy(Pn(q.transmission_scatter)),r.transmission_scatter_anisotropy.value=q.transmission_scatter_anisotropy,r.transmission_dispersion_abbe_number.value=q.transmission_dispersion_abbe_number,r.transmission_dispersion_scale.value=q.transmission_dispersion_scale,r.subsurface_weight.value=q.subsurface_weight,r.subsurface_color.value.copy(Pn(q.subsurface_color)),r.subsurface_radius.value=q.subsurface_radius,r.subsurface_radius_scale.value.copy(Pn(q.subsurface_radius_scale)),r.subsurface_anisotropy.value=q.subsurface_anisotropy,r.subsurface_mode.value=q.subsurface_mode,r.coat_weight.value=q.coat_weight,r.coat_color.value.copy(Pn(q.coat_color)),r.coat_roughness.value=q.coat_roughness,r.coat_anisotropy.value=q.coat_anisotropy,r.coat_rotation.value=q.coat_rotation,r.coat_ior.value=q.coat_ior,r.coat_darkening.value=q.coat_darkening,r.fuzz_weight.value=q.fuzz_weight,r.fuzz_color.value.copy(Pn(q.fuzz_color)),r.fuzz_roughness.value=q.fuzz_roughness,r.emission_luminance.value=q.emission_luminance,r.emission_color.value.copy(Pn(q.emission_color)),r.geometry_opacity.value=q.geometry_opacity,r.geometry_thin_walled.value=q.geometry_thin_walled,r.skyPower.value=q.skyPower,r.skyColor.value.copy(Pn(q.skyColor)),r.sunPower.value=Math.pow(10,q.sunPower),r.sunAngularSize.value=q.sunAngularSize,r.sunColor.value.copy(Pn(q.sunColor)),bb(),r.sunDir.value.copy(Pn(q.sunDir)),qt.autoClear=or===0,qt.setRenderTarget(eo),ha.render(qt),qt.setRenderTarget(null),Xf.render(qt),qt.autoClear=!0,or++}else Pe(),Et.updateProjectionMatrix(),Et.clearViewOffset(),qt.render(cr,Et);document.getElementById("samples").innerText=`samples: ${or}`,Ys||document.getElementById("progress_overlay").style.display!="none"&&performance.now()-mc>400&&Tb(400),Ys&&(_n.value()<.01?_n.animate(1):_n.value()>.99&&(_n.set(0),_n.animate(1))),ss.update(),requestAnimationFrame($l)}}document.onkeydown=function(r){r=r||window.event;var e=r.which?r.which:r.keyCode;switch(e){case 122:{var t=document.body;"webkitCancelFullScreen"in document?t.webkitRequestFullScreen():"mozCancelFullScreen"in document?t.mozRequestFullScreen():console.assert(!1),Ot.update(),Pe();break}case 70:{qf();break}case 72:{ur.show(ur._hidden),document.body.contains(ss.dom)?document.body.removeChild(ss.dom):document.body.appendChild(ss.dom);let a=document.getElementById("info");a.style.visibility=="visible"?a.style.visibility="hidden":a.style.visibility="visible";let l=document.getElementById("samples");l.style.visibility=="visible"?l.style.visibility="hidden":l.style.visibility="visible";break}case 87:{let a=new L;a.copy(Ot.target),a.sub(Et.position);let l=a.length();a.normalize();var n=new L;n.copy(a),n.multiplyScalar(Ot.flySpeed*l),Et.position.add(n),Ot.target.add(n),Ot.update(),Pe();break}case 65:{let a=new L;a.copy(Ot.target),a.sub(Et.position);let l=a.length();var i=new L(1,0,0),s=i.transformDirection(Et.matrix),n=new L;n.copy(s),n.multiplyScalar(-Ot.flySpeed*l),Et.position.add(n),Ot.target.add(n),Ot.update(),Pe();break}case 83:{let a=new L;a.copy(Ot.target),a.sub(Et.position);let l=a.length();a.normalize();var n=new L;n.copy(a),n.multiplyScalar(-Ot.flySpeed*l),Et.position.add(n),Ot.target.add(n),Ot.update(),Pe();break}case 68:{let a=new L;a.copy(Ot.target),a.sub(Et.position);let l=a.length();var i=new L(1,0,0),s=i.transformDirection(Et.matrix),n=new L;n.copy(s),n.multiplyScalar(Ot.flySpeed*l),Et.position.add(n),Ot.target.add(n),Ot.update(),Pe();break}case 80:{var o=document.createElement("a");let a="openpbr-example-screenshot.png";o.download=a,qt.domElement.toBlob(function(l){o.href=URL.createObjectURL(l);var c=new MouseEvent("click");o.dispatchEvent(c)},"image/png",1);break}}}; diff --git a/index.html b/index.html index 1a3307e..1e50e82 100644 --- a/index.html +++ b/index.html @@ -63,7 +63,7 @@ overflow:hidden; } - +